hasMany(MoneyBuyMatch::class, 'order_id', 'order_id');
}
function getinfo($list = 10, $page, $where = '', $type)
{
$data = $this
->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')
->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')
// ->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.id')
->join('st_' . $type . '_league', 'money_buy_simplex.lg_id', '=', 'st_' . $type . '_league.id')
->select('money_buy_simplex.id', 'money_buy_simplex.account_name', 'money_buy_simplex.is_champion', 'money_buy_simplex.account_identity', 'money_buy_simplex.order_id', 'money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.status', 'money_buy_simplex.money_time', 'money_buy_simplex.settle_status', 'money_buy_simplex.gain_money', 'money_buy_simplex.game_code', 'money_buy_simplex.match_id', 'money_buy_simplex.game_status', 'st_' . $type . '_competition.home_team', 'st_' . $type . '_competition.guest_team', 'st_' . $type . '_competition.match_date', 'st_' . $type . '_competition.match_time', 'st_' . $type . '_competition.lg_id', 'st_' . $type . '_competition.status as match_status', 'money_details.money_cash', 'money_buy_simplex.batch_id', 'st_' . $type . '_league.name_chinese', 'st_' . $type . '_league.last_time')
->where($where)
->orderby('money_buy_simplex.money_time', 'desc')
->paginate($list);
if (!$data < 0) {
return -2021052003; //
}
//反水
$water_return_money = \App\Models\Money_details::where('trade_type', '7')->get();
//注单作废
$invalid_money = \App\Models\Money_details::where('trade_type', '3')->get();
//订单投注的玩法
$content = \App\Models\MoneyBuyMatch::where('bet_type', '1')->get();
for ($d = 0; $d < count($content); $d++) {
if ($content[$d]->result == 0) {
$content[$d]->result = '未处理';
}
if ($content[$d]->result == 1) {
$content[$d]->result = '赢';
}
if ($content[$d]->result == -1) {
$content[$d]->result = '输';
}
if ($content[$d]->result == 2) {
$content[$d]->result = '平';
}
if ($content[$d]->result == 3) {
$content[$d]->result = '赢半平半';
}
if ($content[$d]->result == 4) {
$content[$d]->result = '输半平半';
}
}
//玩法
$result = \App\Models\Matchcode::where('game_code', $type)->get();
//$result = \App\Model\Matchcode::get();
for ($i = 0; $i < count($data); $i++) {
// if($data[$i]->status==1 && $data[$i]->game_status==0){
// $data[$i]->order_status = '投注'.'
; 作废 ';
// }else
if ($data[$i]->status == 1 && $data[$i]->game_status == 0) {
$data[$i]->order_status = '投注';
} else if ($data[$i]->status == 2) {
$data[$i]->order_status = '作废';//.'
已作废 ';
} else if ($data[$i]->status == 3) {
$data[$i]->order_status = '撤单';//.'
已撤单 ';
}
if ($data[$i]->settle_status == 1) {
$data[$i]->settle_status = '未结算';
} else if ($data[$i]->settle_status == 2) {
$data[$i]->settle_status = '已结算';
}
if ($data[$i]->game_status == 0) {
$data[$i]->game_status = '未处理';
} else {
$data[$i]->game_status = '已处理';
}
if ($data[$i]->game_code == 'zq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
if ($data[$i]->game_code == 'lq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
if ($data[$i]->game_code == 'wq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
if ($data[$i]->game_code == 'bq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
$data[$i]->league = $data[$i]->name_chinese;
if ($data[$i]->is_champion == 0) {
$data[$i]->home_guest = $data[$i]->home_team . ' VS ' . $data[$i]->guest_team;
$data[$i]->time = '开赛:' . $data[$i]->match_date . ' ' . $data[$i]->match_time;
} else {
$data[$i]->home_guest = '冠军联赛投注';
$data[$i]->time = '结束:' . $data[$i]->last_time;
}
$data[$i]->money_match_time = '下注:' . $data[$i]->money_time . $data[$i]->time;
//反水
$data[$i]->water_return = -1;
for ($a = 0; $a < count($water_return_money); $a++) {
if ($data[$i]->order_id == $water_return_money[$a]->trade_id) {
if ($data[$i]->status == 2 || $data[$i]->status == 3) {
$data[$i]->water_return = 0;
} else {
$data[$i]->water_return = $water_return_money[$a]->money;
}
//用户投注后账户金额
$data[$i]->frozen_cash = $water_return_money[$a]->money_cash;
}
}
if ($data[$i]->water_return == -1) {
$data[$i]->water_return = 0;
//用户投注后账户金额
$data[$i]->frozen_cash = $data[$i]->money_cash;
}
//此时结果金额
$data[$i]->result = $data[$i]->water_return + $data[$i]->gain_money;
//用户投注前账户金额
$data[$i]->available_cash = $data[$i]->money_cash + $data[$i]->money;
//投注前后账户金额
$data[$i]->account_money = $data[$i]->available_cash . '
' . $data[$i]->money . '
' . $data[$i]->frozen_cash;
if ($data[$i]->status == 2 || $data[$i]->status == 3) {
for ($b = 0; $b < count($invalid_money); $b++) {
if ($data[$i]->order_id == $invalid_money[$b]->trade_id) {
$data[$i]->available_cash = $invalid_money[$b]->money_cash;
$data[$i]->account_money = $data[$i]->available_cash;
}
}
}
$data[$i]->str = 0;
for ($b = 0; $b < count($content); $b++) {
$data[$i]->str1 = 0;
$data[$i]->team = '';
if (!empty($content[$b]->odds_code)) {
if (!empty(stristr($content[$b]->odds_code, 'home'))) {
$data[$i]->team = $data[$i]->home_team;
}
if (!empty(stristr($content[$b]->odds_code, 'guest'))) {
$data[$i]->team = $data[$i]->guest_team;
}
if ($content[$b]->p_code == 'half_full') {
$string = str_replace('home', $data[$i]->home_team, $content[$b]->odds_code);
$string = str_replace('guest', $data[$i]->guest_team, $string);
$string = str_replace('dogfall', '和局', $string);
$string = explode('_', $string);
$data[$i]->team = $string['2'] . '/' . $string['3'];
}
}
//处理普通赛事玩法详情
if ($data[$i]->match_id == $content[$b]->match_id && $data[$i]->batch_id == $content[$b]->batch_id && $data[$i]->is_champion == 0) {
if ($content[$b]->p_code == 'first_last_ball' || $content[$b]->p_code == 'half_full' || $content[$b]->p_code == 'capot' || $content[$b]->p_code == 'two_sides' || $content[$b]->p_code == 'total_goal') {
$content[$b]->condition = '';
}
$data[$i]->game_status = $data[$i]->game_status;
//投注详情
if (!empty($data[$i]->match_time)) {
$data[$i]->content1 = '[' . $data[$i]->match_time . ']';
//$data[$i]->match_time = $data[$i]->match_time;
} else {
if (!empty($data[$i]->last_time)) {
$datetime = explode(' ', $data[$i]->last_time);
//$data[$i]->match_time = $datetime[1];
$data[$i]->content1 = '[' . $datetime[1] . ']';
}
}
for ($c = 0; $c < count($result); $c++) {
if ($content[$b]->odds_code == $result[$c]->odds_code) {
$data[$i]->str1 = 1;
if ($content[$b]->result == '未处理') {
$data[$i]->content = $data[$i]->content . $result[$c]->odds_name . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
';
} else {
$data[$i]->content = $data[$i]->content . $result[$c]->odds_name . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
' . $content[$b]->result . '(' . $content[$b]->matchresult . ')
';
}
}
}
if ($data[$i]->str1 == 0) {
if ($content[$b]->result == '未处理') {
$data[$i]->content = $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
';
} else {
$data[$i]->content = $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
' . $content[$b]->result . '(' . $content[$b]->matchresult . ')
';
}
}
}
//处理冠军联赛玩法详情
if ($data[$i]->match_id == $content[$b]->lg_id && $data[$i]->batch_id == $content[$b]->batch_id && $data[$i]->is_champion == 1) {
$content[$b]->condition = '';
if ($content[$b]->p_code == 'first_last_ball' || $content[$b]->p_code == 'half_full' || $content[$b]->p_code == 'capot' || $content[$b]->p_code == 'two_sides' || $content[$b]->p_code == 'total_goal') {
$content[$b]->condition = '';
}
$data[$i]->game_status = $data[$i]->game_status;
/*
//投注详情
if(!empty($data[$i]->match_time)){
$data[$i]->content1 = '['.$data[$i]->match_time.']';
//$data[$i]->match_time = $data[$i]->match_time;
}
else{
if(!empty($data[$i]->last_time)){
$datetime = explode(' ',$data[$i]->last_time);
//$data[$i]->match_time = $datetime[1];
$data[$i]->content1 = '['.$datetime[1].']';
}
}
*/
/*
for($c=0;$codds_code == $result[$c]->odds_code){
$data[$i]->str1 = 1;
if($content[$b]->result=='未处理'){
$data[$i]->content = $content[$b]->home_team.'
'.$data[$i]->content.$result[$c]->odds_name.'
'.$content[$b]->condition.' '.$data[$i]->team.'@'.$content[$b]->odds.' ¥'.$content[$b]->bet_money.'
';
}else{
$data[$i]->content = $content[$b]->home_team.'
'.$data[$i]->content.$result[$c]->odds_name.'
'.$content[$b]->condition.' '.$data[$i]->team.'@'.$content[$b]->odds.' ¥'.$content[$b]->bet_money.'
'.$content[$b]->result.'('.$content[$b]->matchresult.')
';
}
}
}
*/
if ($data[$i]->str1 == 0) {
if ($content[$b]->result == '未处理') {
$data[$i]->content = $content[$b]->home_team . '
' . $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
';
} else {
$data[$i]->content = $content[$b]->home_team . '
' . $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
' . $content[$b]->result . '(' . $content[$b]->matchresult . ')
';
}
}
}
}
// if($data[$i]->status == 1){
// if($data[$i]->match_status == 0 || $data[$i]->match_status == 1){
// $data[$i]->game_status = $data[$i]->settle_status.'
结算 ';
// }
// if($data[$i]->match_status == 2 || $data[$i]->match_status == 3 || $data[$i]->match_status == 5){
// if($data[$i]->settle_status == '已结算'){
// $data[$i]->game_status = $data[$i]->settle_status.'
重新结算 ';
// }else{
// $data[$i]->game_status = $data[$i]->settle_status.'
结算 ';
// }
// }
// }else{
// $data[$i]->game_status = $data[$i]->settle_status.'
结2算 ';
// }
$data[$i]->content = $data[$i]->content1 . $data[$i]->content;
}
return $data->toArray();
}
//投注金额汇总统计
function MoneyCount($where = '', $type)
{
$data = array();
// $data['all_money'] = $this->sum('money');
// $data['all_prize_money'] = $this->sum('prize_money');
// $data['alraedy_prize_money'] = $this->where('settle_status','2')->sum('gain_money');
$data['all_money'] = 0;
$data['all_prize_money'] = 0;
$data['alraedy_prize_money'] = 0;
$all_money = $this->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')->join('st_' . $type . '_league', 'st_' . $type . '_competition.lg_id', '=', 'st_' . $type . '_league.id')->select('money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.gain_money')->where('money_buy_simplex.status', '1')->get();
for ($a = 0; $a < count($all_money); $a++) {
$data['all_money'] = $data['all_money'] + $all_money[$a]->money;
}
$all_prize_money = $this->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')->join('st_' . $type . '_league', 'st_' . $type . '_competition.lg_id', '=', 'st_' . $type . '_league.id')->select('money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.gain_money')->where('money_buy_simplex.status', '1')->get();
for ($a = 0; $a < count($all_prize_money); $a++) {
$data['all_prize_money'] = $data['all_money'] + $all_prize_money[$a]->prize_money;
}
$alraedy_prize_money = $this->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')->join('st_' . $type . '_league', 'st_' . $type . '_competition.lg_id', '=', 'st_' . $type . '_league.id')->select('money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.gain_money')->where('money_buy_simplex.settle_status', '2')->where('money_buy_simplex.status', '1')->get();
for ($a = 0; $a < count($alraedy_prize_money); $a++) {
$data['alraedy_prize_money'] = $data['all_money'] + $alraedy_prize_money[$a]->gain_money;
}
if (!empty($where) && is_array($where)) {
$data['all_money'] = 0;
$data['all_prize_money'] = 0;
$data['alraedy_prize_money'] = 0;
//$data['all_money'] = $this->where($where)->sum('money');
// $data['all_prize_money'] = $this->where($where)->sum('prize_money');
// $data['alraedy_prize_money'] = $this->where($where)->where('settle_status','2')->sum('gain_money');
$all_money = $this->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')->join('st_zq_competition', 'st_zq_competition.id', '=', 'money_buy_simplex.match_id')->join('st_zq_league', 'st_zq_competition.lg_id', '=', 'st_zq_league.id')->select('money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.gain_money')->where($where)->where('money_buy_simplex.status', '1')->get();
for ($a = 0; $a < count($all_money); $a++) {
$data['all_money'] = $data['all_money'] + $all_money[$a]->money;
}
$all_prize_money = $this->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')->join('st_' . $type . '_league', 'st_' . $type . '_competition.lg_id', '=', 'st_' . $type . '_league.id')->select('money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.gain_money')->where($where)->where('money_buy_simplex.status', '1')->get();
for ($a = 0; $a < count($all_prize_money); $a++) {
$data['all_prize_money'] = $data['all_prize_money'] + $all_prize_money[$a]->prize_money;
}
$alraedy_prize_money = $this->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')->join('st_' . $type . '_league', 'st_' . $type . '_competition.lg_id', '=', 'st_' . $type . '_league.id')->select('money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.gain_money')->where('money_buy_simplex.settle_status', '2')->where($where)->where('money_buy_simplex.status', '1')->get();
for ($a = 0; $a < count($alraedy_prize_money); $a++) {
$data['alraedy_prize_money'] = $data['alraedy_prize_money'] + $alraedy_prize_money[$a]->gain_money;
}
}
return $data;
}
//修改赛事下的所有单式下注 3199308
function updatesimplex($ssid, $code)
{
$newapp = new \App\Models\MoneyBuyMatch();
$data = $newapp->allsimplexorder($ssid, $code);
if ($data) {
for ($i = 0; $i < count($data); $i++) {
$the = array(
'status' => 2,
'game_status' => 3,
'game_code' => $code,
);
$res = $this->where('order_id', $data[$i]['order_id'])->update($the);
}
if ($res < 0) {
return -7012000302; //操作失败
}
return $res;
} else {
return -111;
}
}
function info($list = 10, $page, $where = '', $type)
{
$data = $this
->join('money_details', 'money_details.info_identity', '=', 'money_buy_simplex.info_identity')
->join('st_' . $type . '_competition', 'st_' . $type . '_competition.id', '=', 'money_buy_simplex.match_id')
// ->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.id')
->join('st_' . $type . '_league', 'money_buy_simplex.lg_id', '=', 'st_' . $type . '_league.id')
->select('money_buy_simplex.id', 'money_buy_simplex.account_name', 'money_buy_simplex.is_champion', 'money_buy_simplex.account_identity', 'money_buy_simplex.order_id', 'money_buy_simplex.money', 'money_buy_simplex.prize_money', 'money_buy_simplex.status', 'money_buy_simplex.money_time', 'money_buy_simplex.settle_status', 'money_buy_simplex.gain_money', 'money_buy_simplex.game_code', 'money_buy_simplex.match_id', 'money_buy_simplex.game_status', 'st_' . $type . '_competition.home_team', 'st_' . $type . '_competition.guest_team', 'st_' . $type . '_competition.match_date', 'st_' . $type . '_competition.match_time', 'st_' . $type . '_competition.lg_id', 'st_' . $type . '_competition.status as match_status', 'money_details.money_cash', 'money_buy_simplex.batch_id', 'st_' . $type . '_league.name_chinese', 'st_' . $type . '_league.last_time')
->where($where)
->orderby('money_buy_simplex.money_time', 'desc')
->paginate($list);
if (!$data < 0) {
return -2021052003; //
}
//反水
$water_return_money = \App\Models\Money_details::where('trade_type', '7')->get();
//注单作废
$invalid_money = \App\Models\Money_details::where('trade_type', '3')->get();
//订单投注的玩法
$content = \App\Models\MoneyBuyMatch::where('bet_type', '1')->get();
for ($d = 0; $d < count($content); $d++) {
if ($content[$d]->result == 0) {
$content[$d]->result = '未处理';
}
if ($content[$d]->result == 1) {
$content[$d]->result = '赢';
}
if ($content[$d]->result == -1) {
$content[$d]->result = '输';
}
if ($content[$d]->result == 2) {
$content[$d]->result = '平';
}
if ($content[$d]->result == 3) {
$content[$d]->result = '赢半平半';
}
if ($content[$d]->result == 4) {
$content[$d]->result = '输半平半';
}
}
//玩法
$result = \App\Models\Matchcode::where('game_code', $type)->get();
//$result = \App\Model\Matchcode::get();
for ($i = 0; $i < count($data); $i++) {
if ($data[$i]->status == 1 && $data[$i]->game_status == 0) {
$data[$i]->order_status = '投注' . '
作废 ';
} else if ($data[$i]->status == 1 && $data[$i]->game_status != 0) {
$data[$i]->order_status = '投注';
} else if ($data[$i]->status == 2) {
$data[$i]->order_status = '作废';
} else if ($data[$i]->status == 3) {
$data[$i]->order_status = '撤单';
}
// if($data[$i]->settle_status==1){
// $data[$i]->settle_status = '未结算';
// }else if($data[$i]->settle_status==2){
// $data[$i]->settle_status = '已结算';
// }
if ($data[$i]->game_status == 0) {
$data[$i]->game_status = '未处理';
} else {
$data[$i]->game_status = '已处理';
}
if ($data[$i]->game_code == 'zq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
if ($data[$i]->game_code == 'lq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
if ($data[$i]->game_code == 'wq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
if ($data[$i]->game_code == 'bq') {
$data[$i]->match_id_order = '' . $data[$i]->match_id . ' (' . $data[$i]->account_name . ')
' . $data[$i]->order_id;
}
$data[$i]->league = $data[$i]->name_chinese;
if ($data[$i]->is_champion == 0) {
$data[$i]->home_guest = $data[$i]->home_team . ' VS ' . $data[$i]->guest_team;
$data[$i]->time = '开赛:' . $data[$i]->match_date . ' ' . $data[$i]->match_time;
} else {
$data[$i]->home_guest = '冠军联赛投注';
$data[$i]->time = '结束:' . $data[$i]->last_time;
}
$data[$i]->money_match_time = '下注:' . $data[$i]->money_time . $data[$i]->time;
/*
$data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
$data[$i]->time = '开赛:'.$data[$i]->match_date.' '.$data[$i]->match_time;
$data[$i]->money_match_time = '下注:'.$data[$i]->money_time.'
'.$data[$i]->time;
*/
//反水
$data[$i]->water_return = -1;
for ($a = 0; $a < count($water_return_money); $a++) {
if ($data[$i]->order_id == $water_return_money[$a]->trade_id) {
if ($data[$i]->status == 2 || $data[$i]->status == 3) {
$data[$i]->water_return = 0;
} else {
$data[$i]->water_return = $water_return_money[$a]->money;
}
//用户投注后账户金额
$data[$i]->frozen_cash = $water_return_money[$a]->money_cash;
}
}
if ($data[$i]->water_return == -1) {
$data[$i]->water_return = 0;
//用户投注后账户金额
$data[$i]->frozen_cash = $data[$i]->money_cash;
}
//此时结果金额
$data[$i]->result = $data[$i]->water_return + $data[$i]->gain_money;
//用户投注前账户金额
$data[$i]->available_cash = $data[$i]->money_cash + $data[$i]->money;
//投注前后账户金额
$data[$i]->account_money = $data[$i]->available_cash . '
' . $data[$i]->money . '
' . $data[$i]->frozen_cash;
if ($data[$i]->status == 2 || $data[$i]->status == 3) {
for ($b = 0; $b < count($invalid_money); $b++) {
if ($data[$i]->order_id == $invalid_money[$b]->trade_id) {
$data[$i]->available_cash = $invalid_money[$b]->money_cash;
$data[$i]->account_money = $data[$i]->available_cash;
}
}
}
$data[$i]->str = 0;
for ($b = 0; $b < count($content); $b++) {
$data[$i]->str1 = 0;
$data[$i]->team = '';
if (!empty($content[$b]->odds_code)) {
if (!empty(stristr($content[$b]->odds_code, 'home'))) {
$data[$i]->team = $data[$i]->home_team;
}
if (!empty(stristr($content[$b]->odds_code, 'guest'))) {
$data[$i]->team = $data[$i]->guest_team;
}
if ($content[$b]->p_code == 'half_full') {
$string = str_replace('home', $data[$i]->home_team, $content[$b]->odds_code);
$string = str_replace('guest', $data[$i]->guest_team, $string);
$string = str_replace('dogfall', '和局', $string);
$string = explode('_', $string);
$data[$i]->team = $string['2'] . '/' . $string['3'];
}
}
//处理普通赛事
if ($data[$i]->match_id == $content[$b]->match_id && $data[$i]->batch_id == $content[$b]->batch_id && $data[$i]->is_champion == 0) {
if ($content[$b]->p_code == 'first_last_ball' || $content[$b]->p_code == 'half_full' || $content[$b]->p_code == 'capot' || $content[$b]->p_code == 'two_sides' || $content[$b]->p_code == 'total_goal') {
$content[$b]->condition = '';
}
$data[$i]->game_status = $data[$i]->game_status;
//投注详情
if (!empty($data[$i]->match_time)) {
$data[$i]->content1 = '[' . $data[$i]->match_time . ']';
//$data[$i]->match_time = $data[$i]->match_time;
} else {
if (!empty($data[$i]->last_time)) {
$datetime = explode(' ', $data[$i]->last_time);
//$data[$i]->match_time = $datetime[1];
$data[$i]->content1 = '[' . $datetime[1] . ']';
}
}
for ($c = 0; $c < count($result); $c++) {
if ($content[$b]->odds_code == $result[$c]->odds_code) {
$data[$i]->str1 = 1;
if ($content[$b]->result == '未处理') {
$data[$i]->content = $data[$i]->content . $result[$c]->odds_name . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
';
} else {
$data[$i]->content = $data[$i]->content . $result[$c]->odds_name . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
' . $content[$b]->result . '(' . $content[$b]->matchresult . ')
';
}
}
}
if ($data[$i]->str1 == 0) {
if ($content[$b]->result == '未处理') {
$data[$i]->content = $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
';
} else {
$data[$i]->content = $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
' . $content[$b]->result . '(' . $content[$b]->matchresult . ')
';
}
}
}
//处理冠军联赛玩法详情
if ($data[$i]->match_id == $content[$b]->lg_id && $data[$i]->batch_id == $content[$b]->batch_id && $data[$i]->is_champion == 1) {
$content[$b]->condition = '';
if ($content[$b]->p_code == 'first_last_ball' || $content[$b]->p_code == 'half_full' || $content[$b]->p_code == 'capot' || $content[$b]->p_code == 'two_sides' || $content[$b]->p_code == 'total_goal') {
$content[$b]->condition = '';
}
$data[$i]->game_status = $data[$i]->game_status;
/*
//投注详情
if(!empty($data[$i]->match_time)){
$data[$i]->content1 = '['.$data[$i]->match_time.']';
//$data[$i]->match_time = $data[$i]->match_time;
}
else{
if(!empty($data[$i]->last_time)){
$datetime = explode(' ',$data[$i]->last_time);
//$data[$i]->match_time = $datetime[1];
$data[$i]->content1 = '['.$datetime[1].']';
}
}
*/
/*
for($c=0;$codds_code == $result[$c]->odds_code){
$data[$i]->str1 = 1;
if($content[$b]->result=='未处理'){
$data[$i]->content = $data[$i]->content.$result[$c]->odds_name.'
'.$content[$b]->condition.' '.$data[$i]->team.'@'.$content[$b]->odds.' ¥'.$content[$b]->bet_money.'
';
}else{
$data[$i]->content = $data[$i]->content.$result[$c]->odds_name.'
'.$content[$b]->condition.' '.$data[$i]->team.'@'.$content[$b]->odds.' ¥'.$content[$b]->bet_money.'
'.$content[$b]->result.'('.$content[$b]->matchresult.')
';
}
}
}
*/
if ($data[$i]->str1 == 0) {
if ($content[$b]->result == '未处理') {
$data[$i]->content = $content[$b]->home_team . '
' . $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
';
} else {
$data[$i]->content = $content[$b]->home_team . '
' . $data[$i]->content . $content[$b]->odds_code . '
' . $content[$b]->condition . ' ' . $data[$i]->team . '@' . $content[$b]->odds . ' ¥' . $content[$b]->bet_money . '
' . $content[$b]->result . '(' . $content[$b]->matchresult . ')
';
}
}
}
}
$data[$i]->game_status = $data[$i]->settle_status;
$data[$i]->content = $data[$i]->content1 . $data[$i]->content;
}
return $data->toArray();
}
//查询单订单是否存在
function onlyorder($orderid)
{
$order = $this->where('order_id', $orderid)->count();
return $order;
}
//查询单订单是否存在
function getorder($orderid)
{
$order = $this->with("matchdatas")->where('order_id', $orderid)->first();
return $order;
}
}