vali 6 年之前
父節點
當前提交
d9d49caf20
共有 3 個文件被更改,包括 103 次插入7 次删除
  1. 42 0
      app/Logic/WinfailLogic.php
  2. 7 6
      commands/clientws4.php
  3. 54 1
      datainf/logic/HttpServerSettelement.php

+ 42 - 0
app/Logic/WinfailLogic.php

@@ -205,4 +205,46 @@ class WinfailLogic
     }
 
 
+    //对单式订单   单个更改过比赛结果的订单进行输赢判断  $orderInfoArray一维数组  $matchArray二维数组
+    public function WinFailOneOrder($orderInfo, $matchArray, $result)
+    {
+        $game_code = $orderInfo->game_code;
+        $match_id = $orderInfo->match_id;
+        $order_id = $orderInfo->order_id;
+
+        $AdapterObj = $this->getAdapterObj($game_code);
+        $RefClass = new  \ReflectionClass($AdapterObj);
+
+        $fun1 = $orderInfo->odds_code;
+        $fun2 = $orderInfo->p_code;
+
+        $result = array_merge(json_decode(json_encode($result), true), json_decode($orderInfo->single_result,true));
+        $winorfalsedef = ['result' => 2, 'matchResult' => 'noRuleOrError'];
+
+        foreach ($matchArray as $matchModel) {
+            $mid = $matchModel->id;
+            try {
+                if ($RefClass->hasMethod($fun1)) {
+                    $winorfalse = $AdapterObj->$fun1($matchModel, $result, []);
+                } elseif ($RefClass->hasMethod($fun2)) {
+                    $winorfalse = $AdapterObj->$fun2($matchModel, $result, []);
+                }
+            } catch (\Exception $e) {
+
+            }
+
+            if (!isset($winorfalse['result']) || !isset($winorfalse['matchResult']) || !in_array($winorfalse['result'], [-1, 1, 2, 3, 4])) {
+                $winorfalse = $winorfalsedef;
+            }
+
+            $win = intval($winorfalse['result']);
+            $rwin = ($win == 1) ? 1 : ($win == -1 ? 2 : 3);
+            $matword = $winorfalse['matchResult'];
+
+            DB::update('update money_buy_match  set "result"=?,matchresult=? where match_id=? and game_code=? and id=?', [$win, $matword, $match_id, $game_code, $mid]);
+            DB::update("update money_buy_simplex  set game_status=$rwin  where  order_id='$order_id' and   game_code='$game_code' and  match_id=$match_id  ");
+        }
+        return true;
+    }
+
 }

+ 7 - 6
commands/clientws4.php

@@ -78,8 +78,8 @@ function getIds($type, $match_id, $game_code = '')
     }
 }
 
-$ids = getIds(1, 830, 'zg');
-echo "ids_len:" . count($ids) . "\n";
+//$ids = getIds(1, 30, 'zq');
+//echo "ids_len:" . count($ids) . "\n";
 
 function request_post($url = '', $param = '')
 {
@@ -103,18 +103,19 @@ function request_post($url = '', $param = '')
 
 
 $data = [
-    'token' => 'DmYo5x15595307615cf48d09ad67b',
+     //'token' => 'DmYo5x15595307615cf48d09ad67b',    //2.220
+    'token' => 'A6vmp915647140435d43a43b0147e',    //外网
     //'order_ids' => implode(",", $ids),
     'order_ids' => '',
     'bettype' => 1,
     'settype' => 2,
     'game_code' => 'zq',
-    'match_id' => 483,
+    'match_id' => 234,
     'change_status' => 1
 ];
 
-//$ret = request_post('http://stadmin.bocai108.com:9094/Settelement', $data);
-$ret = request_post('http://192.168.2.220:9094/Settelement', $data);
+$ret = request_post('http://stadmin.bocai108.com:9094/Settelement', $data);
+//$ret = request_post('http://192.168.2.220:9094/Settelement', $data);
 echo "返回:" . print_r($ret, true) . "\n\n";
 
 /*

+ 54 - 1
datainf/logic/HttpServerSettelement.php

@@ -126,6 +126,10 @@ class HttpServerSettelement
             return $this->doWinFailse($request, $response, $paras);
         }
 
+        if ($request_uri == 'WinFailOneOrder') {
+            return $this->WinFailOneOrder($request, $response, $paras);
+        }
+
         if ($request_uri == 'Settelement') {
             return $this->doSettelementIntoRedis($request, $response, $paras);
         }
@@ -146,6 +150,55 @@ class HttpServerSettelement
         return $tokenvel;
     }
 
+    //对单个订单的赛事结果进行过手动更改的订单,单独进行输赢判断处理
+    private function WinFailOneOrder($request, $response, $paras)
+    {
+        $orderid = isset($paras['order_id']) ? $paras['order_id'] : '';
+        if (empty($orderid)) {
+            $data = Response::generate('', 10, $paras, 'order_id is empty');
+            $response->end($data);
+            return;
+        }
+        $orderInfo = DB::table('money_buy_simplex')->where(['order_id' => $orderid])->first();
+        if (empty($orderInfo)) {
+            $data = Response::generate('', 10, $paras, 'order info empty');
+            $response->end($data);
+            return;
+        }
+        if ($orderInfo->result_flag != 1) {
+            $data = Response::generate('', 10, $paras, 'result_flag !=1');
+            $response->end($data);
+            return;
+        }
+
+        $match_datas = DB::table('money_buy_match')->where(['batch_id' => $orderInfo->batch_id, 'bet_type' => 1])->get();
+        if (count($match_datas) <= 0) {
+            $data = Response::generate('', 10, $paras, 'match info empty');
+            $response->end($data);
+            return;
+        }
+        $logic_obj = new WinfailLogic();
+        $result = $logic_obj->getCompResult($orderInfo->game_code, $orderInfo->match_id);
+        if (count($result) <= 0) {
+            $data = Response::generate('', 10, $paras, 'result empty');
+            $response->end($data);
+            return;
+        }
+
+
+        try {
+            $logic_obj->WinFailOneOrder($orderInfo, $match_datas, $result['0']);
+            $data = Response::generate('', 1, ['cost' => (microtime(true) - $request->server['request_time_float'])], 'succes ');
+        } catch (\Exception $e) {
+            $data = Response::generate('', 10, '', $e->getMessage() . '--' . $e->getFile() . '--' . $e->getLine());
+        }
+
+        unset($logic_obj, $match_datas, $orderInfo);
+        $response->end($data);
+
+        return;
+    }
+
 
     //胜负计算
     private function doWinFailse($request, $response, $paras)
@@ -210,7 +263,7 @@ class HttpServerSettelement
 
         try {
             list($order_ids, $bettype, $settype, $game_code, $match_id, $change_status) = $tmp = $this->requestpara($request, $response, $paras);
-            
+
             if (empty($order_ids)) {
                 goto LABRETURN;
             }