公会分成管理--更新

master
chenxiaojun 5 years ago
parent ec273ab157
commit e66893dc7f

@ -146,6 +146,10 @@ class PromoteGameRatioController extends ThinkController
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
$promoteId = $promoteGameRatio['promote_id'];
$this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据
if ($promoteGameRatio['status'] == 1) {
$save['last_ratio'] = $promoteGameRatio['ratio'];
$save['last_ratio_status'] = 1;
@ -161,6 +165,7 @@ class PromoteGameRatioController extends ThinkController
}
$promoteId = intval($params['promote_id']);
$gameId = intval($params['game_id']);
$this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据
$promote = M('promote', 'tab_')->find($promoteId);
if (empty($promote) || $promote['level'] != 1) {
@ -217,6 +222,26 @@ class PromoteGameRatioController extends ThinkController
}
}
private function isWithdraw($promoteId, $beginTime)
{
$promote = M('promote', 'tab_')->find($promoteId);
if (empty($promote)) {
$this->error("数据异常");
}
if ($promote['level'] != 1) {
$this->error("该推广员不是会长账号,无法执行此操作");
}
$withdrawMap['promote_id'] = $promoteId;
$withdrawMap['status'] = ['neq', -2];
$withdrawMap['settlement_end_time'] = ['egt', $beginTime];
$withdraw = M('withdraw', 'tab_')->where($withdrawMap)->order('create_time desc')->find();
if (!empty($withdraw) && $withdraw['status'] != -2) {
$time = date('Y-m-d', $withdraw['create_time']);
$this->error("{$time}之前的订单已经申请提现, 无法变更分成比例,请重新选择开始时间");
}
}
public function setStatus($status)
{
$params = I('post.');
@ -228,6 +253,7 @@ class PromoteGameRatioController extends ThinkController
if (empty($status) || !in_array($status, [-1, 1])) {
$this->error('操作失败');
}
$time = time();
$map['id'] = ['in', $ids];
$map['status'] = 0;
@ -240,6 +266,32 @@ class PromoteGameRatioController extends ThinkController
}
$result = D(self::MODEL_NAME)->where($map)->save($save);
if ($result) {
if ($status == 1) {
foreach ($ids as $id) {
$promoteGameRatio = D(self::MODEL_NAME)->find($id);
if (!empty($promoteGameRatio)) {
if ($promoteGameRatio['begin_time'] <= strtotime(date('Y-m-d', time()))) {
$promoteId = $promoteGameRatio['promote_id'];
$promoteMap['chain'] = ['like', "/{$promoteId}/%"];
$promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true);
$promoteIds[] = $promoteId;
$spendMap['promote_id'] = ['in', $promoteIds];
$spendMap['game_id'] = $promoteGameRatio['game_id'];
if ($promoteGameRatio['end_time'] > 0) {
$spendMap['pay_time'] = ['between', [$promoteGameRatio['begin_time'], $promoteGameRatio['end_time'] + 3600 * 24 - 1]];
} else {
$spendMap['pay_time'] = ['egt', $promoteGameRatio['begin_time']];
}
$spendMap['pay_status'] = 1;
$spendMap['selle_status'] = 0;
$spendSave['selle_ratio'] = $promoteGameRatio['ratio'];
M('spend', 'tab_')->where($spendMap)->save($spendSave);
}
}
}
}
$this->success('操作成功');
} else {
$this->error('操作失败');

@ -112,7 +112,7 @@
<input type="hidden" name="id" id="id" value="{$record['id']|default=''}" />
<div class="form-item cf">
<button class="submit_btn ajax-post mlspacing" id="submit" type="submit" target-form="form-horizontal">
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
@ -203,7 +203,42 @@ $(function(){
});
}
$('submit')
$('#submit').click(function (e) {
var target = $('form').get(0).action;
var query = $('form').serialize();
var that = this;
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
$.post(target,query).success(function(data){
if(layer) {layer.closeAll('loading');}
if (data.status==1) {
if (data.url) {
updateAlert(data.info + ' 页面即将自动跳转~');
}else{
updateAlert(data.info);
}
setTimeout(function(){
$(that).removeClass('disabled').prop('disabled',false);
if (data.url) {
location.href=data.url;
}else if( $(that).hasClass('no-refresh')){
$('#tip').find('.tipclose').click();
}else{
location.reload();
}
},1500);
}else{
updateAlert(data.info,'tip_error');
setTimeout(function(){
$(that).removeClass('disabled').prop('disabled',false);
if (data.url) {
location.href=data.url;
}else{
$('#tip').find('.tipclose').click();
}
},3000);
}
});
});
});
</script>
</block>

@ -46,35 +46,7 @@
</if>
</div>
<div class="cf top_nav_list">
<if condition="I('group',1) eq 1">
<div class="infomation information1711">
<div>
<span>参与结算设置:</span>
<label>
<input type="radio" class="inp_radio" value="0" name="bind_coin" <if condition="I('bind_coin',0) eq 0">checked="checked"</if>> 排除绑币
</label>
&nbsp;&nbsp;&nbsp;&nbsp;
<label>
<input type="radio" class="inp_radio" value="1" name="bind_coin" <if condition="I('bind_coin',0) eq 1">checked="checked"</if>> 包含绑币
</label>
</div>
<div style="line-height: 30px;">
<p>注意①:推广结算只结算消费到游戏的所有订单记录。(系统默认全部排除绑币,可视情况自行勾选)</p>
<p>注意②:包含绑币勾选请慎重,由于玩家账户部分绑币的来源属于后台发放或者会长代充等,涉及到成本盈亏,是否参与推广员结算请考虑清楚!</p>
<p>注意③:推广结算时间请按规律时间统一结算,否则时间不统一容易导致个别游戏在统一时间内无法结算。(结算时间只可选到前一天)</p>
</div>
</div>
</if>
<!-- 高级搜索 -->
<if condition="I('group') eq 1 or $group eq 1">
<empty name="model.extend">
<div class="fl button_list">
<div class="tools">
<a class=" ajax-post " target-form="ids" url="{:U('generatesettlementAll?model='.$model['id'],array('ids'=>$data['id'],'bind_coin'=>I('bind_coin',0),'game_name'=>I('game_name'),'promote_account'=>I('promote_account'),'timestart'=>I('timestart'),'timeend'=>I('timeend'),'cooperation'=>I('cooperation'),'bill_number'=>I('bill_number')))}"><span class="button_icon button_icon14"></span>批量结算</a>
</div>
</div>
</empty>
</if>
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>

Loading…
Cancel
Save