修改管理员列表按钮和密码初始化
This commit is contained in:
1 parent
9539290f87
commit
1ecfffee55
5 files changed
+98
-55
No files matched your search
@@ -128,13 +128,10 @@ class Index extends Base
|
||||
|
||||
$msg = array();
|
||||
|
||||
if($data == 1)
|
||||
{
|
||||
$data =['msg'=>'添加成功','val'=>1];
|
||||
}else{
|
||||
$data =['msg'=>'数据处理错误','val'=>0];
|
||||
}
|
||||
// 根据更新结果设置返回提示信息
|
||||
$data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
|
||||
|
||||
// 返回信息
|
||||
return json($data);
|
||||
}
|
||||
|
||||
@@ -187,13 +184,10 @@ class Index extends Base
|
||||
|
||||
$data = $admin->save($list,['id'=>$id]);
|
||||
|
||||
if($data == 1)
|
||||
{
|
||||
$data =['msg'=>'更新成功','val'=>1];
|
||||
}else{
|
||||
$data =['msg'=>'数据处理错误','val'=>0];
|
||||
}
|
||||
// 根据更新结果设置返回提示信息
|
||||
$data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
|
||||
|
||||
// 返回信息
|
||||
return json($data);
|
||||
}
|
||||
|
||||
@@ -215,8 +209,10 @@ class Index extends Base
|
||||
|
||||
$data = $admin->destroy($id);
|
||||
|
||||
$data = ['msg'=>'删除成功','val'=>1];
|
||||
// 根据更新结果设置返回提示信息
|
||||
$data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
|
||||
|
||||
// 返回信息
|
||||
return json($data);
|
||||
}
|
||||
|
||||
@@ -241,9 +237,40 @@ class Index extends Base
|
||||
$data = $list->save();
|
||||
|
||||
// 根据更新结果设置返回提示信息
|
||||
$data ? $data=['msg'=>'操作成功'] : $data=['msg'=>'数据处理错误'];
|
||||
$data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
|
||||
|
||||
// 返回信息
|
||||
// 返回信息
|
||||
return json($data);
|
||||
}
|
||||
|
||||
|
||||
// 重置密码
|
||||
public function resetpassword($id)
|
||||
{
|
||||
|
||||
// 实例化管理员数据模型类
|
||||
$admin = new Admin();
|
||||
// 实例化加密类
|
||||
$md5 = new APR1_MD5();
|
||||
|
||||
// 生成密码
|
||||
$password = $md5->hash('123456');
|
||||
|
||||
// 查询用户信息
|
||||
$list = $admin->get($id);
|
||||
|
||||
// 设置管理员新信息
|
||||
$list->password = $password;
|
||||
|
||||
// 更新密码
|
||||
$data = $list->save();
|
||||
|
||||
// 根据更新结果设置返回提示信息
|
||||
$data ? $data=['msg'=>'密码重置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
|
||||
|
||||
// 返回信息
|
||||
return json($data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
<div class="cl pd-5 bg-1 bk-gray mt-20">
|
||||
<span class="l">
|
||||
<!-- 删除按钮 -->
|
||||
<a href="javascript:;" onclick="dels()" class="btn btn-danger radius">
|
||||
<a href="javascript:;" onclick="dels('/admin/m')" class="btn btn-danger radius">
|
||||
<i class="Hui-iconfont"></i>
|
||||
批量删除
|
||||
</a>
|
||||
@@ -91,7 +91,7 @@
|
||||
"className":'.td-manage',
|
||||
"render": function(data, type, row, meta) {
|
||||
// 初始化密码
|
||||
resetpw = '<a style="text-decoration:none" onClick="stop(this,'+ row.id +')" href="javascript:;" title="重置密码"><i class="Hui-iconfont"></i></a>';
|
||||
resetpwbut = '<a style="text-decoration:none" onClick="resetpw(this,'+ row.id +')" href="javascript:;" title="重置密码"><i class="Hui-iconfont"></i></a>';
|
||||
// 停用按钮
|
||||
stopbut = '<a style="text-decoration:none" onClick="stop(this,'+ row.id +')" href="javascript:;" title="停用"><i class="Hui-iconfont"></i></a>';
|
||||
// 启用按钮
|
||||
@@ -100,12 +100,12 @@
|
||||
readbut = '<a title="详细信息" data-href="admin/'+ row.id +'" data-title="' + row.xingming + ' 信息" onClick="Hui_admin_tab(this)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>';
|
||||
// 编辑按钮
|
||||
editbut = '<a title="编辑" href="javascript:void(0);" onclick=addfull("编辑","/admin/'+row.id+'/edit","500","300") class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>';
|
||||
delbut = '<a title="删除" href="javascript:void(0);" onclick=del(this,"'+row.id+'") class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>';
|
||||
delbut = '<a title="删除" href="javascript:void(0);" onclick=del(this,"/admin/'+row.id+'") class="ml-5" style="text-decoration:none"><i class="Hui-iconfont"></i></a>';
|
||||
if(row.status == '已停用')
|
||||
{
|
||||
buts = resetpw + startbut + readbut + editbut + delbut;
|
||||
buts = resetpwbut + startbut + readbut + editbut + delbut;
|
||||
}else{
|
||||
buts = resetpw + stopbut + readbut + editbut + delbut;
|
||||
buts = resetpwbut + stopbut + readbut + editbut + delbut;
|
||||
}
|
||||
|
||||
return buts;
|
||||
|
||||
Reference in new issue
Block a user