修改原有框架中英文映射

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

@@ -63,7 +63,7 @@ class InstallController extends OpenController
clearstatcache();
if (is_file($env)) {
return $this->fail('管理后台已经安装如需重新安装请删除根目录env配置文件并重启');
return $this->fail('admin already installed, to reinstall please delete env file and restart');
}
$user = $request->post('username');
@@ -82,13 +82,13 @@ class InstallController extends OpenController
} catch (\Throwable $e) {
$message = $e->getMessage();
if (stripos($message, 'Access denied for user')) {
return $this->fail('数据库用户名或密码错误');
return $this->fail('database username or password is incorrect');
}
if (stripos($message, 'Connection refused')) {
return $this->fail('Connection refused. 请确认数据库IP端口是否正确数据库已经启动');
return $this->fail('connection refused, please check database ip/port and ensure database is running');
}
if (stripos($message, 'timed out')) {
return $this->fail('数据库连接超时请确认数据库IP端口是否正确安全组及防火墙已经放行端口');
return $this->fail('database connection timeout, please check ip/port and firewall/security group rules');
}
throw $e;
}
@@ -98,7 +98,7 @@ class InstallController extends OpenController
$smt = $db->query("show tables like 'sa_system_menu';");
$tables = $smt->fetchAll();
if (count($tables) > 0) {
return $this->fail('数据库已经安装,请勿重复安装');
return $this->fail('database already installed, please do not install again');
}
if ($dataType == 'demo') {
@@ -108,7 +108,7 @@ class InstallController extends OpenController
}
if (!is_file($sql_file)) {
return $this->fail('数据库SQL文件不存在');
return $this->fail('database SQL file not found');
}
$sql_query = file_get_contents($sql_file);
@@ -151,7 +151,7 @@ EOF;
restore_error_handler();
}
return $this->success('安装成功');
return $this->success('install success');
}
/**

View File

@@ -53,7 +53,7 @@ class LoginController extends BaseController
if ($captchaEnabled) {
$captcha = new Captcha();
if (!$captcha->checkCaptcha($uuid, $code)) {
return $this->fail('验证码错误');
return $this->fail('captcha error');
}
}
$logic = new SystemUserLogic();

View File

@@ -37,14 +37,14 @@ class SystemController extends BaseController
if ($adminInfo === null || !is_array($adminInfo) || !isset($adminInfo['id'])) {
$token = getCurrentInfo();
if (!is_array($token) || empty($token['id'])) {
return $this->fail('登录已过期或用户信息无效,请重新登录', 401);
return $this->fail('login expired or invalid, please login again', 401);
}
$adminInfo = UserInfoCache::getUserInfo($token['id']);
if (empty($adminInfo) || !isset($adminInfo['id'])) {
$adminInfo = UserInfoCache::setUserInfo($token['id']);
}
if (empty($adminInfo) || !isset($adminInfo['id'])) {
return $this->fail('登录已过期或用户信息无效,请重新登录', 401);
return $this->fail('login expired or invalid, please login again', 401);
}
$this->adminInfo = $adminInfo;
}
@@ -86,7 +86,7 @@ class SystemController extends BaseController
public function menu(): Response
{
if (!$this->ensureAdminInfo()) {
return $this->fail('登录已过期或用户信息无效,请重新登录', 401);
return $this->fail('login expired or invalid, please login again', 401);
}
$data = UserMenuCache::getUserMenu($this->adminInfo['id']);
return $this->success($data);
@@ -151,7 +151,7 @@ class SystemController extends BaseController
$config = Storage::getConfig('local');
$logic = new SystemAttachmentLogic();
$data = $logic->saveNetworkImage($url, $config);
return $this->success($data, '操作成功');
return $this->success($data, 'operation success');
}
/**
@@ -228,7 +228,7 @@ class SystemController extends BaseController
UserInfoCache::clearUserInfo($this->adminId);
UserAuthCache::clearUserAuth($this->adminId);
UserMenuCache::clearUserMenu($this->adminId);
return $this->success([], '清除缓存成功!');
return $this->success([], 'clear cache success');
}
/**

View File

@@ -78,11 +78,11 @@ class DataBaseController extends BaseController
if (!empty($ids)) {
$result = $this->logic->delete($table, $ids);
if (!$result) {
return $this->fail('操作失败');
return $this->fail('operation failed');
}
return $this->success('操作成功');
return $this->success('operation success');
} else {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
}
@@ -99,11 +99,11 @@ class DataBaseController extends BaseController
if (!empty($ids)) {
$result = $this->logic->recovery($table, $ids);
if (!$result) {
return $this->fail('操作失败');
return $this->fail('operation failed');
}
return $this->success('操作成功');
return $this->success('operation success');
} else {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
}
@@ -130,7 +130,7 @@ class DataBaseController extends BaseController
{
$tables = $request->input('tables', []);
$this->logic->optimizeTable($tables);
return $this->success('优化成功');
return $this->success('optimize success');
}
/**
@@ -141,7 +141,7 @@ class DataBaseController extends BaseController
{
$tables = $request->input('tables', []);
$this->logic->fragmentTable($tables);
return $this->success('清理成功');
return $this->success('clean success');
}
}

View File

@@ -57,9 +57,9 @@ class SystemAttachmentController extends BaseController
$data = $request->post();
$result = $this->logic->edit($data['id'], ['origin_name' => $data['origin_name']]);
if ($result) {
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -73,13 +73,13 @@ class SystemAttachmentController 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');
}
}
@@ -94,13 +94,13 @@ class SystemAttachmentController extends BaseController
$category_id = $request->post('category_id', '');
$ids = $request->post('ids', '');
if (empty($ids) || empty($category_id)) {
return $this->fail('参数错误,请检查参数');
return $this->fail('invalid parameters, please check');
}
$result = $this->logic->move($category_id, $ids);
if ($result) {
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -57,7 +57,7 @@ class SystemCategoryController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -73,9 +73,9 @@ class SystemCategoryController 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');
}
}
@@ -91,9 +91,9 @@ class SystemCategoryController 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');
}
}
@@ -107,13 +107,13 @@ class SystemCategoryController 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

@@ -62,9 +62,9 @@ class SystemConfigController 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');
}
}
@@ -80,9 +80,9 @@ class SystemConfigController 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');
}
}
@@ -96,13 +96,13 @@ class SystemConfigController 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');
}
}
@@ -117,10 +117,10 @@ class SystemConfigController extends BaseController
$group_id = $request->post('group_id');
$config = $request->post('config');
if (empty($group_id) || empty($config)) {
return $this->fail('参数错误');
return $this->fail('Invalid parameters');
}
$this->logic->batchUpdate($group_id, $config);
return $this->success('操作成功');
return $this->success('operation success');
}
}

View File

@@ -61,9 +61,9 @@ class SystemConfigGroupController 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');
}
}
@@ -80,9 +80,9 @@ class SystemConfigGroupController extends BaseController
$result = $this->logic->edit($data['id'], $data);
if ($result) {
ConfigCache::clearConfig($data['code']);
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -96,13 +96,13 @@ class SystemConfigGroupController 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');
}
}
@@ -116,7 +116,7 @@ class SystemConfigGroupController extends BaseController
{
$email = $request->input('email', '');
if (empty($email)) {
return $this->fail('请输入邮箱');
return $this->fail('please input email');
}
$subject = "测试邮件";
$code = "9527";
@@ -137,11 +137,11 @@ class SystemConfigGroupController extends BaseController
$model->status = 'failure';
$model->response = $result;
$model->save();
return $this->fail('发送失败,请查看日志');
return $this->fail('send failed, please check logs');
} else {
$model->status = 'success';
$model->save();
return $this->success([], '发送成功');
return $this->success([], 'send success');
}
} catch (\Exception $e) {
$model->status = 'failure';

View File

@@ -59,7 +59,7 @@ class SystemDeptController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -75,9 +75,9 @@ class SystemDeptController 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');
}
}
@@ -93,9 +93,9 @@ class SystemDeptController 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');
}
}
@@ -109,13 +109,13 @@ class SystemDeptController 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

@@ -63,9 +63,9 @@ class SystemDictDataController extends BaseController
$result = $this->logic->add($data);
if ($result) {
DictCache::clear();
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -82,9 +82,9 @@ class SystemDictDataController extends BaseController
$result = $this->logic->edit($data['id'], $data);
if ($result) {
DictCache::clear();
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -98,14 +98,14 @@ class SystemDictDataController 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) {
DictCache::clear();
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -61,9 +61,9 @@ class SystemDictTypeController extends BaseController
$result = $this->logic->add($data);
if ($result) {
DictCache::clear();
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -80,9 +80,9 @@ class SystemDictTypeController extends BaseController
$result = $this->logic->edit($data['id'], $data);
if ($result) {
DictCache::clear();
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -96,14 +96,14 @@ class SystemDictTypeController 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) {
DictCache::clear();
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -51,9 +51,9 @@ class SystemLogController extends BaseController
$logic = new SystemLoginLogLogic();
if (!empty($ids)) {
$logic->destroy($ids);
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
}
@@ -91,9 +91,9 @@ class SystemLogController extends BaseController
$logic = new SystemOperLogLogic();
if (!empty($ids)) {
$logic->destroy($ids);
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
}

View File

@@ -59,13 +59,13 @@ class SystemMailController 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

@@ -61,7 +61,7 @@ class SystemMenuController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -78,9 +78,9 @@ class SystemMenuController extends BaseController
$result = $this->logic->add($data);
if ($result) {
UserMenuCache::clearMenuCache();
return $this->success('添加成功');
return $this->success('add success');
} else {
return $this->fail('添加失败');
return $this->fail('add failed');
}
}
@@ -97,9 +97,9 @@ class SystemMenuController extends BaseController
$result = $this->logic->edit($data['id'], $data);
if ($result) {
UserMenuCache::clearMenuCache();
return $this->success('修改成功');
return $this->success('update success');
} else {
return $this->fail('修改失败');
return $this->fail('update failed');
}
}
@@ -113,14 +113,14 @@ class SystemMenuController 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) {
UserMenuCache::clearMenuCache();
return $this->success('删除成功');
return $this->success('delete success');
} else {
return $this->fail('删除失败');
return $this->fail('delete failed');
}
}

View File

@@ -60,7 +60,7 @@ class SystemPostController 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 SystemPostController 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 SystemPostController 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 SystemPostController 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');
}
}
@@ -130,10 +130,10 @@ class SystemPostController extends BaseController
{
$file = current($request->file());
if (!$file || !$file->isValid()) {
return $this->fail('未找到上传文件');
return $this->fail('uploaded file not found');
}
$this->logic->import($file);
return $this->success('导入成功');
return $this->success('import success');
}
/**

View File

@@ -66,7 +66,7 @@ class SystemRoleController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -82,9 +82,9 @@ class SystemRoleController 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');
}
}
@@ -100,9 +100,9 @@ class SystemRoleController 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');
}
}
@@ -116,13 +116,13 @@ class SystemRoleController 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');
}
}
@@ -150,7 +150,7 @@ class SystemRoleController extends BaseController
$id = $request->post('id');
$menu_ids = $request->post('menu_ids');
$this->logic->saveMenuPermission($id, $menu_ids);
return $this->success('操作成功');
return $this->success('operation success');
}
/**

View File

@@ -75,11 +75,11 @@ class SystemServerController extends BaseController
{
$tag = $request->input('tag', '');
if (empty($tag)) {
return $this->fail('请选择要删除的缓存');
return $this->fail('please select cache to delete');
}
Cache::tag($tag)->clear();
Cache::delete($tag);
return $this->success('删除成功');
return $this->success('delete success');
}
}

View File

@@ -65,7 +65,7 @@ class SystemUserController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -81,9 +81,9 @@ class SystemUserController 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');
}
}
@@ -99,9 +99,9 @@ class SystemUserController 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');
}
}
@@ -116,9 +116,9 @@ class SystemUserController extends BaseController
$ids = $request->input('ids', '');
if (!empty($ids)) {
$this->logic->destroy($ids);
return $this->success('操作成功');
return $this->success('operation success');
} else {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
}
@@ -134,7 +134,7 @@ class SystemUserController extends BaseController
UserInfoCache::clearUserInfo($id);
UserAuthCache::clearUserAuth($id);
UserMenuCache::clearUserMenu($id);
return $this->success('操作成功');
return $this->success('operation success');
}
/**
@@ -148,12 +148,12 @@ class SystemUserController extends BaseController
$id = $request->post('id', '');
$password = $request->post('password', '');
if ($id == 1) {
return $this->fail('超级管理员不允许重置密码');
return $this->fail('super admin cannot reset password');
}
$data = ['password' => password_hash($password, PASSWORD_DEFAULT)];
$this->logic->authEdit($id, $data);
UserInfoCache::clearUserInfo($id);
return $this->success('操作成功');
return $this->success('operation success');
}
/**
@@ -169,7 +169,7 @@ class SystemUserController extends BaseController
$data = ['dashboard' => $dashboard];
$this->logic->authEdit($id, $data);
UserInfoCache::clearUserInfo($id);
return $this->success('操作成功');
return $this->success('operation success');
}
/**
@@ -187,9 +187,9 @@ class SystemUserController extends BaseController
$result = $this->logic->updateInfo($this->adminId, $data);
if ($result) {
UserInfoCache::clearUserInfo($this->adminId);
return $this->success('操作成功');
return $this->success('operation success');
} else {
return $this->fail('操作失败');
return $this->fail('operation failed');
}
}
@@ -205,6 +205,6 @@ class SystemUserController extends BaseController
$newPassword = $request->input('newPassword');
$this->logic->modifyPassword($this->adminId, $oldPassword, $newPassword);
UserInfoCache::clearUserInfo($this->adminId);
return $this->success('修改成功');
return $this->success('update success');
}
}

View File

@@ -61,9 +61,9 @@ class CrontabController 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');
}
}
@@ -79,9 +79,9 @@ class CrontabController 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');
}
}
@@ -95,13 +95,13 @@ class CrontabController 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');
}
}
@@ -116,13 +116,13 @@ class CrontabController extends BaseController
$id = $request->input('id', '');
$status = $request->input('status', 1);
if (empty($id)) {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
$result = $this->logic->changeStatus($id, $status);
if ($result) {
return $this->success('操作成功');
return $this->success('operation success');
} else {
return $this->fail('操作失败');
return $this->fail('operation failed');
}
}
@@ -137,9 +137,9 @@ class CrontabController extends BaseController
$id = $request->input('id', '');
$result = $this->logic->run($id);
if ($result) {
return $this->success('执行成功');
return $this->success('execute success');
} else {
return $this->fail('执行失败');
return $this->fail('execution failed');
}
}
@@ -173,9 +173,9 @@ class CrontabController extends BaseController
if (!empty($ids)) {
$logic = new CrontabLogLogic();
$logic->destroy($ids);
return $this->success('操作成功');
return $this->success('operation success');
} else {
return $this->fail('参数错误,请检查');
return $this->fail('invalid parameters, please check');
}
}
}

View File

@@ -59,7 +59,7 @@ class GenerateTablesController extends BaseController
$data = is_array($model) ? $model : $model->toArray();
return $this->success($data);
} else {
return $this->fail('未查找到信息');
return $this->fail('not found');
}
}
@@ -75,9 +75,9 @@ class GenerateTablesController 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');
}
}
@@ -91,13 +91,13 @@ class GenerateTablesController 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');
}
}
@@ -112,7 +112,7 @@ class GenerateTablesController extends BaseController
$names = $request->input('names', []);
$source = $request->input('source', '');
$this->logic->loadTable($names, $source);
return $this->success('操作成功');
return $this->success('operation success');
}
/**
@@ -125,7 +125,7 @@ class GenerateTablesController extends BaseController
{
$id = $request->input('id', '');
$this->logic->sync($id);
return $this->success('操作成功');
return $this->success('operation success');
}
/**
@@ -159,7 +159,7 @@ class GenerateTablesController extends BaseController
$id = $request->input('id', '');
$this->logic->generateFile($id);
UserMenuCache::clearMenuCache();
return $this->success('操作成功');
return $this->success('operation success');
}
/**

View File

@@ -68,7 +68,7 @@ if (!function_exists('downloadFile')) {
if (file_exists($base_dir . DIRECTORY_SEPARATOR . $file_name)) {
return response()->download($base_dir . DIRECTORY_SEPARATOR . $file_name, urlencode($file_name));
} else {
throw new ApiException('模板不存在');
throw new ApiException('Template not found');
}
}
}

View File

@@ -158,7 +158,7 @@ class DatabaseLogic extends BaseLogic
$isDeleteTime = true;
}
if (!$isDeleteTime) {
throw new ApiException('当前表不支持回收站功能');
throw new ApiException('Current table does not support recycle bin');
}
// 查询软删除数据
$request = request();

View File

@@ -38,7 +38,7 @@ class SystemAttachmentLogic extends BaseLogic
{
$category = SystemCategory::where('id', $category_id)->findOrEmpty();
if ($category->isEmpty()) {
throw new ApiException('目标分类不存在');
throw new ApiException('Target category not found');
}
return $this->model->whereIn('id', $ids)->update(['category_id' => $category_id]);
}
@@ -54,11 +54,11 @@ class SystemAttachmentLogic extends BaseLogic
{
$image_data = file_get_contents($url);
if ($image_data === false) {
throw new ApiException('获取文件资源失败');
throw new ApiException('Failed to get file resource');
}
$image_resource = imagecreatefromstring($image_data);
if (!$image_resource) {
throw new ApiException('创建图片资源失败');
throw new ApiException('Failed to create image resource');
}
$filename = basename($url);
$file_extension = pathinfo($filename, PATHINFO_EXTENSION);
@@ -84,11 +84,11 @@ class SystemAttachmentLogic extends BaseLogic
break;
default:
imagedestroy($image_resource);
throw new ApiException('文件格式错误');
throw new ApiException('Invalid file format');
}
imagedestroy($image_resource);
if (!$result) {
throw new ApiException('文件保存失败');
throw new ApiException('Failed to save file');
}
$hash = md5_file($save_path);

View File

@@ -41,14 +41,14 @@ class SystemCategoryLogic extends BaseLogic
{
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('上级分类和当前分类不能相同');
throw new ApiException('Parent category cannot be the same as current');
}
if (in_array($id, explode(',', $data['level']))) {
throw new ApiException('不能将上级分类设置为当前分类的子分类');
throw new ApiException('Cannot set parent category as child of current');
}
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
throw new ApiException('Data not found');
}
return $model->save($data);
}
@@ -60,7 +60,7 @@ class SystemCategoryLogic extends BaseLogic
{
$num = $this->model->where('parent_id', 'in', $ids)->count();
if ($num > 0) {
throw new ApiException('该部门下存在子分类,请先删除子分类');
throw new ApiException('This category has sub-categories, please delete them first');
} else {
return $this->model->destroy($ids);
}

View File

@@ -34,10 +34,10 @@ class SystemConfigGroupLogic extends BaseLogic
$id = $ids[0];
$model = $this->model->where('id', $id)->findOrEmpty();
if ($model->isEmpty()) {
throw new ApiException('配置数据未找到');
throw new ApiException('Config data not found');
}
if (in_array(intval($id), [1, 2, 3])) {
throw new ApiException('系统默认分组,无法删除');
throw new ApiException('System default group cannot be deleted');
}
Db::startTrans();
try {
@@ -51,7 +51,7 @@ class SystemConfigGroupLogic extends BaseLogic
return true;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('删除数据异常,请检查');
throw new ApiException('Delete data error, please check');
}
}
}

View File

@@ -63,7 +63,7 @@ class SystemConfigLogic extends BaseLogic
{
$group = SystemConfigGroup::find($group_id);
if (!$group) {
throw new ApiException('配置组未找到');
throw new ApiException('Config group not found');
}
$saveData = [];
foreach ($config as $key => $value) {

View File

@@ -44,10 +44,10 @@ class SystemDeptLogic extends BaseLogic
$oldLevel = $data['level'] . $id . ',';
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('上级部门和当前部门不能相同');
throw new ApiException('Parent department cannot be the same as current department');
}
if (in_array($id, explode(',', $data['level']))) {
throw new ApiException('不能将上级部门设置为当前部门的子部门');
throw new ApiException('Cannot set parent department to a child of current department');
}
$newLevel = $data['level'] . $id . ',';
$deptIds = $this->model->where('level', 'like', $oldLevel . '%')->column('id');
@@ -65,11 +65,11 @@ class SystemDeptLogic extends BaseLogic
{
$num = $this->model->where('parent_id', 'in', $ids)->count();
if ($num > 0) {
throw new ApiException('该部门下存在子部门,请先删除子部门');
throw new ApiException('This department has sub-departments, please delete them first');
} else {
$count = SystemUser::where('dept_id', 'in', $ids)->count();
if ($count > 0) {
throw new ApiException('该部门下存在用户,请先删除或者转移用户');
throw new ApiException('This department has users, please delete or transfer them first');
}
return $this->model->destroy($ids);
}

View File

@@ -35,7 +35,7 @@ class SystemDictDataLogic extends BaseLogic
{
$type = SystemDictType::where('id', $data['type_id'])->findOrEmpty();
if ($type->isEmpty()) {
throw new ApiException('字典类型不存在');
throw new ApiException('Dict type not found');
}
$data['code'] = $type->code;
$model = $this->model->create($data);

View File

@@ -32,7 +32,7 @@ class SystemDictTypeLogic extends BaseLogic
{
$model = $this->model->where('code', $data['code'])->findOrEmpty();
if (!$model->isEmpty()) {
throw new ApiException('该字典标识已存在');
throw new ApiException('This dict code already exists');
}
return $this->model->save($data);
}
@@ -52,7 +52,7 @@ class SystemDictTypeLogic extends BaseLogic
return $result;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('修改数据异常,请检查');
throw new ApiException('Update data error, please check');
}
}
@@ -72,7 +72,7 @@ class SystemDictTypeLogic extends BaseLogic
return $result;
} catch (\Exception $e) {
Db::rollback();
throw new ApiException('删除数据异常,请检查');
throw new ApiException('Delete data error, please check');
}
}

View File

@@ -43,7 +43,7 @@ class SystemMenuLogic extends BaseLogic
{
$data = $this->handleData($data);
if ($data['parent_id'] == $id) {
throw new ApiException('不能设置父级为自身');
throw new ApiException('Cannot set parent to self');
}
return $this->model->update($data, ['id' => $id]);
}
@@ -55,7 +55,7 @@ class SystemMenuLogic extends BaseLogic
{
$num = $this->model->where('parent_id', 'in', $ids)->count();
if ($num > 0) {
throw new ApiException('该菜单下存在子菜单,请先删除子菜单');
throw new ApiException('This menu has sub-menus, please delete them first');
} else {
return $this->model->destroy($ids);
}

View File

@@ -65,7 +65,7 @@ class SystemPostLogic extends BaseLogic
}
$this->saveAll($data);
} catch (\Exception $e) {
throw new ApiException('导入文件错误请上传正确的文件格式xlsx');
throw new ApiException('Import file error, please upload correct xlsx file');
}
}

View File

@@ -43,7 +43,7 @@ class SystemRoleLogic extends BaseLogic
{
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
throw new ApiException('Data not found');
}
$data = $this->handleData($data);
return $model->save($data);
@@ -60,7 +60,7 @@ class SystemRoleLogic extends BaseLogic
$num = SystemRole::where('level', '>=', $maxLevel)->whereIn('id', $ids)->count();
if ($num > 0) {
throw new ApiException('不能操作比当前账户职级高的角色');
throw new ApiException('Cannot operate roles with higher level than current account');
} else {
return $this->model->destroy($ids);
}
@@ -75,7 +75,7 @@ class SystemRoleLogic extends BaseLogic
$levelArr = array_column($this->adminInfo['roleList'], 'level');
$maxLevel = max($levelArr);
if ($data['level'] >= $maxLevel) {
throw new ApiException('不能操作比当前账户职级高的角色');
throw new ApiException('Cannot operate roles with higher level than current account');
}
return $data;
}

View File

@@ -85,7 +85,7 @@ class SystemUserLogic extends BaseLogic
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
throw new ApiException('No permission to operate department data');
}
}
return $data;
@@ -105,11 +105,11 @@ class SystemUserLogic extends BaseLogic
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
throw new ApiException('No permission to operate department data');
}
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
throw new ApiException('没有权限操作该角色数据');
throw new ApiException('No permission to operate role data');
}
}
$user = SystemUser::create($data);
@@ -142,16 +142,16 @@ class SystemUserLogic extends BaseLogic
}
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
throw new ApiException('No permission to operate this data');
}
if ($this->adminInfo['id'] > 1) {
// 部门保护
if (!$this->deptProtect($this->adminInfo['deptList'], $data['dept_id'])) {
throw new ApiException('没有权限操作该部门数据');
throw new ApiException('No permission to operate department data');
}
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], $role_ids)) {
throw new ApiException('没有权限操作该角色数据');
throw new ApiException('No permission to operate role data');
}
}
$result = parent::edit($id, $data);
@@ -179,12 +179,12 @@ class SystemUserLogic extends BaseLogic
{
if (is_array($ids)) {
if (count($ids) > 1) {
throw new ApiException('禁止批量删除操作');
throw new ApiException('Batch delete is not allowed');
}
$ids = $ids[0];
}
if ($ids == 1) {
throw new ApiException('超级管理员禁止删除');
throw new ApiException('Super admin cannot be deleted');
}
$query = $this->model->where('id', $ids);
// 超级管理员可删除任意用户,普通管理员仅可删除当前部门和子部门的用户
@@ -193,14 +193,14 @@ class SystemUserLogic extends BaseLogic
}
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
throw new ApiException('No permission to operate this data');
}
if ($this->adminInfo['id'] > 1) {
$role_ids = $user->roles->toArray() ?: [];
if (!empty($role_ids)) {
// 越权保护
if (!$this->roleProtect($this->adminInfo['roleList'], array_column($role_ids, 'id'))) {
throw new ApiException('没有权限操作该角色数据');
throw new ApiException('No permission to operate role data');
}
}
}
@@ -283,7 +283,7 @@ class SystemUserLogic extends BaseLogic
$model->password = password_hash($newPassword, PASSWORD_DEFAULT);
return $model->save();
} else {
throw new ApiException('原密码错误');
throw new ApiException('Old password is incorrect');
}
}
@@ -298,7 +298,7 @@ class SystemUserLogic extends BaseLogic
$query->auth($this->adminInfo['deptList']);
$user = $query->findOrEmpty();
if ($user->isEmpty()) {
throw new ApiException('没有权限操作该数据');
throw new ApiException('No permission to operate this data');
}
}
parent::edit($id, $data);

View File

@@ -50,7 +50,7 @@ class CrontabLogic extends BaseLogic
6 => "0 {$minute} {$hour} * * {$week}",
7 => "0 {$minute} {$hour} {$day} * *",
8 => "0 {$minute} {$hour} {$day} {$month} *",
default => throw new ApiException("任务类型异常"),
default => throw new ApiException('Invalid task type'),
};
// 定时任务模型新增
@@ -95,13 +95,13 @@ class CrontabLogic extends BaseLogic
6 => "0 {$minute} {$hour} * * {$week}",
7 => "0 {$minute} {$hour} {$day} * *",
8 => "0 {$minute} {$hour} {$day} {$month} *",
default => throw new ApiException("任务类型异常"),
default => throw new ApiException('Invalid task type'),
};
// 查询任务数据
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
throw new ApiException('Data not found');
}
$result = $model->save([
@@ -134,7 +134,7 @@ class CrontabLogic extends BaseLogic
{
if (is_array($ids)) {
if (count($ids) > 1) {
throw new ApiException('禁止批量删除操作');
throw new ApiException('Batch delete is not allowed');
}
$ids = $ids[0];
}
@@ -157,7 +157,7 @@ class CrontabLogic extends BaseLogic
{
$model = $this->model->findOrEmpty($id);
if ($model->isEmpty()) {
throw new ApiException('数据不存在');
throw new ApiException('Data not found');
}
$result = $model->save(['status' => $status]);
if ($result) {

View File

@@ -63,7 +63,7 @@ class GenerateTablesLogic extends BaseLogic
$data = config('think-orm.connections');
$config = $data[$source];
if (!$config) {
throw new ApiException('数据库配置读取失败');
throw new ApiException('Failed to read database config');
}
$prefix = $config['prefix'] ?? '';
@@ -262,10 +262,10 @@ class GenerateTablesLogic extends BaseLogic
{
$table = $this->model->findOrEmpty($id);
if (!in_array($table['template'], ["plugin", "app"])) {
throw new ApiException('应用类型必须为plugin或者app');
throw new ApiException('App type must be plugin or app');
}
if (empty($table['namespace'])) {
throw new ApiException('请先设置应用名称');
throw new ApiException('Please set app name first');
}
$columns = $this->columnLogic->where('table_id', $id)
@@ -320,11 +320,11 @@ class GenerateTablesLogic extends BaseLogic
{
$table = $this->model->where('id', $id)->findOrEmpty();
if ($table->isEmpty()) {
throw new ApiException('请选择要生成的表');
throw new ApiException('Please select tables to generate');
}
$debug = config('app.debug', true);
if (!$debug) {
throw new ApiException('非调试模式下,不允许生成文件');
throw new ApiException('File generation not allowed in non-debug mode');
}
$this->updateMenu($table);
$this->genModule($id);

View File

@@ -27,10 +27,10 @@ class CheckLogin implements MiddlewareInterface
try {
$token = JwtToken::getExtend();
} catch (\Throwable $e) {
throw new ApiException('您的登录凭证错误或者已过期,请重新登录', 401);
throw new ApiException('Your login credential is invalid or expired, please login again', 401);
}
if ($token['plat'] !== 'saiadmin') {
throw new ApiException('登录凭证校验失败');
throw new ApiException('Login credential verification failed');
}
// 一次合并设置,避免 setHeader 覆盖导致只保留最后一个
$request->setHeader(array_merge($request->header() ?: [], [

View File

@@ -30,7 +30,7 @@ class SystemLog implements MiddlewareInterface
// 记录日志
Event::emit('user.operateLog', true);
} catch (\Throwable $e) {
throw new ApiException('登录凭获取失败,请检查');
throw new ApiException('Failed to get login credential, please check');
}
}
return $handler($request);