wzh 5 år sedan
förälder
incheckning
9bfe5fd544
1 ändrade filer med 8 tillägg och 5 borttagningar
  1. 8 5
      api/application/controllers/User.php

+ 8 - 5
api/application/controllers/User.php

@@ -169,17 +169,17 @@ class User extends Base_Controller{
 	// 添加编辑用户
 	public function user_update(){
 		$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()));
-        }
+		// $role = $this->get_user_info('role');
+        // if ($role == COMPANY_CUSTOMER) {
+        //     exit(json_result('0011', $this->response['0011'], array()));
+        // }
 		$data['name'] = $this->input->post('name',true);
 		
 		$phone = $this->input->post('phone',true);
 		
 		$email = $this->input->post('email',true);
 		$data['company'] = $this->input->post('company',true);
-		$data['role'] = intval($this->input->post('roleType'));
+		// $data['role'] = intval($this->input->post('roleType'));
 		$avatar = $this->input->post('avatar',true);
 		if (isset($avatar) && !empty($avatar)) {
             $path = parse_url($avatar);
@@ -192,7 +192,10 @@ class User extends Base_Controller{
 		
 		if(!isset($data['name']) || isset($data['name']) == '') exit(json_result('0707',$this->response['0707'],array()));
 		if(empty($data['company'])) exit(json_result('0712',$this->response['0712'],array()));
+		$res = $this->Company_model->get_one(['id'=>$$data['company']],'type');
 
+		if (empty($res) || empty($res['type'])) exit(json_result('0007',$this->response['0007']));
+		$data['role'] = $res['type'];
 		// $data['zone'] = empty($zone) ? '' : $zone;
 		// 验证请求数据
 		$config = array();