相关记录表admin_id关联当前管理员id

This commit is contained in:
2026-03-10 12:30:56 +08:00
parent b1efeb8b31
commit fdd8f6dffa
18 changed files with 290 additions and 26 deletions

View File

@@ -45,8 +45,10 @@ class UserLogic
* 登录JSONusername, password, lang, coin, time
* 存在则校验密码并更新 coin累加不存在则创建用户并写入 coin。
* 将会话写入 Redis返回 token 与前端连接地址。
*
* @param int|null $adminId 创建新用户时关联的后台管理员IDsa_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();
}