彭俊 пре 6 година
родитељ
комит
a0fdefd7bd

+ 1 - 1
app/Http/Controllers/Admin/BaseLeagueController.php

@@ -31,7 +31,7 @@ class BaseLeagueController extends Controller {
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/BaseLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));

+ 1 - 1
app/Http/Controllers/Admin/BasketLeagueController.php

@@ -31,7 +31,7 @@ class BasketLeagueController extends Controller {
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/BasketLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));

+ 3 - 3
app/Http/Controllers/Admin/BqChampionsLeagueController.php

@@ -36,7 +36,7 @@ class BqChampionsLeagueController extends Controller
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/BqChampionsLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));
@@ -61,7 +61,7 @@ class BqChampionsLeagueController extends Controller
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
 
         $where = array();
-        //$where[] = array('st_bq_league.identity', '=', '');
+        $where[] = array('st_bq_odds.type', 1);
         if (!empty($name_chinese)) {
             if (empty($sureblur) || $sureblur == 'off') {
                 $where[] = array('st_bq_league.name_chinese', 'like', '%' . $name_chinese . '%');
@@ -84,7 +84,7 @@ class BqChampionsLeagueController extends Controller
 
         $newapp = new \App\Models\BaseLeague();
         $data = $newapp->get_league_gj_info($list, $page, $where);
-        $allcount = \App\Models\BaseLeague::where($where)->distinct('name_chinese')->count();
+        $allcount = $newapp->join('st_bq_odds','st_bq_odds.lg_id', '=', 'st_bq_league.id')->where($where)->distinct('st_bq_league.name_chinese')->count('st_bq_league.name_chinese');
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $allcount);
     }
 

+ 3 - 3
app/Http/Controllers/Admin/LqChampionsLeagueController.php

@@ -36,7 +36,7 @@ class LqChampionsLeagueController extends Controller
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/LqChampionsLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));
@@ -61,7 +61,7 @@ class LqChampionsLeagueController extends Controller
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
 
         $where = array();
-        //$where[] = array('st_lq_league.identity', '=', '');
+        $where[] = array('st_lq_odds.type', 1);
         if (!empty($name_chinese)) {
             if (empty($sureblur) || $sureblur == 'off') {
                 $where[] = array('st_lq_league.name_chinese', 'like', '%' . $name_chinese . '%');
@@ -84,7 +84,7 @@ class LqChampionsLeagueController extends Controller
 
         $newapp = new \App\Models\BasketLeague();
         $data = $newapp->get_league_gj_info($list, $page, $where);
-        $allcount = \App\Models\BasketLeague::where($where)->distinct('name_chinese')->count();
+        $allcount = $newapp->join('st_lq_odds','st_lq_odds.lg_id', '=', 'st_lq_league.id')->where($where)->distinct('st_lq_league.name_chinese')->count('st_lq_league.name_chinese');
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $allcount);
     }
 

+ 1 - 1
app/Http/Controllers/Admin/SoccerLeagueController.php

@@ -30,7 +30,7 @@ class SoccerLeagueController extends Controller {
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/SoccerLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));

+ 74 - 6
app/Http/Controllers/Admin/SoccerNoteListController.php

@@ -610,7 +610,7 @@ class SoccerNoteListController extends Controller
         return responseToJson($data);
     }
 
-    //单式订直接手动更改输赢结果并结算
+    //单式订单数据
     public function manualmatchget(Req $req)
     {
         $order_id = isset($req->order_id) ? $req->order_id : 0;
@@ -622,25 +622,93 @@ class SoccerNoteListController extends Controller
         } else {
             return responseToJson(-1, 'false', $ret);
         }
-        
-    }
 
