Procházet zdrojové kódy

师傅端,用户

lizhen_gitee před 8 měsíci
rodič
revize
b928b7f28a

+ 5 - 21
application/api/controller/worker/User.php

@@ -21,7 +21,7 @@ class User extends Apiw
 
 
     //用户详细资料
-    public function userInfo(){
+    public function getuserinfo(){
         $info = $this->auth->getUserinfo();
 
         $this->success(__('success'),$info);
@@ -101,15 +101,11 @@ class User extends Apiw
     public function profile()
     {
         $field_array = [
-            'realname',
-            'idcard',
-            'english_status',
             'idcard_z_image',
             'idcard_f_image',
-            'doctor_image',
+            'jineng_image',
 
-            'avatar','nickname','gender',
-            'keshi_id','hospital','goodat','level_id','info','job_status'
+            'avatar',
         ];
 
         $data = [];
@@ -132,22 +128,10 @@ class User extends Apiw
             $data[$field] = $newone;
         }
 
-        //
-        /*if(isset($data['birthday'])){
-            $data['birthday'] = strtotime($data['birthday']);
-        }*/
-
         if(empty($data)){
             $this->success();
         }
 
-        if(isset($data['realname']) && isset($data['idcard']) && isset($data['idcard_z_image']) && isset($data['idcard_f_image'])){
-            $data['idcard_status'] = 0;
-        }
-        if(isset($data['doctor_image'])){
-            $data['doctor_status'] = 0;
-        }
-
         $update_rs = Db::name('worker')->where('id',$this->auth->id)->update($data);
 
         $this->success();
@@ -184,7 +168,7 @@ class User extends Apiw
         }
         $ret = $this->auth->login($mobile, $password);
         if ($ret) {
-            $data = $this->auth->getUserinfo();
+            $data = $this->auth->getUserinfo_simple();
             $this->success(__('Logged in successful'), $data);
         } else {
             $this->error($this->auth->getError());
@@ -226,7 +210,7 @@ class User extends Apiw
         }
 
         if ($ret) {
-            $this->success(__('Reset password successful'));
+            $this->success();
         } else {
             $this->error($this->auth->getError());
         }

+ 0 - 0
application/api/lang/worker/common.php → application/api/lang/zh-cn/worker/common.php


+ 0 - 0
application/api/lang/worker/user.php → application/api/lang/zh-cn/worker/user.php


+ 10 - 15
application/common/library/Authworker.php

@@ -26,7 +26,7 @@ class Authworker
     protected $config = [];
     protected $options = [];
     protected $allowFields = [
-        'id',  'truename', 'avatar', 'gonghao','mobile',
+        'id',  'truename', 'avatar', 'gonghao','mobile','idcard_z_image','idcard_f_image','jineng_image'
     ];
 
 
@@ -174,7 +174,6 @@ class Authworker
         $params = array_merge($data, [
 //            'nickname'  => preg_match("/^1[3-9]{1}\d{9}$/", $username) ? substr_replace($username, '****', 3, 4) : $username,
             'nickname'  => get_rand_nick_name(),
-//            'salt'      => Random::alnum(),
 //            'jointime'  => $time,
 //            'joinip'    => $ip,
 //            'logintime' => $time,
@@ -182,7 +181,7 @@ class Authworker
 //            'prevtime'  => $time,
             'status'    => 1
         ]);
-//        $params['password'] = $this->getEncryptPassword($password, $params['salt']);
+//        $params['password'] = $password;
         $params = array_merge($params, $extend);
 
         //账号注册时需要开启事务,避免出现垃圾数据
@@ -265,7 +264,7 @@ class Authworker
             $this->setError('Account is locked');
             return false;
         }
-        if ($user->password != $this->getEncryptPassword($password, $user->salt)) {
+        if ($user->password != $this->getEncryptPassword($password)) {
             $this->setError('Password is incorrect');
             return false;
         }
@@ -308,11 +307,11 @@ class Authworker
             return false;
         }
         //判断旧密码是否正确
-        if ($this->_user->password == $this->getEncryptPassword($oldpassword, $this->_user->salt) || $ignoreoldpassword) {
+        if ($this->_user->password == $this->getEncryptPassword($oldpassword) || $ignoreoldpassword) {
             Db::startTrans();
             try {
                 $salt = Random::alnum();
-                $newpassword = $this->getEncryptPassword($newpassword, $salt);
+                $newpassword = $this->getEncryptPassword($newpassword);
                 $this->_user->save(['password' => $newpassword]);
 
                 Tokenworker::delete($this->_token);
@@ -400,10 +399,6 @@ class Authworker
     public function getUserinfo_simple(){
         $userinfo = Tokenworker::get($this->_token);
 
-        //是否完成用户资料
-        $data = $this->_user->toArray();
-
-
         return $userinfo;
     }
 
@@ -419,9 +414,9 @@ class Authworker
 
         //追加
         $userinfo['avatar'] = one_domain_image($userinfo['avatar']);
-
-
-
+        $userinfo['idcard_z_image'] = one_domain_image($userinfo['idcard_z_image']);
+        $userinfo['idcard_f_image'] = one_domain_image($userinfo['idcard_f_image']);
+        $userinfo['jineng_image'] = one_domain_image($userinfo['jineng_image']);
 
         return $userinfo;
     }
@@ -472,10 +467,10 @@ class Authworker
      * @param string $salt     密码盐
      * @return string
      */
-    public function getEncryptPassword($password, $salt = '')
+    public function getEncryptPassword($password)
     {
         return $password;
-        return md5(md5($password) . $salt);
+//        return md5(md5($password) . $salt);
     }
 
     /**