外团推广功能提交

master
zhengyongxing 4 years ago
parent def69bf6aa
commit 27c95792ff

@ -1514,6 +1514,13 @@ class MarketPercentageController extends ThinkController
$time_end = 99999999999; $time_end = 99999999999;
} }
$last_month = strtotime(date('Y-m-t',strtotime("-1 month")));
if ($data['begin_time'] < $last_month) {
$this->ajaxReturn(['msg'=>"已经结算过的时间不能添加","status"=>0]);
}
$belong_game = M("company_belong_game","tab_") $belong_game = M("company_belong_game","tab_")
->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end}))") ->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end}))")
->select(); ->select();
@ -1540,7 +1547,7 @@ class MarketPercentageController extends ThinkController
if (IS_POST) { if (IS_POST) {
$data = $_POST; $data = $_POST;
if (!$data['begin_time']) { if (!$data['begin_time'] && !$data['is_start']) {
$this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]); $this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]);
} }
@ -1564,6 +1571,7 @@ class MarketPercentageController extends ThinkController
$time_start = strtotime($data['begin_time']); $time_start = strtotime($data['begin_time']);
if($data['end_time']) { if($data['end_time']) {
$time_end = strtotime($data['end_time']); $time_end = strtotime($data['end_time']);
} else { } else {
@ -1573,6 +1581,28 @@ class MarketPercentageController extends ThinkController
$data['begin_time'] = strtotime($data['begin_time']); $data['begin_time'] = strtotime($data['begin_time']);
$data['end_time'] = strtotime($data['end_time']); $data['end_time'] = strtotime($data['end_time']);
$company_belong_game_data = M("company_belong_game","tab_")->where(['id'=>$id])->find();
if ($data['is_start']) {
$time_start = $company_belong_game_data['begin_time'];
}
$last_month = strtotime(date('Y-m-t',strtotime("-1 month")));
if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month)
{
$time_end = $last_month;
$data['end_time'] = $last_month;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
if ($data['begin_time'] < $last_month && $data['end_time'] <= $last_month) {
$this->ajaxReturn(['msg'=>"已经结算过的时间不能修改","status"=>0]);
} elseif ($data['begin_time'] < $last_month && $data['end_time'] > $last_month) {
unset($data['begin_time']);
}
$belong_game = M("company_belong_game","tab_") $belong_game = M("company_belong_game","tab_")
->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end})) and id != {$id}") ->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end})) and id != {$id}")
->select(); ->select();
@ -1596,12 +1626,8 @@ class MarketPercentageController extends ThinkController
// $data['game_ids'] = json_encode(explode(',',$data['game_ids'])); // $data['game_ids'] = json_encode(explode(',',$data['game_ids']));
$game_ids = explode(',',$data['game_ids']); $game_ids = explode(',',$data['game_ids']);
$data['game_ids'] = explode(',',$data['game_ids']); $data['game_ids'] = explode(',',$data['game_ids']);
foreach($game_ids as $key => $value) { foreach($game_ids as $key => $value) {
if ($value == "\"") { if ($value == "\"") {
@ -1613,6 +1639,10 @@ class MarketPercentageController extends ThinkController
} }
$data['is_start'] = 0;
if($data['begin_time']<strtotime(date("Y-m-1",time()))) {
$data['is_start'] = 1;
}
$data['ids'] = implode(',',$game_ids); $data['ids'] = implode(',',$game_ids);
@ -1637,8 +1667,6 @@ class MarketPercentageController extends ThinkController
$data['span_str'] = $span_str; $data['span_str'] = $span_str;
} }
$this->assign("data",$data); $this->assign("data",$data);
$this->display(); $this->display();
} }
@ -1654,6 +1682,15 @@ class MarketPercentageController extends ThinkController
$this->ajaxReturn(['msg'=>"参数传递错误","status"=>0]); $this->ajaxReturn(['msg'=>"参数传递错误","status"=>0]);
} }
$data = M("company_belong_game","tab_")
->where(['id'=>$id])
->find();
if (date("m",$data['begin_time']) < date("m",time())) {
$this->ajaxReturn(['msg'=>"过去已结算过的比例不能删除","status"=>0]);
}
$is_del = M("company_belong_game","tab_") $is_del = M("company_belong_game","tab_")
->where(['id'=>$id]) ->where(['id'=>$id])
->delete(); ->delete();

@ -107,7 +107,8 @@
<td class="l"><i class="mustmark">*</i>生效期限:</td> <td class="l"><i class="mustmark">*</i>生效期限:</td>
<td class="r table_radio"> <td class="r table_radio">
<div style="float: left;"> <div style="float: left;">
<input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="起始时间" value="{$data['begin_time']}">- <input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="起始时间" value="{$data['begin_time']}" <if condition="$data['is_start'] eq 1">disabled</if>>-
<input type="hidden" name="is_start" value="{$data['is_start']}">
<input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="{$data['end_time']}"> <input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="{$data['end_time']}">
</div> </div>
<span class="notice-text"></span> <span class="notice-text"></span>

Loading…
Cancel
Save