|
|
@@ -135,35 +135,50 @@ class WinfailLogic
|
|
|
|
|
|
public function getOddsTypeData($game_code, $match_id)
|
|
|
{
|
|
|
- $ret = DB::table('money_buy_match')->select("p_code", "odds_code", "condition", "bet_type")->where(['game_code' => $game_code, 'match_id' => $match_id])->groupBy('p_code', 'odds_code', 'condition', 'bet_type')->get();
|
|
|
+ $ret = DB::table('money_buy_match')->select("p_code", "odds_code", "condition", "bet_type", "is_champion", "lg_id")->where(['match_id' => $match_id, 'game_code' => $game_code])->groupBy('p_code', 'odds_code', 'condition', 'bet_type', 'is_champion')->get();
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function doLogic($matchModel, $result)
|
|
|
+ //胜负判断 NotiematchModel赛事结束通知model $result普通赛事结果对像数组[冠军赛事下可能为空] $GJresult冠军赛事结果对像数组[非冠军赛事为空]
|
|
|
+ public function doLogic($NotiematchModel, $result, $GJresult)
|
|
|
{
|
|
|
- $game_code = $matchModel->game_code;
|
|
|
- $match_id = $matchModel->match_id;
|
|
|
+ $game_code = $NotiematchModel->game_code;
|
|
|
+ $match_id = $NotiematchModel->match_id;
|
|
|
$AdapterObj = $this->getAdapterObj($game_code);
|
|
|
$groupDatas = $this->getOddsTypeData($game_code, $match_id);
|
|
|
$fristRet = $this->getFristRecord($game_code, $match_id, $groupDatas);
|
|
|
$RefClass = new \ReflectionClass($AdapterObj);
|
|
|
- $noticeId = $matchModel->id;
|
|
|
+ $noticeId = $NotiematchModel->id;
|
|
|
$nowtime = date("Y-m-d H:i:s");
|
|
|
|
|
|
$winorfalsedef = ['result' => 2, 'matchResult' => 'noRuleOrError'];
|
|
|
foreach ($fristRet as $matchModel) {
|
|
|
+ $is_champion = $matchModel->is_champion;
|
|
|
$fun1 = $matchModel->odds_code;
|
|
|
$fun2 = $matchModel->p_code;
|
|
|
|
|
|
+ if ($is_champion == 0) {
|
|
|
+ //普通赛事
|
|
|
+ $resultTypeNow = $result;
|
|
|
+ if (empty($resultTypeNow)) {
|
|
|
+ throw new \Exception("赛事结果不能为空! --lg_id=" . $matchModel->game_code . '_' . $matchModel->lg_id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //冠军赛事;
|
|
|
+ $resultTypeNow = $GJresult;
|
|
|
+ if (empty($resultTypeNow)) {
|
|
|
+ throw new \Exception("冠军赛事结果不能为空! --lg_id=" . $matchModel->game_code . '_' . $matchModel->lg_id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
try {
|
|
|
if ($RefClass->hasMethod($fun1)) {
|
|
|
- $winorfalse = $AdapterObj->$fun1($matchModel, $result, []);
|
|
|
+ $winorfalse = $AdapterObj->$fun1($matchModel, $resultTypeNow, []);
|
|
|
} elseif ($RefClass->hasMethod($fun2)) {
|
|
|
- $winorfalse = $AdapterObj->$fun2($matchModel, $result, []);
|
|
|
+ $winorfalse = $AdapterObj->$fun2($matchModel, $resultTypeNow, []);
|
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
|
-
|
|
|
}
|
|
|
if (!isset($winorfalse['result']) || !isset($winorfalse['matchResult']) || !in_array($winorfalse['result'], [-1, 1, 2, 3, 4])) {
|
|
|
$winorfalse = $winorfalsedef;
|
|
|
@@ -177,12 +192,12 @@ class WinfailLogic
|
|
|
$condition = $matchModel->condition;
|
|
|
$bet_type = $matchModel->bet_type;
|
|
|
|
|
|
- DB::update('update money_buy_match set "result"=?,matchresult=? where match_id=? and game_code=? and odds_code=? and p_code=? and condition=?', [$win, $matword, $match_id, $game_code, $odds_code, $p_code, $condition]);
|
|
|
- $sql = "select batch_id from money_buy_match where match_id=$match_id and game_code='$game_code' and p_code='$p_code'and odds_code='$odds_code'and condition='$condition' ";
|
|
|
+ DB::update('update money_buy_match set "result"=?,matchresult=? where match_id=? and game_code=? and odds_code=? and p_code=? and condition=? and is_champion=?', [$win, $matword, $match_id, $game_code, $odds_code, $p_code, $condition, $is_champion]);
|
|
|
+ $sql = "select batch_id from money_buy_match where match_id=$match_id and game_code='$game_code' and p_code='$p_code'and odds_code='$odds_code'and condition='$condition' and is_champion=$is_champion ";
|
|
|
if ($bet_type == 1) {
|
|
|
DB::update("update money_buy_simplex set game_status=$rwin where game_code='$game_code' and match_id=$match_id and batch_id in ( $sql)");
|
|
|
} else {
|
|
|
- DB::update("update money_buy_simplex set game_status=$rwin where batch_id in ( $sql)");
|
|
|
+ DB::update("update money_buy_str set game_status=$rwin where batch_id in ( $sql)");
|
|
|
}
|
|
|
}
|
|
|
DB::update("update comendnotice set status=1,result=1,done_time='$nowtime',pcount=pcount+1 where id=$noticeId ");
|
|
|
@@ -197,8 +212,9 @@ class WinfailLogic
|
|
|
$p_code = $val->p_code;
|
|
|
$odds_code = $val->odds_code;
|
|
|
$condition = $val->condition;
|
|
|
+ $is_champion = $val->is_champion;
|
|
|
|
|
|
- $ret = DB::table('money_buy_match')->where(['game_code' => $game_code, 'match_id' => $match_id, 'p_code' => $p_code, 'odds_code' => $odds_code, 'condition' => $condition])->first();
|
|
|
+ $ret = DB::table('money_buy_match')->where(['match_id' => $match_id, 'game_code' => $game_code, 'p_code' => $p_code, 'odds_code' => $odds_code, 'condition' => $condition, 'is_champion' => $is_champion])->first();
|
|
|
$return[] = $ret;
|
|
|
}
|
|
|
return $return;
|