wesmiler 1 giorno fa
parent
commit
ea53d6ef6d

+ 5 - 2
app/Http/Controllers/Admin/BalanceLogsController.php

@@ -62,8 +62,11 @@ class BalanceLogsController extends Backend
     {
         try {
             $id = request()->input('id');
-            $service = new BalanceLogsService();
-            return $service->payment($this->userId, $id);
+            if($result = BalanceLogsService::make()->payment($this->userId, $id)){
+                return message(BalanceLogsService::make()->getError(),true, $result);
+            }else{
+                return message(BalanceLogsService::make()->getError(),false);
+            }
         } catch (\Exception $exception){
             return  message('服务器错误',false,['error'=>$exception->getMessage(),'trace'=>$exception->getTrace()]);
         }

+ 2 - 4
app/Services/Common/BalanceLogsService.php

@@ -350,8 +350,7 @@ class BalanceLogsService extends BaseService
                         $wechatOpenid = isset($member['wechat_openid'])?$member['wechat_openid']: '';
                         $openid = $openid?$openid:$wechatOpenid;
                         if(empty($openid)){
-                            $this->error = '微信OPENID不为空,请确认该用户已授权登录过才可打款';
-                            return false;
+                            throw new \Exception('微信OPENID不为空,请确认该用户已授权登录过才可打款');
                         }
 
                         // 打款请求
@@ -364,8 +363,7 @@ class BalanceLogsService extends BaseService
                         ];
 
                         if(!$result = PaymentService::make()->transfer($order)){
-                            $this->error = PaymentService::make()->getError();
-                            return false;
+                            throw new \Exception(PaymentService::make()->getError());
                         }
 
                         var_dump($result);