|
@@ -14,68 +14,68 @@ use Request;
|
|
|
*/
|
|
*/
|
|
|
class SportsfootController extends Controller {
|
|
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);
|
|
|
|
|
|
|
+ // 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);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 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);
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- //串式结算
|
|
|
|
|
- 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'=>$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'=>'该赛事没有任何订单,将会结束该赛事!!!']);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
//足球结果列表
|
|
//足球结果列表
|
|
|
function outcome(Req $req) {
|
|
function outcome(Req $req) {
|
|
@@ -167,86 +167,86 @@ class SportsfootController extends Controller {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//结算 allhalf全场1,半场0
|
|
//结算 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){
|
|
function revokeft(Req $req){
|