修改原有框架中英文映射

This commit is contained in:
2026-03-17 18:09:10 +08:00
parent e7b8f4cae9
commit bdf50e61f5
81 changed files with 1956 additions and 735 deletions

View File

@@ -80,7 +80,7 @@ class GameController extends BaseController
$userId = (int) ($request->player_id ?? 0);
$count = (int) $request->post('count', 0);
if (!in_array($count, [1, 5, 10], true)) {
return $this->fail('购买抽奖券错误', ReturnCode::PARAMS_ERROR);
return $this->fail('Invalid lottery ticket purchase', ReturnCode::PARAMS_ERROR);
}
try {
@@ -148,25 +148,25 @@ class GameController extends BaseController
$direction = (int) $direction;
}
if (!in_array($direction, [0, 1], true)) {
return $this->fail('direction 必须为 0 1', ReturnCode::PARAMS_ERROR);
return $this->fail('direction must be 0 or 1', ReturnCode::PARAMS_ERROR);
}
$player = DicePlayer::find($userId);
if (!$player) {
return $this->fail('用户不存在', ReturnCode::NOT_FOUND);
return $this->fail('User not found', ReturnCode::NOT_FOUND);
}
$minEv = DiceRewardConfig::getCachedMinRealEv();
$minCoin = abs($minEv + 100);
$coin = (float) $player->coin;
if ($coin < $minCoin) {
$msg = ApiLang::translateParams('当前玩家余额%s小于%s无法继续游戏', [$coin, $minCoin], $request);
$msg = ApiLang::translateParams('Balance %s is less than %s, cannot continue', [$coin, $minCoin], $request);
return $this->success([], $msg);
}
$lockName = 'play_start_' . $userId;
$lockResult = Db::query('SELECT GET_LOCK(?, 30) as l', [$lockName]);
if (empty($lockResult) || (int) ($lockResult[0]['l'] ?? 0) !== 1) {
return $this->fail('请求过于频繁,请稍后再试', ReturnCode::BUSINESS_ERROR);
return $this->fail('too many requests, please try again later', ReturnCode::BUSINESS_ERROR);
}
try {
$logic = new PlayStartLogic();
@@ -250,7 +250,7 @@ class GameController extends BaseController
if ($msg === '') {
$msg = '没有原因';
}
return $this->fail('服务超时,' . $msg);
return $this->fail('Service timeout: ' . $msg);
} finally {
Db::execute('SELECT RELEASE_LOCK(?)', [$lockName]);
}