+    }
 
     //单式订直接手动更改输赢结果并结算
     public function manualmatchpdate(Req $req)
     {
         $order_id = isset($req->order_id) ? $req->order_id : 0;
         $datas = isset($req->matchdata) ? $req->matchdata : [];
+        $datas = json_decode($datas, true);
         if (empty($order_id) || empty($datas)) {
             return responseToJson(-1, '参数不能为空!');
         }
 
-        //$simple = new  \App\Models\MoneyBuy;
-        //$match_datas = \App\Models\MoneyBuyMatch::where('match_id', $req->order_id)->get()->toArray();
+        $model = new  \App\Models\SportsNoteList();
+        $modeldata = $model->getorder($order_id);
+        if (empty($modeldata)) {
+            return responseToJson(-1, 'false');
+        }
 
+        $sdataArr = [];
+        foreach ($datas as $val) {
+            $tmp_id = $val['id'];
+            $tmp_result = intval($val['result']);
+            $tmp_matchword = trim($val['matchresult']);
+            if (!in_array($tmp_result, [-1, 1, 2, 3, 4])) {
+                continue;
+            }
+            $sdataArr[$tmp_id] = ['result' => $tmp_result, 'matchresult' => $tmp_matchword];
+        }
+        if (empty($sdataArr)) {
+            return responseToJson(-2, '没有要更新的数据');
+        }
+
+        $chageNum = 0;
+        foreach ($modeldata->matchdatas as $key => $val) {
+            $id = $val->id;
+            if (isset($sdataArr[$id])) {
+                if ($val->result != $sdataArr[$id]['result'] || $val->matchwork != $sdataArr[$id]['matchresult']) {
+                    $val->result = $sdataArr[$id]['result'];
+                    $val->matchresult = $sdataArr[$id]['matchresult'];
+                    $val->save();
+                    $chageNum++;
+                }
+            }
+        }
+        if ($chageNum) {
+            $modeldata->is_manual = 1;
+            $modeldata->save();
+        } else {
+            return responseToJson(1, '没有更新操作数据!');
+        }
+
+        $data = [
+            'token' => 'oclatv15689731035d84a12f550df',    //外网
+            'order_ids' => $modeldata->order_id,
+            'bettype' => 1,
+            'settype' => 2,
+            'game_code' => $modeldata->game_code,
+            'match_id' => $modeldata->match_id,
+            'change_status' => 0,
+            'is_manual' => 1,
+        ];
+        $ret = $this->request_post('http://stadmin.bocai108.com:9094/Settelement', $data);
+
+        return responseToJson(1, '更新成功');
+
+    }
 
-        return responseToJson(1, '成功');
 
+    private 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;
     }
 
 

+ 1 - 1
app/Http/Controllers/Admin/TennisLeagueController.php

@@ -31,7 +31,7 @@ class TennisLeagueController extends Controller {
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/TennisLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));

+ 3 - 3
app/Http/Controllers/Admin/WqChampionsLeagueController.php

@@ -36,7 +36,7 @@ class WqChampionsLeagueController extends Controller
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/WqChampionsLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));
@@ -62,7 +62,7 @@ class WqChampionsLeagueController extends Controller
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
 
         $where = array();
-        //$where[] = array('st_wq_league.identity', '=', '');
+        $where[] = array('st_wq_odds.type', 1);
         if (!empty($name_chinese)) {
             if (empty($sureblur) || $sureblur == 'off') {
                 $where[] = array('st_wq_league.name_chinese', 'like', '%' . $name_chinese . '%');
@@ -85,7 +85,7 @@ class WqChampionsLeagueController extends Controller
 
         $newapp = new \App\Models\TennisLeague();
         $data = $newapp->get_league_gj_info($list, $page, $where);
-        $allcount = \App\Models\TennisLeague::where($where)->distinct('name_chinese')->count();
+        $allcount = $newapp->join('st_wq_odds','st_wq_odds.lg_id', '=', 'st_wq_league.id')->where($where)->distinct('st_wq_league.name_chinese')->count('st_wq_league.name_chinese');
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $allcount);
     }
 

+ 3 - 5
app/Http/Controllers/Admin/ZqChampionsLeagueController.php

@@ -37,7 +37,7 @@ class ZqChampionsLeagueController extends Controller
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/ZqChampionsLeague/info');
         $dt->setLang('sportsbase');
-        $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
+        $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 120));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('area', array('sort' => false, 'width' => 180));
         $dt->addColsFields('country', array('sort' => true, 'width' => 180));
@@ -62,7 +62,7 @@ class ZqChampionsLeagueController extends Controller
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
 
         $where = array();
