|
@@ -15,13 +15,116 @@ use App\Lib\Biz\Sport\Common as commonFunction;
|
|
|
*/
|
|
*/
|
|
|
class SportsfootController extends Controller {
|
|
class SportsfootController extends Controller {
|
|
|
|
|
|
|
|
|
|
+ function Settlement1(Req $req){
|
|
|
|
|
+ $match_id = $req->match_id;
|
|
|
|
|
+ $type = $req->type;
|
|
|
|
|
+ $process = $req->process;
|
|
|
|
|
+ if(empty($process)){
|
|
|
|
|
+ $process = array();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $token = session('adminInfo.token');
|
|
|
|
|
+ $notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
|
|
|
|
|
+
|
|
|
|
|
+ if(!$notice){
|
|
|
|
|
+ return json_encode(['status'=>5,'msg'=>'请先核对结果,并提交结果']);
|
|
|
|
|
+ }
|
|
|
|
|
+ $noticeid = $notice['id'];
|
|
|
|
|
+ //查询赛事单式是否有订单(足球)
|
|
|
|
|
+ $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
|
|
+ $simplex = $newapp->simsettleorder($match_id,'zq');
|
|
|
|
|
+ $str = $newapp->strsettleorder($match_id);
|
|
|
|
|
+
|
|
|
|
|
+ //获取赛事结算进程下的注单
|
|
|
|
|
+ $simplex = commonFunction::getOrderData($data = [],$simplex,$type,$process);
|
|
|
|
|
+ $str = commonFunction::getOrderData($data = [],$str,$type,$process);
|
|
|
|
|
+
|
|
|
|
|
+ //获取注单id组成一维数组
|
|
|
|
|
+ $simplex_ids = array_column($simplex['settle'],'order_id');
|
|
|
|
|
+ $str_ids = array_column($str['settle'],'order_id');
|
|
|
|
|
+
|
|
|
|
|
+ //去重
|
|
|
|
|
+ $simplex_ids = array_unique($simplex_ids);
|
|
|
|
|
+ $str_ids = array_unique($str_ids);
|
|
|
|
|
+// print_r($simplex_ids);exit;
|
|
|
|
|
+
|
|
|
|
|
+ //判断赛事下注单输赢
|
|
|
|
|
+ $datas = array('noticeid' => $noticeid , 'token' => $token);
|
|
|
|
|
+ $settlementAuto = new \App\Lib\Settlement\SettlementAuto();
|
|
|
|
|
+ $winfail = $settlementAuto->SubmitSettelement('w',$datas);
|
|
|
|
|
+ if($winfail == false){
|
|
|
|
|
+ return json_encode(['status'=>2,'msg'=>'判断输赢错误,请联系管理员!!!']);//输赢错误
|
|
|
|
|
+ }
|
|
|
|
|
+ $sim = array(
|
|
|
|
|
+ 'token'=>$token,
|
|
|
|
|
+ 'order_ids'=>'', //订单id字符串,用半角都好分隔
|
|
|
|
|
+ 'bettype'=>1, //结算类型 1单式 2串式
|
|
|
|
|
+ 'settype'=>2, //结算次数 1首次 2非首次
|
|
|
|
|
+ 'game_code'=>$type, //赛事类型 zq lq wq bq
|
|
|
|
|
+ 'match_id'=>$match_id, // 赛事ID
|
|
|
|
|
+ 'change_status'=>1 //是否改状态
|
|
|
|
|
+ );
|
|
|
|
|
+ $str = array(
|
|
|
|
|
+ 'token'=>$token,
|
|
|
|
|
+ 'order_ids'=>'', //订单id字符串,用半角都好分隔
|
|
|
|
|
+ 'bettype'=>2, //结算类型 1单式 2串式
|
|
|
|
|
+ 'settype'=>2, //结算次数 1首次 2非首次
|
|
|
|
|
+ 'game_code'=>$type, //赛事类型 zq lq wq bq
|
|
|
|
|
+ 'match_id'=>$match_id, // 赛事ID
|
|
|
|
|
+ 'change_status'=>1 //是否改状态
|
|
|
|
|
+ );
|
|
|
|
|
+ if(count($simplex_ids)>0 || count($str_ids)>0){
|
|
|
|
|
+ //单式结算
|
|
|
|
|
+ if(count($simplex_ids)>0 && count($str_ids)==0){
|
|
|
|
|
+ $sim['order_ids'] = implode(',',$simplex_ids);
|
|
|
|
|
+ $settlesim = $settlementAuto->SubmitSettelement('s',$sim);
|
|
|
|
|
+ if($settlesim == false){
|
|
|
|
|
+ return json_encode(['status'=>3,'msg'=>'单式注单结算有误,请联系管理员!!!']);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return json_encode(['status'=>1,'msg'=>'单式结算成功,没有串式订单']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //串式结算
|
|
|
|
|
+ elseif(count($str_ids)>0 && count($simplex_ids)==0){
|
|
|
|
|
+ $str['order_ids'] = implode(',',$str_ids);
|
|
|
|
|
+ $settlestr = $settlementAuto->SubmitSettelement('s',$str);
|
|
|
|
|
+ if($settlestr == false){
|
|
|
|
|
+ return json_encode(['status'=>3,'msg'=>'串式注单结算有误,请联系管理员!!!']);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return json_encode(['status'=>1,'msg'=>'串式结算成功,没有单式订单']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //既有单式也有串式
|
|
|
|
|
+ elseif(count($str_ids)>0 && count($simplex_ids)>0){
|
|
|
|
|
+ $sim['order_ids'] = implode(',',$simplex_ids);
|
|
|
|
|
+ $str['order_ids'] = implode(',',$str_ids);
|
|
|
|
|
+ $settlesim = $settlementAuto->SubmitSettelement('s',$sim);
|
|
|
|
|
+ $settlestr = $settlementAuto->SubmitSettelement('s',$str);
|
|
|
|
|
+ if($settlesim == true || $settlestr == true){
|
|
|
|
|
+ return json_encode(['status'=>1,'msg'=>'结算成功']);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return json_encode(['status'=>3,'msg'=>'结算有误,请联系管理员!!!']);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $log = array(
|
|
|
|
|
+ session('adminInfo.admin_name'),
|
|
|
|
|
+ );
|
|
|
|
|
+ OperationLog(session('adminInfo.admin_id'), '足球结算', $log);
|
|
|
|
|
+ $res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
|
|
|
|
|
+ $res = \App\Models\SportsSoccer::where ('id', $match_id)->update(['status' =>3]);
|
|
|
|
|
+ return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function Settlement(Req $req){
|
|
function Settlement(Req $req){
|
|
|
$jsurl = config('sconstant.url');//结算请求域名地址
|
|
$jsurl = config('sconstant.url');//结算请求域名地址
|
|
|
$match_id = $req->match_id;
|
|
$match_id = $req->match_id;
|
|
|
$type = $req->type;
|
|
$type = $req->type;
|
|
|
$token = session('adminInfo.token');
|
|
$token = session('adminInfo.token');
|
|
|
$notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
|
|
$notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if(!$notice){
|
|
if(!$notice){
|
|
|
return json_encode(['status'=>5,'msg'=>'请先核对结果,并提交结果']);
|
|
return json_encode(['status'=>5,'msg'=>'请先核对结果,并提交结果']);
|
|
|
}
|
|
}
|
|
@@ -100,9 +203,9 @@ class SportsfootController extends Controller {
|
|
|
OperationLog(session('adminInfo.admin_id'), '足球结算', $log);
|
|
OperationLog(session('adminInfo.admin_id'), '足球结算', $log);
|
|
|
$res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
|
|
$res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
|
|
|
$res = \App\Models\SportsSoccer::where ('id', $match_id)->update(['status' =>3]);
|
|
$res = \App\Models\SportsSoccer::where ('id', $match_id)->update(['status' =>3]);
|
|
|
- return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
|
|
|
|
|
|
|
+ return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//添加危险球列表
|
|
//添加危险球列表
|
|
@@ -503,28 +606,88 @@ class SportsfootController extends Controller {
|
|
|
$match_status = $match['status'];
|
|
$match_status = $match['status'];
|
|
|
|
|
|
|
|
$data = array(
|
|
$data = array(
|
|
|
|
|
+ //上半场角球
|
|
|
|
|
+ "half_corner" => array(
|
|
|
|
|
+ 'home' => intval($req->homehalfcorner)?intval($req->homehalfcorner):'',
|
|
|
|
|
+ 'guest' => intval($req->guesthalfcorner)?intval($req->guesthalfcorner):'',
|
|
|
|
|
+ ),
|
|
|
|
|
+ //全场角球
|
|
|
|
|
+ "all_corner" => array(
|
|
|
|
|
+ 'home' => intval($req->homeallcorner)?intval($req->homeallcorner):'',
|
|
|
|
|
+ 'guest' => intval($req->guestallcorner)?intval($req->guestallcorner):'',
|
|
|
|
|
+ ),
|
|
|
|
|
+ //上半场罚牌
|
|
|
|
|
+ "half_penalty" => array(
|
|
|
|
|
+ 'home' => intval($req->homehalfcard)?intval($req->homehalfcard):'',
|
|
|
|
|
+ 'guest' => intval($req->guesthalfcard)?intval($req->guesthalfcard):'',
|
|
|
|
|
+ ),
|
|
|
|
|
+ //全场罚牌
|
|
|
|
|
+ "all_penalty" => array(
|
|
|
|
|
+ 'home' => intval($req->homeallcard)?intval($req->homeallcard):'',
|
|
|
|
|
+ 'guest' => intval($req->guestallcard)?intval($req->guestallcard):'',
|
|
|
|
|
+ ),
|
|
|
|
|
+ //首进球时间
|
|
|
|
|
+ "first_score" => array(
|
|
|
|
|
+ 'time' => intval($req->onescoretime)?intval($req->onescoretime):'',
|
|
|
|
|
+ ),
|
|
|
|
|
+
|
|
|
|
|
+ //上半场比分
|
|
|
"half" => array(
|
|
"half" => array(
|
|
|
- 'home' => intval($req->homehalf)?intval($req->homehalf):0,
|
|
|
|
|
- 'guest' => intval($req->guesthalf)?intval($req->guesthalf):0,
|
|
|
|
|
|
|
+ 'home' => intval($req->homehalf)?intval($req->homehalf):'',
|
|
|
|
|
+ 'guest' => intval($req->guesthalf)?intval($req->guesthalf):'',
|
|
|
),
|
|
),
|
|
|
|
|
+ //全场比分
|
|
|
"all" => array(
|
|
"all" => array(
|
|
|
- 'home' => intval($req->homeall)?intval($req->homeall):0,
|
|
|
|
|
- 'guest' => intval($req->guestall)?intval($req->guestall):0,
|
|
|
|
|
|
|
+ 'home' => intval($req->homeall)?intval($req->homeall):'',
|
|
|
|
|
+ 'guest' => intval($req->guestall)?intval($req->guestall):'',
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
- foreach($data as $key){
|
|
|
|
|
- $array[] = $key['home'];
|
|
|
|
|
- $array[] = $key['guest'];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// foreach($data as $key){
|
|
|
|
|
+// $array[] = $key['home'];
|
|
|
|
|
+// $array[] = $key['guest'];
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
//修改足球比分前的比分数据
|
|
//修改足球比分前的比分数据
|
|
|
$res = \App\Models\Stzqresult::where('match_id', $match_id)->first();
|
|
$res = \App\Models\Stzqresult::where('match_id', $match_id)->first();
|
|
|
- //$scores = json_decode($res['penalty_card'],true);
|
|
|
|
|
|
|
+ $scores = json_decode($res['manual_result'],true);
|
|
|
$process = array();//进程
|
|
$process = array();//进程
|
|
|
- if($res['home_score'] != $data['all']['home'] || $res['guest_score'] != $data['all']['guest']){
|
|
|
|
|
|
|
+ //主队上半场角球
|
|
|
|
|
+ if($scores['half_corner']['home'] != $data['half_corner']['home']){
|
|
|
|
|
+ $process[] = 'half_corner_home';
|
|
|
|
|
+ }
|
|
|
|
|
+ //客队上半场角球
|
|
|
|
|
+ if($scores['half_corner']['guest'] != $data['half_corner']['guest']){
|
|
|
|
|
+ $process[] = 'half_corner_guest';
|
|
|
|
|
+ }
|
|
|
|
|
+ //主队全场角球
|
|
|
|
|
+ if($scores['all_corner']['home'] != $data['all_corner']['home']){
|
|
|
|
|
+ $process[] = 'all_corner_home';
|
|
|
|
|
+ }
|
|
|
|
|
+ //客队全场角球
|
|
|
|
|
+ if($scores['all_corner']['guest'] != $data['all_corner']['guest']){
|
|
|
|
|
+ $process[] = 'all_corner_guest';
|
|
|
|
|
+ }
|
|
|
|
|
+ //主队上半场罚牌
|
|
|
|
|
+ if($scores['half_penalty']['home'] != $data['half_penalty']['home']){
|
|
|
|
|
+ $process[] = 'half_penalty_home';
|
|
|
|
|
+ }
|
|
|
|
|
+ //客队上半场罚牌
|
|
|
|
|
+ if($scores['half_penalty']['guest'] != $data['half_penalty']['guest']){
|
|
|
|
|
+ $process[] = 'half_penalty_guest';
|
|
|
|
|
+ }
|
|
|
|
|
+ //主队全场罚牌
|
|
|
|
|
+ if($scores['all_penalty']['home'] != $data['all_penalty']['home']){
|
|
|
|
|
+ $process[] = 'all_penalty_home';
|
|
|
|
|
+ }
|
|
|
|
|
+ //客队全场罚牌
|
|
|
|
|
+ if($scores['all_penalty']['guest'] != $data['all_penalty']['guest']){
|
|
|
|
|
+ $process[] = 'all_penalty_guest';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if($scores['all']['home'] != $data['all']['home'] || $scores['all']['guest'] != $data['all']['guest']){
|
|
|
$process[] = 'all';
|
|
$process[] = 'all';
|
|
|
}
|
|
}
|
|
|
- if($res['u_home_score'] != $data['half']['home'] || $res['u_guest_score'] != $data['half']['guest']){
|
|
|
|
|
|
|
+ if($scores['half']['home'] != $data['half']['home'] || $scores['half']['guest'] != $data['half']['guest']){
|
|
|
$process[] = 'half';
|
|
$process[] = 'half';
|
|
|
}
|
|
}
|
|
|
//print_r($process);exit;
|
|
//print_r($process);exit;
|
|
@@ -561,6 +724,7 @@ class SportsfootController extends Controller {
|
|
|
$model->corner_ball = json_encode($cornerball,JSON_UNESCAPED_UNICODE);
|
|
$model->corner_ball = json_encode($cornerball,JSON_UNESCAPED_UNICODE);
|
|
|
$model->first_score = json_encode($firstone,JSON_UNESCAPED_UNICODE);
|
|
$model->first_score = json_encode($firstone,JSON_UNESCAPED_UNICODE);
|
|
|
$model->is_correct = 1;
|
|
$model->is_correct = 1;
|
|
|
|
|
+ $model->manual_result = json_encode($data,JSON_UNESCAPED_UNICODE);
|
|
|
$model->save();
|
|
$model->save();
|
|
|
|
|
|
|
|
$update = $this->addcomendnotice($match_id);
|
|
$update = $this->addcomendnotice($match_id);
|
|
@@ -617,6 +781,7 @@ class SportsfootController extends Controller {
|
|
|
'corner_ball' => json_decode($newapp['corner_ball'],true),
|
|
'corner_ball' => json_decode($newapp['corner_ball'],true),
|
|
|
'penalty_card' => json_decode($newapp['penalty_card'],true),
|
|
'penalty_card' => json_decode($newapp['penalty_card'],true),
|
|
|
'first_score' => json_decode($newapp['first_score'],true),
|
|
'first_score' => json_decode($newapp['first_score'],true),
|
|
|
|
|
+ 'manual_result' => json_decode($newapp['manual_result'],true),
|
|
|
'newapp' => $newapp,
|
|
'newapp' => $newapp,
|
|
|
);
|
|
);
|
|
|
return $array;
|
|
return $array;
|
|
@@ -1052,5 +1217,14 @@ class SportsfootController extends Controller {
|
|
|
$model->save();
|
|
$model->save();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //获取赛事进程数据
|
|
|
|
|
+ function getprocess(Req $req){
|
|
|
|
|
+ $type = $req->type;
|
|
|
|
|
+
|
|
|
|
|
+ $process = commonFunction::getprocess($type);
|
|
|
|
|
+ return json_encode($process);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|