浏览代码

用户管理

wzh 5 年之前
父节点
当前提交
51d64884f2
共有 2 个文件被更改,包括 307 次插入294 次删除
  1. 273 13
      api/application/config/response.php
  2. 34 281
      api/application/controllers/User.php

+ 273 - 13
api/application/config/response.php

@@ -1,6 +1,9 @@
 <?php
 defined('BASEPATH') OR exit('No direct script access allowed');
 
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
 //通用 0000-0099
 $config['response']['0000'] = "操作成功";
 $config['response']['0001'] = "缺少username";
@@ -13,18 +16,147 @@ $config['response']['0007'] = "缺少必要参数";
 $config['response']['0008'] = "服务器连接失败";
 $config['response']['0009'] = "数据库更新失败";
 $config['response']['0010'] = "命令下发失败";
-$config['response']['0011'] = "删除失败";
-$config['response']['0012'] = "上传失败";
-$config['response']['0013'] = "无权限";
-$config['response']['0014'] = '下发命令超时,请稍后重试!';
-$config['response']['0015'] = '上传文件过大';
-$config['response']['0016'] = '上传文件类型错误';
+$config['response']['0011'] = "无权限操作";
+$config['response']['0012'] = "找不到文件";
+$config['response']['0013'] = "无访问权限";
+$config['response']['0014'] = "参数错误";
+$config['response']['0015'] = "上传失败";
+$config['response']['0016'] = "下发命令超时,请稍后重试";
 //登录 0100-0199
 $config['response']['0100'] = '用户名或密码不能为空';
 $config['response']['0101'] = '用户名或密码错误';
 $config['response']['0102'] = '用户不存在';
