wzh 5 سال پیش
والد
کامیت
27d7a0db04
2فایلهای تغییر یافته به همراه3 افزوده شده و 2 حذف شده
  1. 2 1
      api/application/controllers/Base_Controller.php
  2. 1 1
      api/application/controllers/Common.php

+ 2 - 1
api/application/controllers/Base_Controller.php

@@ -25,12 +25,13 @@ class Base_Controller extends CI_Controller {
         $token = $this->input->post('token',true);
         $client_key = $this->input->post('client_key',true);
         $os = intval($this->input->post('os',true));
+        $role = intval($this->input->post('role',true));
 
         if(empty($username)){
             exit(json_result('0001', $this->response['0001']));
         }
 
-        $userinfo = $this->User_model->get_one(array('username'=>$username));
+        $userinfo = $this->User_model->get_one(array('username'=>$username,'role'=>$role));
         if(empty($userinfo)){
             exit(json_result('0102', $this->response['0102']));
         }

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

@@ -24,7 +24,7 @@ class Common extends CI_Controller {
         if(empty($username) || empty($password)) exit(json_result('0100', $this->response['0100']));
         $password = md5($password);
 
-        $user = $this->User_model->get_one(array('username'=>$username));
+        $user = $this->User_model->get_one(array('username'=>$username,'role'=>$role));
         if(!empty($user)) {
             if ($user['password'] != $password) {
                 exit(json_result('0101', $this->response['0101']));