mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 18:12:50 +08:00
增加默认密码;修改curd返回异常信息;去除admin表username唯一值;
This commit is contained in:
@@ -11,6 +11,8 @@ use app\common\controller\AdminController;
|
||||
use app\admin\service\annotation\ControllerAnnotation;
|
||||
use app\admin\service\annotation\NodeAnotation;
|
||||
use think\App;
|
||||
use think\facade\Validate;
|
||||
use think\validate\ValidateRule;
|
||||
|
||||
/**
|
||||
* Class Admin
|
||||
@@ -76,12 +78,23 @@ class Admin extends AdminController
|
||||
$post = $this->request->post();
|
||||
$authIds = $this->request->post('auth_ids', []);
|
||||
$post['auth_ids'] = implode(',', array_keys($authIds));
|
||||
$rule = [];
|
||||
$rule = Validate::rule('username|用户登录名', ValidateRule::isRequire());
|
||||
$post['password'] = password(sysconfig('site', 'site_default_password', '123456'));
|
||||
$this->validate($post, $rule);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$model_admin = SystemAdmin::where('username', $post['username'])->find();
|
||||
|
||||
if (!empty($model_admin)) {
|
||||
throw new \Exception('同名用户已存在');
|
||||
}
|
||||
|
||||
$save = $this->model->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
$this->error('保存失败:' . $e->getMessage());
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ trait Curd
|
||||
try {
|
||||
$save = $row->save($post);
|
||||
} catch (\Exception $e) {
|
||||
$this->error('保存失败');
|
||||
$this->error('保存失败:' . $e->getMessage());
|
||||
}
|
||||
$save ? $this->success('保存成功') : $this->error('保存失败');
|
||||
}
|
||||
@@ -98,7 +98,7 @@ trait Curd
|
||||
try {
|
||||
$save = $row->delete();
|
||||
} catch (\Exception $e) {
|
||||
$this->error('删除失败');
|
||||
$this->error('删除失败:' . $e->getMessage());
|
||||
}
|
||||
$save ? $this->success('删除成功') : $this->error('删除失败');
|
||||
}
|
||||
@@ -156,7 +156,7 @@ trait Curd
|
||||
$post['field'] => $post['value'],
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
$this->error('修改失败:' . $e->getMessage());
|
||||
}
|
||||
$this->success('保存成功');
|
||||
}
|
||||
|
||||
@@ -49,6 +49,13 @@
|
||||
<tip>填写站点域名。以http://或https://开头,内置的定时任务用到了这个配置项,修改之后需要重启定时任务</tip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">默认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="site_default_password" class="layui-input" placeholder="请输入默认密码" value="{:sysconfig('site','site_default_password')}">
|
||||
<tip>添加账号时自动填充的密码,默认为:123456 。建议填写为您系统特有的默认密码规则,比如:ul-aa@@123</tip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">js脚本</label>
|
||||
<div class="layui-input-block">
|
||||
|
||||
Reference in New Issue
Block a user