修改原有框架中英文映射

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

@@ -60,7 +60,7 @@ class DiceConfigController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -76,9 +76,9 @@ class DiceConfigController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -94,9 +94,9 @@ class DiceConfigController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -110,13 +110,13 @@ class DiceConfigController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -85,7 +85,7 @@ class DiceLotteryPoolConfigController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -101,9 +101,9 @@ class DiceLotteryPoolConfigController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -119,9 +119,9 @@ class DiceLotteryPoolConfigController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -135,13 +135,13 @@ class DiceLotteryPoolConfigController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}
@@ -149,7 +149,7 @@ class DiceLotteryPoolConfigController extends BaseController
* 获取当前彩金池Redis 实例化,无则按 type=0 创建)
* 返回含玩家累计盈利 profit_amount 实时值,供前端轮询展示
*/
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:index')]
#[Permission('色子奖池配置列表', 'dice:lottery_pool_config:index:getCurrentPool')]
public function getCurrentPool(Request $request): Response
{
$data = $this->logic->getCurrentPool();
@@ -159,21 +159,21 @@ class DiceLotteryPoolConfigController extends BaseController
/**
* 更新当前彩金池:仅可修改 safety_line、t1_weightt5_weight不可修改 profit_amount
*/
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:update')]
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:updateCurrentPool')]
public function updateCurrentPool(Request $request): Response
{
$data = $request->post();
$this->logic->updateCurrentPool($data);
return $this->success('保存成功');
return $this->success('save success');
}
/**
* 重置当前彩金池的玩家累计盈利:将 profit_amount 置为 0
*/
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:update')]
#[Permission('色子奖池配置修改', 'dice:lottery_pool_config:index:resetProfitAmount')]
public function resetProfitAmount(Request $request): Response
{
$this->logic->resetProfitAmount();
return $this->success('重置成功');
return $this->success('reset success');
}
}

View File

@@ -120,11 +120,11 @@ class DicePlayRecordController extends BaseController
$id = $request->input('id', '');
$model = $this->logic->read($id);
if (!$model) {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限查看该记录');
return $this->fail('no permission to view this record');
}
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
@@ -142,9 +142,9 @@ class DicePlayRecordController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -160,9 +160,9 @@ class DicePlayRecordController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -176,13 +176,13 @@ class DicePlayRecordController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -75,7 +75,7 @@ class DicePlayRecordTestController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -91,9 +91,9 @@ class DicePlayRecordTestController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -109,9 +109,9 @@ class DicePlayRecordTestController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -125,13 +125,13 @@ class DicePlayRecordTestController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}
@@ -146,9 +146,9 @@ class DicePlayRecordTestController extends BaseController
try {
$table = (new \app\dice\model\play_record_test\DicePlayRecordTest())->getTable();
Db::execute('TRUNCATE TABLE `' . $table . '`');
return $this->success('已清空所有测试数据');
return $this->success('all test data cleared');
} catch (\Throwable $e) {
return $this->fail('清空失败:' . $e->getMessage());
return $this->fail('clear failed: ' . $e->getMessage());
}
}
}

View File