-        //$where[] = array('st_zq_league.identity', '=', '');
+        $where[] = array('st_zq_odds.type', 1);
         if (!empty($name_chinese)) {
             if (empty($sureblur) || $sureblur == 'off') {
                 $where[] = array('st_zq_league.name_chinese', 'like', '%' . $name_chinese . '%');
@@ -85,9 +85,7 @@ class ZqChampionsLeagueController extends Controller
         
         $newapp = new \App\Models\SoccerLeague();
         $data = $newapp->get_league_gj_info($list, $page, $where);
-        $allcount = \App\Models\SoccerLeague::where($where)->distinct('name_chinese')->count(); 
-
-        // $allcount = $newapp->countnum($where);//去重
+        $allcount = $newapp->join('st_zq_odds','st_zq_odds.lg_id', '=', 'st_zq_league.id')->where($where)->distinct('st_zq_league.name_chinese')->count('st_zq_league.name_chinese');
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $allcount);
     }
 

+ 14 - 0
app/Http/Controllers/Api/WriteSportsController.php

@@ -703,6 +703,20 @@ class WriteSportsController extends BaseController
                                 'team_g' => $data['guest_team'],
                             ];
                             $setTeame = StTeamModel::setTeam($game_code, $team, $source);
+
+                            //追加写赛事结果
+                            $opt = [
+                                'match_id' => $data,
+                                'lg_id' => $lg_id,
+                                'match_id' => $id,
+                                'models' => $models,
+                                'gameName' => $gameName,
+                                'game_code' => $game_code,
+                            ];
+
+                            $setMatchResult = ZqResultModel::set_result($opt);
+
+
                         }
                     }
                 }

+ 193 - 0
app/Http/Model/StZqResult.php

@@ -330,6 +330,148 @@ class StZqResult extends Model
         return 1;
     }
 
