ソースを参照

修复撤销出金接口

Robin 6 年 前
コミット
5d0ba9965c
1 ファイル変更29 行追加22 行削除
  1. 29 22
      normandcrm/service/backend/controllers/WithdrawController.php

+ 29 - 22
normandcrm/service/backend/controllers/WithdrawController.php

@@ -370,30 +370,37 @@ class WithdrawController extends BaseController
 
         if($res){
             //调用mt4的撤销出金接口
-             $api = new Mt4ManagerApi();
-             $result = $api->revokeOrder($mt4_id);
-             $result = json_decode($result,true);
-             $tt = print_r($result,true);
-             file_put_contents('mt1.txt',$tt);
-             if(!$result['ret']){
-                 $result2 = $api->fixbalance($login);
-                 $res2 = json_decode($result2,true);
-                 $tt = print_r($res2,true);
-                 file_put_contents('mt2.txt',$tt);
-                 if(!$res2['ret']){
-                     $res3 = Withdraw::updateAll(['mt4_status' => 0], "id = $id");    //更新出金表的状态(mt4未扣减)
-                     if($res3){
-                         return $this->outJson(1, [], '操作成功');
-                     }else{
-                         return $this->outJson(0, [], 'fixbalance失败');
-                     }
-                 }
-             }else{
-                 return $this->outJson(0, [], 'mt4操作失败');
-             }
+            $api = new Mt4ManagerApi();
+            $result = $api->revokeOrder($mt4_id);
+            if(empty($result)){
+                return $this->outJson(0, [], '更新失败');
+            }
+            $result = json_decode($result,true);
+            $tt = print_r($result,true);
+            file_put_contents('mt1.txt',$tt);
+            if(!$result['ret']){
+                $result2 = $api->fixbalance($login);
+                if(empty($result2)){
+                    return $this->outJson(0, [], '更新失败');
+                }
+                $res2 = json_decode($result2,true);
+                $tt = print_r($res2,true);
+                file_put_contents('mt2.txt',$tt);
+                if(!$res2['ret']){
+                    $res3 = Withdraw::updateAll(['mt4_status' => 0], "id = $id");    //更新出金表的状态(mt4未扣减)
+                    if($res3){
+                        return $this->outJson(1, [], '操作成功');
+                    }else{
+                        return $this->outJson(0, [], '更新失败');
+                    }
+                }
+            }else{
+                return $this->outJson(0, [], '更新失败');
+            }
 
         }else{
-            return $this->outJson(0, [], '更新操作失败');
+            return $this->outJson(0, [], '更新失败');
+            return $this->outJson(0, [], '更新失败');
         }
     }