xieruidong 2 years ago
parent
commit
cdbd260229

+ 4 - 0
application/common/command/TakeCashQueryCommand.php

@@ -1,6 +1,7 @@
 <?php
 namespace app\common\command;
 
+use app\common\model\MoneyLog;
 use app\common\model\TakeCash;
 use app\common\model\User;
 use app\service\WechatTransferSvc;
@@ -30,6 +31,9 @@ class TakeCashQueryCommand extends Command{
                 if(in_array($data['detail_status'],['SUCCESS','PROCESSING'])){
                     $cash['check_status']=$data['detail_status']=='SUCCESS'?1:2;
                     $cash['check_data']=$data['fail_reason']??json_encode($data,256);
+                    if($cash['check_status']==2){
+                        User::money($this['amount'],$cash['user_id'],MoneyLog::TYPE_TAKECASH_REJECT,'提现打款失败');
+                    }
                     $cash->save();
                 }
                 Db::commit();

+ 1 - 0
application/common/model/TakeCash.php

@@ -51,6 +51,7 @@ class TakeCash extends Model
             //(new PayUserWechat())->payment($this['amount'],$user,MoneyLog::TYPE_TAKECASH,'提现',[],false);
             $this['order_no']=session_create_id();
             $this['detail_no']=session_create_id();
+            $this['check_status']=0;
             $pay=new WechatTransferSvc();
             list($response)=$pay->transfer($user['openid'],$this['order_no'],$this['detail_no'],$this['amount']);
             $this['response']=$response;