+    /**
+     * 测试新结果写入
+     */
+    public static function ZQresult_xxx($model){
+        //获取当天开始并且已结束的所有赛事
+        $matchData = $model['model_match']::select('id','home_team','guest_team','lg_id','status','tag','match_date','match_time')
+            ->where([['match_date','>',date('Y-m-d', strtotime("-2 day"))],['status','=',2]])
+            ->get()
+            ->toArray();
+
+        //获取赛事结果表 一天内
+        $matchData_r = $model['model_result']::select('match_id','is_correct')
+            ->where([['start_time','>',date('Y-m-d H:i:s', strtotime("-2 day"))],['status','=',2]])
+            ->get()
+            ->toArray();
+            dd($matchData_r);
+
+        if(!empty($matchData_r)){
+            //如果结果表有数据,则获取结果表没有的赛事
+            foreach ($matchData as $k => $v) {
+                foreach ($matchData_r as $kk => $vv) {
+                    if ($v['id'] == $vv['match_id']) {
+                        unset($matchData[$k]);
+                    }
+                }
+            }
+
+        }
+
+        //没有数据,无需操作
+        if(empty($matchData)) return Response::success();
+
+        //获取赛事id 用于获取赛事对应结果比分
+        $match_ids = [];
+        foreach($matchData as $k =>$v){
+            //只获取赛事已结束的
+            if($v['status'] == 2){
+                $match_ids[] = $v['id'];
+            }
+        }
+
+
+        $match_ids_str = implode(",", $match_ids);
+        
+        //上半场
+        $sql_h = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process,a.all_goal,a.first_score,a.last_score,a.match_score,a.match_winer from st_zq_result_record a,
+        (select match_id,max(id) id from st_zq_result_record where match_process = '半场' and match_id IN ($match_ids_str) group by match_id)b
+        where a.match_id = b.match_id and a.id = b.id ";
+
+        //全场
+        $sql_f = "select a.match_id,a.home_score,a.guest_score,a.match_time as a_time,a.match_process,a.all_goal,a.first_score,a.last_score,a.match_score,a.match_winer,a.home_rate,a.guest_rate from st_zq_result_record a,
+        (select match_id,max(id) id from st_zq_result_record where match_id IN ($match_ids_str) group by match_id)b
+        where a.match_id = b.match_id and a.id = b.id ";
+
+
+        //上半场最终结果
+        $match_result_h = DB::select($sql_h);
+
+        //全场最终结果
+        $match_result_f = DB::select($sql_f);
+
+        //拼装赛事结果数据
+        $match_result_record = [];
+        if(!empty($match_result_h) and !empty($match_result_f)){
+            foreach($match_result_h as $k=>$v){
+                foreach($match_result_f as $kk=>$vv){
+                    if($v->match_id == $vv->match_id){
+                        $match_result_record[$k] = [
+                            "match_id"=>$v->match_id,
+                            "home_score"=> $vv->home_score,
+                            "guest_score"=> $vv->guest_score,
+                            "a_time"=> $vv->a_time,
+                            "match_process"=> $vv->match_process,
+                            "all_goal"=> $vv->all_goal,
+                            "first_score"=> $vv->first_score,
+                            "last_score"=> $vv->last_score,
+                            "match_score"=> $vv->match_score,
+                            "match_winer"=> $vv->match_winer,
+                            "u_home_score"=> $v->home_score,
+                            "u_guest_score"=> $v->guest_score,
+                            "home_rate"=> $vv->home_rate,
+                            "guest_rate"=> $vv->guest_rate,
+                        ];
+                    }
+                }
+            }
+        }
+        
+
+        //组装赛果数据
+        if(!empty($match_result_record)){
+            foreach ($matchData as $k=>$v){
+                $start_time = ($v['match_date'].' '.$v['match_time']);
+                $time = time()-strtotime($v['match_time']);
+                $match_time = self::secTime($time);
+                foreach($match_result_record as $kk =>$vv){        
+                    if($v['id'] == $vv['match_id']){
+                        //获取获胜球队
+                        if(($vv['home_score']) > ($vv['guest_score'])){
+                            $match_winer = $v['home_team'];
+                        }else{
+                            $match_winer = $v['guest_team'];
+                        }
+                        $set_match_r[] = [
+                            "match_id"=> $v['id'],
+                            "home_team"=>$v['home_team'],
+                            "guest_team"=>$v['guest_team'],
+                            "lg_id"=>$v['lg_id'],
+                            "status"=>$v['status'],
+                            "tag"=> $v['tag'],
+                            'match_time'=>$vv['a_time']?:0,//比赛进行时间
+                            "ctime"=>date('Y-m-d H:i:s'),
+                            "update_time"=>date('Y-m-d H:i:s'),
+                            "start_time"=>date('Y-m-d H:i:s',strtotime($start_time)),
+
+                            "home_rate"=> $vv['home_rate']?:0, //主队让球
+                            "guest_rate"=> $vv['guest_rate']?:0, //客队让球
+                            "home_score"=> $vv['home_score']?:0, //主队进球数
+                            "guest_score"=> $vv['guest_score']?:0, //客队进球数
+                            "all_goal"=> $vv['all_goal']?:0, //总进球数
+                            // "first_score"=> $vv['first_score']?:'', //最先进球球队
+                            // "last_score"=> $vv['last_score']?:'', //最后进球球队
+                            "match_score"=> $vv['match_score']?:0, //赛事比分
+                            "match_winer"=>  $match_winer?:'',//获胜球队
+                            "match_process"=> $vv['match_process']?:'',//比赛进程
+                            "u_home_score"=> $vv['u_home_score']?:0,//上半场主队进球数
+                            "u_guest_score"=> $vv['u_guest_score']?:0,//上半场客队进球数
+                        ];                        
+                    }                   
+                }
+            }
+        }
+
+        //写入赛果
+        if(!empty($set_match_r)){
+            $ret = $model['model_result']::insert($set_match_r);
+            if($ret != true) throw new \Exception( Response::generate('',Response::ADD_MATCH_R_ERROR));
+        }
+
+        return 1;
+    }
+
 
     //计算滚球 赛事进行时间
     public static function secTime($sec=0){
@@ -337,4 +479,55 @@ class StZqResult extends Model
         $res = $min.':'.($sec-$min*60);
         return $res;
     }
