修改原有框架中英文映射

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

@@ -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');
}
}