Files
webman-buildadmin/app/common/model/User.php
zhenhui cfe5ec6fb0 API接口
1.新增鉴权接口/api/v1/authToken
2.修复注册,登录,获取首页初始化数据,获取用户信息接口报错
2026-04-16 18:42:44 +08:00

41 lines
969 B
PHP

<?php
namespace app\common\model;
use support\think\Model;
/**
* 用户主表
*/
class User extends Model
{
protected $name = 'user';
protected $autoWriteTimestamp = true;
protected $type = [
'create_time' => 'integer',
'update_time' => 'integer',
'coin' => 'string',
'total_deposit_coin' => 'string',
'total_valid_bet_coin' => 'string',
'risk_flags' => 'integer',
'current_streak' => 'integer',
];
public function channel(): \think\model\relation\BelongsTo
{
return $this->belongsTo(Channel::class, 'channel_id', 'id');
}
public function admin(): \think\model\relation\BelongsTo
{
return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
}
public function resetPassword(int|string $uid, string $newPassword): int
{
return $this->where(['id' => $uid])->update(['password' => hash_password($newPassword)]);
}
}