优化/api/game/playStart接口

This commit is contained in:
2026-03-06 11:14:08 +08:00
parent 02549f4feb
commit 01f71a4871
2 changed files with 2 additions and 34 deletions

View File

@@ -71,7 +71,7 @@ class GameController extends OpenController
{
$userId = (int) ($request->player_id ?? 0);
$direction = $request->post('direction');
if (!in_array($direction, [0, 1], true)) {
if (!in_array($direction, ['0', '1'], true)) {
return $this->fail('direction 必须为 0 或 1', ReturnCode::PARAMS_ERROR);
}
@@ -88,7 +88,7 @@ class GameController extends OpenController
try {
$logic = new PlayStartLogic();
$data = $logic->run($userId, $direction);
$data = $logic->run($userId, (int)$direction);
return $this->success($data);
} catch (ApiException $e) {
return $this->fail($e->getMessage(), ReturnCode::BUSINESS_ERROR);