修改原有框架中英文映射
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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_weight~t5_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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ class DiceRewardController extends BaseController
|
||||
{
|
||||
$direction = $request->input('direction', null);
|
||||
if ($direction === null || $direction === '') {
|
||||
return $this->fail('请传入 direction(0=顺时针 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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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('导入成功,已刷新 DiceReward、DiceRewardConfig(BIGWIN)、奖池配置');
|
||||
return $this->success('import success, refreshed DiceReward, DiceRewardConfig(BIGWIN), and pool config');
|
||||
} catch (\plugin\saiadmin\exception\ApiException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user