浏览代码

追加自动结算

彭俊 6 年之前
父节点
当前提交
523bfd2ba1

+ 58 - 0
app/Http/Controllers/Api/SettlementAutoController.php

@@ -0,0 +1,58 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use  Illuminate\Routing\Controller as Controller;
+use  App\Lib\Settlement\SettlementAuto;
+use Illuminate\Support\Facades\DB;
+use App\Lib\Biz\Sport\Common;
+
+
+class SettlementAutoController extends Controller
+{
+    public function doAddNotie()
+    {
+        if (!$this->safecheck()) {
+            Common::SET_NOMAM_RECORD('自动结算验证失败(doaddnotice) ', array_merge($_REQUEST, ['ip' => $_SERVER['REMOTE_ADDR']]));
+            exit();
+        }
+
+        $obj = new SettlementAuto();
+        $obj->doAddNotie();
+        return true;
+    }
+
+    public function doAutoSett()
+    {
+        if (!$this->safecheck()) {
+            Common::SET_NOMAM_RECORD('自动结算验证失败(doAutoSett) ', array_merge($_REQUEST, ['ip' => $_SERVER['REMOTE_ADDR']]));
+            exit();
+        }
+
+        $obj = new SettlementAuto();
+        $obj->doAutoSett();
+        return true;
+    }
+
+
+    private function safecheck()
+    {
+        $ip = $_SERVER['REMOTE_ADDR'];
+        $ipreg = "/(^127\.0\.0\.1$)|(^172\.18\.0\.\d{1,3}$)|(^172\.17\.0\.\d{1,3}$)|(^103\.108\.41\.11\d$)/";
+        $token = $_REQUEST['token'];
+
+        $ret = preg_match($ipreg, $ip);
+        if (!$ret) {
+            return false;
+        }
+
+        $us = DB::table('system_user')->where(['token' => $token])->first();
+        if (!$us) {
+            return false;
+        }
+
+        return true;
+    }
+
+
+}

+ 32 - 5
app/Http/Controllers/Api/SettlementController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
 use App\Http\Model\StSettlementMiddleDetail;
 use App\Lib\Settlement\Adapter\RulePlus;
 use App\Lib\Settlement\Adapter\ZqRule;
+use App\Lib\Settlement\SettlementAuto;
 use App\Lib\Settlement\SettlementOrder;
 use App\Lib\Settlement\Adapter\WqRule;
 
@@ -15,11 +16,21 @@ use  Illuminate\Routing\Controller as Controller;
 use Illuminate\Support\Facades\DB;
 use App\Lib\Biz\Sport\WagentProxy;
 
