修改原有框架中英文映射
This commit is contained in:
@@ -34,7 +34,7 @@ class UserController extends BaseController
|
||||
$time = $request->post('time');
|
||||
$time = $time !== null && $time !== '' ? (string) $time : (string) time();
|
||||
if ($username === '' || $password === '') {
|
||||
return $this->fail('username、password 不能为空', ReturnCode::PARAMS_ERROR);
|
||||
return $this->fail('USERNAME_PASSWORD_REQUIRED', ReturnCode::PARAMS_ERROR);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -68,15 +68,15 @@ class UserController extends BaseController
|
||||
}
|
||||
$token = $token !== null ? trim((string) $token) : '';
|
||||
if ($token === '') {
|
||||
return $this->fail('请携带 token', ReturnCode::UNAUTHORIZED);
|
||||
return $this->fail('Please provide token', ReturnCode::UNAUTHORIZED);
|
||||
}
|
||||
$username = UserLogic::getUsernameFromJwtPayload($token);
|
||||
if ($username === null || $username === '') {
|
||||
return $this->fail('token 无效', ReturnCode::TOKEN_INVALID);
|
||||
return $this->fail('Invalid or expired token', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
UserCache::deleteSessionByUsername($username);
|
||||
UserCache::deletePlayerByUsername($username);
|
||||
return $this->success('已退出登录');
|
||||
return $this->success('Logged out successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +89,7 @@ class UserController extends BaseController
|
||||
$userId = (int) ($request->player_id ?? 0);
|
||||
$user = UserLogic::getCachedUser($userId);
|
||||
if (empty($user)) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
$fields = ['id', 'username', 'phone', 'uid', 'name', 'coin', 'total_ticket_count'];
|
||||
$info = [];
|
||||
@@ -111,7 +111,7 @@ class UserController extends BaseController
|
||||
$userId = (int) ($request->player_id ?? 0);
|
||||
$user = UserLogic::getCachedUser($userId);
|
||||
if (empty($user)) {
|
||||
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
|
||||
return $this->fail('User not found', ReturnCode::NOT_FOUND);
|
||||
}
|
||||
$coin = $user['coin'] ?? 0;
|
||||
if (is_string($coin) && is_numeric($coin)) {
|
||||
|
||||
Reference in New Issue
Block a user