Преглед изворни кода

Merge branch 'master' of http://git.bocai108.com:10180/aqm/sports_admin

Jonlin пре 6 година
родитељ
комит
dc7db6018a
1 измењених фајлова са 11 додато и 6 уклоњено
  1. 11 6
      app/Lib/Settlement/SettlementOrder.php

+ 11 - 6
app/Lib/Settlement/SettlementOrder.php

@@ -29,6 +29,7 @@ class SettlementOrder extends SettlementBase
     private $SN = 0;    //结算批次号
     private $hissettlementDetail = [];
     private $set_type = 0;
+    private $change_status = 1;
 
 
     //返回数据
@@ -43,9 +44,11 @@ class SettlementOrder extends SettlementBase
 
 
     ///$order_ids 某场比塞全部订单数组, $bettype=2 订单类型: 1单式  2串式(默认),    $settype = 1 结算次数:1首次(默认)  2非首次或重结算
-    public function reSettlement($order_ids, $bettype = 2, $settype = 1, $game_code = 0, $match_id = 0)
+    /// $change_status 对单个订单结算时,是否改赛事状态和比赛结果状态  1要改  0不改
+    public function reSettlement($order_ids, $bettype = 2, $settype = 1, $game_code = 0, $match_id = 0, $change_status = 1)
     {
         $order_ids = array_unique($order_ids);
+        $this->change_status = $change_status;
 
         if (intval($match_id) <= 0) {
             return self::makeData(8, 'matchid不能为空或0!');
@@ -64,7 +67,7 @@ class SettlementOrder extends SettlementBase
         if (empty($order_ids)) {
             $needs_matchs = DB::table('money_buy_match')->where(['game_code' => $game_code, 'match_id' => $match_id])->get();
             if (count($needs_matchs) <= 0) {
-                $this->cgStatus($game_code, $match_id);
+                $this->cgStatus($game_code, $match_id, $this->change_status);
                 return self::makeData();
             } else {
                 return self::makeData(5, '订单号不能为空');
@@ -100,7 +103,7 @@ class SettlementOrder extends SettlementBase
                 }
             }
 
-            $this->cgStatus($game_code, $match_id);
+            $this->cgStatus($game_code, $match_id, $this->change_status);
 
 
             DB::commit();
@@ -416,10 +419,12 @@ class SettlementOrder extends SettlementBase
         return true;
     }
 
-    private function cgStatus($game_code, $match_id)
+    private function cgStatus($game_code, $match_id, $change_status)
     {
-        DB::table("st_" . $game_code . "_result")->where(['match_id' => $match_id])->update(['status' => 3]);
-        DB::table("st_" . $game_code . "_competition")->where(['id' => $match_id])->update(['status' => 3]);
+        if ($change_status) {
+            DB::table("st_" . $game_code . "_result")->where(['match_id' => $match_id])->update(['status' => 3]);
+            DB::table("st_" . $game_code . "_competition")->where(['id' => $match_id])->update(['status' => 3]);
+        }
     }
 
 }