vali 6 år sedan
förälder
incheckning
b56964d7dc
2 ändrade filer med 67 tillägg och 13 borttagningar
  1. 28 12
      app/Logic/WinfailLogic.php
  2. 39 1
      datainf/logic/HttpServerSettelement.php

+ 28 - 12
app/Logic/WinfailLogic.php

@@ -418,6 +418,8 @@ class WinfailLogic
         }
 
         $winorfalsedef = ['result' => 2, 'matchResult' => 'noRuleOrError'];
+        $chuanSkip = 0;   //串式跳过输赢结果处理标识
+
         foreach ($matchArray as $matchModel) {
             if ($bet_type == 2) {
                 $game_code = $matchModel->game_code;
@@ -425,6 +427,12 @@ class WinfailLogic
                 $table = 'st_' . $game_code . '_result';
                 $result = DB::table($table)->where('match_id', $match_id)->get();
                 if (empty($result)) {
+                    $chuanSkip = 1;
+                    continue;
+                }
+                if ($result['0']->status == 1) {
+                    //还未结束,暂不用输赢处理
+                    $chuanSkip = 1;
                     continue;
                 }
             }
@@ -432,24 +440,29 @@ class WinfailLogic
             $AdapterObj = $this->getAdapterObj($game_code);
             $RefClass = new  \ReflectionClass($AdapterObj);
 
-
             $fun1 = $matchModel->odds_code;
             $fun2 = $matchModel->p_code;
-
             $mid = $matchModel->id;
-            try {
-                if ($RefClass->hasMethod($fun1)) {
-                    $winorfalse = $AdapterObj->$fun1($matchModel, $result, []);
-                } elseif ($RefClass->hasMethod($fun2)) {
-                    $winorfalse = $AdapterObj->$fun2($matchModel, $result, []);
+
+            if ($result['0']->status == 4) {
+                $winorfalse = ['result' => 2, 'matchResult' => '赛事取消和'];
+            } else {
+
+                try {
+                    if ($RefClass->hasMethod($fun1)) {
+                        $winorfalse = $AdapterObj->$fun1($matchModel, $result, []);
+                    } elseif ($RefClass->hasMethod($fun2)) {
+                        $winorfalse = $AdapterObj->$fun2($matchModel, $result, []);
+                    }
+
+                } catch (\Exception $e) {
+                    echo 'excetption: ' . print_r([$order_id, $e->getMessage(), $e->getFile(), $e->getLine()], true) . "\n";
                 }
 
-            } catch (\Exception $e) {
-                echo 'excetption: ' . print_r([$order_id, $e->getMessage(), $e->getFile(), $e->getLine()], true) . "\n";
-            }
+                if (!isset($winorfalse['result']) || !isset($winorfalse['matchResult']) || !in_array($winorfalse['result'], [-1, 1, 2, 3, 4])) {
+                    $winorfalse = $winorfalsedef;
+                }
 
-            if (!isset($winorfalse['result']) || !isset($winorfalse['matchResult']) || !in_array($winorfalse['result'], [-1, 1, 2, 3, 4])) {
-                $winorfalse = $winorfalsedef;
             }
 
             $win = intval($winorfalse['result']);
@@ -467,6 +480,9 @@ class WinfailLogic
             DB::update("update money_buy_simplex  set game_status=$rwin  where  order_id='$order_id' ");
         } else {
             $rwin = 2;
+            if ($chuanSkip) {
+                return 1;
+            }
             foreach ($rwinarr as $nwin) {
                 if ($nwin == -1) {
                     $rwin = -1;

+ 39 - 1
datainf/logic/HttpServerSettelement.php

@@ -93,7 +93,7 @@ class HttpServerSettelement
         $paras = array_merge(['request_time' => date("H:i:s")], !empty($request->get) ? $request->get : [], !empty($request->post) ? $request->post : []);
 
         $request_uri = substr($request->server['request_uri'], 1);
-        $urls = ['WinFail', 'Settelement', 'DoWinFailOneOrder', 'WinfailoneNomal', 'UnSettelement', 'UnsetOneOrder', 'UnsetOneStringOrder', 'ResStringOneOrder'];
+        $urls = ['WinFail', 'Settelement', 'DoWinFailOneOrder', 'WinfailoneNomal', 'WinfailMulNomal', 'UnSettelement', 'UnsetOneOrder', 'UnsetOneStringOrder', 'ResStringOneOrder'];
 
         $this->httpserver->account->add();
 
@@ -142,6 +142,13 @@ class HttpServerSettelement
             return $this->WinFailOneOrderNomal($request, $response, $paras);
         }
 
+        //普通订单输赢计算 参数order_ids 多个订单用半角逗号分割  bet_type[1单式 2串式]  待实现
+        if ($request_uri == 'WinfailMulNomal') {
+            $this->dosubcount();
+            return $this->WinfailMulNomal($request, $response, $paras);
+        }
+
+
         if ($request_uri == 'Settelement') {
             $this->dosubcount();
             return $this->doSettelementIntoRedis($request, $response, $paras);
@@ -217,6 +224,37 @@ class HttpServerSettelement
 
     }
 
+    //同一赛事多个订单输赢判断处理, 要么单式,要么串式..
+    public function WinfailMulNomal($request, $response, $paras)
+    {
+        $orderids = isset($paras['order_ids']) ? $paras['order_ids'] : '';
+        $bet_type = isset($paras['bet_type']) ? $paras['bet_type'] : 1;
+
+        if (empty($orderids)) {
+            $data = Response::generate('', 10, $paras, 'order_id is empty');
+            $response->end($data);
+            return;
+        }
+
+        $logic_obj = new WinfailLogic();
+        $orderidsArr = explode(",", $orderids);
+        $rets = [];
+
+        foreach ($orderidsArr as $orderid) {
+            try {
+                $ret = $logic_obj->WinFailOneOrderNomal($orderid, $bet_type);
+                $rets[$orderid] = ['code' => $ret, 'msg' => $ret ? 'success' : 'false'];
+            } catch (\Exception $e) {
+                $rets[$orderid] = ['code' => 0, 'msg' => $e->getFile() . '--' . $e->getLine() . '--' . $e->getMessage()];
+            }
+        }
+
+        $data = Response::generate('', 1, $rets);
+        unset($logic_obj, $match_datas, $orderInfo, $rets);
+        $response->end($data);
+        echo $data . "\n";
+    }
+
 
     //对单个订单的赛事结果进行过手动更改的订单,单独进行输赢判断处理
     private function WinFailOneOrder($request, $response, $paras)