1.优化接口返回中间信息ui_text(中文)ui_text_en(英文)
2.修复BUG色子点数权重配置-权重配比-顺时针/逆时针显示错误
This commit is contained in:
@@ -88,6 +88,27 @@ class GameController extends BaseController
|
||||
$list = array_values(array_filter($list, function ($row) {
|
||||
return (string) ($row['tier'] ?? '') !== 'BIGWIN';
|
||||
}));
|
||||
|
||||
$lang = $request->header('lang', 'zh');
|
||||
if (!is_string($lang) || $lang === '') {
|
||||
$lang = 'zh';
|
||||
}
|
||||
$langLower = strtolower($lang);
|
||||
$isEn = $langLower === 'en' || str_starts_with($langLower, 'en-');
|
||||
|
||||
if ($isEn) {
|
||||
foreach ($list as $index => $row) {
|
||||
$uiEn = '';
|
||||
if (is_array($row) && array_key_exists('ui_text_en', $row) && $row['ui_text_en'] !== null) {
|
||||
$uiEn = (string) $row['ui_text_en'];
|
||||
}
|
||||
if ($uiEn !== '') {
|
||||
$row['ui_text'] = $uiEn;
|
||||
}
|
||||
$list[$index] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
@@ -123,6 +144,37 @@ class GameController extends BaseController
|
||||
try {
|
||||
$logic = new PlayStartLogic();
|
||||
$data = $logic->run($userId, (int)$direction);
|
||||
|
||||
$lang = $request->header('lang', 'zh');
|
||||
if (!is_string($lang) || $lang === '') {
|
||||
$lang = 'zh';
|
||||
}
|
||||
$langLower = strtolower($lang);
|
||||
$isEn = $langLower === 'en' || str_starts_with($langLower, 'en-');
|
||||
|
||||
if (is_array($data) && array_key_exists('reward_config_id', $data)) {
|
||||
$rewardConfigId = (int) $data['reward_config_id'];
|
||||
if ($rewardConfigId > 0) {
|
||||
$configRow = DiceRewardConfig::getCachedById($rewardConfigId);
|
||||
if ($configRow !== null) {
|
||||
$uiText = '';
|
||||
$uiTextEn = '';
|
||||
if (array_key_exists('ui_text', $configRow) && $configRow['ui_text'] !== null) {
|
||||
$uiText = (string) $configRow['ui_text'];
|
||||
}
|
||||
if (array_key_exists('ui_text_en', $configRow) && $configRow['ui_text_en'] !== null) {
|
||||
$uiTextEn = (string) $configRow['ui_text_en'];
|
||||
}
|
||||
if ($isEn && $uiTextEn !== '') {
|
||||
$data['ui_text'] = $uiTextEn;
|
||||
} else {
|
||||
$data['ui_text'] = $uiText;
|
||||
}
|
||||
$data['ui_text_en'] = $uiTextEn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
} catch (ApiException $e) {
|
||||
return $this->fail($e->getMessage(), ReturnCode::BUSINESS_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user