系统细节优化
This commit is contained in:
parent
b57c613f08
commit
ec03c5fb6b
@ -89,6 +89,11 @@ abstract class BaseController
|
|||||||
View::assign('login_user', $this->uid);
|
View::assign('login_user', $this->uid);
|
||||||
// 验证用户访问权限
|
// 验证用户访问权限
|
||||||
if ($this->controller !== 'index' && $this->controller !== 'api') {
|
if ($this->controller !== 'index' && $this->controller !== 'api') {
|
||||||
|
$reg_pwd = Db::name('Admin')->where(['id' => $this->uid])->value('reg_pwd');
|
||||||
|
if($reg_pwd!==''){
|
||||||
|
redirect('/home/api/edit_password.html')->send();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
if (!$this->checkAuth()) {
|
if (!$this->checkAuth()) {
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
return to_assign(202, '你没有权限,请联系管理员或者人事部');
|
return to_assign(202, '你没有权限,请联系管理员或者人事部');
|
||||||
|
@ -67,6 +67,10 @@ class Admin extends BaseController
|
|||||||
$username = $pinyin->name($param['name'], PINYIN_UMLAUT_V);
|
$username = $pinyin->name($param['name'], PINYIN_UMLAUT_V);
|
||||||
$param['username'] = implode('', $username);
|
$param['username'] = implode('', $username);
|
||||||
if (!empty($param['id']) && $param['id'] > 0) {
|
if (!empty($param['id']) && $param['id'] > 0) {
|
||||||
|
$count = Db::name('Admin')->where([['username', '=', $param['username']], ['id', '<>', $param['id']]])->count();
|
||||||
|
if ($count > 0) {
|
||||||
|
$param['username'] = implode('', $username) . $count;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
validate(AdminCheck::class)->scene('edit')->check($param);
|
validate(AdminCheck::class)->scene('edit')->check($param);
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException $e) {
|
||||||
@ -76,10 +80,6 @@ class Admin extends BaseController
|
|||||||
// 启动事务
|
// 启动事务
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$count = Db::name('Admin')->where([['username', '=', $param['username']], ['id', '<>', $param['id']]])->count();
|
|
||||||
if ($count > 0) {
|
|
||||||
$param['username'] = implode('', $username) . $count;
|
|
||||||
}
|
|
||||||
Db::name('Admin')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
|
Db::name('Admin')->where(['id' => $param['id']])->strict(false)->field(true)->update($param);
|
||||||
if (!isset($param['thumb']) || $param['thumb'] == '') {
|
if (!isset($param['thumb']) || $param['thumb'] == '') {
|
||||||
$char = mb_substr($param['name'], 0, 1, 'utf-8');
|
$char = mb_substr($param['name'], 0, 1, 'utf-8');
|
||||||
@ -97,16 +97,16 @@ class Admin extends BaseController
|
|||||||
return to_assign(1, '提交失败:' . $e->getMessage());
|
return to_assign(1, '提交失败:' . $e->getMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$count = Db::name('Admin')->where('username', $param['username'])->count();
|
||||||
|
if ($count > 0) {
|
||||||
|
$param['username'] = implode('', $username) . $count;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
validate(AdminCheck::class)->scene('add')->check($param);
|
validate(AdminCheck::class)->scene('add')->check($param);
|
||||||
} catch (ValidateException $e) {
|
} catch (ValidateException $e) {
|
||||||
// 验证失败 输出错误信息
|
// 验证失败 输出错误信息
|
||||||
return to_assign(1, $e->getError());
|
return to_assign(1, $e->getError());
|
||||||
}
|
}
|
||||||
$count = Db::name('Admin')->where('username', $param['username'])->count();
|
|
||||||
if ($count > 0) {
|
|
||||||
$param['username'] = implode('', $username) . $count;
|
|
||||||
}
|
|
||||||
$param['salt'] = set_salt(20);
|
$param['salt'] = set_salt(20);
|
||||||
$param['pwd'] = set_password($param['reg_pwd'], $param['salt']);
|
$param['pwd'] = set_password($param['reg_pwd'], $param['salt']);
|
||||||
// 启动事务
|
// 启动事务
|
||||||
|
@ -2,27 +2,30 @@
|
|||||||
<!-- 主体 -->
|
<!-- 主体 -->
|
||||||
{block name="body"}
|
{block name="body"}
|
||||||
<form class="layui-form body-content">
|
<form class="layui-form body-content">
|
||||||
<h3 style="height:36px">重置密码</h3>
|
{notempty name="$admin.reg_pwd"}
|
||||||
<table class="layui-table layui-table-form">
|
<div style="text-align:center; padding:20px 0; font-size:18px; color:#FF5722">初始化密码才能正常使用系统</div>
|
||||||
<tr>
|
{/notempty}
|
||||||
<td class="layui-td-gray2">旧密码<span style="color: red">*</span></td>
|
<h3 class="h3-title">重置密码</h3>
|
||||||
<td>
|
<table class="layui-table layui-table-form">
|
||||||
<input type="password" lay-verify="required" name="old_pwd" placeholder="请输入旧密码" lay-reqText="请输入旧密码" autocomplete="off" class="layui-input">
|
<tr>
|
||||||
</td>
|
<td class="layui-td-gray2">旧密码<span style="color: red">*</span></td>
|
||||||
<td class="layui-td-gray2">用户名</td>
|
<td>
|
||||||
<td>{$admin.username}</td>
|
<input type="password" lay-verify="required" name="old_pwd" placeholder="请输入旧密码" lay-reqText="请输入旧密码" autocomplete="off" class="layui-input">
|
||||||
</tr>
|
</td>
|
||||||
<tr>
|
<td class="layui-td-gray2">用户名</td>
|
||||||
<td class="layui-td-gray2">新密码 <span style="color: red">*</span></td>
|
<td>{$admin.username}</td>
|
||||||
<td>
|
</tr>
|
||||||
<input type="password" lay-verify="required" name="pwd" placeholder="请输入新密码" lay-reqText="请输入新密码" autocomplete="off" class="layui-input">
|
<tr>
|
||||||
</td>
|
<td class="layui-td-gray2">新密码 <span style="color: red">*</span></td>
|
||||||
<td class="layui-td-gray2">确认新密码 <span style="color: red">*</span></td>
|
<td>
|
||||||
<td>
|
<input type="password" lay-verify="required" name="pwd" placeholder="请输入新密码" lay-reqText="请输入新密码" autocomplete="off" class="layui-input">
|
||||||
<input type="password" lay-verify="required" name="pwd_confirm" placeholder="请再次输入新密码" lay-reqText="请再次输入新密码" autocomplete="off" class="layui-input">
|
</td>
|
||||||
</td>
|
<td class="layui-td-gray2">确认新密码 <span style="color: red">*</span></td>
|
||||||
</tr>
|
<td>
|
||||||
</table>
|
<input type="password" lay-verify="required" name="pwd_confirm" placeholder="请再次输入新密码" lay-reqText="请再次输入新密码" autocomplete="off" class="layui-input">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<div style="padding: 10px 0">
|
<div style="padding: 10px 0">
|
||||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
detail['start_time_a']='';
|
detail['start_time_a']='';
|
||||||
detail['end_time_a']='';
|
detail['end_time_a']='';
|
||||||
detail['start_time_b']='08:30';
|
detail['start_time_b']='08:30';
|
||||||
detail['end_time_b']='09:00';
|
detail['end_time_b']='18:00';
|
||||||
detail['remark']='';
|
detail['remark']='';
|
||||||
detail['type']=0;
|
detail['type']=0;
|
||||||
detail['remind_type']=0;
|
detail['remind_type']=0;
|
||||||
|
@ -72,8 +72,8 @@
|
|||||||
ids: ids,
|
ids: ids,
|
||||||
names: names,
|
names: names,
|
||||||
type: 0,
|
type: 0,
|
||||||
department_url:"{:url('/home/api/get_department_tree')}",
|
department_url:"{:url('home/api/get_department_tree')}",
|
||||||
employee_url:"{:url('/home/api/get_employee')}",
|
employee_url:"{:url('home/api/get_employee')}",
|
||||||
callback: function (ids, names, dids, departments) {
|
callback: function (ids, names, dids, departments) {
|
||||||
$('[name="uid"]').val(ids);
|
$('[name="uid"]').val(ids);
|
||||||
that.val(names);
|
that.val(names);
|
||||||
@ -235,7 +235,7 @@
|
|||||||
detail['start_time_a']='';
|
detail['start_time_a']='';
|
||||||
detail['end_time_a']='';
|
detail['end_time_a']='';
|
||||||
detail['start_time_b']='08:30';
|
detail['start_time_b']='08:30';
|
||||||
detail['end_time_b']='09:00';
|
detail['end_time_b']='18:00';
|
||||||
detail['remark']='';
|
detail['remark']='';
|
||||||
detail['type']=0;
|
detail['type']=0;
|
||||||
detail['remind_type']=0;
|
detail['remind_type']=0;
|
||||||
|
@ -211,7 +211,7 @@
|
|||||||
}
|
}
|
||||||
console.log(detail);
|
console.log(detail);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:"{:url('home/schedule/save')}",
|
url:"{:url('home/schedule/add')}",
|
||||||
type:'post',
|
type:'post',
|
||||||
data:detail,
|
data:detail,
|
||||||
success:function(e){
|
success:function(e){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user