|
|
@@ -12,6 +12,10 @@ use Illuminate\Http\Request as Req;
|
|
|
use App\Http\Response\Response;
|
|
|
use App\Lib\Biz\Sport\Common as commonFunction;
|
|
|
use App\Http\Model\St_area_country as St_area_countryModel;
|
|
|
+use App\Http\Model\StBroadcast as broadcastModel;
|
|
|
+use App\Http\Model\StGameType as gameModel;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
class WriteSportsController extends BaseController{
|
|
|
|
|
|
@@ -19,21 +23,17 @@ class WriteSportsController extends BaseController{
|
|
|
* 体育数据入库接口
|
|
|
*/
|
|
|
public function setSports(Req $data){
|
|
|
-
|
|
|
try {
|
|
|
//开启事务
|
|
|
DB::beginTransaction();
|
|
|
- //当只有球类代码,则写滚球结果
|
|
|
if($data->game_code){
|
|
|
- //将所有进行中的赛事写入结果
|
|
|
+ //用于后台 将所有进行中的赛事写入结果
|
|
|
$this->match_result($data->game_code);
|
|
|
}
|
|
|
//写赛事数据
|
|
|
$obt = $data->data;
|
|
|
if($obt){
|
|
|
$getData = $this->getAddData($obt);
|
|
|
-// return Response::success($getData);
|
|
|
-
|
|
|
$league = [];
|
|
|
$competition = [];
|
|
|
$odds = [];
|
|
|
@@ -41,6 +41,7 @@ class WriteSportsController extends BaseController{
|
|
|
$match_result = [];
|
|
|
$match_result_record = [];
|
|
|
$odds_record = [];
|
|
|
+ $broadcast = [];
|
|
|
//指定排序
|
|
|
foreach ($getData as $k=>$v){
|
|
|
if($v['title'] == 'league') $league[] = $v;
|
|
|
@@ -50,18 +51,17 @@ class WriteSportsController extends BaseController{
|
|
|
if($v['title'] == 'match_result') $match_result[] = $v;
|
|
|
if($v['title'] == 'match_result_record') $match_result_record[] = $v;
|
|
|
if($v['title'] == 'odds_record') $odds_record[] = $v;
|
|
|
+ if($v['title'] == 'broadcast') $broadcast[] = $v;
|
|
|
+
|
|
|
}
|
|
|
- $matchData = [$league,$competition,$odds,$league_result,$match_result,$match_result_record,$odds_record];
|
|
|
+ $matchData = [$league,$competition,$odds,$league_result,$match_result,$match_result_record,$odds_record,$broadcast];
|
|
|
//排空处理
|
|
|
foreach ($matchData as $k=>$v){
|
|
|
if($v == []) unset($matchData[$k]);
|
|
|
}
|
|
|
-// $dd = [];
|
|
|
//根据顺序写入数据
|
|
|
-// return Response::success($matchData);
|
|
|
foreach ($matchData as $k=>$v){
|
|
|
foreach ($v as $kk =>$vv){
|
|
|
-
|
|
|
switch ($vv['title']){
|
|
|
case 'area'://地区
|
|
|
throw new \Exception(Response::generate(Response::AUTH_ERROR)) ;
|
|
|
@@ -70,8 +70,7 @@ class WriteSportsController extends BaseController{
|
|
|
throw new \Exception(Response::generate(Response::AUTH_ERROR));
|
|
|
break;
|
|
|
case 'league'://联赛
|
|
|
- $ret = $this->league($vv);
|
|
|
-// $dd[] = $ret;
|
|
|
+ $this->league($vv);
|
|
|
break;
|
|
|
case 'competition'://赛事
|
|
|
$this->competition($vv);
|
|
|
@@ -83,17 +82,21 @@ class WriteSportsController extends BaseController{
|
|
|
$this->league_result($vv);
|
|
|
break;
|
|
|
case 'match_result'://赛事结果
|
|
|
- throw new \Exception(Response::generate(Response::AUTH_ERROR));
|
|
|
+ throw new \Exception(Response::generate('',Response::AUTH_ERROR));
|
|
|
$this->match_result($vv);
|
|
|
break;
|
|
|
case 'match_result_record'://赛事结果记录
|
|
|
$this->com_result_record($vv);
|
|
|
break;
|
|
|
case 'odds_record'://赔率记录
|
|
|
+ throw new \Exception(Response::generate('',Response::AUTH_ERROR));
|
|
|
$this->odds_record($vv);
|
|
|
break;
|
|
|
+ case 'broadcast'://直播数据
|
|
|
+ $this->broadcast($vv);
|
|
|
+ break;
|
|
|
default:
|
|
|
- throw new \Exception(Response::generate(Response::ABNORMAL)) ;
|
|
|
+ throw new \Exception(Response::generate('',Response::ABNORMAL)) ;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -115,6 +118,25 @@ class WriteSportsController extends BaseController{
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
+ //写入直播 数据
|
|
|
+ public function broadcast($opt = []){
|
|
|
+ $data = $opt['data'];
|
|
|
+ $set_broadcast = [
|
|
|
+ "doing" => $data['doing'],
|
|
|
+ "game_type" => $data['game_type'],
|
|
|
+ "guest_team" => $data['guest_team'],
|
|
|
+ "host_team" => $data['host_team'],
|
|
|
+ "league_name" => $data['league_name'],
|
|
|
+ "shower" => $data['shower'],
|
|
|
+ "showid" => (int)$data['showid'],
|
|
|
+ "start_time" => $data['start_time'],
|
|
|
+ "ctime" =>date('Y-m-d H:m:i'),
|
|
|
+ "utime" =>date('Y-m-d H:m:i'),
|
|
|
+ ];
|
|
|
+ $ret = broadcastModel::insert($set_broadcast);
|
|
|
+ if($ret == false) throw new \Exception(Response::generate('',Response::BROADCAST_ERROR));
|
|
|
+ }
|
|
|
+
|
|
|
//将进行中赛事写入 赛事结果
|
|
|
public function match_result($game_code = ''){
|
|
|
$model =commonFunction::getModels($game_code,1);
|
|
|
@@ -150,7 +172,7 @@ class WriteSportsController extends BaseController{
|
|
|
];
|
|
|
}
|
|
|
$ret = $model['model_result']::insert($set_match_r);
|
|
|
- if($ret != true) return Response::generate(Response::ADD_MATCH_R_ERROR);
|
|
|
+ if($ret != true) throw new \Exception( Response::generate('',Response::ADD_MATCH_R_ERROR));
|
|
|
}
|
|
|
|
|
|
//如果结果表有数据,则获取结果表没有的赛事
|
|
|
@@ -179,7 +201,7 @@ class WriteSportsController extends BaseController{
|
|
|
];
|
|
|
}
|
|
|
$ret = $model['model_result']::insert($set_match_r);
|
|
|
- if($ret != true) return Response::generate(Response::ADD_MATCH_R_ERROR);//Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
|
|
|
+ if($ret != true) throw new \Exception( Response::generate('',Response::ADD_MATCH_R_ERROR));//Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
|
|
|
}
|
|
|
}
|
|
|
//写入地区数据 弃用
|
|
|
@@ -229,7 +251,7 @@ class WriteSportsController extends BaseController{
|
|
|
$set_lg['utime'] = date('Y-m-d H:m:i');
|
|
|
$id = $model['model_league']::insertGetId($set_lg);
|
|
|
$m_lg_id = $id;
|
|
|
- if($m_lg_id < 1) throw new \Exception(Response::generate(Response::INSERT_ERROR));
|
|
|
+ if($m_lg_id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::INSERT_ERROR));
|
|
|
}
|
|
|
$set_local = [
|
|
|
'lg_id'=>$id,
|
|
|
@@ -237,10 +259,8 @@ class WriteSportsController extends BaseController{
|
|
|
'source'=>$data['source'],
|
|
|
];
|
|
|
$ret = $model['model_local_league']::insertGetId($set_local);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::LOCAL_LEAGUE_ERROR)) ;//Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LOCAL_LEAGUE_ERROR)) ;//Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
|
}
|
|
|
- return 1;
|
|
|
-// return Response::success();
|
|
|
}
|
|
|
|
|
|
//写入赛事数据
|
|
|
@@ -249,12 +269,12 @@ class WriteSportsController extends BaseController{
|
|
|
//根据球类代码获取相关model
|
|
|
$model = commonFunction::getModels($game_code,1);
|
|
|
$data = $opt['data'];
|
|
|
- if(empty($data['lg_id'])) throw new \Exception(Response::generate(Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if(empty($data['lg_id'])) throw new \Exception(Response::generate('',Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
|
|
|
//根据源联赛ID 获取本地关联id
|
|
|
$lg_id = $model['model_local_league']::where(['others_lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->value('lg_id');
|
|
|
- if(empty($lg_id)) throw new \Exception(Response::generate(Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if(empty($lg_id)) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
//查询关联记录是否存在
|
|
|
$match_id = $model['model_local_match']::where(['others_match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
|
->value('match_id');
|
|
|
@@ -268,7 +288,7 @@ class WriteSportsController extends BaseController{
|
|
|
if(!empty($data['half_match_id'])){
|
|
|
$half_match_id = $match_id = $model['model_local_match']::where(['others_match_id'=>$data['half_match_id'],'source'=>$data['source']])
|
|
|
->value('match_id');
|
|
|
- if(empty($half_match_id)) throw new \Exception(Response::generate(Response::HALF_MATCH_ERROR)) ;//Render([], '10024', lang('Tips','Sports')->get('half_match_error'));
|
|
|
+ if(empty($half_match_id)) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::HALF_MATCH_ERROR)) ;//Render([], '10024', lang('Tips','Sports')->get('half_match_error'));
|
|
|
}
|
|
|
//写入赛事
|
|
|
if(empty($id)){
|
|
|
@@ -278,7 +298,7 @@ class WriteSportsController extends BaseController{
|
|
|
$last_time = $model['model_league']::where(['id'=>$lg_id])
|
|
|
->value('last_time');
|
|
|
|
|
|
- if(empty($last_time)) throw new \Exception(Response::generate(Response::LG_LASTTIME_ERROR)) ;//Render([], '10023', lang('Tips','Sports')->get('lg_lastTime_error'));
|
|
|
+ if(empty($last_time)) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LG_LASTTIME_ERROR)) ;//Render([], '10023', lang('Tips','Sports')->get('lg_lastTime_error'));
|
|
|
//给冠军盘口赛事 赋值时间
|
|
|
$time = strtotime($last_time);
|
|
|
$data['match_date'] = date('Y-m-d',$time);
|
|
|
@@ -305,7 +325,7 @@ class WriteSportsController extends BaseController{
|
|
|
];
|
|
|
//写入赛事 返回id
|
|
|
$id = $model['model_match']::insertGetId($set_match);
|
|
|
- if($id < 1) throw new \Exception(Response::generate(Response::INSERT_ERROR)) ;//Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
+ if($id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::INSERT_ERROR)) ;//Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
$set_local = [
|
|
|
'match_id'=>$id,
|
|
|
@@ -313,7 +333,7 @@ class WriteSportsController extends BaseController{
|
|
|
'source'=>$data['source'],
|
|
|
];
|
|
|
$ret = $model['model_local_match']::insertGetId($set_local);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::LOCAL_MATCH_ERROR)) ;//Render([], '10018', lang('Tips','Sports')->get('local_match_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::LOCAL_MATCH_ERROR)) ;//Render([], '10018', lang('Tips','Sports')->get('local_match_error'));
|
|
|
}
|
|
|
// return Response::success();
|
|
|
}
|
|
|
@@ -328,7 +348,8 @@ class WriteSportsController extends BaseController{
|
|
|
$match = $model['model_local_match']::select('match_id','others_match_id')
|
|
|
->where(['others_match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
|
->first();
|
|
|
- if(count($match) < 1) throw new \Exception(Response::generate(Response::MATCH_ERROR)) ;//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
+
|
|
|
+ if(count($match) < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::MATCH_ERROR)) ;//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
|
|
|
//获取赛事 本地/源ID
|
|
|
$others_match_id = $match->others_match_id;
|
|
|
@@ -337,13 +358,47 @@ class WriteSportsController extends BaseController{
|
|
|
$lg = $model['model_local_league']::select('lg_id','others_lg_id')
|
|
|
->where(['others_lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->first();
|
|
|
- if(count($lg) < 1) throw new \Exception(Response::generate(Response::LEAGUE_ERROR));//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if(count($lg) < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LEAGUE_ERROR));
|
|
|
|
|
|
//获取联赛 本地/源ID
|
|
|
$others_lg_id = $lg->others_lg_id;
|
|
|
$lg_id = $lg->lg_id;
|
|
|
+ //===写赔率记录===
|
|
|
+ //查询赔率记录是否存在
|
|
|
+ $oddsRecordID = $model['model_odds_record']::where(['odds_only'=>$data['odds_only']])
|
|
|
+ ->value('id');
|
|
|
+
|
|
|
+ $set_odds_r = [
|
|
|
+ 'match_id'=> $match_id,
|
|
|
+ 'others_match_id'=> $others_match_id,
|
|
|
+ 'odds_code'=> $data['odds_code'],
|
|
|
+ 'status'=> $data['status'],
|
|
|
+ 'sort'=> $data['sort'],
|
|
|
+ 'p_code'=> $data['p_code'],
|
|
|
+ 'odds'=> $data['odds'],
|
|
|
+ 'condition'=> $data['condition'],
|
|
|
+ 'odds_only'=> $data['odds_only'],
|
|
|
+ 'sole'=> $data['sole'],
|
|
|
+ 'source'=> $data['source'],
|
|
|
+ 'type'=> $data['type'],
|
|
|
+ 'team'=> $data['team'],
|
|
|
+ 'lg_id'=> $lg_id,
|
|
|
+ 'others_lg_id'=> $others_lg_id,
|
|
|
+ 'ctime'=> date('Y-m-d H:m:i'),
|
|
|
+ 'utime'=> date('Y-m-d H:m:i'),
|
|
|
+ ];
|
|
|
+ //更新或写入赔率记录
|
|
|
+ if(!empty($oddsID)){
|
|
|
+ $ret = $model['model_odds_record']::where(['id'=>$oddsRecordID])
|
|
|
+ -> update($set_odds_r);
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赔率记录-odds_only:'.$data['odds_only'].';',Response::ADD_ODDS_R_ERROR)) ;//Render([], '10020', lang('Tips','Sports')->get('add_odds_r_error'));
|
|
|
+ }else{
|
|
|
+ $ret = $model['model_odds_record']::insert($set_odds_r);
|
|
|
+ if($ret != true) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赔率记录-odds_only:'.$data['odds_only'].';',Response::ADD_ODDS_R_ERROR));//Render([], '10020', lang('Tips','Sports')->get('add_odds_r_error'));
|
|
|
+ }
|
|
|
+ //===写赔率===
|
|
|
//查询 赔率数据是否存在
|
|
|
- $oddsID = $model['model_odds']::where(['lg_id'=>$lg_id,'others_lg_id'=>$others_lg_id,'match_id'=>$match_id,'others_match_id'=>$others_match_id,'odds_code'=>$data['odds_code'],'sort'=>$data['sort']])
|
|
|
+ $oddsID = $model['model_odds']::where(['sole'=>$data['sole']])
|
|
|
->value('id');
|
|
|
|
|
|
$set_odds = [
|
|
|
@@ -368,14 +423,14 @@ class WriteSportsController extends BaseController{
|
|
|
];
|
|
|
//更新或写入赔率数据
|
|
|
if(!empty($oddsID)){
|
|
|
- $ret = $model['model_odds']::where(['id'=>$oddsID])
|
|
|
+ $ret = $model['model_odds']::where(['sole'=>$data['sole']])
|
|
|
-> update($set_odds);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::ADD_ODDS_ERROR));//Render([], '10019', lang('Tips','Sports')->get('add_odds_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赔率-odds_only:'.$data['odds_only'].';',Response::ADD_ODDS_ERROR));//Render([], '10019', lang('Tips','Sports')->get('add_odds_error'));
|
|
|
}else{
|
|
|
$ret = $model['model_odds']::insert($set_odds);
|
|
|
- if($ret != true) throw new \Exception(Response::generate(Response::ADD_ODDS_ERROR));//Render([], '10019', lang('Tips','Sports')->get('add_odds_error'));
|
|
|
+ if($ret != true) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赔率-odds_only:'.$data['odds_only'].';',Response::ADD_ODDS_ERROR));//Render([], '10019', lang('Tips','Sports')->get('add_odds_error'));
|
|
|
}
|
|
|
-// return Response::success();
|
|
|
+ //===end===
|
|
|
}
|
|
|
|
|
|
//写入联赛结果
|
|
|
@@ -388,7 +443,7 @@ class WriteSportsController extends BaseController{
|
|
|
//验证结果所属联赛
|
|
|
$lg_id = $model['model_local_league']::where(['others_lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->value('lg_id');
|
|
|
- if($lg_id < 1) throw new \Exception(Response::generate(Response::LEAGUE_ERROR));//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if($lg_id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LEAGUE_ERROR));//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
|
|
|
$lg_result_id = $model['model_league_result']::where(['lg_id'=>$lg_id,'game_name'=>$data['game_name']])
|
|
|
->value('id');
|
|
|
@@ -404,10 +459,10 @@ class WriteSportsController extends BaseController{
|
|
|
if(!empty($lg_result_id)){
|
|
|
$ret = $model['model_league_result']::where(['id'=>$lg_result_id])
|
|
|
-> update($set_lg_result);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::ADD_LG_R_ERROR)) ;//Render([], '10021', lang('Tips','Sports')->get('add_lg_r_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::ADD_LG_R_ERROR)) ;//Render([], '10021', lang('Tips','Sports')->get('add_lg_r_error'));
|
|
|
}else{
|
|
|
$ret = $model['model_league_result']::insert($set_lg_result);
|
|
|
- if($ret != true) throw new \Exception(Response::generate(Response::ADD_LG_R_ERROR));//Render([], '10021', lang('Tips','Sports')->get('add_lg_r_error'));
|
|
|
+ if($ret != true) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::ADD_LG_R_ERROR));//Render([], '10021', lang('Tips','Sports')->get('add_lg_r_error'));
|
|
|
}
|
|
|
// return Response::success();
|
|
|
}
|
|
|
@@ -421,11 +476,11 @@ class WriteSportsController extends BaseController{
|
|
|
//验证结果所属联赛
|
|
|
$lg_id = $model['model_local_league']::where(['others_lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->value('lg_id');
|
|
|
- if($lg_id < 1) throw new \Exception(Response::generate(Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if($lg_id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
//验证结果所属赛事
|
|
|
$match_id = $model['model_local_match']::where(['others_match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
|
->value('match_id');
|
|
|
- if($match_id < 1) throw new \Exception(Response::generate(Response::MATCH_ERROR));//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
+ if($match_id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::MATCH_ERROR));//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
//查询结果是否存在
|
|
|
$match_r_id = $model['model_result']::where(['match_id'=>$match_id])
|
|
|
->value('id');
|
|
|
@@ -457,10 +512,10 @@ class WriteSportsController extends BaseController{
|
|
|
if(!empty($match_r_id)){
|
|
|
$ret = $model['model_result']::where(['id'=>$match_r_id])
|
|
|
-> update($set_match_r);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::ADD_MATCH_R_ERROR)) ;//Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::ADD_MATCH_R_ERROR)) ;//Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
|
|
|
}else{
|
|
|
$ret = $model['model_result']::insert($set_match_r);
|
|
|
- if($ret != true) throw new \Exception(Response::generate(Response::ADD_MATCH_R_ERROR)) ;//Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
|
|
|
+ if($ret != true) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::ADD_MATCH_R_ERROR)) ;//Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
|
|
|
}
|
|
|
// return Response::success();
|
|
|
}
|
|
|
@@ -474,11 +529,11 @@ class WriteSportsController extends BaseController{
|
|
|
//验证结果所属联赛
|
|
|
$lg_id = $model['model_local_league']::where(['others_lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->value('lg_id');
|
|
|
- if($lg_id < 1) throw new \Exception(Response::generate(Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if($lg_id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
//验证结果所属赛事
|
|
|
$match_id = $model['model_local_match']::where(['others_match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
|
->value('match_id');
|
|
|
- if($match_id < 1) throw new \Exception(Response::generate(Response::MATCH_ERROR));//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
+ if($match_id < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::MATCH_ERROR));//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
|
|
|
$match_r_id = $model['model_result_record']::where(['match_id'=>$match_id,'match_time'=>$data['match_time']])
|
|
|
->value('id');
|
|
|
@@ -507,10 +562,10 @@ class WriteSportsController extends BaseController{
|
|
|
if($match_r_id > 0){
|
|
|
$ret = $model['model_result_record']::where(['id'=>$match_r_id])
|
|
|
->update($set_match_r);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::ADD_MATCH_R_R_ERROR));//Render([], '10022', lang('Tips','Sports')->get('add_match_r_r_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::ADD_MATCH_R_R_ERROR));//Render([], '10022', lang('Tips','Sports')->get('add_match_r_r_error'));
|
|
|
}else{
|
|
|
$ret = $model['model_result_record']::insert($set_match_r);
|
|
|
- if($ret != true) throw new \Exception(Response::generate(Response::ADD_MATCH_R_R_ERROR));//Render([], '10022', lang('Tips','Sports')->get('add_match_r_r_error'));
|
|
|
+ if($ret != true) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::ADD_MATCH_R_R_ERROR));//Render([], '10022', lang('Tips','Sports')->get('add_match_r_r_error'));
|
|
|
}
|
|
|
// return Response::success();
|
|
|
}
|
|
|
@@ -525,7 +580,7 @@ class WriteSportsController extends BaseController{
|
|
|
$match = $model['model_local_match']::select('match_id','others_match_id')
|
|
|
->where(['others_match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
|
->first();
|
|
|
- if(count($match) < 1) throw new \Exception(Response::generate(Response::MATCH_ERROR)) ;//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
+ if(count($match) < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赛事-match_id:'.$data['match_id'].';',Response::MATCH_ERROR)) ;//Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
|
|
|
//获取赛事 本地/源ID
|
|
|
$others_match_id = $match->others_match_id;
|
|
|
@@ -534,7 +589,7 @@ class WriteSportsController extends BaseController{
|
|
|
$lg = $model['model_local_league']::select('lg_id','others_lg_id')
|
|
|
->where(['others_lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->first();
|
|
|
- if(count($lg) < 1) throw new \Exception(Response::generate(Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
+ if(count($lg) < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'联赛-lg_id:'.$data['lg_id'].';',Response::LEAGUE_ERROR)) ;//Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
|
|
|
//获取联赛 本地/源ID
|
|
|
$others_lg_id = $lg->others_lg_id;
|
|
|
@@ -565,10 +620,10 @@ class WriteSportsController extends BaseController{
|
|
|
if(!empty($oddsID)){
|
|
|
$ret = $model['model_odds_record']::where(['id'=>$oddsID])
|
|
|
-> update($set_odds);
|
|
|
- if($ret < 1) throw new \Exception(Response::generate(Response::ADD_ODDS_R_ERROR)) ;//Render([], '10020', lang('Tips','Sports')->get('add_odds_r_error'));
|
|
|
+ if($ret < 1) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赔率记录-odds_only:'.$data['odds_only'].';',Response::ADD_ODDS_R_ERROR)) ;//Render([], '10020', lang('Tips','Sports')->get('add_odds_r_error'));
|
|
|
}else{
|
|
|
$ret = $model['model_odds_record']::insert($set_odds);
|
|
|
- if($ret != true) throw new \Exception(Response::generate(Response::ADD_ODDS_R_ERROR));//Render([], '10020', lang('Tips','Sports')->get('add_odds_r_error'));
|
|
|
+ if($ret != true) throw new \Exception(Response::generate(gameModel::getGameName($game_code).'赔率记录-odds_only:'.$data['odds_only'].';',Response::ADD_ODDS_R_ERROR));//Render([], '10020', lang('Tips','Sports')->get('add_odds_r_error'));
|
|
|
}
|
|
|
// return Response::success();
|
|
|
}
|