@ -562,22 +562,22 @@ class CompanyGameRatioController extends AdminController
}
}
// dump($end_time);dump($begin_time);die();
// dump($end_time);dump($begin_time);die();
$check_data = M("company_game_ratio","tab_")
$check_data = M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time])
->find();
->find();
if ($check_data) {
if ($check_data) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time])
->save($ratiov);
->save($ratiov);
return;
return;
}
}
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
// ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>['egt',$begin_time],'end_time'=>['elt',$end_time]])
// ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>['egt',$begin_time],'end_time'=>['elt',$end_time]])
->where("company_belong={$company_belong} and company_ id={$company_id} and relation_game_id={$relation_game_id} and begin_time>={$begin_time} and end_time < = {$end_time} and end_time!=0")
->where("company_id={$company_id} and relation_game_id={$relation_game_id} and begin_time>={$begin_time} and end_time < = {$end_time} and end_time!=0")
->delete();
->delete();
$data = M("company_game_ratio","tab_")
$data = M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id])
->order("begin_time DESC")
->order("begin_time DESC")
->select();
->select();
@ -587,7 +587,7 @@ class CompanyGameRatioController extends AdminController
if (!$end_time) {
if (!$end_time) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->delete();
->delete();
continue;
continue;
}
}
@ -598,18 +598,18 @@ class CompanyGameRatioController extends AdminController
if ($end_time > $value['begin_time'] & & ($end_time < $value['end_time']||$value['end_time']==0)) {
if ($end_time > $value['begin_time'] & & ($end_time < $value['end_time']||$value['end_time']==0)) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$end_time+1]);
->save(['begin_time'=>$end_time+1]);
} else if ($end_time > $value['begin_time'] & & ($end_time >= $value['end_time']& & $value['end_time']!=0)) {
} else if ($end_time > $value['begin_time'] & & ($end_time >= $value['end_time']& & $value['end_time']!=0)) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);
->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);
}
}
} else if ($value['begin_time'] < = $begin_time) {
} else if ($value['begin_time'] < = $begin_time) {
if (!$end_time& & ($value['end_time']>$begin_time||$value['end_time']==0)) {
if (!$end_time& & ($value['end_time']>$begin_time||$value['end_time']==0)) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
->save(['end_time'=>$begin_time-1]);
continue;
continue;
}else if (!$end_time) {
}else if (!$end_time) {
@ -621,11 +621,11 @@ class CompanyGameRatioController extends AdminController
}
}
if ($begin_time > $value['begin_time'] & & ($end_time >= $value['end_time'] & & $value['end_time']!=0)) {
if ($begin_time > $value['begin_time'] & & ($end_time >= $value['end_time'] & & $value['end_time']!=0)) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
->save(['end_time'=>$begin_time-1]);
} else if ($begin_time > $value['begin_time'] & & ($end_time < $value['end_time']||$value['end_time']==0)) {
} else if ($begin_time > $value['begin_time'] & & ($end_time < $value['end_time']||$value['end_time']==0)) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
->save(['end_time'=>$begin_time-1]);
$dataValue = $value;
$dataValue = $value;
$dataValue['begin_time'] = $end_time+1;
$dataValue['begin_time'] = $end_time+1;
@ -634,15 +634,15 @@ class CompanyGameRatioController extends AdminController
} else if ($begin_time == $value['begin_time'] & & ($end_time < $value['end_time']||$value['end_time']==0)) {
} else if ($begin_time == $value['begin_time'] & & ($end_time < $value['end_time']||$value['end_time']==0)) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$end_time+1]);
->save(['begin_time'=>$end_time+1]);
} else if ($end_time == $value['end_time']& & $begin_time>$value['begin_time']) {
} else if ($end_time == $value['end_time']& & $begin_time>$value['begin_time']) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
->save(['end_time'=>$begin_time-1]);
} else if ($end_time == $value['end_time']& & $begin_time == $value['begin_time']) {
} else if ($end_time == $value['end_time']& & $begin_time == $value['begin_time']) {
M("company_game_ratio","tab_")
M("company_game_ratio","tab_")
->where(['company_belong'=>$company_belong,'company_ id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);
->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);
}
}