|
|
@@ -14,68 +14,122 @@ use Request;
|
|
|
*/
|
|
|
class SportsfootController extends Controller {
|
|
|
|
|
|
- // function Settlement(Req $req){
|
|
|
- // $jsurl = config('sconstant.url');//结算请求域名地址
|
|
|
- // $match_id = $req->match_id;
|
|
|
- // $type = $req->type;
|
|
|
- // $token = session('adminInfo.token');
|
|
|
- // $notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
|
|
|
- // $noticeid = $notice['id'];
|
|
|
- // //查询赛事单式是否有订单
|
|
|
- // $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
- // $simplex_ids = array_column($newapp->allsimplexorder($match_id,'zq'),'order_id');
|
|
|
- // $str_ids = array_column($newapp->allstrorder($match_id),'order_id');
|
|
|
-
|
|
|
- // if($simplex_ids && $str_ids){
|
|
|
- // $requet = file_get_contents($jsurl."/WinFail?noticeid=".$noticeid."&token=".$token);
|
|
|
-
|
|
|
- // if(json_decode($requet,true)['status']==1){
|
|
|
- // //单式结算
|
|
|
- // if($simplex_ids){
|
|
|
- // $simplex = array(
|
|
|
- // 'token'=>$token,
|
|
|
- // 'order_ids'=>'', //订单id字符串,用半角都好分隔
|
|
|
- // 'bettype'=>1, //结算类型 1单式 2串式
|
|
|
- // 'settype'=>$type, //结算次数 1首次 2非首冷饮
|
|
|
- // 'game_code'=>'zq', //赛事类型 zq lq wq bq
|
|
|
- // 'match_id'=>$match_id, // 赛事ID
|
|
|
- // 'change_status'=>1 //是否改状态
|
|
|
- // );
|
|
|
- // $url=$jsurl.'/Settelement';
|
|
|
- // $newapp = new \App\Models\Stzqresult();
|
|
|
- // $simplex_res = $newapp->post_curls($url,$simplex);//返回json
|
|
|
- // $huawei_res = json_decode($simplex_res,true);
|
|
|
- // }
|
|
|
+ function Settlement(Req $req){
|
|
|
+ $jsurl = config('sconstant.url');//结算请求域名地址
|
|
|
+ $match_id = $req->match_id;
|
|
|
+ $type = $req->type;
|
|
|
+ $token = session('adminInfo.token');
|
|
|
+ $notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
|
|
|
+ $noticeid = $notice['id'];
|
|
|
+ //查询赛事单式是否有订单(足球)
|
|
|
+ $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
+ $simplex_ids = array_column($newapp->allsimplexorder($match_id,'zq'),'order_id');
|
|
|
+ $str_ids = array_column($newapp->allstrorder($match_id),'order_id');
|
|
|
+
|
|
|
+ if(count($simplex_ids)>0 || count($str_ids)>0){
|
|
|
+ $requet = file_get_contents($jsurl."/WinFail?noticeid=".$noticeid."&token=".$token);
|
|
|
+ // return $requet;
|
|
|
+ if(json_decode($requet,true)['status']==1){
|
|
|
+ //单式结算
|
|
|
+ if($simplex_ids){
|
|
|
+ $simplex = array(
|
|
|
+ 'token'=>$token,
|
|
|
+ 'order_ids'=>'', //订单id字符串,用半角都好分隔
|
|
|
+ 'bettype'=>1, //结算类型 1单式 2串式
|
|
|
+ 'settype'=>2, //结算次数 1首次 2非首冷饮
|
|
|
+ 'game_code'=>'zq', //赛事类型 zq lq wq bq
|
|
|
+ 'match_id'=>$match_id, // 赛事ID
|
|
|
+ 'change_status'=>1 //是否改状态
|
|
|
+ );
|
|
|
+ $url=$jsurl.'/Settelement';
|
|
|
+ $newapp = new \App\Models\Stzqresult();
|
|
|
+ $simplex_res = $newapp->post_curls($url,$simplex);//返回json
|
|
|
+ $huawei_res = json_decode($simplex_res,true);
|
|
|
+ }
|
|
|
|
|
|
- // //串式结算
|
|
|
- // if($str_ids){
|
|
|
- // $tandem = array(
|
|
|
- // 'token'=>$token,
|
|
|
- // 'order_ids'=>'', //订单id字符串,用半角都好分隔
|
|
|
- // 'bettype'=>2, //结算类型 1单式 2串式
|
|
|
- // 'settype'=>$type, //结算次数 1首次 2非首冷饮
|
|
|
- // 'game_code'=>'zq', //赛事类型 zq lq wq bq
|
|
|
- // 'match_id'=>$match_id, // 赛事ID
|
|
|
- // 'change_status'=>1 //是否改状态
|
|
|
- // );
|
|
|
- // $url=$jsurl.'/Settelement';
|
|
|
- // $tandem_res = $newapp->post_curls($url,$tandem);//返回json
|
|
|
- // $tandem_res = json_decode($tandem_res,true);
|
|
|
- // }
|
|
|
- // if($huawei_res['status']==1 || $tandem_res['status']==1){
|
|
|
- // return json_encode(['status'=>1,'msg'=>'结算成功']);
|
|
|
- // }else{
|
|
|
- // return json_encode(['status'=>3,'msg'=>'结算有误,请联系管理员!!!']);//结算错误
|
|
|
- // }
|
|
|
- // }else{
|
|
|
- // return json_encode(['status'=>2,'msg'=>'结算有错,请联系管理员!!!']);;//输赢错误
|
|
|
- // }
|
|
|
- // }else{
|
|
|
- // $res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
|
|
|
- // $res = \App\Models\SportsSoccer::where ('match_id', $match_id)->update(['status' =>3]);
|
|
|
- // return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
|
|
|
- // }
|
|
|
- // }
|
|
|
+ //串式结算
|
|
|
+ if($str_ids){
|
|
|
+ $tandem = array(
|
|
|
+ 'token'=>$token,
|
|
|
+ 'order_ids'=>'', //订单id字符串,用半角都好分隔
|
|
|
+ 'bettype'=>2, //结算类型 1单式 2串式
|
|
|
+ 'settype'=>2, //结算次数 1首次 2非首冷饮
|
|
|
+ 'game_code'=>'zq', //赛事类型 zq lq wq bq
|
|
|
+ 'match_id'=>$match_id, // 赛事ID
|
|
|
+ 'change_status'=>1 //是否改状态
|
|
|
+ );
|
|
|
+ $url=$jsurl.'/Settelement';
|
|
|
+ $tandem_res = $newapp->post_curls($url,$tandem);//返回json
|
|
|
+ $tandem_res = json_decode($tandem_res,true);
|
|
|
+ }
|
|
|
+ if($huawei_res['status']==1 || $tandem_res['status']==1){
|
|
|
+ return json_encode(['status'=>1,'msg'=>'结算成功']);
|
|
|
+ }else{
|
|
|
+ return json_encode(['status'=>3,'msg'=>'结算有误,请联系管理员!!!']);//结算错误
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return json_encode(['status'=>2,'msg'=>'结算有错,请联系管理员!!!']);;//输赢错误
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
|
|
|
+ $res = \App\Models\SportsSoccer::where ('match_id', $match_id)->update(['status' =>3]);
|
|
|
+ return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加危险球列表
|
|
|
+ function addwarn(Req $req){
|
|
|
+ $match_id = $req->match_id;
|
|
|
+ $warn = \App\Models\Stzqresult::where('match_id', $match_id)->select("warn_more")->first();
|
|
|
+ $request['warnmore'] = json_decode($warn['warn_more'],true);
|
|
|
+ $request['match_id'] = $match_id;
|
|
|
+ // return
|
|
|
+ return view('admin.sportsfoot/addwarn', $request);
|
|
|
+ }
|
|
|
+
|
|
|
+ //危险球查询
|
|
|
+ function warnresult(Req $req){
|
|
|
+ $match_id = $req->match_id;
|
|
|
+ $warnonlys = \App\Models\Stzqresult::where('match_id', $match_id)->select("warn_more")->first();
|
|
|
+ $warnonly = json_decode($warnonlys['warn_more'],true);
|
|
|
+ return $warnonly;
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加编辑危险球
|
|
|
+ function addwarnonly(Req $req){
|
|
|
+ $matchid = $req->matchid;
|
|
|
+ $wid = $req->wid;//编辑对象值
|
|
|
+ $timei = $req->timei?$req->timei:"1970-11-1 0:0:1";
|
|
|
+ $rtype = $req->warntype?$req->warntype:0;
|
|
|
+ $model = \App\Models\Stzqresult::where('match_id', $matchid)->select("warn_more")->first()->toArray();
|
|
|
+ $sel = json_decode($model['warn_more'],true);
|
|
|
+ $addru = array(
|
|
|
+ array(
|
|
|
+ 'timei'=>$timei,
|
|
|
+ 'rtype'=>$rtype,
|
|
|
+ ),
|
|
|
+ );
|
|
|
+
|
|
|
+ if(!$wid){
|
|
|
+ if($sel[0]['rtype']==0){
|
|
|
+ //首次添加
|
|
|
+ $res = \App\Models\Stzqresult::where ('match_id', $matchid)->update(['warn_more' => json_encode($addru)]);
|
|
|
+ }else{
|
|
|
+ //再次添加
|
|
|
+ $upnum = array_merge_recursive($sel,$addru);
|
|
|
+ $res = \App\Models\Stzqresult::where ('match_id', $matchid)->update(['warn_more' => json_encode($upnum)]);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //编辑
|
|
|
+ for ($i=0; $i < count($sel); $i++) {
|
|
|
+ $sel[$wid]['timei'] = $timei;
|
|
|
+ $sel[$wid]['rtype'] = $rtype;
|
|
|
+ }
|
|
|
+ $res = \App\Models\Stzqresult::where ('match_id', $matchid)->update(['warn_more' => json_encode($sel)]);
|
|
|
+ }
|
|
|
+
|
|
|
+ return responseToJson(1);
|
|
|
+ }
|
|
|
|
|
|
//足球结果列表
|
|
|
function outcome(Req $req) {
|
|
|
@@ -167,86 +221,86 @@ class SportsfootController extends Controller {
|
|
|
}
|
|
|
|
|
|
//结算 allhalf全场1,半场0
|
|
|
- function Settlement(Req $req){
|
|
|
- $allhalf = $req->allhalf?$req->allhalf:'';
|
|
|
- if(intval($allhalf)){
|
|
|
- //赛事id
|
|
|
- $id = $req->input('id');
|
|
|
- if (empty($id)) {
|
|
|
- return responseToJson(-2001); //
|
|
|
- }
|
|
|
- $ids = explode(',', $id);
|
|
|
- if (!is_array($ids) && intval($ids) < 0) {
|
|
|
- return responseToJson(-2002); //
|
|
|
- }
|
|
|
- if (is_array($ids) && count($ids) > 0) {
|
|
|
- foreach ($ids as $k => $v) {
|
|
|
- if (intval($v) < 1) {
|
|
|
- unset($ids[$k]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for ($i=0; $i < count($ids); $i++) {
|
|
|
- $model = \App\Models\Stzqresult::where('id', $ids[$i])->select("match_id","status")->first();
|
|
|
- //查询赛事下所有订单
|
|
|
- $ssid = $model['match_id'];//赛事id
|
|
|
- if($model['status']==2){
|
|
|
- $type = 1;;//是否再结算1,首次结算2,再次结算
|
|
|
- }else{
|
|
|
- $type = 2;
|
|
|
- }
|
|
|
+ // function Settlement(Req $req){
|
|
|
+ // $allhalf = $req->allhalf?$req->allhalf:'';
|
|
|
+ // if(intval($allhalf)){
|
|
|
+ // //赛事id
|
|
|
+ // $id = $req->input('id');
|
|
|
+ // if (empty($id)) {
|
|
|
+ // return responseToJson(-2001); //
|
|
|
+ // }
|
|
|
+ // $ids = explode(',', $id);
|
|
|
+ // if (!is_array($ids) && intval($ids) < 0) {
|
|
|
+ // return responseToJson(-2002); //
|
|
|
+ // }
|
|
|
+ // if (is_array($ids) && count($ids) > 0) {
|
|
|
+ // foreach ($ids as $k => $v) {
|
|
|
+ // if (intval($v) < 1) {
|
|
|
+ // unset($ids[$k]);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // for ($i=0; $i < count($ids); $i++) {
|
|
|
+ // $model = \App\Models\Stzqresult::where('id', $ids[$i])->select("match_id","status")->first();
|
|
|
+ // //查询赛事下所有订单
|
|
|
+ // $ssid = $model['match_id'];//赛事id
|
|
|
+ // if($model['status']==2){
|
|
|
+ // $type = 1;;//是否再结算1,首次结算2,再次结算
|
|
|
+ // }else{
|
|
|
+ // $type = 2;
|
|
|
+ // }
|
|
|
|
|
|
- $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
- $simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
|
|
|
- $str_ids = array_column($newapp->allstrorder($ssid),'order_id');
|
|
|
-
|
|
|
- $data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
|
|
|
- if($data){
|
|
|
- $tapp = new \App\Lib\Settlement\SettlementWinFail();
|
|
|
- \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
|
|
|
- $ret = $tapp->doRun($data->toArray()['id']);
|
|
|
- $ret2 =$data->toArray()['id'];
|
|
|
- if ($ret2['status']==1){
|
|
|
- \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
|
|
|
- }
|
|
|
- }
|
|
|
+ // $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
+ // $simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
|
|
|
+ // $str_ids = array_column($newapp->allstrorder($ssid),'order_id');
|
|
|
+
|
|
|
+ // $data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
|
|
|
+ // if($data){
|
|
|
+ // $tapp = new \App\Lib\Settlement\SettlementWinFail();
|
|
|
+ // \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
|
|
|
+ // $ret = $tapp->doRun($data->toArray()['id']);
|
|
|
+ // $ret2 =$data->toArray()['id'];
|
|
|
+ // if ($ret2['status']==1){
|
|
|
+ // \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- $SettlementOrder = new SettlementOrder();
|
|
|
- $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid,$allhalf);//串式
|
|
|
- $data = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid,$allhalf);//单式注单
|
|
|
- }
|
|
|
- return responseToJson(1);
|
|
|
- }else{
|
|
|
- //查询赛事下所有订单
|
|
|
- $ssid = $req->match_id;//赛事id
|
|
|
- $type = $req->type;//是否再结算1,首次结算2,再次结算
|
|
|
+ // $SettlementOrder = new SettlementOrder();
|
|
|
+ // $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid,$allhalf);//串式
|
|
|
+ // $data = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid,$allhalf);//单式注单
|
|
|
+ // }
|
|
|
+ // return responseToJson(1);
|
|
|
+ // }else{
|
|
|
+ // //查询赛事下所有订单
|
|
|
+ // $ssid = $req->match_id;//赛事id
|
|
|
+ // $type = $req->type;//是否再结算1,首次结算2,再次结算
|
|
|
|
|
|
- $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
- $simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
|
|
|
- $str_ids = array_column($newapp->allstrorder($ssid),'order_id');
|
|
|
-
|
|
|
- $data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
|
|
|
- if($data){
|
|
|
- $tapp = new \App\Lib\Settlement\SettlementWinFail();
|
|
|
- \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
|
|
|
- $ret = $tapp->doRun($data->toArray()['id']);
|
|
|
+ // $newapp = new \App\Models\MoneyBuyMatch();
|
|
|
+ // $simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
|
|
|
+ // $str_ids = array_column($newapp->allstrorder($ssid),'order_id');
|
|
|
+
|
|
|
+ // $data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
|
|
|
+ // if($data){
|
|
|
+ // $tapp = new \App\Lib\Settlement\SettlementWinFail();
|
|
|
+ // \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
|
|
|
+ // $ret = $tapp->doRun($data->toArray()['id']);
|
|
|
|
|
|
- $ret2 =$data->toArray()['id'];
|
|
|
- if ($ret2['status']==1){
|
|
|
- \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
|
|
|
- }
|
|
|
-
|
|
|
- if($ret['status']==1){
|
|
|
- $SettlementOrder = new SettlementOrder();
|
|
|
- $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid);//串式
|
|
|
- $nda = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid);//单式注单
|
|
|
- return responseToJson($nda);
|
|
|
- }else{
|
|
|
- return responseToJson($ret);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ // $ret2 =$data->toArray()['id'];
|
|
|
+ // if ($ret2['status']==1){
|
|
|
+ // \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if($ret['status']==1){
|
|
|
+ // $SettlementOrder = new SettlementOrder();
|
|
|
+ // $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid);//串式
|
|
|
+ // $nda = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid);//单式注单
|
|
|
+ // return responseToJson($nda);
|
|
|
+ // }else{
|
|
|
+ // return responseToJson($ret);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
//作废
|
|
|
function revokeft(Req $req){
|