相关记录表admin_id关联当前管理员id
This commit is contained in:
@@ -45,8 +45,10 @@ class UserLogic
|
||||
* 登录(JSON:username, password, lang, coin, time)
|
||||
* 存在则校验密码并更新 coin(累加);不存在则创建用户并写入 coin。
|
||||
* 将会话写入 Redis,返回 token 与前端连接地址。
|
||||
*
|
||||
* @param int|null $adminId 创建新用户时关联的后台管理员ID(sa_system_user.id),可选
|
||||
*/
|
||||
public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time): array
|
||||
public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time, ?int $adminId = null): array
|
||||
{
|
||||
$username = trim($username);
|
||||
if ($username === '') {
|
||||
@@ -72,6 +74,9 @@ class UserLogic
|
||||
$player->password = $this->hashPassword($password);
|
||||
$player->status = self::STATUS_NORMAL;
|
||||
$player->coin = $coin;
|
||||
if ($adminId !== null && $adminId > 0) {
|
||||
$player->admin_id = $adminId;
|
||||
}
|
||||
$player->save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user