post('username', ''))); $password = trim((string) ($request->post('password', '123456'))); $time = trim((string) ($request->post('time', ''))); if ($username === '') { return $this->fail('username 不能为空', ReturnCode::PARAMS_ERROR); } if ($password === '') { $password = '123456'; } if ($time === '') { $time = (string) time(); } try { $logic = new UserLogic(); $result = $logic->loginByUsername($username, $password, 'chs', 0.0, $time); } catch (\plugin\saiadmin\exception\ApiException $e) { return $this->fail($e->getMessage(), ReturnCode::PARAMS_ERROR); } $gameUrlBase = rtrim(config('api.game_url', 'dice-game.yuliao666.top'), '/'); $tokenInUrl = str_replace('%3D', '=', urlencode($result['token'])); $url = $gameUrlBase . '/?token=' . $tokenInUrl; return $this->success([ 'url' => $url, ]); } }