+use App\Models\Comendnotice as ComendnoticeModel;
+use App\Models\MoneyBuyMatch as MoneyBuyMatchModel;
+use App\Lib\Biz\Sport\Common;
+
 
 class SettlementController extends Controller
 {
     use RulePlus;
 
+    public function AutoSett()
+    {
+
+
+    }
+
     public function index()
     {
         $dd = new ZqRule();
@@ -35,6 +46,21 @@ class SettlementController extends Controller
 
     public function debug(Req $req)
     {
+        $auto = new SettlementAuto();
+        $auto->doAutoSett();
+
+        return;
+
+
+        print_r($_SERVER);
+        exit;
+
+        $model = new MoneyBuyMatchModel();
+        $ret = $model->countByMatch(758);
+        print_r($ret);
+
+        exit;
+
 
         /*
         $model = new  \App\Models\StoddsCode();
@@ -45,19 +71,20 @@ class SettlementController extends Controller
 
 
         $order_id = isset($req->order_id) ? $req->order_id : 0;
-        $model  = new  \App\Models\SportsNoteList();
+        $model = new  \App\Models\SportsNoteList();
         $ret = $model->getorder($order_id);
 
-        if ($ret){
+        if ($ret) {
             $ret = $ret->toArray();
         }
 
-        print_r($ret);exit ;
+        print_r($ret);
+        exit;
 
-        return responseToJson(1, '成功',$ret);
+        return responseToJson(1, '成功', $ret);
 
 
-        return ;
+        return;
         $match = DB::table('money_buy_match')->where(['batch_id' => '20190916094717519851520'])->first();
         $result = DB::table('st_zq_result')->where(['match_id' => '2115'])->get();
         //$result = DB::table('st_wq_result')->where(['id' => '20'])->get();

+ 17 - 2
app/Lib/Biz/Sport/Common.php

@@ -721,7 +721,7 @@ class Common
                     $model_local_match = new StZqLocalMatch;
                     $model_broadcast = new StZqBroadcast;
                     $model_result_express = new StZqResultExpress;
-                    
+
                     break;
                 case 'lq':
                     $model_league = new StLqLeague;
@@ -1289,7 +1289,22 @@ class Common
         Log::info('--->msg:' . $msg . ';data:' . $json_data);
     }
 
-    /* 
+    //写入赛事数据日志文件
+    static function SET_NOMAM_RECORD($msg, $getData = [], $fileName = '')
+    {
+        $json_data = json_encode($getData, JSON_UNESCAPED_UNICODE);
+        Log::getMonolog()->popHandler();
+        if ($fileName) {
+            $lastfileName = date('Y-m', time()) . '_' . $fileName . '.log';
+        } else {
+            $lastfileName = date('Y-m', time()) . '.log';
+        }
+        Log::useFiles(storage_path('logs/' . $lastfileName), 'info');
+        Log::info($msg . ' -- ' . $json_data);
+    }
+
+
+    /*
      * 根据二维数组某个字段的值查找数组
      * $array 数组
      * 查询字段

+ 114 - 0
app/Lib/Settlement/SettlementAuto.php

@@ -0,0 +1,114 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019/4/25
+ * Time: 14:10
+ */
+
+namespace App\Lib\Settlement;
+set_time_limit(600);
+ini_set('memory_limit', '256M');
+
+use Illuminate\Support\Facades\DB;
+use App\Lib\Settlement\SettlementBase;
+
+use App\Models\MoneyBuyMatch as MoneyBuyMatchModel;
+use App\Models\Comendnotice as ComendnoticeModel;
+use App\Lib\Biz\Sport\Common;
+
+
+/**
+ * 自动结算相关功能
+ */
+class SettlementAuto
+{
+    public function doAddNotie()
+    {
+        $model = new ComendnoticeModel();
+        $ret = $model->InsertEndGame();
+        return $ret;
+    }
+
+
+    public function doAutoSett()
+    {
+        $ccmodel = new ComendnoticeModel();
+        $model = $ccmodel->getNeedSettelent();
+        if (empty($model)) {
+            return 0;
+        }
+        Common::SET_NOMAM_RECORD('开始自动结算! ' . $model->match_id);
+
+        $model->pcount = 1;
+        $model->start_time = date('Y-m-d H:i:s', time());
+        $model->status = 1;
+        $model->save();
+
+        $mbmm = new MoneyBuyMatchModel();
+        $count = $mbmm['count'];
+        if (!$count) {
+            $model->status = 4;
+            $model->save();
+            $this->cgStatus($model->game_code, $model->match_id);
+            Common::SET_NOMAM_RECORD('结束自动结算(无match记录)! ' . $model->match_id);
+            return 0;
+        }
+
+        $winret = $this->SubmitSettelement('w', ['noticeid' => $model->id, 'token' => $_REQUEST['token']]);
+        if ($winret) {
+            $dataComm = [
+                'match_id' => $model->match_id,
+                'game_code' => $model->game_code,
+                'change_status' => 1,
+                'settype' => 2,
+                'is_manaue' => 0,
+                'order_ids' => '',
+                'token' => $_REQUEST['token']
+            ];
+            if ($mbmm['bet1'] > 0) {
+                $this->SubmitSettelement('s', array_merge($dataComm, ['bet_type' => 1]));
+            }
+            if ($mbmm['bet2'] > 0) {
+                $this->SubmitSettelement('s', array_merge($dataComm, ['bet_type' => 2]));
+            }
+            return true;
+        }
+        return false;
+    }
+
+
+    //提交结算
+    public function SubmitSettelement($type, $datas)
+    {
+        $url = config('sconstant.url');
+        $wsurls = ['w' => '/WinFail', 's' => '/Settelement'];
+
+        //$token = 'oclatv15689731035d84a12f550df';
+        //$datas = array_merge(['token' => $token], $datas);
+
+        $fullurl = $url . $wsurls[$type];
+        $ret = request_post($fullurl, $datas);
+        if (!empty($ret)) {
+            $retarr = json_decode($ret, true);
+            Common::SET_NOMAM_RECORD('自动结算返回: ', ['type' => $type, 'req' => $datas, 'rt' => $retarr]);
+            if (isset($retarr['status']) && $retarr['status'] == 1) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    function cgStatus($game_code, $match_id)
+    {
+        $table1 = "st_" . $game_code . "_result";
+        $table2 = "st_" . $game_code . "_competition";
+
+        DB::update("update $table1 set  status=3  where   match_id=$match_id ");
+        DB::update("update $table2 set  status=3  where   id=$match_id ");
+
+        return true;
+    }
+
+
+}

+ 67 - 17
app/Models/Comendnotice.php

@@ -1,29 +1,79 @@
 <?php
 /**
-*------Create thems Model------
-*------SCWPHP  Version 1.0.0------
-*------Dev Model Jions------
-*------Create Time 2017-06-13 18:45:24------
-*/
+ *------Create thems Model------
+ *------SCWPHP  Version 1.0.0------
+ *------Dev Model Jions------
+ *------Create Time 2017-06-13 18:45:24------
+ */
+
 namespace App\Models;
+
 use DB;
+use App\Models\MoneyBuyMatch as MoneyBuyMatchModel;
+
 
-class Comendnotice extends BaseModel {
+class Comendnotice extends BaseModel
+{
 
     protected $table = 'comendnotice';
     public $timestamps = false;
-    protected $fillable=['status','pcount','logs','game_code','match_id','result','done_time','start_time','ctime'];
+    protected $fillable = ['status', 'pcount', 'logs', 'game_code', 'match_id', 'result', 'done_time', 'start_time', 'ctime'];
 
     //添加赛事结束纪录
-	function addcomendnotice($match_id,$type){
-		$data = $this->where(['match_id'=>$match_id,'game_code'=>$type])->first();
-		if(!$data){
-			$res=$this->insert(['game_code'=>$type,'status'=>0,'pcount'=>1,'match_id'=>$match_id,'ctime'=>date('Y-m-d H:i:s')]);
-			if(!$res){
-	            return -6030001222;
-	        }
-		}
-		return 1;
-	}
+    function addcomendnotice($match_id, $type, $pcount = 1, $game_start_time = 0)
+    {
+        $data = $this->where(['match_id' => $match_id, 'game_code' => $type])->first();
+        if (!$data) {
+            $res = $this->insert(['game_code' => $type, 'status' => 0, 'pcount' => $pcount, 'game_start_time' => $game_start_time, 'match_id' => $match_id, 'ctime' => date('Y-m-d H:i:s')]);
+            if (!$res) {
+                return -6030001222;
+            }
+        }
+        return 1;
+    }
+
+    //
+    public function getNeedSettelent()
+    {
+        $lastDay = date("Y-m-d H:i:s", time() - 86400 * 30);
+        $now = date("Y-m-d H:i:s", time() - 5 * 36000);
+
+        $model = $this->where([['game_start_time', '>=', $now], ['ctime', '>=', $lastDay], ['pcount', '=', 0]])->orderBy('id', 'asc')->first();
+        return $model;
+    }
+
+    //找到比赛已经结束,还没结算的记录,插入到消息通知表里[多个球类]
+    public function InsertEndGame($day = 30)
+    {
+        $types = ['zq', 'lq', 'wq', 'bq'];
+        foreach ($types as $gtype) {
+            $rows = $this->findByType($gtype, $day);
+            if (!empty($rows) && count($rows) > 0) {
+                foreach ($rows as $matchidObj) {
+                    $matchid = $matchidObj->match_id;
+                    $start_time = $matchidObj->start_time;
+                    $this->addcomendnotice($matchid, $gtype, 0, $start_time);
+                }
+            }
+        }
+        return true;
+    }
+
+
+    public function findByType($type, $days = 30)
+    {
+        $days = intval($days);
+        $time = date("Y-m-d 00:00:00", (time() - 86400 * $days));
+        $table = "st_" . $type . "_result";
+        $sql = <<<EOS
+    select tabb.match_id,tabb.start_time  from 
+( select  match_id,start_time  from  $table where start_time>='$time'  and status=2 ) as tabb
+where match_id not in (select match_id from  comendnotice  where game_code='$type')
+order by match_id asc 
+EOS;
+        $result = DB::select($sql);
+        return $result;
+    }
+
 
 }

+ 45 - 18
app/Models/MoneyBuyMatch.php

@@ -8,62 +8,89 @@
 
 namespace App\Models;
 
-
+use Illuminate\Support\Facades\DB;
 use Illuminate\Database\Eloquent\Model;
 
 class MoneyBuyMatch extends Model
 {
-    protected $table='money_buy_match';
+    protected $table = 'money_buy_match';
     public $timestamps = false;
 
-    public function getByAttrs($where,$orderArray=[]){
-        if (empty($order)){
+    public function getByAttrs($where, $orderArray = [])
+    {
+        if (empty($order)) {
             $datas = $this->where($where)->get();
-        }else{
-            $datas = $this->where($where)->orderby($orderArray['orderby'],$orderArray['order'])->get();
+        } else {
+            $datas = $this->where($where)->orderby($orderArray['orderby'], $orderArray['order'])->get();
         }
-        return $datas ;
+        return $datas;
     }
 
-  	//赛事下所有下注单式下单
-    function allsimplexorder($ssid,$code){ 
+    //赛事下所有下注单式下单
+    function allsimplexorder($ssid, $code)
+    {
         //单式下单
         $where = array();
         $where[] = array('money_buy_match.match_id', '=', $ssid);
         $where[] = array('money_buy_match.bet_type', '=', 1);
         $where[] = array('money_buy_match.game_code', '=', $code);
-        $data = $this->join('money_buy_simplex','money_buy_match.batch_id','=','money_buy_simplex.batch_id')->select('money_buy_simplex.order_id','money_buy_simplex.money','money_buy_simplex.account_identity','money_buy_simplex.info_identity','money_buy_simplex.match_id')->where($where)->get()->toArray();
+        $data = $this->join('money_buy_simplex', 'money_buy_match.batch_id', '=', 'money_buy_simplex.batch_id')->select('money_buy_simplex.order_id', 'money_buy_simplex.money', 'money_buy_simplex.account_identity', 'money_buy_simplex.info_identity', 'money_buy_simplex.match_id')->where($where)->get()->toArray();
         return $data;
     }
 
     //赛事下所有下注串式下单
-    function allstrorder($ssid){
+    function allstrorder($ssid)
+    {
         //串式下单
         $where = array();
         $where[] = array('money_buy_match.match_id', '=', $ssid);
         $where[] = array('money_buy_match.bet_type', '=', 2);
-        $data = $this->join('money_buy_str','money_buy_match.batch_id','=','money_buy_str.batch_id')->select('money_buy_str.order_id')->where($where)->get()->toArray();
+        $data = $this->join('money_buy_str', 'money_buy_match.batch_id', '=', 'money_buy_str.batch_id')->select('money_buy_str.order_id')->where($where)->get()->toArray();
         return $data;
     }
 
     //修改串式下注状态
-    function updatast($match_id){
+    function updatast($match_id)
+    {
         $the = array(
-            'updated_at'=>date('Y-m-d H:i:s'),
-            'result'=>2,
+            'updated_at' => date('Y-m-d H:i:s'),
+            'result' => 2,
         );
         $where = array(
-        	'match_id'=>$match_id,
-        	'bet_type'=>2,
+            'match_id' => $match_id,
+            'bet_type' => 2,
         );
 
         $res = $this->where($where)->update($the);
-          
+
         if (!$res) {
             return -4010000102; //更新失败
         }
         return $res;
     }
 
+    //某个赛事的单式和串式条数统计
+    public function countByMatch($matchID)
+    {
+        $matchID = intval($matchID);
+
+        $sqla = "select count(id) as mcount from  money_buy_match where match_id=$matchID and  bet_type=1 and   order_id in( select order_id from  money_buy_simplex where match_id=$matchID and is_manual=0 )";
+        $sqlb = "select count(id) as mcount from  money_buy_match where match_id=$matchID and  bet_type=2 ";
+
+        $reta = DB::select($sqla);
+        $retb = DB::select($sqlb);
+
+        $ret1 = $ret2 = 0;
+        if ($reta && isset($reta['0']->mcount)) {
+            $ret1 = intval($reta['0']->mcount);
+        }
+
+        if ($retb && isset($retb['0']->mcount)) {
+            $ret2 = intval($retb['0']->mcount);
+        }
+
+        return ['bet1' => $ret1, 'bet2' => $ret2, 'count' => $ret1 + $ret2];
+    }
+
 
 }

+ 78 - 36
public/function.php

@@ -16,35 +16,38 @@ function appExec($module, $class, $action)
  * @param integer $return
  * @return void
  */
-function computeTime($runName='',$return=0,$start=1){
-    $curTime= get_millisecond();
-    $oldTime=LARAVEL_START;
-	$numTime=$curTime-(intval($oldTime)*1000);
-	if($return){
-		return array('curTime'=>$curTime,'numTime'=>$numTime,'runName'=>$runName);
-	}else{
-		echo "<pre>执行{$runName} 功能,当前时间为:{$curTime},累积用时: {$numTime}</pre>";
-		return;
-	}
+function computeTime($runName = '', $return = 0, $start = 1)
+{
+    $curTime = get_millisecond();
+    $oldTime = LARAVEL_START;
+    $numTime = $curTime - (intval($oldTime) * 1000);
+    if ($return) {
+        return array('curTime' => $curTime, 'numTime' => $numTime, 'runName' => $runName);
+    } else {
+        echo "<pre>执行{$runName} 功能,当前时间为:{$curTime},累积用时: {$numTime}</pre>";
+        return;
+    }
 
 }
+
 function get_millisecond()
 {
     list($usec, $sec) = explode(" ", microtime());
     $msec = round($usec * 1000);
     return $sec . $msec;
 
-} 
+}
 
 //获取当日或指定日期年、月、日、周、季
-function GetpartTime($date=''){
-    $date = empty($date)?date('Y-m-d',time()):$date;
+function GetpartTime($date = '')
+{
+    $date = empty($date) ? date('Y-m-d', time()) : $date;
     $tstr = strtotime($date);
     $t = array();
-    $t['year'] = date('Y',$tstr);
-    $t['month'] = date('m',$tstr);
-    $t['day'] = date('d',$tstr);
-    $t['season'] = ceil($t['month']/3);
+    $t['year'] = date('Y', $tstr);
+    $t['month'] = date('m', $tstr);
+    $t['day'] = date('d', $tstr);
+    $t['season'] = ceil($t['month'] / 3);
     /*$time = $t['year'] . '-' . $t['month'];
     $weekday = date('w', strtotime($time));      //获取1号是周几
     if ($weekday == 1) {      //1号是周一
@@ -54,21 +57,22 @@ function GetpartTime($date=''){
     } else {
         $firstWeekDay = 8 - $weekday;
     }
-    $t['week'] = 1 + ceil(($t['day'] - $firstWeekDay) / 7);*/   
+    $t['week'] = 1 + ceil(($t['day'] - $firstWeekDay) / 7);*/
     $t['week'] = date('W', $tstr);
-    $t['wyear'] = ($t['month']==12 && $t['week']==1)?($t['year']+1):$t['year'];
+    $t['wyear'] = ($t['month'] == 12 && $t['week'] == 1) ? ($t['year'] + 1) : $t['year'];
     return $t;
 }
 
 //检测是否有权限,有权限返回True,没有权限false
 function checkRriv($code)
 {
-    if (($re=\App\Models\Role::hasRoot($code)) == 1) {
+    if (($re = \App\Models\Role::hasRoot($code)) == 1) {
 
         return true;
     }
     return false;
 }
+
 function arrayToOptions($data, $key, $val)
 {
     $options = array();
@@ -79,6 +83,7 @@ function arrayToOptions($data, $key, $val)
     }
     return $options;
 }
+
 function arrayToNumber($data, $field = array())
 {
 
@@ -94,6 +99,7 @@ function arrayToNumber($data, $field = array())
     }
     return $data;
 }
+
 function responseToJson($status, $msg = '', $data = '')
 {
     $return = array(); //返回数组
@@ -125,7 +131,7 @@ function responseToJson($status, $msg = '', $data = '')
  */
 function GenEncryption()
 {
-    srand((double) microtime() * 1000000); //create a random number feed.
+    srand((double)microtime() * 1000000); //create a random number feed.
     $ychar = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
     $list = explode(",", $ychar);
     $authnum = "";
@@ -157,6 +163,7 @@ function VerPassword($checkpwd, $enc, $ypwd)
     }
 
 }
+
 //订单号
 function OrderID($prefix = '')
 {
@@ -165,6 +172,7 @@ function OrderID($prefix = '')
     $order = date("YmdHis") . ($s * 1000000) . $num;
     return $prefix . $order;
 }
+
 //identity生产
 function UUID()
 {
@@ -189,6 +197,7 @@ function S($key, $value = '')
     }
     return $GLOBALS[$key] = $value;
 }
+
 /**
  * 获取客户端真实IP
  */
@@ -209,6 +218,7 @@ function GETIP()
     return $ip;
 
 }
+
 function OperationLog($id, $opt, $data)
 {
     $data = array(
@@ -249,6 +259,7 @@ function emailHide($email)
     }
     return $email;
 }
+
 //手机中间星号
 function phoneHide($phone)
 {
@@ -257,12 +268,14 @@ function phoneHide($phone)
     }
     return $phone;
 }
+
 //用户名中间星号
 function userHide($user_name)
 {
     $len = strlen($user_name) / 2;
     return substr_replace($user_name, str_repeat('*', $len), ceil(($len) / 2), $len);
 }
+
 //银行卡号中间星号
 function bankHide($bank)
 {
@@ -273,38 +286,67 @@ function bankHide($bank)
     $maskBankCardNo = $prefix . " ************ " . $suffix;
     return $maskBankCardNo;
 }
-function toLog($data){
+
+function toLog($data)
+{
     file_put_contents();
 }
+
 //生成token
-function createToken(){
+function createToken()
+{
     $enc = GenEncryption();
     $time = time();
     $token = substr(uniqid($enc . $time), 0, 35);
     return $token;
 }
+
 //更新token
-function refreshToken($admin_id){
-    $db=new \App\Models\System_user;
-    $token=createToken();
-    $res=$db->refreshToken($admin_id,$token);
-    if($res>0){
+function refreshToken($admin_id)
+{
+    $db = new \App\Models\System_user;
+    $token = createToken();
+    $res = $db->refreshToken($admin_id, $token);
+    if ($res > 0) {
         return $token;
     }
     return $res;
 }
+
 //检测token
-function checkToken($admin_id,$token){
-    $db=new \App\Models\System_user;
-    return $db->checkToken($admin_id,$token);
+function checkToken($admin_id, $token)
+{
+    $db = new \App\Models\System_user;
+    return $db->checkToken($admin_id, $token);
 }
 
 //保留小数位数
-function  floatPointDigit($data,$long=2){
-    $long = intval($long) ;
-    $for1 = "%.".$long."f" ;
-    $for2 = "%.".($long+1)."f" ;
-    return  sprintf($for1,substr(sprintf($for2, $data), 0, -1));
+function floatPointDigit($data, $long = 2)
+{
+    $long = intval($long);
+    $for1 = "%." . $long . "f";
+    $for2 = "%." . ($long + 1) . "f";
+    return sprintf($for1, substr(sprintf($for2, $data), 0, -1));
 }
 
+//构造请求
+function request_post($url = '', $param = '')
+{
+    if (empty($url) || empty($param)) {
+        return false;
+    }
+
+    $postUrl = $url;
+    $curlPost = $param;
+    $ch = curl_init();//初始化curl
+    curl_setopt($ch, CURLOPT_URL, $postUrl);//抓取指定网页
+    curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
+    curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
+    curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
+    $data = curl_exec($ch);//运行curl
+    curl_close($ch);
+
+    return $data;
+}
 

+ 39 - 34
routes/api.php

@@ -13,49 +13,54 @@ use Illuminate\Support\Facades\Route;
 |
 */
 
-$routes=array(
-    'getCurrentGame'=> exeApi('api','PrizeHandle','getNewprizeGamedata'),
-    'setCurrentGameStatus' => exeApi( 'api', 'PrizeHandle',  'updateCloses'),
-    'setCheckGame'=> exeApi('api','PrizeHandle','UpdateCheckgame'),
-    'getjnd28Info'=> exeApi('api','PrizeHandle','Getjnd28Info'),
-    'checkJnd28'=>exeApi('api','PrizeHandle', 'checkJnd28'),
-    'delGamebetInfo'=> exeApi('api','PrizeHandle','DelinfoBytime'),
-    'getOpeninfo' => exeApi( 'api', 'Basicinfo',  'getOnOrOff'),
-    'clearTable' => exeApi( 'api', 'Basicinfo',  'clearTable'),    //清空指定表数据
-    'addRecharge' => exeApi( 'api', 'Recharges',  'AddRecharge'),
+$routes = array(
+    'getCurrentGame' => exeApi('api', 'PrizeHandle', 'getNewprizeGamedata'),
+    'setCurrentGameStatus' => exeApi('api', 'PrizeHandle', 'updateCloses'),
+    'setCheckGame' => exeApi('api', 'PrizeHandle', 'UpdateCheckgame'),
+    'getjnd28Info' => exeApi('api', 'PrizeHandle', 'Getjnd28Info'),
+    'checkJnd28' => exeApi('api', 'PrizeHandle', 'checkJnd28'),
+    'delGamebetInfo' => exeApi('api', 'PrizeHandle', 'DelinfoBytime'),
+    'getOpeninfo' => exeApi('api', 'Basicinfo', 'getOnOrOff'),
+    'clearTable' => exeApi('api', 'Basicinfo', 'clearTable'),    //清空指定表数据
+    'addRecharge' => exeApi('api', 'Recharges', 'AddRecharge'),
     'odds' => exeApi('api', 'BetLog', 'odds'),
-    'rechargeMoney'=> exeApi('admin','Regulation','AddOrCutMoney'),
+    'rechargeMoney' => exeApi('admin', 'Regulation', 'AddOrCutMoney'),
     'countHistory' => exeApi('api', 'History', 'index'),
-    'HistoryCount'=>exeApi('api', 'History', 'count'),
-    'getBetLog'=> exeApi('api', 'BetLog', 'getBetLog'),
-    'updateBnumber'=>exeApi('admin', 'bnumber','update'),
+    'HistoryCount' => exeApi('api', 'History', 'count'),
+    'getBetLog' => exeApi('api', 'BetLog', 'getBetLog'),
+    'updateBnumber' => exeApi('admin', 'bnumber', 'update'),
     'batchUpdateBnumber' => exeApi('admin', 'bnumber', 'batchUpdate'),
-    'autoOpenPrize'=>exeApi('api', 'OpenPrize','open'),
-    'nagentCountwater'=>exeApi('api', 'PrizeHandle','CountWater'),  //级差代理业绩统计
-    'kygame'=>exeApi('api', 'Kygame','getPipelineRecord'),
-    'oggame'=>exeApi('api', 'Oggame','getPipelineRecord'),
-    'aggameDownloadFile'=>exeApi('api', 'Aggame','downloadFile'),
-    'aggameReadFile'=>exeApi('api', 'Aggame','readerFile'),
-    'a'=>exeApi('api', 'Aggame','aftp'),
-    'lcqpgame'=>exeApi('api', 'Lcqpgame','getPipelineRecord'),
-    'lygame'=>exeApi('api', 'Lygame','getPipelineRecord'),
-    'hjgame'=>exeApi('api', 'HjGame','getPipelineRecord'),
-    'ogsports'=>exeApi('api', 'Oggame_sport','getPipelineRecord'),
-    'fygame'=>exeApi('api', 'fyGame','getBetting'),
-    'settdebug'=>exeApi('api', 'Settlement','debug'),
-    'setSports'=>exeApi('api', 'WriteSports','setSports'),
-    'upMatch'=>exeApi('api', 'WriteSports','upMatch'),
-    'mysetSportsnew_odds'=>exeApi('api', 'WriteSportsnew','odds'),
+    'autoOpenPrize' => exeApi('api', 'OpenPrize', 'open'),
+    'nagentCountwater' => exeApi('api', 'PrizeHandle', 'CountWater'),  //级差代理业绩统计
+    'kygame' => exeApi('api', 'Kygame', 'getPipelineRecord'),
+    'oggame' => exeApi('api', 'Oggame', 'getPipelineRecord'),
+    'aggameDownloadFile' => exeApi('api', 'Aggame', 'downloadFile'),
+    'aggameReadFile' => exeApi('api', 'Aggame', 'readerFile'),
+    'a' => exeApi('api', 'Aggame', 'aftp'),
+    'lcqpgame' => exeApi('api', 'Lcqpgame', 'getPipelineRecord'),
+    'lygame' => exeApi('api', 'Lygame', 'getPipelineRecord'),
+    'hjgame' => exeApi('api', 'HjGame', 'getPipelineRecord'),
+    'ogsports' => exeApi('api', 'Oggame_sport', 'getPipelineRecord'),
+    'fygame' => exeApi('api', 'fyGame', 'getBetting'),
+    'settdebug' => exeApi('api', 'Settlement', 'debug'),
+
+    'autoSettadd' => exeApi('api', 'SettlementAuto', 'doAddNotie'),
+    'autoSettsett' => exeApi('api', 'SettlementAuto', 'doAutoSett'),
+
+    'setSports' => exeApi('api', 'WriteSports', 'setSports'),
+    'upMatch' => exeApi('api', 'WriteSports', 'upMatch'),
+    'mysetSportsnew_odds' => exeApi('api', 'WriteSportsnew', 'odds'),
 );
 
 function exeApi($m, $c, $act)
 {
     return array('m' => $m, 'c' => $c, 'act' => $act);
 }
-Route::any('/{name}', function ($name) use($routes) {
-    if(!isset($routes[$name])){
-        return responseToJson(-404,'404');
+
+Route::any('/{name}', function ($name) use ($routes) {
+    if (!isset($routes[$name])) {
+        return responseToJson(-404, '404');
     }
-    $target=$routes[$name];
+    $target = $routes[$name];
     return appExec($target['m'], $target['c'], $target['act']);
 })->middleware('api');