|
|
@@ -67,11 +67,91 @@ class WinfailLogic
|
|
|
if (empty($model)) {
|
|
|
throw new \Exception("没有找到赛事结果记录-" . $type . '-' . $match_id);
|
|
|
}
|
|
|
+
|
|
|
+ //按赛事结算时,存在手动更改赛事结果的问题,如果有手动设置结果,就用手动结果覆盖真实结果
|
|
|
+ $this->FormatResult_all($type, $model['0']);
|
|
|
+
|
|
|
return $model;
|
|
|
}
|
|
|
|
|
|
|
|
|
- //单式订单存在 单独设置比赛结果的情况,要分开处理
|
|
|
+ //格式化比赛结果为兼容以前的格式(主要因为有手动修改结果和自然采集到数据的问題)
|
|
|
+ //如果比赛结果表中的 is_correct=1时 手动输入结果覆盖旧字段的数据
|
|
|
+ //开始1-->
|
|
|
+
|
|
|
+ public function FormatResult_all($type, $resultObj)
|
|
|
+ {
|
|
|
+ switch ($type) {
|
|
|
+ case 'zq':
|
|
|
+ $this->FormatResult_zq($resultObj);
|
|
|
+ break;
|
|
|
+ case 'lq':
|
|
|
+ $this->FormatResult_lq($resultObj);
|
|
|
+ break;
|
|
|
+ case 'wq':
|
|
|
+ $this->FormatResult_wq($resultObj);
|
|
|
+ break;
|
|
|
+ case 'bq':
|
|
|
+ $this->FormatResult_bq($resultObj);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function FormatResult_zq($resultObj)
|
|
|
+ {
|
|
|
+ if ($resultObj->is_correct != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $handres = json_decode($resultObj->manual_result);
|
|
|
+
|
|
|
+ $resultObj->u_home_score = intval($handres->half->home);
|
|
|
+ $resultObj->u_guest_score = intval($handres->half->guest);
|
|
|
+ $resultObj->home_score = intval($handres->all->home);
|
|
|
+ $resultObj->guest_score = intval($handres->all->guest);
|
|
|
+
|
|
|
+
|
|
|
+ $tmp = ["home" => intval($handres->all_corner->home), "guest" => intval($handres->all_corner->guest), "home_half" => intval($handres->half_corner->home), "guest_half" => intval($handres->half_corner->home)];
|
|
|
+ $resultObj->corner_ball = json_encode($tmp, 256);
|
|
|
+
|
|
|
+ //其它结果因为废弃其玩法,就不用管了
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function FormatResult_lq($resultObj)
|
|
|
+ {
|
|
|
+ if ($resultObj->is_correct != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $resultObj->inning = $resultObj->manual_result;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function FormatResult_wq($resultObj)
|
|
|
+ {
|
|
|
+ if ($resultObj->is_correct != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $resultObj->inning = $resultObj->manual_result;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function FormatResult_bq($resultObj)
|
|
|
+ {
|
|
|
+ if ($resultObj->is_correct != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $resultObj->match_score_t = $resultObj->manual_result;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+//结束1 -->
|
|
|
+
|
|
|
+
|
|
|
+//单式订单存在 单独设置比赛结果的情况,要分开处理
|
|
|
public function getSimplexData($type, $match_id)
|
|
|
{
|
|
|
$return = [];
|
|
|
@@ -86,8 +166,9 @@ class WinfailLogic
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
- //找到订单详细数据
|
|
|
- public function getMatchRecords($type, $match_id, $bet_type)
|
|
|
+//找到订单详细数据
|
|
|
+ public
|
|
|
+ function getMatchRecords($type, $match_id, $bet_type)
|
|
|
{
|
|
|
$return = [];
|
|
|
$ret = DB::table("money_buy_match")->where(['game_code' => $type, 'match_id' => $match_id, 'bet_type' => $bet_type])->get();
|
|
|
@@ -101,7 +182,8 @@ class WinfailLogic
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
- public function getAdapterObj($game_type)
|
|
|
+ public
|
|
|
+ function getAdapterObj($game_type)
|
|
|
{
|
|
|
$game_type = strtolower($game_type);
|
|
|
if (!isset($this->gameAllMap)) {
|
|
|
@@ -126,8 +208,9 @@ class WinfailLogic
|
|
|
return $apd;
|
|
|
}
|
|
|
|
|
|
- //冠军比赛结果
|
|
|
- public function getGjDatas($matchModel)
|
|
|
+//冠军比赛结果
|
|
|
+ public
|
|
|
+ function getGjDatas($matchModel)
|
|
|
{
|
|
|
$table = 'st_' . $matchModel->game_code . '_league_result';
|
|
|
$where = ['lg_id' => $matchModel->lg_id, 'game_name' => $matchModel->game_code];
|
|
|
@@ -138,8 +221,9 @@ class WinfailLogic
|
|
|
return $model;
|
|
|
}
|
|
|
|
|
|
- //冠军比赛结果
|
|
|
- public function getGjDatasV2($game_code, $lg_id)
|
|
|
+//冠军比赛结果
|
|
|
+ public
|
|
|
+ function getGjDatasV2($game_code, $lg_id)
|
|
|
{
|
|
|
$table = 'st_' . $game_code . '_league_result';
|
|
|
$where = ['lg_id' => $lg_id, 'game_name' => $game_code];
|
|
|
@@ -151,15 +235,17 @@ class WinfailLogic
|
|
|
}
|
|
|
|
|
|
|
|
|
- public function getOddsTypeData($game_code, $match_id)
|
|
|
+ public
|
|
|
+ function getOddsTypeData($game_code, $match_id)
|
|
|
{
|
|
|
$ret = DB::table('money_buy_match')->select("p_code", "odds_code", "condition", "bet_type", "is_champion")->where(['match_id' => $match_id, 'game_code' => $game_code])->groupBy('p_code', 'odds_code', 'condition', 'bet_type', 'is_champion')->get();
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
|
|
|
- //胜负判断 NotiematchModel赛事结束通知model $result普通赛事结果对像数组[冠军赛事下可能为空] $GJresult冠军赛事结果对像数组[非冠军赛事为空]
|
|
|
- public function doLogic($NotiematchModel, $result, $GJresult)
|
|
|
+//胜负判断 NotiematchModel赛事结束通知model $result普通赛事结果对像数组[冠军赛事下可能为空] $GJresult冠军赛事结果对像数组[非冠军赛事为空]
|
|
|
+ public
|
|
|
+ function doLogic($NotiematchModel, $result, $GJresult)
|
|
|
{
|
|
|
$game_code = $NotiematchModel->game_code;
|
|
|
$match_id = $NotiematchModel->match_id;
|
|
|
@@ -222,8 +308,9 @@ class WinfailLogic
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- //得到每个玩法第一条记录 根据规则计算输赢
|
|
|
- public function getFristRecord($game_code, $match_id, $ret)
|
|
|
+//得到每个玩法第一条记录 根据规则计算输赢
|
|
|
+ public
|
|
|
+ function getFristRecord($game_code, $match_id, $ret)
|
|
|
{
|
|
|
$return = [];
|
|
|
foreach ($ret as $val) {
|
|
|
@@ -239,8 +326,9 @@ class WinfailLogic
|
|
|
}
|
|
|
|
|
|
|
|
|
- //对单式订单 单个更改过比赛结果的订单进行输赢判断 $orderInfoArray一维数组 $matchArray二维数组
|
|
|
- public function WinFailOneOrder($orderInfo, $matchArray, $is_champion)
|
|
|
+//对单式订单 单个更改过比赛结果的订单进行输赢判断 $orderInfoArray一维数组 $matchArray二维数组
|
|
|
+ public
|
|
|
+ function WinFailOneOrder($orderInfo, $matchArray, $is_champion)
|
|
|
{
|
|
|
$game_code = $orderInfo->game_code;
|
|
|
$match_id = $orderInfo->match_id;
|
|
|
@@ -304,8 +392,9 @@ class WinfailLogic
|
|
|
}
|
|
|
|
|
|
|
|
|
- //普通单式或串式订单输赢处理
|
|
|
- public function WinFailOneOrderNomal($order_id, $bet_type = 1)
|
|
|
+//普通单式或串式订单输赢处理
|
|
|
+ public
|
|
|
+ function WinFailOneOrderNomal($order_id, $bet_type = 1)
|
|
|
{
|
|
|
if ($bet_type == 1) {
|
|
|
$orderInfo = DB::table('money_buy_simplex')->where('order_id', $order_id)->first();
|