1.优化/api/v1/getGameUrl接口,无需再验证password
This commit is contained in:
@@ -124,7 +124,7 @@ class UserLogic
|
||||
* @param int|null $adminId 创建新用户时关联的后台管理员ID(sa_system_user.id),可选
|
||||
* @param int[]|null $adminIdsInTopDept 当前管理员顶级部门下的所有管理员ID,用于按部门范围查找玩家;为空时退化为仅按 username 查找
|
||||
*/
|
||||
public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time, ?int $adminId = null, ?array $adminIdsInTopDept = null, ?int $deptId = null): array
|
||||
public function loginByUsername(string $username, string $password, string $lang, float $coin, string $time, ?int $adminId = null, ?array $adminIdsInTopDept = null, ?int $deptId = null, bool $skipPasswordValidation = false): array
|
||||
{
|
||||
$username = trim($username);
|
||||
if ($username === '') {
|
||||
@@ -143,9 +143,11 @@ class UserLogic
|
||||
if ((int) ($player->status ?? 1) === 0) {
|
||||
throw new ApiException('Account is disabled and cannot log in');
|
||||
}
|
||||
$hashed = $this->hashPassword($password);
|
||||
if ($player->password !== $hashed) {
|
||||
throw new ApiException('Wrong password');
|
||||
if (!$skipPasswordValidation) {
|
||||
$hashed = $this->hashPassword($password);
|
||||
if ($player->password !== $hashed) {
|
||||
throw new ApiException('Wrong password');
|
||||
}
|
||||
}
|
||||
$currentCoin = (float) $player->coin;
|
||||
$player->coin = $currentCoin + $coin;
|
||||
|
||||
Reference in New Issue
Block a user