|
|
@@ -81,36 +81,37 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证联赛所属国家
|
|
|
- if(!empty($v['country_id'])){
|
|
|
+ if(!empty($data['country_id'])){
|
|
|
$country = lm('st_country','Sports')
|
|
|
- ->where(['country_id'=>$v['country_id']])
|
|
|
+ ->where(['country_id'=>$data['country_id']])
|
|
|
->count();
|
|
|
if($country < 1) Render([], '10013', lang('Tips','Sports')->get('country_error'));
|
|
|
}
|
|
|
//验证联赛所属地区
|
|
|
- if(!empty($v['area_id'])){
|
|
|
+ if(!empty($data['area_id'])){
|
|
|
$area = lm('st_area','Sports')
|
|
|
- ->where(['id'=>$v['area_id']])
|
|
|
+ ->where(['id'=>$data['area_id']])
|
|
|
->count();
|
|
|
if($area < 1) Render([], '10014', lang('Tips','Sports')->get('area_error'));
|
|
|
}
|
|
|
$post = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_league'],'Sports')
|
|
|
- -> where(['lg_id'=>$v['lg_id']])
|
|
|
- -> update($v);
|
|
|
+ -> where(['lg_id'=>$data['lg_id']])
|
|
|
+ -> update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_league'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_league'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|
|
|
@@ -119,29 +120,30 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证赛事所属联赛
|
|
|
- if(!empty($v['lg_id'])){
|
|
|
+ if(!empty($data['lg_id'])){
|
|
|
$lg = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
}
|
|
|
$post = lm($model['model_match'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id']])
|
|
|
+ ->where(['match_id'=>$data['match_id']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_match'],'Sports')
|
|
|
- -> where(['match_id'=>$v['match_id']])
|
|
|
- -> update($v);
|
|
|
+ -> where(['match_id'=>$data['match_id']])
|
|
|
+ -> update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_match'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_match'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|
|
|
@@ -150,36 +152,37 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证赔率所属赛事
|
|
|
- if(!empty($v['match_id'])){
|
|
|
+ if(!empty($data['match_id'])){
|
|
|
$match = lm($model['model_match'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id']])
|
|
|
+ ->where(['match_id'=>$data['match_id']])
|
|
|
->count();
|
|
|
if($match < 1) Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
}
|
|
|
//验证赔率所属联赛 冠军盘口
|
|
|
- if(!empty($v['lg_id'])){
|
|
|
+ if(!empty($data['lg_id'])){
|
|
|
$lg = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
}
|
|
|
$post = lm($model['model_odds'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id'],'odds_code'=>$v['odds_code'],'sort'=>$v['sort']])
|
|
|
+ ->where(['match_id'=>$data['match_id'],'odds_code'=>$data['odds_code'],'sort'=>$data['sort']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_odds'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id'],'odds_code'=>$v['odds_code'],'sort'=>$v['sort']])
|
|
|
- -> update($v);
|
|
|
+ ->where(['match_id'=>$data['match_id'],'odds_code'=>$data['odds_code'],'sort'=>$data['sort']])
|
|
|
+ -> update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_odds'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_odds'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|
|
|
@@ -188,29 +191,30 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证结果所属联赛
|
|
|
- if(!empty($v['lg_id'])){
|
|
|
+ if(!empty($data['lg_id'])){
|
|
|
$lg = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
}
|
|
|
$post = lm($model['model_league_result'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id'],'game_name'=>$v['game_name']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id'],'game_name'=>$data['game_name']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_league_result'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id'],'game_name'=>$v['game_name']])
|
|
|
- -> update($v);
|
|
|
+ ->where(['lg_id'=>$data['lg_id'],'game_name'=>$data['game_name']])
|
|
|
+ -> update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_league_result'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_league_result'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|
|
|
@@ -219,36 +223,37 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证结果所属联赛
|
|
|
- if(!empty($v['lg_id'])){
|
|
|
+ if(!empty($data['lg_id'])){
|
|
|
$lg = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
}
|
|
|
//验证结果所属赛事
|
|
|
- if(!empty($v['match_id'])){
|
|
|
+ if(!empty($data['match_id'])){
|
|
|
$lg = lm($model['model_match'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id']])
|
|
|
+ ->where(['match_id'=>$data['match_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
}
|
|
|
$post = lm($model['model_result'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id']])
|
|
|
+ ->where(['match_id'=>$data['match_id']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_result'],'Sports')
|
|
|
- -> where(['match_id'=>$v['match_id']])
|
|
|
- -> update($v);
|
|
|
+ -> where(['match_id'=>$data['match_id']])
|
|
|
+ -> update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_result'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_result'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|
|
|
@@ -257,36 +262,37 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证结果所属联赛
|
|
|
- if(!empty($v['lg_id'])){
|
|
|
+ if(!empty($data['lg_id'])){
|
|
|
$lg = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
}
|
|
|
//验证结果所属赛事
|
|
|
- if(!empty($v['match_id'])){
|
|
|
+ if(!empty($data['match_id'])){
|
|
|
$lg = lm($model['model_match'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id']])
|
|
|
+ ->where(['match_id'=>$data['match_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
}
|
|
|
$post = lm($model['model_result_record'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id'],'match_time'=>$v['match_time']])
|
|
|
+ ->where(['match_id'=>$data['match_id'],'match_time'=>$data['match_time']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_result_record'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id'],'match_time'=>$v['match_time']])
|
|
|
- -> update($v);
|
|
|
+ ->where(['match_id'=>$data['match_id'],'match_time'=>$data['match_time']])
|
|
|
+ -> update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_result_record'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_result_record'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|
|
|
@@ -295,36 +301,37 @@ class WriteSports extends Controller{
|
|
|
$game_code = $opt['game_code'];
|
|
|
//根据球类代码获取相关model
|
|
|
$model = $this->commonFunction->getModels($game_code,1);
|
|
|
- foreach ($opt['data'] as $k => $v){
|
|
|
+ $data = $opt['data'];
|
|
|
+// foreach ($opt['data'] as $k => $v){
|
|
|
//验证赔率所属赛事
|
|
|
- if(!empty($v['match_id'])){
|
|
|
+ if(!empty($data['match_id'])){
|
|
|
$match = lm($model['model_match'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id']])
|
|
|
+ ->where(['match_id'=>$data['match_id']])
|
|
|
->count();
|
|
|
if($match < 1) Render([], '10016', lang('Tips','Sports')->get('match_error'));
|
|
|
}
|
|
|
//验证赔率所属联赛 冠军盘口
|
|
|
- if(!empty($v['lg_id'])){
|
|
|
+ if(!empty($data['lg_id'])){
|
|
|
$lg = lm($model['model_league'],'Sports')
|
|
|
- ->where(['lg_id'=>$v['lg_id']])
|
|
|
+ ->where(['lg_id'=>$data['lg_id']])
|
|
|
->count();
|
|
|
if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
|
|
|
}
|
|
|
$post = lm($model['model_odds_record'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id'],'odds_code'=>$v['odds_code'],'sort'=>$v['sort']])
|
|
|
+ ->where(['match_id'=>$data['match_id'],'odds_code'=>$data['odds_code'],'sort'=>$data['sort']])
|
|
|
->count();
|
|
|
//更新操作
|
|
|
if($post > 0){
|
|
|
$ret = lm($model['model_odds_record'],'Sports')
|
|
|
- ->where(['match_id'=>$v['match_id'],'odds_code'=>$v['odds_code'],'sort'=>$v['sort']])
|
|
|
- -> update($v);
|
|
|
+ ->where(['match_id'=>$data['match_id'],'odds_code'=>$data['odds_code'],'sort'=>$data['sort']])
|
|
|
+ ->update($data);
|
|
|
if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
|
|
|
}else{
|
|
|
//写入操作
|
|
|
- $ret = lm($model['model_odds_record'],'Sports')->insert($v);
|
|
|
+ $ret = lm($model['model_odds_record'],'Sports')->insert($data);
|
|
|
if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
}
|
|
|
- }
|
|
|
+// }
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
|
|