+
+    /**
+     * 写入预植赛果
+     */
+    public static function set_result($opt = []){
+        if(!empty($opt)){
+
+            //赛事数据
+            $data = $opt['data'];
+            //获取开始时间
+            $start_time = ($data['match_date'].' '.$data['match_time']);
+
+            $match_result = [
+                "match_id"=> $opt['match_id'],
+                "lg_id"=>$opt['lg_id'],
+                "status"=>$data['status'],
+                "tag"=> 0,
+                'match_time'=>0,//比赛进行时间
+                "ctime"=>date('Y-m-d H:i:s'),
+                "update_time"=>date('Y-m-d H:i:s'),
+                "start_time"=>date('Y-m-d H:i:s',strtotime($start_time)),
+            ];
+
+            //根据球类赋值
+            if($opt['game_code'] == 'zq'){//足球
+                $match_result['home_team'] = $data['home_team'];
+                $match_result['guest_team'] = $data['guest_team'];
+            }
+            if($opt['game_code'] == 'lq'){//篮球
+                $match_result['home_team'] = $data['home_team'];
+                $match_result['guest_team'] = $data['guest_team'];
+            }
+            if($opt['game_code'] == 'wq'){//网球
+                $match_result['home_player_name'] = $data['home_team'];
+                $match_result['guest_player_name'] = $data['guest_team'];
+            }
+            if($opt['game_code'] == 'bq'){//棒球
+                $match_result['home_team'] = $data['home_team'];
+                $match_result['guest_team'] = $data['guest_team'];
+            }
+
+            //获取model
+            $models = $opt['models'];
+
+            //执行写入
+            $ret_id = $models['model_result']::insertGetId($match_result);
+
+            //如果失败,返回异常
+            if ($ret_id < 1) throw new \Exception(Response::generate($opt['gameName'] . '赛事-match_id:' . $opt['match_id'] . ';', Response::SET_MATCH_ERR));
+        }
+    }
 }

+ 6 - 0
app/Http/Response/Response.php

@@ -56,6 +56,9 @@ class Response
     //===删除无效赔率失败===
     const DEL_ODDS_ERR = 10041;
 
+    //===写预植赛果失败===
+    const SET_MATCH_ERR = 10042;
+
 
     private static $errorMsgs = [
         self::SUCCESS => '成功',
@@ -104,6 +107,9 @@ class Response
         //===删除无效赔率失败===
         self::DEL_ODDS_ERR =>'删除无效赔率失败',
 
+        //===写预植赛果失败===
+        self::SET_MATCH_ERR =>'写预植赛果失败',
+
     ];
 
     public static function getMsg($code)

+ 2 - 3
app/Models/BaseLeague.php

@@ -44,7 +44,7 @@ class BaseLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';
@@ -110,7 +110,6 @@ class BaseLeague extends BaseModel {
             $data = $this
                 ->join('st_bq_odds','st_bq_odds.lg_id','=','st_bq_league.id')
                 ->select('st_bq_league.id','st_bq_league.name_chinese','st_bq_league.area_id','st_bq_league.country_id','st_bq_league.status','st_bq_league.utime')
-                ->where('st_bq_odds.type',1)
                 ->distinct('st_bq_league.name_chinese')
                 ->orderby('st_bq_league.utime','desc')
                 ->paginate ($list);
@@ -125,7 +124,7 @@ class BaseLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';

+ 2 - 5
app/Models/BasketLeague.php

@@ -46,7 +46,7 @@ class BasketLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';
@@ -97,7 +97,6 @@ class BasketLeague extends BaseModel {
         return $data->toArray();
     }
 
-
     //测试冠军联赛数据
     function get_league_gj_info($list = 10, $page, $where = '')
     {
@@ -113,7 +112,6 @@ class BasketLeague extends BaseModel {
             $data = $this
                 ->join('st_lq_odds','st_lq_odds.lg_id','=','st_lq_league.id')
                 ->select('st_lq_league.id','st_lq_league.name_chinese','st_lq_league.area_id','st_lq_league.country_id','st_lq_league.status','st_lq_league.utime')
-                ->where('st_lq_odds.type',1)
                 ->distinct('st_lq_league.name_chinese')
                 ->orderby('st_lq_league.utime','desc')
                 ->paginate ($list);
@@ -128,7 +126,7 @@ class BasketLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';
@@ -163,7 +161,6 @@ class BasketLeague extends BaseModel {
             }
 
         }
-
         return $data->toArray();
     }
 }

+ 2 - 4
app/Models/SoccerLeague.php

