登录游戏/api/v1/getGameUrl携带游戏语言lang
This commit is contained in:
@@ -50,16 +50,19 @@ class GameController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lang = trim((string) ($request->post('lang', 'zh')));
|
||||||
|
$lang = in_array($lang, ['en', 'zh'], true) ? $lang : 'zh';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$logic = new UserLogic();
|
$logic = new UserLogic();
|
||||||
$result = $logic->loginByUsername($username, $password, 'chs', 0.0, $time, $adminId);
|
$result = $logic->loginByUsername($username, $password, $lang === 'en' ? 'en' : 'chs', 0.0, $time, $adminId);
|
||||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||||
return $this->fail($e->getMessage(), ReturnCode::PARAMS_ERROR);
|
return $this->fail($e->getMessage(), ReturnCode::PARAMS_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameUrlBase = rtrim(config('api.game_url', 'dice-game.yuliao666.top'), '/');
|
$gameUrlBase = rtrim(config('api.game_url', 'dice-game.yuliao666.top'), '/');
|
||||||
$tokenInUrl = str_replace('%3D', '=', urlencode($result['token']));
|
$tokenInUrl = str_replace('%3D', '=', urlencode($result['token']));
|
||||||
$url = $gameUrlBase . '/?token=' . $tokenInUrl;
|
$url = $gameUrlBase . '/?token=' . $tokenInUrl . '&lang=' . $lang;
|
||||||
|
|
||||||
return $this->success([
|
return $this->success([
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
|
|||||||
Reference in New Issue
Block a user