|
|
@@ -298,9 +298,88 @@ class WinfailLogic
|
|
|
$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' ");
|
|
|
}
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //普通单式或串式订单输赢处理
|
|
|
+ public function WinFailOneOrderNomal($order_id, $bet_type = 1)
|
|
|
+ {
|
|
|
+ if ($bet_type == 1) {
|
|
|
+ $orderInfo = DB::table('money_buy_simplex')->where('order_id', $order_id)->first();
|
|
|
+ } else {
|
|
|
+ $orderInfo = DB::table('money_buy_str')->where('order_id', $order_id)->first();
|
|
|
+ }
|
|
|
+
|
|
|
+ $matchArray = DB::table('money_buy_match')->where('order_id', $order_id)->get();
|
|
|
+ if (empty($orderInfo) || empty($matchArray)) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($bet_type) {
|
|
|
+ $game_code = $orderInfo->game_code;
|
|
|
+ $match_id = $orderInfo->match_id;
|
|
|
+ $table = 'st_' . $game_code . '_result';
|
|
|
+ $result = DB::table($table)->where('match_id', $match_id)->get();
|
|
|
+ if (empty($result)) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $game_code = $orderInfo->game_code;
|
|
|
+ $match_id = $orderInfo->match_id;
|
|
|
+ $order_id = $orderInfo->order_id;
|
|
|
+
|
|
|
+ $AdapterObj = $this->getAdapterObj($game_code);
|
|
|
+ $RefClass = new \ReflectionClass($AdapterObj);
|
|
|
+
|
|
|
+ $winorfalsedef = ['result' => 2, 'matchResult' => 'noRuleOrError'];
|
|
|
+ foreach ($matchArray as $matchModel) {
|
|
|
+ if ($bet_type == 2) {
|
|
|
+ $game_code = $matchModel->game_code;
|
|
|
+ $match_id = $matchModel->match_id;
|
|
|
+ $table = 'st_' . $game_code . '_result';
|
|
|
+ $result = DB::table($table)->where('match_id', $match_id)->get();
|
|
|
+ if (empty($result)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $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, []);
|
|
|
+ }
|
|
|
+
|
|
|
+ } 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ $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]);
|
|
|
+ }
|
|
|
+ if ($bet_type == 1) {
|
|
|
+ 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' ");
|
|
|
+ } else {
|
|
|
+ DB::update("update money_buy_str set game_status=$rwin where order_id='$order_id' and game_code='$game_code' and match_id='$match_id' ");
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|