-$config['response']['0103'] = '当前账号已被停用';
-$config['response']['0104'] = '用户名不能为空';
+$config['response']['0103'] = '账户已被停用,请联系管理员';
+$config['response']['0104'] = '同级用户不能修改账户状态';
+//项目 0200-0299
+$config['response']['0200'] = '项目id不能为空';
+$config['response']['0201'] = '项目编号已存在';
+$config['response']['0202'] = '该项目不存在';
+$config['response']['0203'] = '项目名称已存在';
+$config['response']['0204'] = '项目名称不能为空';
+$config['response']['0205'] = '项目编号不能为空';
+$config['response']['0206'] = '请选择区域';
+$config['response']['0207'] = '请选择省份';
+$config['response']['0208'] = '请选择时区';
+$config['response']['0209'] = '请选择公司';
+$config['response']['0210'] = '项目编号长度不能超过20位';
+$config['response']['0211'] = '项目名称长度不能超过40位';
+$config['response']['0212'] = '项目编号为数字或字母';
+$config['response']['0213'] = '命令已经下发,请稍后查看';
+//网络 0300-0399
+$config['response']['0300'] = '网络id不能为空';
+$config['response']['0301'] = '网络编号已存在';
+$config['response']['0302'] = '该网络不存在';
+$config['response']['0303'] = '网络名称已存在';
+$config['response']['0304'] = '协议类型为0-3';
+$config['response']['0305'] = '网络编号不能为空';
+$config['response']['0306'] = '网络名称不能为空';
+$config['response']['0307'] = '项目不能为空';
+$config['response']['0308'] = '请选择项目';
+$config['response']['0309'] = '网络编号为数字或字母';
+//灯控 0400-0499
+$config['response']['0400'] = '灯控id不能为空';
+$config['response']['0401'] = '灯控编号已存在';
+$config['response']['0402'] = '该灯控不存在';
+$config['response']['0403'] = '灯控名称已存在';
+$config['response']['0404'] = '无线模块地址已被使用';
+$config['response']['0405'] = '请选择网络';
+$config['response']['0406'] = '后台正在更新,请两分钟后重试';
+$config['response']['0407'] = '手动更新已经发送';
+$config['response']['0408'] = '路灯编号不能超过六位数';
+$config['response']['0409'] = '请填写路灯编号';
+$config['response']['0410'] = '路灯编号为1-999999的数字';
+$config['response']['0411'] = '请选择需要更新的路灯';
+$config['response']['0412'] = '路灯不在线';
+$config['response']['0413'] = '路灯已存在';
+$config['response']['0414'] = '无线模块地址必须为十六进制';
+$config['response']['0415'] = '协议类型选项错误';
+$config['response']['0416'] = '指令已下发,请稍后查看结果';
+$config['response']['0417'] = '获取参数信息失败,请稍后重试';
+$config['response']['0418'] = '选择日期不能超过31天';
+$config['response']['0419'] = '设备未绑定路段信息';
+$config['response']['0420'] = '只有杀虫灯设备能设置策略';
+$config['response']['0421'] = '经度范围错误';
+$config['response']['0422'] = '纬度范围错误';
+//报表 0500-0599
+$config['response']['0500'] = "type不正确";
+$config['response']['0501'] = "show_type不正确";
+$config['response']['0502'] = "缺少item_ids";
+//告警维修 0600-0699
+$config['response']['0601'] = "维修人员不存在";
+$config['response']['0602'] = "维修人员已经存在";
+$config['response']['0603'] = "请选择要删除的故障";
+$config['response']['0604'] = "请选择故障";
+$config['response']['0605'] = "维修人员id不能为空";
+$config['response']['0606'] = "维修人员名称不能为空";
+$config['response']['0607'] = "手机号码不能为空";
+$config['response']['0608'] = "请选择要删除维修人员";
+$config['response']['0609'] = "请选择要删除的记录";
+$config['response']['0610'] = "请选择维修人员";
+$config['response']['0611'] = "计划完成时间不能为空";
+$config['response']['0612'] = "开始时间不能为空";
+$config['response']['0613'] = "请选择需要维修的故障";
+$config['response']['0614'] = "请选择路灯";
+$config['response']['0615'] = "同一路灯半个小时之内只能调度一次";
+$config['response']['0616'] = "暂无数据,请在维修记录页面添加";
+$config['response']['0617'] = "维修人员id为1-999999的数字";
+//个人中心 0700-0799
+$config['response']['0701'] = "确认密码错误";
+$config['response']['0702'] = "密码错误";
+$config['response']['0703'] = "密码长度为6-12位";
+$config['response']['0704'] = "密码修改失败,请稍后重试!";
+$config['response']['0705'] = "上传失败!";
+$config['response']['0706'] = "账号已经存在";
+$config['response']['0707'] = "用户名称不能为空";
+$config['response']['0708'] = "登录账号不能为空";
+$config['response']['0709'] = "新密码与旧密码不能相同";
+$config['response']['0710'] = "请选择上一级区域";
+$config['response']['0711'] = "区域名称不能为空";
+$config['response']['0712'] = "请选择所属公司";
+$config['response']['0713'] = "请输入密码";
+$config['response']['0714'] = "姓名不能为空";
+$config['response']['0715'] = "联系方式不能为空";
+$config['response']['0716'] = "反馈内容不能为空";
+$config['response']['0717'] = "请选择权限";
+$config['response']['0718'] = "手机格式错误";
+$config['response']['0719'] = "邮箱格式错误";
+$config['response']['0720'] = "密码长度最少六位";
+$config['response']['0721'] = "手机号码已经存在";
+$config['response']['0722'] = "E-mail已经存在";
+$config['response']['0723'] = "登录账号长度不能超过20位";
+$config['response']['0724'] = "请选择用户类型";
+//监控 0800-0899
+$config['response']['0801'] = "监控名称已经存在";
+$config['response']['0802'] = "请选择路灯";
+$config['response']['0803'] = "监控名称不能为空";
+$config['response']['0804'] = "监控编号不能为空";
+$config['response']['0805'] = "无线模块地址不能为空";
+$config['response']['0806'] = "端口号不能为空";
+$config['response']['0807'] = "ip地址或域名不能为空";
+$config['response']['0808'] = "监控用户名不能为空";
+$config['response']['0809'] = "监控密码不能为空";
+$config['response']['0810'] = "请选择监控类型";
+$config['response']['0811'] = "通道不能为空";
+$config['response']['0812'] = "通道已被使用";
+$config['response']['0813'] = '监控编号为1-999999的数字';
+$config['response']['0814'] = '萤石云账号异常,请联系管理员';
+//策略分组 0900-0999
+$config['response']['0901'] = "策略名称已经存在";
+$config['response']['0902'] = "分组名称已经存在";
+$config['response']['0903'] = "缺少分组id";
+$config['response']['0904'] = "结束时间必须大于开始时间";
+$config['response']['0905'] = "结束日期必须大于开始日期";
+$config['response']['0906'] = "选择时间有重叠";
+$config['response']['0907'] = "选择日期有重叠";
+$config['response']['0908'] = "策略名称不能为空";
+$config['response']['0909'] = "策略内容不能为空";
+$config['response']['0910'] = "分组名称不能为空";
+$config['response']['0911'] = "请选择所属项目";
+$config['response']['0911'] = "请选择分组";
+$config['response']['0912'] = "请选择操作类型";
+$config['response']['0913'] = "请选择策略";
+$config['response']['0914'] = "请选择要删除的分组";
+
 
 
 // 英文版