@@ -110,11 +110,11 @@ class DicePlayerController extends BaseController
$id = $request->input('id', '');
$model = $this->logic->read($id);
if (!$model) {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限查看该记录');
return $this->fail('no permission to view this record');
}
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
@@ -142,9 +142,9 @@ class DicePlayerController extends BaseController
if ($player && $player->username !== '') {
UserCache::deletePlayerByUsername($player->username);
}
return $this->success('添加成功');
return $this->success('add success');
}
return $this->fail('添加失败');
return $this->fail('add failed');
}
/**
@@ -161,7 +161,7 @@ class DicePlayerController extends BaseController
if ($model) {
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限修改该记录');
return $this->fail('no permission to update this record');
}
}
$result = $this->logic->edit($data['id'], $data);
@@ -172,9 +172,9 @@ class DicePlayerController extends BaseController
if ($player && $player->username !== '') {
UserCache::deletePlayerByUsername($player->username);
}
return $this->success('修改成功');
return $this->success('update success');
}
return $this->fail('修改失败');
return $this->fail('update failed');
}
/**
@@ -188,16 +188,16 @@ class DicePlayerController extends BaseController
$id = $request->input('id');
$status = $request->input('status');
if ($id === null || $id === '') {
return $this->fail('缺少参数 id');
return $this->fail('missing parameter id');
}
if ($status === null || $status === '') {
return $this->fail('缺少参数 status');
return $this->fail('missing parameter status');
}
$model = $this->logic->read($id);
if ($model) {
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限修改该记录');
return $this->fail('no permission to update this record');
}
}
$this->logic->edit($id, ['status' => (int) $status]);
@@ -207,7 +207,7 @@ class DicePlayerController extends BaseController
if ($player && $player->username !== '') {
UserCache::deletePlayerByUsername($player->username);
}
return $this->success('修改成功');
return $this->success('update success');
}
/**
@@ -220,7 +220,7 @@ class DicePlayerController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$ids = is_array($ids) ? $ids : explode(',', (string) $ids);
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
@@ -235,7 +235,7 @@ class DicePlayerController extends BaseController
}
$ids = $validIds;
if (empty($ids)) {
return $this->fail('无权限删除所选数据');
return $this->fail('no permission to delete selected data');
}
}
$result = $this->logic->destroy($ids);
@@ -248,9 +248,9 @@ class DicePlayerController extends BaseController
UserCache::deletePlayerByUsername($player->username);
}
}
return $this->success('删除成功');
return $this->success('delete success');
}
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -88,11 +88,11 @@ class DicePlayerTicketRecordController extends BaseController
$id = $request->input('id', '');
$model = $this->logic->read($id);
if (!$model) {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限查看该记录');
return $this->fail('no permission to view this record');
}
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
@@ -110,9 +110,9 @@ class DicePlayerTicketRecordController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -128,9 +128,9 @@ class DicePlayerTicketRecordController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -144,13 +144,13 @@ class DicePlayerTicketRecordController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -85,15 +85,15 @@ class DicePlayerWalletRecordController extends BaseController
{
$playerId = $request->input('player_id');
if ($playerId === null || $playerId === '') {
return $this->fail('缺少 player_id');
return $this->fail('missing player_id');
}
$player = DicePlayer::field('coin,admin_id')->where('id', $playerId)->find();
if (!$player) {
return $this->fail('玩家不存在');
return $this->fail('Player not found');
}
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($player->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限操作该玩家');
return $this->fail('no permission to operate this player');
}
return $this->success(['wallet_before' => (float) $player['coin']]);
}
@@ -109,11 +109,11 @@ class DicePlayerWalletRecordController extends BaseController
$id = $request->input('id', '');
$model = $this->logic->read($id);
if (!$model) {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($model->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限查看该记录');
return $this->fail('no permission to view this record');
}
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
@@ -133,13 +133,13 @@ class DicePlayerWalletRecordController extends BaseController
$coin = isset($data['coin']) ? (float) $data['coin'] : null;
if ($playerId === null || $playerId === '') {
return $this->fail('请选择玩家');
return $this->fail('please select player');
}
if (!in_array($type, [3, 4], true)) {
return $this->fail('操作类型必须为 3=加点 或 4=扣点');
return $this->fail('operation type must be 3 (add) or 4 (deduct)');
}
if ($coin === null || $coin <= 0) {
return $this->fail('平台币变动必须大于 0');
return $this->fail('Coin change must be greater than 0');
}
$data['player_id'] = $playerId;
@@ -163,20 +163,20 @@ class DicePlayerWalletRecordController extends BaseController
}
}
if ($adminId === null || $adminId <= 0) {
return $this->fail('请先登录');
return $this->fail('please login first');
}
$player = DicePlayer::field('admin_id')->where('id', $playerId)->find();
if ($player) {
$allowedIds = AdminScopeHelper::getAllowedAdminIds($this->adminInfo ?? null);
if ($allowedIds !== null && !in_array((int) ($player->admin_id ?? 0), $allowedIds, true)) {
return $this->fail('无权限操作该玩家');
return $this->fail('no permission to operate this player');
}
}
try {
$this->logic->adminOperate($data, $adminId);
return $this->success('操作成功');
return $this->success('operation success');
} catch (\Throwable $e) {
return $this->fail($e->getMessage());
}
@@ -194,9 +194,9 @@ class DicePlayerWalletRecordController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -212,9 +212,9 @@ class DicePlayerWalletRecordController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -228,13 +228,13 @@ class DicePlayerWalletRecordController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -29,11 +29,11 @@ class DiceRewardController extends BaseController
{
$direction = $request->input('direction', null);
if ($direction === null || $direction === '') {
return $this->fail('请传入 direction0=顺时针 1=逆时针)');
return $this->fail('please provide direction (0=clockwise, 1=counterclockwise)');
}
$direction = (int) $direction;
if (!in_array($direction, [DiceReward::DIRECTION_CLOCKWISE, DiceReward::DIRECTION_COUNTERCLOCKWISE], true)) {
return $this->fail('direction 必须为 0顺时针或 1逆时针');
return $this->fail('direction must be 0 (clockwise) or 1 (counterclockwise)');
}
$tier = $request->input('tier', '');
$page = (int) $request->input('page', 1);
@@ -120,11 +120,11 @@ class DiceRewardController extends BaseController
{
$recordId = (int) $request->input('record_id', 0);
if ($recordId <= 0) {
return $this->fail('请传入 record_id');
return $this->fail('please provide record_id');
}
$record = DiceRewardConfigRecord::find($recordId);
if (!$record) {
return $this->fail('记录不存在');
return $this->fail('record not found');
}
$arr = $record->toArray();
$data = [
@@ -147,9 +147,9 @@ class DiceRewardController extends BaseController
try {
$table = (new DicePlayRecordTest())->getTable();
Db::execute('TRUNCATE TABLE `' . $table . '`');
return $this->success('已清空测试数据');
return $this->success('test data cleared');
} catch (\Throwable $e) {
return $this->fail('清空失败:' . $e->getMessage());
return $this->fail('clear failed: ' . $e->getMessage());
}
}
@@ -162,12 +162,12 @@ class DiceRewardController extends BaseController
{
$items = $request->post('items', []);
if (!is_array($items)) {
return $this->fail('参数 items 必须为数组');
return $this->fail('parameter items must be an array');
}
try {
$logic = new DiceRewardLogic();
$logic->batchUpdateWeights($items);
return $this->success('保存成功');
return $this->success('save success');
} catch (\plugin\saiadmin\exception\ApiException $e) {
return $this->fail($e->getMessage());
}
@@ -182,16 +182,16 @@ class DiceRewardController extends BaseController
{
$direction = (int) $request->post('direction', 0);
if (!in_array($direction, [DiceReward::DIRECTION_CLOCKWISE, DiceReward::DIRECTION_COUNTERCLOCKWISE], true)) {
return $this->fail('direction 必须为 0顺时针或 1逆时针');
return $this->fail('direction must be 0 (clockwise) or 1 (counterclockwise)');
}
$items = $request->post('items', []);
if (!is_array($items)) {
return $this->fail('参数 items 必须为数组');
return $this->fail('parameter items must be an array');
}
try {
$logic = new DiceRewardLogic();
$logic->batchUpdateWeightsByDirection($direction, $items);
return $this->success('保存成功');
return $this->success('save success');
} catch (\plugin\saiadmin\exception\ApiException $e) {
return $this->fail($e->getMessage());
}

View File

@@ -64,7 +64,7 @@ class DiceRewardConfigController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -80,9 +80,9 @@ class DiceRewardConfigController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -98,9 +98,9 @@ class DiceRewardConfigController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -114,7 +114,7 @@ class DiceRewardConfigController extends BaseController
{
$items = $request->post('items', []);
if (! is_array($items)) {
return $this->fail('参数 items 必须为数组');
return $this->fail('parameter items must be an array');
}
$err = $this->logic->validateBatchUpdateItems($items);
if ($err !== null) {
@@ -124,7 +124,7 @@ class DiceRewardConfigController extends BaseController
$this->validate('batch_update', array_merge($item, ['id' => $item['id']]));
}
$this->logic->batchUpdate($items);
return $this->success('保存成功');
return $this->success('save success');
}
/**
@@ -137,13 +137,13 @@ class DiceRewardConfigController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}
@@ -171,12 +171,12 @@ class DiceRewardConfigController extends BaseController
{
$items = $request->post('items', []);
if (!is_array($items)) {
return $this->fail('参数 items 必须为数组');
return $this->fail('parameter items must be an array');
}
try {
$rewardLogic = new DiceRewardLogic();
$rewardLogic->batchUpdateWeights($items);
return $this->success('保存成功');
return $this->success('save success');
} catch (\plugin\saiadmin\exception\ApiException $e) {
return $this->fail($e->getMessage());
}
@@ -193,14 +193,14 @@ class DiceRewardConfigController extends BaseController
{
$items = $request->post('items', []);
if (! is_array($items)) {
return $this->fail('参数 items 必须为数组');
return $this->fail('parameter items must be an array');
}
$err = $this->logic->validateBigwinWeightItems($items);
if ($err !== null) {
return $this->fail($err);
}
$this->logic->batchUpdateBigwinWeight($items);
return $this->success('保存成功');
return $this->success('save success');
}
/**
@@ -215,7 +215,7 @@ class DiceRewardConfigController extends BaseController
try {
$rewardLogic = new DiceRewardLogic();
$result = $rewardLogic->createRewardReferenceFromConfig();
return $this->success($result, '创建奖励对照成功');
return $this->success($result, 'create reward mapping success');
} catch (\plugin\saiadmin\exception\ApiException $e) {
return $this->fail($e->getMessage());
}

View File

@@ -59,7 +59,7 @@ class DiceRewardConfigRecordController extends BaseController
$data['admin_name'] = $this->getAdminName((int) ($data['admin_id'] ?? 0));
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -96,9 +96,9 @@ class DiceRewardConfigRecordController extends BaseController
$this->validate('save', $data);
$result = $this->logic->add($data);
if ($result) {
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -114,9 +114,9 @@ class DiceRewardConfigRecordController extends BaseController
$this->validate('update', $data);
$result = $this->logic->edit($data['id'], $data);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -130,13 +130,13 @@ class DiceRewardConfigRecordController extends BaseController
{
$ids = $request->post('ids', '');
if (empty($ids)) {
return $this->fail('请选择要删除的数据');
return $this->fail('please select data to delete');
}
$result = $this->logic->destroy($ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}
@@ -149,7 +149,7 @@ class DiceRewardConfigRecordController extends BaseController
{
$recordId = (int) $request->post('record_id', 0);
if ($recordId <= 0) {
return $this->fail('请指定测试记录');
return $this->fail('please specify test record');
}
$paidId = $request->post('paid_lottery_config_id', null);
$freeId = $request->post('free_lottery_config_id', null);
@@ -159,7 +159,7 @@ class DiceRewardConfigRecordController extends BaseController
$lotteryConfigId = $legacyId !== null && $legacyId !== '' ? (int) $legacyId : null;
try {
$this->logic->importFromRecord($recordId, $paidLotteryConfigId, $freeLotteryConfigId, $lotteryConfigId);
return $this->success('导入成功,已刷新 DiceRewardDiceRewardConfig(BIGWIN)、奖池配置');
return $this->success('import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config');
} catch (\plugin\saiadmin\exception\ApiException $e) {
return $this->fail($e->getMessage());
}

View File

@@ -40,7 +40,7 @@ class DiceLotteryPoolConfigLogic extends BaseLogic
{
$configType0 = DiceLotteryPoolConfig::where('name', 'default')->find();
if (!$configType0) {
throw new ApiException('未找到 name=default 的奖池配置,请先创建');
throw new ApiException('No name=default pool config found, please create one first');
}
$configType1 = DiceLotteryPoolConfig::where('name', 'killScore')->find();
$row0 = $configType0->toArray();

View File

@@ -50,20 +50,20 @@ class DicePlayerWalletRecordLogic extends BaseLogic
$coin = (float) ($data['coin'] ?? 0);
if ($playerId <= 0 || !in_array($type, [3, 4], true)) {
throw new ApiException('参数错误:需要有效的 player_id type3=加点4=扣点)');
throw new ApiException('Invalid params: player_id and type are required (3=add, 4=deduct)');
}
if ($coin <= 0) {
throw new ApiException('平台币变动必须大于 0');
throw new ApiException('Coin change must be greater than 0');
}
$player = DicePlayer::where('id', $playerId)->find();
if (!$player) {
throw new ApiException('玩家不存在');
throw new ApiException('Player not found');
}
$walletBefore = (float) ($player['coin'] ?? 0);
if ($type === 4 && $walletBefore < $coin) {
throw new ApiException('扣点数量不能大于当前余额');
throw new ApiException('Deduct amount cannot exceed current balance');
}
$walletAfter = $type === 3 ? $walletBefore + $coin : $walletBefore - $coin;

View File

@@ -86,7 +86,7 @@ class DiceRewardLogic
$id = isset($item['id']) ? (int) $item['id'] : 0;
$weight = isset($item['weight']) ? (int) $item['weight'] : self::WEIGHT_MIN;
if ($id <= 0) {
throw new ApiException('存在无效的配置ID');
throw new ApiException('Invalid config ID exists');
}
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $weight));
@@ -199,7 +199,7 @@ class DiceRewardLogic
$id = isset($item['reward_id']) ? (int) $item['reward_id'] : 0;
}
if ($id <= 0) {
throw new ApiException('存在无效的 DiceReward id');
throw new ApiException('Invalid DiceReward id exists');
}
$weight = isset($item['weight']) ? (int) $item['weight'] : self::WEIGHT_MIN;
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $weight));
@@ -313,7 +313,7 @@ class DiceRewardLogic
{
$list = DiceRewardConfig::order('id', 'asc')->select()->toArray();
if (empty($list)) {
throw new ApiException('奖励配置为空,请先维护 dice_reward_config');
throw new ApiException('Reward config is empty, please maintain dice_reward_config first');
}
$configCount = count($list);
if ($configCount < self::BOARD_SIZE) {

View File

@@ -319,7 +319,7 @@ class DiceRewardConfigLogic extends BaseLogic
{
$allowedCounts = [100, 500, 1000, 5000, 10000];
if (!in_array($testCount, $allowedCounts, true)) {
throw new ApiException('测试次数仅支持 1005001000500010000');
throw new ApiException('Test count only supports 100, 500, 1000, 5000, 10000');
}
$grouped = [];

View File

@@ -81,7 +81,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
{
$record = $this->model->find($recordId);
if (!$record) {
throw new ApiException('测试记录不存在');
throw new ApiException('Test record not found');
}
$record = is_array($record) ? $record : $record->toArray();
@@ -195,7 +195,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
if (is_array($paidData) && $paidTargetId > 0) {
$pool = DiceLotteryPoolConfig::find($paidTargetId);
if (!$pool) {
throw new ApiException('付费奖池配置不存在');
throw new ApiException('Paid pool config not found');
}
$update = [
't1_weight' => (int) ($paidData['T1'] ?? $paidData['t1'] ?? 0),
@@ -209,7 +209,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
if (is_array($freeData) && $freeTargetId > 0) {
$pool = DiceLotteryPoolConfig::find($freeTargetId);
if (!$pool) {
throw new ApiException('免费奖池配置不存在');
throw new ApiException('Free pool config not found');
}
$update = [
't1_weight' => (int) ($freeData['T1'] ?? $freeData['t1'] ?? 0),
@@ -264,12 +264,12 @@ class DiceRewardConfigRecordLogic extends BaseLogic
foreach ([$paidS, $paidN, $freeS, $freeN] as $c) {
if ($c !== 0 && !in_array($c, $allowed, true)) {
throw new ApiException('各抽奖次数仅支持 0、10050010005000');
throw new ApiException('Counts only support 0, 100, 500, 1000, 5000');
}
}
$total = $paidS + $paidN + $freeS + $freeN;
if ($total <= 0) {
throw new ApiException('付费或免费至少一种方向次数之和大于 0');
throw new ApiException('Sum of paid/free direction counts must be greater than 0');
}
$snapshot = [];
@@ -314,7 +314,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
if ($paidConfigId > 0) {
$config = DiceLotteryPoolConfig::find($paidConfigId);
if (!$config) {
throw new ApiException('付费奖池配置不存在');
throw new ApiException('Paid pool config not found');
}
$tierWeightsSnapshot['paid'] = [
'T1' => (int) ($config->t1_weight ?? 0),
@@ -326,19 +326,19 @@ class DiceRewardConfigRecordLogic extends BaseLogic
} else {
$paidTierWeights = $params['paid_tier_weights'] ?? null;
if (!is_array($paidTierWeights)) {
throw new ApiException('付费未选择奖池配置时,请填写付费自定义档位概率(T1T5');
throw new ApiException('When paid pool is not selected, please fill paid custom tier probabilities (T1T5)');
}
$tiers = ['T1', 'T2', 'T3', 'T4', 'T5'];
foreach ($tiers as $t) {
$v = (int) ($paidTierWeights[$t] ?? 0);
if ($v < 0 || $v > 100) {
throw new ApiException('付费档位概率每档只能 0-100%');
throw new ApiException('Paid tier probability must be between 0 and 100%');
}
$paidTierWeights[$t] = $v;
}
$paidSum = array_sum(array_intersect_key($paidTierWeights, array_flip($tiers)));
if ($paidSum > 100) {
throw new ApiException('付费档位概率 T1T5 之和不能超过 100%');
throw new ApiException('Paid tier probabilities (T1T5) sum cannot exceed 100%');
}
$tierWeightsSnapshot['paid'] = $paidTierWeights;
}
@@ -346,7 +346,7 @@ class DiceRewardConfigRecordLogic extends BaseLogic
if ($freeConfigId > 0) {
$config = DiceLotteryPoolConfig::find($freeConfigId);
if (!$config) {
throw new ApiException('免费奖池配置不存在');
throw new ApiException('Free pool config not found');
}
$tierWeightsSnapshot['free'] = [
'T1' => (int) ($config->t1_weight ?? 0),
@@ -358,19 +358,19 @@ class DiceRewardConfigRecordLogic extends BaseLogic
} else {
$freeTierWeights = $params['free_tier_weights'] ?? null;
if (!is_array($freeTierWeights)) {
throw new ApiException('免费未选择奖池配置时,请填写免费自定义档位概率(T1T5');
throw new ApiException('When free pool is not selected, please fill free custom tier probabilities (T1T5)');
}
$tiers = ['T1', 'T2', 'T3', 'T4', 'T5'];
foreach ($tiers as $t) {
$v = (int) ($freeTierWeights[$t] ?? 0);
if ($v < 0 || $v > 100) {
throw new ApiException('免费档位概率每档只能 0-100%');
throw new ApiException('Free tier probability must be between 0 and 100%');
}
$freeTierWeights[$t] = $v;
}
$freeSum = array_sum(array_intersect_key($freeTierWeights, array_flip($tiers)));
if ($freeSum > 100) {
throw new ApiException('免费档位概率 T1T5 之和不能超过 100%');
throw new ApiException('Free tier probabilities (T1T5) sum cannot exceed 100%');
}
$tierWeightsSnapshot['free'] = $freeTierWeights;
}