Browse Source

提现新增微信方式

lizhen_gitee 1 year ago
parent
commit
578450b3da
1 changed files with 28 additions and 5 deletions
  1. 28 5
      application/api/controller/Takecash.php

+ 28 - 5
application/api/controller/Takecash.php

@@ -45,6 +45,10 @@ class Takecash extends Api
             $this->error('请选择或填写金额');
         }
 
+        if (!in_array($type,[1,2,3])) {
+            $this->error('未知的提现类型');
+        }
+
         if(!$this->user_auth_limit()){
             $this->error('请先完成实名认证');
         }
@@ -86,10 +90,21 @@ class Takecash extends Api
             $this->error('提现金额不能大于可提现余额');
         }
 
-        $table_name = $type == 1 ? 'user_alipay' : 'user_bank';
-        $account_json = Db::name($table_name)->where('user_id',$this->auth->id)->find();
-        if(empty($account_json)){
-            $this->error('未绑定对应的提现账号');
+        if($type == 1){
+            $table_name = 'user_alipay';
+            $account_json = Db::name($table_name)->where('user_id',$this->auth->id)->find();
+            if(empty($account_json)){
+                $this->error('未绑定对应的提现账号');
+            }
+        }elseif($type == 2){
+            $table_name = 'user_bank';
+            $account_json = Db::name($table_name)->where('user_id',$this->auth->id)->find();
+            if(empty($account_json)){
+                $this->error('未绑定对应的提现账号');
+            }
+        }else{
+            //微信支付
+            $account_json = [];
         }
 
         $plat_bilv = config('site.withdrawal_plat_bili');
@@ -129,7 +144,15 @@ class Takecash extends Api
     public function take_cash_log(){
         $list = Db::name('take_cash')->field('id,money,type,createtime')->where(['user_id'=>$this->auth->id])->autopage()->select();
         foreach($list as $key => &$val){
-            $val['remark'] = $val['type'] == 1 ? '支付宝提现' : '银行卡提现';
+            $val['remark'] = '';
+
+            if($val['type'] == 1){
+                $val['remark'] = '支付宝提现';
+            }elseif($val['type'] == 2){
+                $val['remark'] = '银行卡提现';
+            }else{
+                $val['remark'] = '微信提现';
+            }
         }
 
         $this->success('success',$list);