@@ -47,11 +179,139 @@ $config['response_en']['0014'] = 'The command is timed out, please try again lat
 $config['response_en']['0015'] = 'Oversize Upload Files';
 $config['response_en']['0016'] = 'Error uploading file type';
 //登录 0100-0199
-$config['response_en']['0100'] = 'The user name or password can not be empty';
-$config['response_en']['0101'] = 'ERROR Incorrect username or password';
-$config['response_en']['0102'] = 'User does not exist';
-$config['response_en']['0103'] = 'Account disabled';
-$config['response_en']['0104'] = 'User name can not be empty';
+$config['response_en']['0100'] = '用户名或密码不能为空';
+$config['response_en']['0101'] = '用户名或密码错误';
+$config['response_en']['0102'] = '用户不存在';
+$config['response_en']['0103'] = '账户已被停用,请联系管理员';
+$config['response_en']['0104'] = '同级用户不能修改账户状态';
+//项目 0200-0299
+$config['response_en']['0200'] = '项目id不能为空';
+$config['response_en']['0201'] = '项目编号已存在';
+$config['response_en']['0202'] = '该项目不存在';
+$config['response_en']['0203'] = '项目名称已存在';
+$config['response_en']['0204'] = '项目名称不能为空';
+$config['response_en']['0205'] = '项目编号不能为空';
+$config['response_en']['0206'] = '请选择区域';
+$config['response_en']['0207'] = '请选择省份';
+$config['response_en']['0208'] = '请选择时区';
+$config['response_en']['0209'] = '请选择公司';
+$config['response_en']['0210'] = '项目编号长度不能超过20位';
+$config['response_en']['0211'] = '项目名称长度不能超过40位';
+$config['response_en']['0212'] = '项目编号为数字或字母';
+$config['response_en']['0213'] = '命令已经下发,请稍后查看';
+//网络 0300-0399
+$config['response_en']['0300'] = '网络id不能为空';
+$config['response_en']['0301'] = '网络编号已存在';
+$config['response_en']['0302'] = '该网络不存在';
+$config['response_en']['0303'] = '网络名称已存在';
+$config['response_en']['0304'] = '协议类型为0-3';
+$config['response_en']['0305'] = '网络编号不能为空';
+$config['response_en']['0306'] = '网络名称不能为空';
+$config['response_en']['0307'] = '项目不能为空';
+$config['response_en']['0308'] = '请选择项目';
+$config['response_en']['0309'] = '网络编号为数字或字母';
+//灯控 0400-0499
+$config['response_en']['0400'] = '灯控id不能为空';
+$config['response_en']['0401'] = '灯控编号已存在';
+$config['response_en']['0402'] = '该灯控不存在';
+$config['response_en']['0403'] = '灯控名称已存在';
+$config['response_en']['0404'] = '无线模块地址已被使用';
+$config['response_en']['0405'] = '请选择网络';
+$config['response_en']['0406'] = '后台正在更新,请两分钟后重试';
+$config['response_en']['0407'] = '手动更新已经发送';
+$config['response_en']['0408'] = '路灯编号不能超过六位数';
+$config['response_en']['0409'] = '请填写路灯编号';
+$config['response_en']['0410'] = '路灯编号为1-999999的数字';
+$config['response_en']['0411'] = '请选择需要更新的路灯';
+$config['response_en']['0412'] = '路灯不在线';
+$config['response_en']['0413'] = '路灯已存在';
+$config['response_en']['0414'] = '无线模块地址必须为十六进制';
+$config['response_en']['0415'] = '协议类型选项错误';
+$config['response_en']['0416'] = '指令已下发,请稍后查看结果';
+$config['response_en']['0417'] = '获取参数信息失败,请稍后重试';
+$config['response_en']['0418'] = '选择日期不能超过31天';
+$config['response_en']['0419'] = '设备未绑定路段信息';
+$config['response_en']['0420'] = '只有杀虫灯设备能设置策略';
+$config['response_en']['0421'] = '经度范围错误';
+$config['response_en']['0422'] = '纬度范围错误';
+//报表 0500-0599
+$config['response_en']['0500'] = "type不正确";
+$config['response_en']['0501'] = "show_type不正确";
+$config['response_en']['0502'] = "缺少item_ids";
+//告警维修 0600-0699
+$config['response_en']['0601'] = "维修人员不存在";
+$config['response_en']['0602'] = "维修人员已经存在";
+$config['response_en']['0603'] = "请选择要删除的故障";
+$config['response_en']['0604'] = "请选择故障";
+$config['response_en']['0605'] = "维修人员id不能为空";
+$config['response_en']['0606'] = "维修人员名称不能为空";
+$config['response_en']['0607'] = "手机号码不能为空";
+$config['response_en']['0608'] = "请选择要删除维修人员";
+$config['response_en']['0609'] = "请选择要删除的记录";
+$config['response_en']['0610'] = "请选择维修人员";
+$config['response_en']['0611'] = "计划完成时间不能为空";
+$config['response_en']['0612'] = "开始时间不能为空";
+$config['response_en']['0613'] = "请选择需要维修的故障";
+$config['response_en']['0614'] = "请选择路灯";
+$config['response_en']['0615'] = "同一路灯半个小时之内只能调度一次";
+$config['response_en']['0616'] = "暂无数据,请在维修记录页面添加";
+$config['response_en']['0617'] = "维修人员id为1-999999的数字";
+//个人中心 0700-0799
+$config['response_en']['0701'] = "确认密码错误";
+$config['response_en']['0702'] = "密码错误";
+$config['response_en']['0703'] = "密码长度为6-12位";
+$config['response_en']['0704'] = "密码修改失败,请稍后重试!";
+$config['response_en']['0705'] = "上传失败!";
+$config['response_en']['0706'] = "账号已经存在";
+$config['response_en']['0707'] = "用户名称不能为空";
+$config['response_en']['0708'] = "登录账号不能为空";
+$config['response_en']['0709'] = "新密码与旧密码不能相同";
+$config['response_en']['0710'] = "请选择上一级区域";
+$config['response_en']['0711'] = "区域名称不能为空";
+$config['response_en']['0712'] = "请选择所属公司";
+$config['response_en']['0713'] = "请输入密码";
+$config['response_en']['0714'] = "姓名不能为空";
+$config['response_en']['0715'] = "联系方式不能为空";
+$config['response_en']['0716'] = "反馈内容不能为空";
+$config['response_en']['0717'] = "请选择权限";
+$config['response_en']['0718'] = "手机格式错误";
+$config['response_en']['0719'] = "邮箱格式错误";
+$config['response_en']['0720'] = "密码长度最少六位";
+$config['response_en']['0721'] = "手机号码已经存在";
+$config['response_en']['0722'] = "E-mail已经存在";
+$config['response_en']['0723'] = "登录账号长度不能超过20位";
+$config['response_en']['0724'] = "请选择用户类型";
+//监控 0800-0899
+$config['response_en']['0801'] = "监控名称已经存在";
+$config['response_en']['0802'] = "请选择路灯";
+$config['response_en']['0803'] = "监控名称不能为空";
+$config['response_en']['0804'] = "监控编号不能为空";
+$config['response_en']['0805'] = "无线模块地址不能为空";
+$config['response_en']['0806'] = "端口号不能为空";
+$config['response_en']['0807'] = "ip地址或域名不能为空";
+$config['response_en']['0808'] = "监控用户名不能为空";
+$config['response_en']['0809'] = "监控密码不能为空";
+$config['response_en']['0810'] = "请选择监控类型";
+$config['response_en']['0811'] = "通道不能为空";
+$config['response_en']['0812'] = "通道已被使用";
+$config['response_en']['0813'] = '监控编号为1-999999的数字';
+$config['response_en']['0814'] = '萤石云账号异常,请联系管理员';
+//策略分组 0900-0999
+$config['response_en']['0901'] = "策略名称已经存在";
+$config['response_en']['0902'] = "分组名称已经存在";
+$config['response_en']['0903'] = "缺少分组id";
+$config['response_en']['0904'] = "结束时间必须大于开始时间";
+$config['response_en']['0905'] = "结束日期必须大于开始日期";
+$config['response_en']['0906'] = "选择时间有重叠";
+$config['response_en']['0907'] = "选择日期有重叠";
+$config['response_en']['0908'] = "策略名称不能为空";
+$config['response_en']['0909'] = "策略内容不能为空";
+$config['response_en']['0910'] = "分组名称不能为空";
+$config['response_en']['0911'] = "请选择所属项目";
+$config['response_en']['0911'] = "请选择分组";
+$config['response_en']['0912'] = "请选择操作类型";
+$config['response_en']['0913'] = "请选择策略";
+$config['response_en']['0914'] = "请选择要删除的分组";
 
 
 

