wzh 5 năm trước cách đây
mục cha
commit
3942672d43

+ 1 - 0
api/application/controllers/Common.php

@@ -16,6 +16,7 @@ class Common extends CI_Controller {
         $username = $this->input->post('username',true);
         $password = $this->input->post('password',true);
         $client_key = $this->input->post('client_key',true);
+        $role = $this->input->post('role',true);
         $code = $this->input->post('code',true);
         $os = intval($this->input->post('os',true));
 

+ 3 - 3
api/application/controllers/User.php

@@ -179,6 +179,7 @@ class User extends Base_Controller{
 		
 		$email = $this->input->post('email',true);
 		$data['company'] = $this->input->post('company',true);
+		$data['role'] = intval($this->input->post('role'));
 		$avatar = $this->input->post('avatar',true);
 		if (isset($avatar) && !empty($avatar)) {
             $path = parse_url($avatar);
@@ -248,7 +249,7 @@ class User extends Base_Controller{
 			$data['privilege'] = $privilegeIds;
 
 			// 验证登录账号是否存在
-			if ($this->User_model->getDataCount(array('username'=>$data['username']))) {
+			if ($this->User_model->getDataCount(array('username'=>$data['username'],'role'=>$data['role']))) {
 				exit(json_result('0706',$this->response['0706'],array()));
 			}
 			if (!empty($data['phone']) && $this->User_model->getDataCount(array('phone'=>$data['phone']))) {
@@ -259,7 +260,6 @@ class User extends Base_Controller{
             }
 			
 			$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']));
 
@@ -297,7 +297,7 @@ class User extends Base_Controller{
 
             $privilegeIds = $this->input->post('privilegeIds',true);
 			if ($privilegeIds !== NULL && $privilegeIds !== '') $data['privilege'] = $privilegeIds;
-			$data['role'] = intval($this->input->post('role'));
+			
 
 			if (empty($data['role'])) exit(json_result('0724',$this->response['0724']));