wupengfei před 3 roky
rodič
revize
626c36ad8e

+ 38 - 4
application/api/controller/UserCenter.php

@@ -68,7 +68,7 @@ class UserCenter extends Base
      */
     public function getUserInfo()
     {
-        $field = 'id,phone,password,name,level_id,headimg,openid,true_name,sex,invite_code,birthday,province_name,city_name,counties_name,bind_wechat,id_card,id_card,card_front,card_back,auth_at';
+        $field = 'id,phone,password,name,level_id,pay_password,headimg,openid,true_name,sex,invite_code,birthday,province_name,city_name,counties_name,bind_wechat,id_card,id_card,card_front,card_back,auth_at';
         $user_info = User::with('wallet')->field($field)->where('id',$this->user_id)->find()->toArray();
         $user_info['level_name'] = UserLevel::where('id',$user_info['level_id'])->value('name');
         $user_info['fans'] = User::where('pid',$user_info['id'])->count();
@@ -188,8 +188,8 @@ class UserCenter extends Base
     }
 
     /**
-     * @title 更换或设置密码
-     * @desc  更换或设置密码
+     * @title 更换或设置登录密码
+     * @desc  更换或设置登录密码
      * @author  qc
      * @url /api/User_center/modifyPassword
      * @method POST
@@ -211,12 +211,43 @@ class UserCenter extends Base
         if($user_info['phone'] != $phone) $this->error('与绑定手机号不一致');
         $check_code = $this->checkPhoneCode($phone,$code);
         if(!$check_code) $this->error('验证码错误');
-        $encryption_password = encryption_password($password);
+        $encryption_password = password_hash($password);
         Db::name('store_member')->where('id',$uid)->update(['password'=>$password,'encryption_password'=>$encryption_password]);
         $this->updatePhoneCode($check_code);
         $this->success('更换成功');
     }
 
+
+    /**
+     * @title 更换或设置提现密码
+     * @desc  更换或设置提现密码
+     * @author  qc
+     * @url /api/User_center/setPayPassword
+     * @method POST
+     * @header name:Authorization require:1 desc:Token
+     * @param name:phone type:int require:1 default:-- desc:手机号
+     * @param name:code type:int require:1 default:-- desc:手机号验证码
+     * @param name:pay_password type:string default:-- desc:密码
+     */
+    public function setPayPassword()
+    {
+        $uid = $this->user_id;
+        $phone = input('post.phone');
+        $code  = input('post.code');
+        $pay_password  = input('post.pay_password');
+        if(empty($phone) || empty($code) || empty($password) ) $this->error('参数错误');
+        $field = 'id,phone';
+        $user_info = Db::name('store_member')->field($field)->where('id',$this->user_id)->find();
+        if(!$user_info['phone']) $this->error('请先绑定手机号');
+        if($user_info['phone'] != $phone) $this->error('与绑定手机号不一致');
+        $check_code = $this->checkPhoneCode($phone,$code);
+        if(!$check_code) $this->error('验证码错误');;
+        Db::name('store_member')->where('id',$uid)->update(['pay_password'=>password_hash($pay_password)]);
+        $this->updatePhoneCode($check_code);
+        $this->success('更换成功');
+    }
+
+
     /**
      * @title 实名认证
      * @desc 实名认证
@@ -320,6 +351,9 @@ class UserCenter extends Base
     }
 
 
+
+
+
     /**
      * @title 更改或绑定银行卡
      * @desc 更改或绑定银行卡

+ 3 - 0
application/api/controller/WalletManage.php

@@ -55,6 +55,7 @@ class WalletManage extends Base
      * @header name:Authorization require:1 desc:Token
      * @param name:money type:float default:-- desc:提现金额
      * @param name:type type:int default:-- desc:到账类型(1支付宝,2银行卡,3微信)
+     * @param name:pay_password type:string default:-- desc:支付密码
      * @param name:bank_id type:int default:-- desc:账号id(type=2或3必传)
      */
     public function withdraw()
@@ -68,6 +69,8 @@ class WalletManage extends Base
        if($money < $min_money) $this->error('最低提现金额:'.$min_money);
        if($money > $max_money) $this->error('最大提现金额:'.$max_money);
        $user_info = User::get($this->user_id);
+       var_dump($user_info);
+       die();
        if($type == 3 && !$user_info['openid']) $this->error('请先绑定微信!');
        if(in_array($type,[1,2])) {
            $acc_info = UserWallet::where(['id'=>$bank_id,'user_id'=>$this->user_id])->find();

+ 0 - 6
application/common.php

@@ -35,12 +35,6 @@ function image_path($image_data){
     return $image_res;
 }
 
-// 密码加密
-function encryption_password($password)
-{
-    return md5($password);
-}
-
 /**
  * @param $id_card
  * @return false|string