Commit e00b61e4 authored by zfc's avatar zfc

编辑调整

parent 75c4099c
...@@ -108,7 +108,15 @@ class Agent extends Basic ...@@ -108,7 +108,15 @@ class Agent extends Basic
$data = input('post.'); $data = input('post.');
$id = isset($data['id']) && $data['id']>0 ? $data['id']:false; //新增或者编辑数据
if(empty($data['id'])){
$data['create_time']= date( 'Y-m-d H:i:s',time());
$data['update_time']= date( 'Y-m-d H:i:s',time());
$id='';
}else{
$data['update_time']= date( 'Y-m-d H:i:s',time());
$id=$data['id'];
}
//判断name是否重复 //判断name是否重复
if($table->repetition('phone',$data['phone'])&& empty($id)){ if($table->repetition('phone',$data['phone'])&& empty($id)){
...@@ -116,8 +124,7 @@ class Agent extends Basic ...@@ -116,8 +124,7 @@ class Agent extends Basic
} }
//新增或者编辑数据
//prt($data);
if ($table->editData($data,$id)) { if ($table->editData($data,$id)) {
return $this->response(200, '成功'); return $this->response(200, '成功');
...@@ -173,7 +180,7 @@ class Agent extends Basic ...@@ -173,7 +180,7 @@ class Agent extends Basic
$data=$this->request->param(); $data=$this->request->param();
$ids=$data['ids']; $ids=$data['ids'];
//1.清空原有数据 //1.清空原有数据
if(!empty($ids)&&!empty($data['group_id'])&&!empty($data['idname'])){ if(!empty($ids)&&!empty($data['group_id'])){
if($table2->delUid($data['idname'],$ids)){ if($table2->delUid($data['idname'],$ids)){
//2.从新分发角色 //2.从新分发角色
......
...@@ -115,12 +115,13 @@ class Auth extends Basic ...@@ -115,12 +115,13 @@ class Auth extends Basic
* post存在id为新增 * post存在id为新增
* *
* */ * */
public function addAuth($group_id=0){ public function addAuth(){
$title = $group_id ? '编辑':'新增'; $group_id=$this->request->param('id');
$table= New AuthGroup(); $table= New AuthGroup();
if (empty($group_id)) { if ($this->request->isPost()) {
$data = input('post.'); $data = input('post.');
$err=$this->validateData($data, $err=$this->validateData($data,
[ [
...@@ -143,7 +144,7 @@ class Auth extends Basic ...@@ -143,7 +144,7 @@ class Auth extends Basic
} else { } else {
$info= $table->where("id={$group_id}")->find(); $info= $table->where("id={$group_id}")->find();
return $this->response(200, $title, $info); return $this->response(200, '取值', $info);
} }
...@@ -172,13 +173,14 @@ class Auth extends Basic ...@@ -172,13 +173,14 @@ class Auth extends Basic
* @date 2018-01-22 * @date 2018-01-22
* @author zfc * @author zfc
*/ */
public function accessLook($group_id=0){ public function accessLook(){
$table= New AuthGroup; $table= New AuthGroup;
$table2=new authRule; $table2=new authRule;
$group_id=$this->request->param('id');
$data['title']='权限分配'; $data['title']='权限分配';
// echo $group_id; // echo $group_id;
// exit; // exit;
if (IS_POST && $group_id==0) { if ($this->request->isPost()) {
//添加or修改 //添加or修改
$data['id'] = $group_id; $data['id'] = $group_id;
$menu_auth = input('post.menu_auth/a','');//获取所有授权菜单id $menu_auth = input('post.menu_auth/a','');//获取所有授权菜单id
...@@ -300,15 +302,12 @@ class Auth extends Basic ...@@ -300,15 +302,12 @@ class Auth extends Basic
} }
} }
//新增编辑权限 //新增编辑权限
public function updateAuthRule($group_id=0){ public function updateAuthRule(){
$data['status'] = 200; $group_id=$this->request->param('id');
$data['msg'] = '';
$title = $group_id ? '编辑':'新增';
$table= New AuthRule; $table= New AuthRule;
if (IS_POST && $group_id==0) { if ($this->request->isPost()) {
$data = input('post.'); $data = input('post.');
...@@ -337,7 +336,7 @@ class Auth extends Basic ...@@ -337,7 +336,7 @@ class Auth extends Basic
$join=[['auth_rule b', ' a.pid=b.id','left']]; $join=[['auth_rule b', ' a.pid=b.id','left']];
$info= $table->authRuleList2($order,$field,$join, $where); $info= $table->authRuleList2($order,$field,$join, $where);
//echo $table->getLastSql(); //echo $table->getLastSql();
return $this->response(200, $title, $info[0]); return $this->response(200, '取值', $info[0]);
} }
......
...@@ -84,7 +84,7 @@ Route::group('index', [ ...@@ -84,7 +84,7 @@ Route::group('index', [
'roleedit' => ['index/auth/roleEdit', ['method' => 'get']], //--编辑角色页面 'roleedit' => ['index/auth/roleEdit', ['method' => 'get']], //--编辑角色页面
'access' => ['index/auth/access', ['method' => 'get']], //--权限分配角色页面 'access' => ['index/auth/access', ['method' => 'get']], //--权限分配角色页面
'updateAccess' => ['index/auth/updateAccess', ['method' => 'post']], //--编辑角色权限【接口】 'updateAccess' => ['index/auth/updateAccess', ['method' => 'post']], //--编辑角色权限【接口】
'addAuth' => ['index/auth/addAuth', ['method' => 'post']], //--添加角色【接口】 'addAuth' => ['index/auth/addAuth', ['method' => ' get|post']], //--添加角色【接口】
'accessLook'=>['index/auth/accessLook', ['method' => 'post']], //--查看编辑角色权限【接口】 'accessLook'=>['index/auth/accessLook', ['method' => 'post']], //--查看编辑角色权限【接口】
'setStatus'=>['index/auth/setStatus', ['method' => 'post']], //--设置角色的状态【接口】 'setStatus'=>['index/auth/setStatus', ['method' => 'post']], //--设置角色的状态【接口】
...@@ -92,7 +92,7 @@ Route::group('index', [ ...@@ -92,7 +92,7 @@ Route::group('index', [
'authRuleIndex'=>['index/auth/authRuleIndex', ['method' => 'get']], //权限列表界面 'authRuleIndex'=>['index/auth/authRuleIndex', ['method' => 'get']], //权限列表界面
'authRuleList'=>['index/auth/authRuleList', ['method' => 'get']], //--规则列表 'authRuleList'=>['index/auth/authRuleList', ['method' => 'get']], //--规则列表
'authRuleBox'=>['index/auth/authRuleBox', ['method' => 'get']], //--编辑规则 'authRuleBox'=>['index/auth/authRuleBox', ['method' => 'get']], //--编辑规则
'updateAuthRule'=>['index/auth/updateAuthRule', ['method' => 'post']], //--编辑规则接口 'updateAuthRule'=>['index/auth/updateAuthRule', ['method' => 'get|post']], //--编辑规则接口
'authClass'=>['index/auth/authClass', ['method' => 'get']], //--规则分类列表 'authClass'=>['index/auth/authClass', ['method' => 'get']], //--规则分类列表
'agent'=>['index/agent/agent', ['method' => 'get']], //列表 'agent'=>['index/agent/agent', ['method' => 'get']], //列表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment