|
@@ -13,6 +13,8 @@ class WriteSports extends Controller{
|
|
|
public function init() {
|
|
public function init() {
|
|
|
$this->commonFunction = C()->get('commonFunction');
|
|
$this->commonFunction = C()->get('commonFunction');
|
|
|
|
|
|
|
|
|
|
+ //当前时间
|
|
|
|
|
+ $this->newTime = date('Y-m-d H:m:i');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -95,7 +97,6 @@ class WriteSports extends Controller{
|
|
|
->where(['lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
->where(['lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
->first()->m_lg_id;
|
|
->first()->m_lg_id;
|
|
|
|
|
|
|
|
-// $m_lg_id = $post->m_lg_id;
|
|
|
|
|
//如果没有记录
|
|
//如果没有记录
|
|
|
if(empty($m_lg_id)){
|
|
if(empty($m_lg_id)){
|
|
|
//查询联赛是否已存在
|
|
//查询联赛是否已存在
|
|
@@ -109,6 +110,7 @@ class WriteSports extends Controller{
|
|
|
$set_lg['match_mode'] = $data['match_mode'];
|
|
$set_lg['match_mode'] = $data['match_mode'];
|
|
|
$set_lg['if_stop'] = $data['if_stop'];
|
|
$set_lg['if_stop'] = $data['if_stop'];
|
|
|
$set_lg['last_time'] = $data['last_time'];
|
|
$set_lg['last_time'] = $data['last_time'];
|
|
|
|
|
+ $set_lg['utime'] = $this->newTime;
|
|
|
|
|
|
|
|
$id = lm($model['model_league'],'Sports')->insertGetId($set_lg);
|
|
$id = lm($model['model_league'],'Sports')->insertGetId($set_lg);
|
|
|
$m_lg_id = $id;
|
|
$m_lg_id = $id;
|
|
@@ -121,33 +123,8 @@ class WriteSports extends Controller{
|
|
|
];
|
|
];
|
|
|
$ret = lm($model['model_local_league'],'Sports')-> insertGetId($set_local);
|
|
$ret = lm($model['model_local_league'],'Sports')-> insertGetId($set_local);
|
|
|
if($ret < 1) Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
if($ret < 1) Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
|
-
|
|
|
|
|
-// $set_lg['name_chinese'] = $data['name_chinese'];
|
|
|
|
|
-// $set_lg['kind'] = $data['kind'];
|
|
|
|
|
-// $set_lg['match_mode'] = $data['match_mode'];
|
|
|
|
|
-// $set_lg['if_stop'] = $data['if_stop'];
|
|
|
|
|
-// $set_lg['last_time'] = $data['last_time'];
|
|
|
|
|
-//
|
|
|
|
|
-// $ret = lm($model['model_league'],'Sports')->insertGetId($set_lg);
|
|
|
|
|
-// $m_lg_id = $ret;
|
|
|
|
|
-// if($m_lg_id < 1) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //查询关联表是否 记录
|
|
|
|
|
- $local_r = lm($model['model_local_league'],'Sports')
|
|
|
|
|
- ->where(['m_lg_id'=>$m_lg_id,'lg_id'=>$data['lg_id'],'source'=>$data['source']])
|
|
|
|
|
- ->count('*');
|
|
|
|
|
-
|
|
|
|
|
- //没有记录则插入
|
|
|
|
|
- if($local_r == 0){
|
|
|
|
|
- $set_local = [
|
|
|
|
|
- 'm_lg_id'=>$m_lg_id,
|
|
|
|
|
- 'lg_id'=>$data['lg_id'],
|
|
|
|
|
- 'source'=>$data['source'],
|
|
|
|
|
- ];
|
|
|
|
|
- $ret = lm($model['model_local_league'],'Sports')-> insertGetId($set_local);
|
|
|
|
|
- if($ret < 1) Render([], '10017', lang('Tips','Sports')->get('local_league_error'));
|
|
|
|
|
- }
|
|
|
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
Render([], '1', lang('Tips','Sports')->get('success'));
|
|
|
}
|
|
}
|
|
|
//弃用
|
|
//弃用
|
|
@@ -211,9 +188,8 @@ class WriteSports extends Controller{
|
|
|
->select('m_match_id')
|
|
->select('m_match_id')
|
|
|
->where(['match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
->where(['match_id'=>$data['match_id'],'source'=>$data['source']])
|
|
|
->first()->m_match_id;
|
|
->first()->m_match_id;
|
|
|
- dd($match_id);
|
|
|
|
|
//更新操作
|
|
//更新操作
|
|
|
- if(!empty($match_id)){
|
|
|
|
|
|
|
+ if(empty($match_id)){
|
|
|
$ret = lm($model['model_match'],'Sports')
|
|
$ret = lm($model['model_match'],'Sports')
|
|
|
-> where(['match_id'=>$data['match_id']])
|
|
-> where(['match_id'=>$data['match_id']])
|
|
|
-> update($data);
|
|
-> update($data);
|