优化临时插入用户接口/api/user/Login和抽奖接口/api/game/playStart

This commit is contained in:
2026-04-08 17:32:14 +08:00
parent ef684a1c55
commit 765f50963a
5 changed files with 39 additions and 14 deletions

View File

@@ -26,9 +26,13 @@ class UserController extends BaseController
*/
public function Login(Request $request): Response
{
$username = trim((string) ($request->post('username', '')));
$password = trim((string) ($request->post('password', '')));
$lang = trim((string) ($request->post('lang', 'chs')));
$usernameRaw = $request->post('username', '');
$passwordRaw = $request->post('password', '');
$langRaw = $request->post('lang', 'zh');
$username = is_string($usernameRaw) ? trim($usernameRaw) : '';
$password = is_string($passwordRaw) ? trim($passwordRaw) : '';
$lang = is_string($langRaw) ? trim($langRaw) : 'zh';
$coin = $request->post('coin');
$coin = $coin !== null && $coin !== '' ? (float) $coin : 0.0;
$time = $request->post('time');

View File

@@ -58,7 +58,7 @@ class GameController extends BaseController
try {
$logic = new UserLogic();
$result = $logic->loginByUsername($username, $password, $lang === 'en' ? 'en' : 'chs', 0.0, $time, $adminId, $adminIdsInTopDept);
$result = $logic->loginByUsername($username, $password, $lang, 0.0, $time, $adminId, $adminIdsInTopDept);
} catch (\plugin\saiadmin\exception\ApiException $e) {
return $this->fail($e->getMessage(), ReturnCode::PARAMS_ERROR);
}