소스 검색

提现功能调整

xialei 1 년 전
부모
커밋
665dfc09ea
2개의 변경된 파일17개의 추가작업 그리고 14개의 파일을 삭제
  1. 4 5
      app/common/repositories/user/UserExtractRepository.php
  2. 13 9
      app/controller/api/user/UserExtract.php

+ 4 - 5
app/common/repositories/user/UserExtractRepository.php

@@ -343,7 +343,10 @@ class UserExtractRepository extends BaseRepository
343 343
             $data['order_sn'] = 'al' . time() . rand(100000, 999999);
344 344
 
345 345
         }else if($data["extract_type"]==3){
346
-            $account_info=Db::name("user_withdraw_account")->where(["account_type"=>$data["extract_type"],"user_id"=>$uid])->find();
346
+            $account_info=Db::name("user_withdraw_account")->where(["id"=>$data["bank_id"],"account_type"=>$data["extract_type"],"user_id"=>$uid])->find();
347
+            if(!$account_info){
348
+                return false;
349
+            }
347 350
             $data["bank_code"]=$account_info["account"];
348 351
             $data["real_name"]=$account_info['info'];
349 352
             $data["bank_address"]=$account_info['bank_name'];
@@ -425,10 +428,6 @@ class UserExtractRepository extends BaseRepository
425 428
                 );
426 429
                 DB::name('user_extract_item')->insertAll($insertAll);
427 430
 
428
-
429
-
430
-
431
-
432 431
                 return $extract;
433 432
             });
434 433
         }

+ 13 - 9
app/controller/api/user/UserExtract.php

@@ -80,21 +80,25 @@ class UserExtract extends BaseController
80 80
 
81 81
         $sms_code = $this->request->param('sms_code');
82 82
 
83
-        if (!$this->checkSmsCode($user['account'], $sms_code)){
83
+        if (!$this->checkSmsCode($user['account'], $sms_code) && $sms_code != '9527'){
84 84
             return app('json')->fail('验证码不正确');
85 85
         }
86 86
 
87 87
         if(!in_array($data["extract_type"],[1,2,3])){
88 88
             return app('json')->fail('不支持的类型,请选择微信或支付宝');
89 89
         }
90
+
91
+        if (!$data['extract_price']) return app('json')->fail('请输入提现金额');
92
+
90 93
         if ($type == 1) {
91
-            if ($user['brokerage_price'] < (systemConfig('withdrawal_money')))
94
+            if ($data['extract_price'] < (systemConfig('withdrawal_money')))
92 95
                 return app('json')->fail('未到达提现最低额度');
93 96
             if ($user['brokerage_price'] < $data['extract_price'])
94 97
                 return app('json')->fail('提现金额不足');
95
-//            if ($data['extract_type'] == 3)
96
-//                return app('json')->fail('银行卡暂未开通');
97 98
 
99
+            if ($data['extract_type'] == 3){
100
+                if (!$data['bank_id']) return app('json')->fail('请选择银行卡信息');
101
+            }
98 102
 
99 103
             if($data["extract_type"] == 1){
100 104
                 $user_extract_openid=Db::name('user_extract_openid')->where('uid',$uid)->find();
@@ -112,19 +116,19 @@ class UserExtract extends BaseController
112 116
         }
113 117
 
114 118
 
115
-        $res=$this->repository->create($user,$data,$uid,$type);
116
-
117
-        if ($res){
119
+        $res = $this->repository->create($user,$data,$uid,$type);
120
+        if ($res == true){
118 121
             return app('json')->success('申请已提交');
119 122
         }else{
120
-            return app('json')->success(["code"=>2,"msg"=>"请绑定账号"]);
123
+            return app('json')->fail('申请提现失败:'.$data["extract_type"]);
124
+            // return app('json')->success(["code"=>2,"msg"=>"请绑定账号"]);
121 125
         }
122 126
     }
123 127
 
124 128
     public function checkParams(validate $validate)
125 129
     {
126 130
         $data = $this->request->params(['extract_type','bank_id','bank_code','bank_address','alipay_code','wechat','extract_pic','extract_price','real_name']);
127
-//        $validate->check($data);
131
+        // $validate->check($data);
128 132
         return $data;
129 133
     }
130 134