From bae615bac0b61f50bb788cd916049e7b2cd0ba4a Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 1 Apr 2021 15:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AD=90=E7=AB=99=E8=A1=8C?= =?UTF-8?q?=E4=B8=BA=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ActionController.class.php | 2 +- .../Admin/Controller/UserController.class.php | 42 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Application/Admin/Controller/ActionController.class.php b/Application/Admin/Controller/ActionController.class.php index 7587efb10..15c013f6b 100644 --- a/Application/Admin/Controller/ActionController.class.php +++ b/Application/Admin/Controller/ActionController.class.php @@ -22,7 +22,7 @@ class ActionController extends AdminController { public function actionLog(){ //获取列表数据 $map['status'] = array('gt', -1); - $list = $this->lists('ActionLog', $map); + $list = $this->lists('ActionLog', $map,'id desc',true,true); int_to_string($list); foreach ($list as $key=>$value){ $model_id = get_document_field($value['model'],"name","id"); diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index b1143f18c..b70514140 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -148,8 +148,8 @@ class UserController extends AdminController public function action() { //获取列表数据 - $Action = M('Action')->where(array('status' => array('gt', -1))); - $list = $this->lists($Action); + $Action = SM('Action')->where(array('status' => array('gt', -1))); + $list = $this->lists($Action,[],'',true,true); int_to_string($list); // 记录当前列表页的cookie Cookie('__forward__', $_SERVER['REQUEST_URI']); @@ -216,10 +216,10 @@ class UserController extends AdminController $map['uid'] = array('in', $id); $map1['id'] = array('in', $id); $status = I('method') == 'forbidUser' ? 0 : 1; - $res = M('UcenterMember')->where($map1)->setField('status', $status); - $res1 = M('Member')->where($map)->setField('status', $status); + $res = SM('UcenterMember')->where($map1)->setField('status', $status); + $res1 = SM('Member')->where($map)->setField('status', $status); if ($res && $res1) { - $nickname = M('Member')->where($map)->field("nickname")->find()['nickname'];//默认一个,多个时需要遍历 + $nickname = SM('Member')->where($map)->field("nickname")->find()['nickname'];//默认一个,多个时需要遍历 addOperationLog(array( "op_type"=>1, "key"=> $nickname, @@ -433,9 +433,9 @@ class UserController extends AdminController // break; // } // } - $Member = D('UcenterMember'); - $mem = D('Member'); - $au = D('AuthGroupAccess'); + $Member = SM('UcenterMember'); + $mem = SM('Member'); + $au = SM('AuthGroupAccess'); $map['id'] = $id; $maps['uid'] = $id; $info['username'] = $_POST['username']; @@ -471,7 +471,9 @@ class UserController extends AdminController } if ($smember !== false || $meb || $ag) { - M('user_pwd')->where($maps)->setField('password', think_encrypt($info['password'])); + if(!IS_SUBSITE){ + M('user_pwd')->where($maps)->setField('password', think_encrypt($info['password'])); + } addOperationLog(array( "op_type"=>1, "key"=>$_POST['username'], @@ -491,17 +493,17 @@ class UserController extends AdminController } } else { $map['id'] = $_GET['id']; - $Member = D('UcenterMember')->where($map)->find(); + $Member = SM('UcenterMember')->where($map)->find(); $Member['apply_leave_time']?($Member['apply_leave_time'] = date("Y-m-d",$Member['apply_leave_time'])):($Member['apply_leave_time']=''); $Member['leave_time']?($Member['leave_time'] = date("Y-m-d",$Member['leave_time'])):($Member['leave_time']=''); - $data = D('Member')->where(array('uid' => $_GET['id']))->find(); + $data = SM('Member')->where(array('uid' => $_GET['id']))->find(); - $au = D('AuthGroupAccess')->where(array('uid' => $_GET['id']))->find(); + $au = SM('AuthGroupAccess')->where(array('uid' => $_GET['id']))->find(); $this->assign("authid", $au["group_id"]); $this->assign("houtai", $au["houtai"]); - $list = D('AuthGroup')->where(array('status' => 1))->select(); + $list = SM('AuthGroup')->where(array('status' => 1))->select(); $username = $_POST['username']; $password = $_POST['password']; $this->assign('lists', $list); @@ -698,13 +700,13 @@ class UserController extends AdminController public function delete($id) { - M()->startTrans(); - $nickname = M('Member')->where("uid = '{$id}'")->field("nickname")->find()['nickname']; - $res1 = M('member')->delete($id); - $res2 = M('ucenter_member')->delete($id); - $res3 = M('auth_group_access')->where(array('uid' => $id))->delete(); + SM()->startTrans(); + $nickname = SM('Member')->where("uid = '{$id}'")->field("nickname")->find()['nickname']; + $res1 = SM('member')->delete($id); + $res2 =SM('ucenter_member')->delete($id); + $res3 = SM('auth_group_access')->where(array('uid' => $id))->delete(); if ($res1 && $res2 && $res3) { - M()->commit(); + SM()->commit(); addOperationLog(array( "op_type"=>2, "key"=> $nickname, @@ -712,7 +714,7 @@ class UserController extends AdminController )); $this->success('删除成功'); } else { - M()->rollback(); + SM()->rollback(); $this->error('删除失败' . M()->getError()); } }