+ 34 - 281
api/application/controllers/User.php

@@ -73,72 +73,6 @@ class User extends Base_Controller{
 		exit(json_result('0000',$this->response['0000'],$data));
 	}
 
-	// 编辑个人信息
-	public function update_user_info(){
-		$userid = $this->get_user_info('id');
-		$data['realname'] = $this->input->post('realname',true);
-		$mobile = $this->input->post('mobile',true);
-		$data['username'] = $this->input->post('name',true);
-		$telephone = $this->input->post('telephone',true);
-		$email = $this->input->post('email',true);
-		$address = $this->input->post('address',true);
-		$memo = $this->input->post('memo',true);
-		$avatar = $this->input->post('avatar',true);
-
-		if (!empty($avatar)) $data['avatar'] = $avatar;
-		if (!empty($mobile)) $data['mobile'] = $mobile;
-		if (!empty($telephone)) $data['telephone'] = $telephone;
-		if (!empty($email)) $data['email'] = $email;
-		if (!empty($address)) $data['address'] = $address;
-		if (!empty($memo)) $data['memo'] = $memo;
-
-		// 检测表单数据
-		if(empty($data['realname'])) exit(json_result('0707',$this->response['0707'],array()));
-		if(empty($data['username'])) exit(json_result('0708',$this->response['0708'],array()));
-		if(mb_strlen($data['username']) > 20) exit(json_result('0723',$this->response['0723'],array()));
-
-		// 检测登录账号是否存在
-		if ($this->User_model->getDataCount(array('username'=>$data['username']),$userid)) {
-			exit(json_result('0706',$this->response['0706'],array()));
-		}
-
-		// 验证请求数据
-		$config = array();
-		if(!empty($data['mobile'])){
-			$config[] = array(
-				        'field' => 'mobile',
-				        'label' => 'Mobile',
-				        'rules' => 'numeric|exact_length[11]',
-				        'errors' => array(
-				            'numeric' => '0718',
-				            'exact_length' => '0718'
-				        )
-				    );
-		}
-		if (!empty($data['email'])) {
-			$config[] = array(
-				        'field' => 'email',
-				        'label' => 'Email',
-				        'rules' => 'valid_email',
-				        'errors' => array(
-				            'valid_email' => '0719',
-				        )
-				    );
-		}
-		if (!empty($config)) {
-			$this->load->library('form_validation');
-			$this->form_validation->set_rules($config);
-			if ($this->form_validation->run() == FALSE){
-				$errors = $this->form_validation->error_array();
-		        exit(json_result(current($errors),$this->response[current($errors)],array()));
-		    }
-		}
-
-		$this->User_model->update_user($data,$userid);
-		$this->userinfo = $this->User_model->get_user_by_name($data['username']);
-		exit(json_result('0000',$this->response['0000'],array('id'=>$userid)));
-	}
-
 	// 修改用户密码
 	public function password(){
 		$username = $this->get_user_info('username');
@@ -177,7 +111,7 @@ class User extends Base_Controller{
 
 	// 修改账号状态
 	public function block_user(){
-		$userid = $this->input->post('userid',true);
+		$userid = $this->input->post('id',true);
 		$status = intval($this->input->post('status',true));
 		if (empty($userid) || $status < 0) {
 			exit(json_result('0007',$this->response['0007'],array()));
@@ -200,6 +134,9 @@ class User extends Base_Controller{
 		$role = intval($this->input->post('role',true));
 		if (!empty($role)) $where['role'] = $role;
 
+		$keywords = $this->input->post('keywords',true);
+		if ($keywords !== NULL && $keywords !== '') $where['name|'] = $keywords;
+
 		$field = "id,name,role,phone,email,status";
 		$list = $this->User_model->get_list($where,$field);
 		exit(json_result('0000',$this->response['0000'],array('list'=>$list)));
@@ -207,34 +144,26 @@ class User extends Base_Controller{
 
 	// 添加编辑用户
 	public function user_update(){
-		$where['id'] = $this->input->post('userid',true);
+		$where['id'] = intval($this->input->post('id',true));
 		$role = $this->get_user_info('role');
         if ($role == COMPANY_CUSTOMER) {
             exit(json_result('0011', $this->response['0011'], array()));
         }
-		$data['realname'] = $this->input->post('realname',true);
-		$data['username'] = trim($this->input->post('name',true));
-		$telephone = $this->input->post('telephone',true);
-		$mobile = $this->input->post('mobile',true);
+		$data['name'] = $this->input->post('name',true);
+		$data['username'] = trim($this->input->post('account',true));
+		$phone = $this->input->post('phone',true);
 		$data['password'] = $this->input->post('password',true);
 		$email = $this->input->post('email',true);
-		$data['companyid'] = $this->input->post('companyid',true);
-		$address = $this->input->post('address',true);
-		$memo = $this->input->post('memo',true);
-		$avatar = $this->input->post('avatar',true);
-		$data['zone'] = $this->input->post('zone',true);
+		$data['company'] = $this->input->post('company',true);
 		
-		if (!empty($avatar)) $data['avatar'] = $avatar;
-		if (!empty($mobile)) $data['mobile'] = $mobile;
+		if (!empty($phone)) $data['phone'] = $phone;
 		if (!empty($telephone)) $data['telephone'] = $telephone;
 		if (!empty($email)) $data['email'] = $email;
-		if (!empty($address)) $data['address'] = $address;
-		if (!empty($memo)) $data['memo'] = $memo;
 		
-		if(!isset($data['realname']) || isset($data['realname']) == '') exit(json_result('0707',$this->response['0707'],array()));
+		if(!isset($data['name']) || isset($data['name']) == '') exit(json_result('0707',$this->response['0707'],array()));
 		if(!isset($data['username']) || $data['username'] == '') exit(json_result('0708',$this->response['0708'],array()));
 		if(mb_strlen($data['username']) > 20) exit(json_result('0723',$this->response['0723'],array()));
-		if(empty($data['companyid'])) exit(json_result('0712',$this->response['0712'],array()));
+		if(empty($data['company'])) exit(json_result('0712',$this->response['0712'],array()));
 
 		// $data['zone'] = empty($zone) ? '' : $zone;
 		// 验证请求数据
@@ -247,10 +176,10 @@ class User extends Base_Controller{
 		            'min_length' => '0720',
 		        )
 		    );
-		if(!empty($data['mobile'])){
+		if(!empty($data['phone'])){
 			$config[] = array(
-				        'field' => 'mobile',
-				        'label' => 'Mobile',
+				        'field' => 'phone',
+				        'label' => 'Phone',
 				        'rules' => 'numeric|exact_length[11]',
 				        'errors' => array(
 				            'numeric' => '0718',
@@ -286,44 +215,30 @@ class User extends Base_Controller{
 			if ($this->User_model->getDataCount(array('username'=>$data['username']))) {
 				exit(json_result('0706',$this->response['0706'],array()));
 			}
-			if (!empty($data['mobile']) && $this->User_model->getDataCount(array('mobile'=>$data['mobile']))) {
+			if (!empty($data['phone']) && $this->User_model->getDataCount(array('phone'=>$data['phone']))) {
                 exit(json_result('0721',$this->response['0721'],array()));
             }
             if (!empty($data['email']) && $this->User_model->getDataCount(array('email'=>$data['email']))) {
                 exit(json_result('0722',$this->response['0722'],array()));
             }
 			
-			$data['avatar'] = empty($data['avatar']) ? 'assets/avatars/user.png' : $data['avatar'];
-			$data['parentid'] = $this->get_user_info('id');
-			$data['role'] = $role == 1 ? 2 : 3;
-			$data['privilege'] = $this->Privilnode_model->get_default_privilege($data['role']);
-			if (empty($data['zone']) && $data['role'] == 2) {
-				$projectids = $this->Project_model->get_project_ids(array('company'=>$data['companyid']));
-				$data['zone'] = !empty($projectids) ? implode(',', $projectids) : '';
-			}
+			$data['pid'] = $this->get_user_info('id');
+			$data['role'] = intval($this->input->post('role'));
+
+			if (empty($data['role'])) exit(json_result('0724',$this->response['0724']));
+
 
 			$userid = $this->User_model->add_user($data);
 
-			$this->add_operation_log('insert',"添加用户,用户名\"{$data['realname']}\"",0);
-			$this->add_operation_log('insert',"Add user.User name:\"{$data['realname']}\"",0,1);
+			$this->add_operation_log('insert',"添加用户,用户名\"{$data['name']}\"",0);
+			$this->add_operation_log('insert',"Add user.User name:\"{$data['name']}\"",0,1);
 		}else{  // 编辑用户
-			if (empty($data['password'])) {
-				unset($data['password']);
-			}else  {
-				$data['password'] = md5($data['password']);
-			}
-			$res = $this->User_model->getOne($where['id'],'role,companyid');
-			if (intval($role) >= intval($res['role'])) {
-				exit(json_result('0011',$this->response['0011'],array()));
-			}
-			if ($data['companyid'] != $res['companyid'] && empty($data['zone']) && $res['role'] == 2) {
-				$projectids = $this->Project_model->get_project_ids(array('company'=>$data['companyid']));
-				$data['zone'] = !empty($projectids) ? implode(',', $projectids) : 0;
-			}
+			unset($data['password']);
+
 			if ($this->User_model->getDataCount(array('username'=>$data['username']),$where['id'])) {
 				exit(json_result('0706',$this->response['0706'],array()));
 			}
-			if (!empty($data['mobile']) && $this->User_model->getDataCount(array('mobile'=>$data['mobile']),$where['id'])) {
+			if (!empty($data['phone']) && $this->User_model->getDataCount(array('phone'=>$data['phone']),$where['id'])) {
                 exit(json_result('0721',$this->response['0721'],array()));
             }
             if (!empty($data['email']) && $this->User_model->getDataCount(array('email'=>$data['email']),$where['id'])) {
@@ -333,185 +248,23 @@ class User extends Base_Controller{
 			$this->User_model->update_user($data,$where['id']);
 
 			$userid = $where['id'];
-			$this->add_operation_log('update',"修改用户,用户名\"{$data['realname']}\"",0);
-			$this->add_operation_log('update',"Update user.User name:\"{$data['realname']}\"",0,1);
+			$this->add_operation_log('update',"修改用户,用户名\"{$data['name']}\"",0);
+			$this->add_operation_log('update',"Update user.User name:\"{$data['name']}\"",0,1);
 		}
 
 		exit(json_result('0000',$this->response['0000'],array('id'=>$userid)));
 	}
 
-	// 获取用户权限列表
-	public function privilege_list(){
-		$userid = $this->input->post('userid',true);
-
-		if (empty($userid)) {
-			exit(json_result('0007',$this->response['0007'],array()));
-		}
-
-		$version = $this->session->userdata('version');
-		$userData = $this->User_model->getOne($userid,'role');
-
-		$privilege_list = $this->Privilnode_model->get_all_privilnode(SYSTEM_ADMIN);
-		// 选中用户拥有的权限
-		if (!empty($userid)) {
-			$data = $this->User_model->getOne($userid,'privilege');
-			$privilegeArr = explode(',', $data['privilege']);
-
-			foreach ($privilege_list as &$v) {
-				if (!empty($version)) {
-					$v['name'] = $v['en_name'];
-				}
-				if ($userData['role'] == SYSTEM_ADMIN || in_array($v['id'], $privilegeArr)) {
-					$v['select'] = 1;
-				}else{
-					$v['select'] = 0;
-				}
-			}
-		}
-
-		// 权限分级
-		$res = list_to_tree($privilege_list, $pk='id', $pid = 'parentid', $child = 'sub_list', $root = 0);
-		exit(json_result('0000',$this->response['0000'],array('list'=>$res)));
-	}
-
-	// 修改用户权限
-	public function save_user_privilege(){
-		$role = $this->get_user_info('role');
-        // if ($role == COMPANY_CUSTOMER) {
-        //     exit(json_result('0011', $this->response['0011'], array()));
-        // }
-        
-		$privilegeIds = $this->input->post('privilegeIds',true);
-		$userid = $this->input->post('userid',true);
-
-		$res = $this->User_model->getOne($userid);
-		// 判断用户权限
-		if ($role >= $res['role']) {
-			exit(json_result('0011',$this->response['0011'],array()));
-		}
-
-		// 参数判断
-		if (empty($privilegeIds) || empty($userid)) {
-			json_result('0000',$this->response['0000'],array());
-		}
-
-		$this->User_model->change_privilege($privilegeIds,$userid);
-		$this->add_operation_log('update','修改用户权限 id:'.$userid,0);
-		$this->add_operation_log('update','Update user rights.User ID:'.$userid,0,1);
-
-		exit(json_result('0000',$this->response['0000'],array()));
-	}
-
-	// 用户反馈
-	public function feedback(){
-		$data['username'] = $this->input->post('name',true);
-		$data['mobile'] = $this->input->post('mobile',true);
-		$data['detail'] = $this->input->post('detail',true);
-
-		if(empty($data['username'])) exit(json_result('0714',$this->response['0714'],array()));
-		if(empty($data['mobile'])) exit(json_result('0715',$this->response['0715'],array()));
-		if(empty($data['detail'])) exit(json_result('0716',$this->response['0716'],array()));
-		$data['feedtime'] = date('Y-m-d H:i:s');
+	// 删除账户
+	public function del(){
+		$id = intval($this->input->post('id',true));
 
-		$res = $this->Feedback_model->insert($data);
+		if (empty($id)) exit(json_result('0007',$this->response['0007']));
 
-		exit(json_result('0000',$this->response['0000'],array('id'=>$res)));
-	}
+		$this->User_model->delete(['id'=>$id]);
 
-	// 获取项目权限列表
-	public function get_porject_list(){
-		$userid = intval($this->input->post('userid',true));
-		$companyid = intval($this->input->post('companyid',true));
-		$zoneId = intval($this->input->post('zoneid',true));
-		$countryId = intval($this->input->post('countryId',true));
-		$provinceId = intval($this->input->post('provinceId',true));
-		$cityId = intval($this->input->post('cityId',true));
-		$areaId = intval($this->input->post('areaId',true));
-
-		$idArr = array();
-		if (!empty($areaId)) {
-			$idArr = array($areaId);
-		}elseif (!empty($cityId)) {
-			$res1 = $this->db->query('select id from global_location where pid = '.$cityId)->result_array();
-			if (empty($res1)) {
-				$idArr = array($cityId);
-			}else{
-				$idArr = array_column($res1, 'id');
-			}	
-		}elseif (!empty($provinceId)) {
-			$res1 = $this->db->query('select id from global_location where pid = '.$provinceId)->result_array();
-			if (empty($res1)) {
-				$idArr = array($provinceId);
-			}else{
-				$idStr1 = implode(',', array_column($res1, 'id'));
-				$res2 = $this->db->query('select id from global_location where pid in ('.$idStr1.')')->result_array();
-				if (empty($res2)) {
-					$idArr = array_column($res1, 'id');
-				}else{
-					$idArr = array_column($res2, 'id');
-				}
-			}
-		}elseif (!empty($countryId)) {
-			$res1 = $this->db->query('select id from global_location where pid = '.$countryId)->result_array();
-			if (empty($res1)) {
-				$idArr = array($countryId);
-			}else{
-				$idStr1 = implode(',', array_column($res1, 'id'));
-				$res2 = $this->db->query('select id from global_location where pid in ('.$idStr1.')')->result_array();
-				if (empty($res2)) {
-					$idArr = array_column($res1, 'id');
-				}else{
-					$idStr2 = implode(',', array_column($res1, 'id'));
-					$res3 = $this->db->query('select id from global_location where pid in ('.$idStr2.')')->result_array();
-					if (empty($res3)) {
-						$idArr = array_column($res2, 'id');
-					}else{
-						$idArr = array_column($res3, 'id');
-					}
-				}
-			}
-		}
-		$where = array();
-		if (!empty($companyid)) {
-			$where['company'] = $companyid;
-		}
-		if (!empty($idArr)) {
-			$where['cityid'] = $idArr;
-		}
-		$projectList = $this->Project_model->get_list($where, 'id,projectname as name',NULL, NULL, 'id desc');
-		$userData = $this->User_model->getOne($userid,'zone,role');
-		$hasArr = empty($userData['zone']) ? [] : array_unique(explode(',', $userData['zone']));
-		foreach ($projectList as &$p) {
-			if ($userData['role'] == SYSTEM_ADMIN || in_array($p['id'], $hasArr)) {
-				$p['select'] = 1;
-			}else{
-				$p['select'] = 0;
-			}
-		}
-		
-		exit(json_result('0000',$this->response['0000'],array('projects'=>$projectList)));
+		exit(json_result('0000',$this->response['0000']));
 	}
 
-	// 修改用户项目权限
-	public function save_user_project(){
-		$projects = $this->input->post('projects',true);
-		$userid = intval($this->input->post('userid'));
-		$role = $this->get_user_info('role');
-		if ($userid <= 0) {
-			exit(json_result('0007',$this->response['0007'],array()));
-		}
-
-		if(empty($projects)) exit(json_result('0717',$this->response['0717'],array()));
-
-		$res = $this->User_model->getOne($userid);
-		// 判断用户权限
-		if ($role >= $res['role']) {
-			exit(json_result('0011',$this->response['0011'],array()));
-		}
-
-		$this->User_model->update_user(array('zone'=>$projects),$userid);
-
-		exit(json_result('0000',$this->response['0000'],array()));
-	}
 }
 ?>