@@ -48,7 +48,7 @@ class SoccerLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';
@@ -115,7 +115,6 @@ class SoccerLeague extends BaseModel {
                 ->join('st_zq_odds','st_zq_odds.lg_id','=','st_zq_league.id')
                 ->select('st_zq_league.id','st_zq_league.name_chinese','st_zq_league.area_id','st_zq_league.country_id','st_zq_league.status','st_zq_league.utime')
                 ->where($where)
-                ->where('st_zq_odds.type',1)
                 ->orderby('st_zq_league.utime','desc')
                 ->distinct('st_zq_league.name_chinese')
                 ->paginate ($list);
@@ -123,7 +122,6 @@ class SoccerLeague extends BaseModel {
             $data = $this
                 ->join('st_zq_odds','st_zq_odds.lg_id','=','st_zq_league.id')
                 ->select('st_zq_league.id','st_zq_league.name_chinese','st_zq_league.area_id','st_zq_league.country_id','st_zq_league.status','st_zq_league.utime')
-                ->where('st_zq_odds.type',1)
                 ->orderby('st_zq_league.utime','desc')
                 ->distinct('st_zq_league.name_chinese')
                 ->paginate ($list);
@@ -138,7 +136,7 @@ class SoccerLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';

+ 2 - 3
app/Models/TennisLeague.php

@@ -47,7 +47,7 @@ class TennisLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';
@@ -114,7 +114,6 @@ class TennisLeague extends BaseModel {
             $data = $this
                 ->join('st_wq_odds','st_wq_odds.lg_id','=','st_wq_league.id')
                 ->select('st_wq_league.id','st_wq_league.name_chinese','st_wq_league.area_id','st_wq_league.country_id','st_wq_league.status','st_wq_league.utime')
-                ->where('st_wq_odds.type',1)
                 ->distinct('st_wq_league.name_chinese')
                 ->orderby('st_wq_league.utime','desc')
                 ->paginate ($list);
@@ -129,7 +128,7 @@ class TennisLeague extends BaseModel {
         $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
 
         for($i=0;$i<count($data);$i++){
-            //$data[$i]->id = $data[$i]->lg_id;
+            $data[$i]->lg_id = $data[$i]->id;
 
             if($data[$i]->status == '-1'){
                 $data[$i]->league_status = '未启用';

+ 2 - 2
resources/lang/zh-cn/sportsnotelist.php

@@ -25,8 +25,8 @@ return array(
     'water_return' => '反水',
     'money_time' => '下注时间',
     'prize' => '开奖号码',
-    'settle_status' => '状态',
-    'game_status' => '状态',
+    'settle_status' => '结算状态',
+    'game_status' => '结算状态',
     'match_status' => '状态',
     'member_type' => '会员类型',
     'edit' => '修改',

+ 98 - 9
resources/views/sports/sports_notelist.blade.php

@@ -3,7 +3,7 @@
     足球单式注单管理
 @endsection
 @section('content')
-  
+
     <script type="text/html" id="game_status">
         @{{#if(d.is_champion==1){ }}
             <a href="/admin/SoccerNoteList/orderupgj?id=@{{d.lg_id}}&order=@{{d.order_id}}" class="layui-btn layui-btn-sm layui-btn-green set">修改结果</a>
@@ -11,20 +11,25 @@
             <button onclick="addResult('@{{d.id}}','{{$type}}')" class="layui-btn layui-btn-sm layui-btn-green set">修改结果</button>
         @{{#} }}
 
-        @{{#if(d.settle_status==1){ }} 
+        @{{#if(d.settle_status==1){ }}
             <span>未结算</span>
         @{{#} }}<br>
         @{{#if(d.settle_status==2){ }}
             <span>已结算</span>
         @{{#} }}
-        
-        @{{#if(d.status==2 || d.status==3 || d.status==5){ }} 
+
+        @{{#if(d.status==2 || d.status==3 || d.status==5){ }}
             <button onclick="resettlement('@{{d.order_id}}','{{$type}}','@{{d.match_id}}')" class="layui-btn layui-btn-sm settlement">再1结算</button>
         @{{#} }}
-        @{{#if(d.status==1){ }} 
+        @{{#if(d.status==1){ }}
             <button onclick="resettlement('@{{d.order_id}}','{{$type}}','@{{d.match_id}}')" class="layui-btn layui-btn-sm settlement">结算</button>
         @{{#} }}
-        
+
+        @{{#if(d.status==2 || d.status==3 || d.status==5){ }}
+            <button onclick="resettlement('@{{d.order_id}}','{{$type}}','@{{d.match_id}}')" class="layui-btn layui-btn-sm settlement">再1结算</button>
+        @{{#} }}
+            <button onclick="setScore('@{{d.order_id}}','@{{d.match_id}}')" class="layui-btn layui-btn-sm settlement">设置比分</button>
+
     </script>
 
     <script type="text/html" id="status">
@@ -210,7 +215,7 @@
                         ,content:conttxt
                     });
                 }
-            }) 
+            })
         }
 
         function czClick() {
@@ -237,7 +242,7 @@
             var guest_score = $("#guest_score").val();//客队得分
             var u_guest_score = $("#u_guest_score").val();// 上半场客队得分
             var u_home_score = $("#u_home_score").val();//上半场主队得分
-          
+
             $.ajax({
                 type: 'POST',
                 dataType: 'json',
@@ -248,7 +253,7 @@
                     location. reload()//刷新当前页面
                 }
             })
-            
+
         }
 
 
@@ -394,6 +399,90 @@
             })
         }
 
+        // 设置结算比分
+        function setScore(order_id, match_id) {
+          // 请求订单数据
+          $.getJSON("/admin/SoccerNoteList/manualmatchget", {'order_id' : order_id}, function(res){
+            if(1 == res.status){
+              const getData = res.data.matchdatas;
+              let content = '<div class="ibox-content" id="box" style="width: 600px !important;">';
+              let id = '';
+              let teamName = '';
+              // 拼接玩法数据
+              for (let o in getData) {
+                id = getData[o].id;
+                teamName = getData[o].home_team + ' VS ' + getData[o].guest_team + ' - ' + getData[o].guest_team;
+                content +=
+                    '        <div style="margin-top: 10px; margin-bottom: 10px;">' +
+                    '            <div style="color: #5f5f5f; margin-left: 10px; margin-bottom: 10px;">' + teamName + '</div>' +
+                    '            <div class="col-5 layui-inline">' +
+                    '                <label class="layui-form-label">结算比分:</label>' +
+                    '                <div class="layui-input-inline" style="">' +
+                    '                    <input type="text" name="" id="resultInfo' + id + '" placeholder="请输入结算比分" eventType="event-query" lay-verify="required" autocomplete="off" class="layui-input">' +
+                    '                </div>' +
+                    '            </div>' +
+                    '            <div class="col-5 layui-inline">' +
+                    '                <label class="layui-form-label">订单结果:</label>' +
+                    '                <div class="layui-input-inline" style="">' +
+                    '                    <select name="order_status"  id="teamResult' + id + '"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>' +
+                    '                        <option value="-1" selected>输</option>' +
+                    '                        <option value="1">赢</option>' +
+                    '                        <option value="2">平</option>' +
+                    '                        <option value="3">半赢半平</option>' +
+                    '                        <option value="4">半输半平</option>' +
+                    '                    </select>' +
+                    '                </div>' +
+                    '            </div>' +
+                    '        </div>' +
+                    '        <div style="border-bottom: 2px dashed #cbcbcb;"></div>';
+              }
+              content += '</div>';
+              // 打开弹窗.
+              layer.open({
+                area: ['600px', '300px'], //宽高
+                type: 1,
+                title: '设置比分',
+                content: content, //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响,
+                btn: ['提交', '取消'],
+                yes: function(index, layero){
+                  let matchdata = [];
+                  let teamResult = '';
+                  let resultInfo = '';
+                  // 循环获取输入的数据.
+                  for (let o in getData) {
+                    id = getData[o].id;
+                    teamResult = $("#teamResult" + id).val();
+                    resultInfo = $("#resultInfo" + id).val();
+                    matchdata.push({id: id, result: teamResult, matchresult: resultInfo})
+                  }
+                  matchdata = JSON.stringify(matchdata);
+                  // 请求设置接口
+                  $.ajax({
+                    type: 'POST',
+                    dataType: 'json',
+                    url: '/admin/SoccerNoteList/manualmatchpdate',
+                    data: {order_id: order_id, matchdata: matchdata},
+                    success: function(res) {
+                      if (1 == res.status) {
+                        layer.alert("设置成功", {title: '友情提示', icon: 1, closeBtn: 0}, function(){
+                          window.location.reload();
+                        });
+                      } else {
+                        layer.alert("服务器异常", {title: '友情提示', icon: 2});
+                      }
+                    },
+                    error: function () {
+                      layer.alert("服务器异常", {title: '友情提示', icon: 2});
+                    }
+                  })
+                },
+              });
+            } else {
+              layer.alert("数据拉取失败", {title: '友情提示', icon: 2});
+            }
+          });
+        }
+
         //单式注单作废
         function invalid(url,ids) {
             layer.confirm('是否确认作废?', {