master
ELF 4 years ago
parent 8440c5d384
commit 90d82b1a8d

@ -444,6 +444,7 @@ class PromoteController extends ThinkController
$data['withdraw_done'] = $_POST['withdraw_done']; $data['withdraw_done'] = $_POST['withdraw_done'];
$data['can_view_recharge'] = $_POST['can_view_recharge']; $data['can_view_recharge'] = $_POST['can_view_recharge'];
$data['ts_over_apply'] = $_POST['ts_over_apply'] ?? 0; $data['ts_over_apply'] = $_POST['ts_over_apply'] ?? 0;
$data['shift_over_apply'] = $_POST['shift_over_apply'] ?? 0;
if (empty($pwd)) { if (empty($pwd)) {
unset($data['password']); unset($data['password']);
} }

@ -348,6 +348,22 @@
</td> </td>
</tr> </tr>
<?php endif;?> <?php endif;?>
<?php if($data['level'] > 1):?>
<tr>
<td class="l">公会内部换绑权限:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label >
<input type="radio" value="1" name="shift_over_apply" class="withdraw_done" <if condition="$data['shift_over_apply'] eq 1">checked="checked"</if>> 开启
</label >
<label >
<input type="radio" value="0" name="shift_over_apply" class="withdraw_done" <if condition="$data['shift_over_apply'] eq 0">checked="checked"</if>> 锁定
</label>
</span>
<span class="notice-text">开启后该推广员有权限操作整个公会的玩家换绑</span>
</td>
</tr>
<?php endif;?>
<tr> <tr>
<td class="l">备注:</td> <td class="l">备注:</td>
<td class="r table_textarea" > <td class="r table_textarea" >

@ -14,7 +14,7 @@ class MendService
return self::$statusList[$status] ?? '未知'; return self::$statusList[$status] ?? '未知';
} }
public function addMendTask($params, $handlePromote = null) public function addMendTask($params, $permPromote = null, $handlePromote = null)
{ {
$userId = $params['user_id'] ?? 0; $userId = $params['user_id'] ?? 0;
$remark = $params['remark'] ?? ''; $remark = $params['remark'] ?? '';
@ -40,6 +40,14 @@ class MendService
throw new \Exception('没有订单日期'); throw new \Exception('没有订单日期');
} }
if ($permPromote) {
$levelColumn = 'level'. $permPromote['level'] . '_id';
$promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $permPromote['id']])->find();
if (!$promote) {
throw new \Exception('所属推广员异常');
}
}
if ($this->checkOrderTime(strtotime($orderTime))) { if ($this->checkOrderTime(strtotime($orderTime))) {
throw new \Exception('仅能补链本周数据,请重新选择补链时间'); throw new \Exception('仅能补链本周数据,请重新选择补链时间');
} }

@ -22,6 +22,12 @@ class MendController extends BaseController
$row = intval(I('row', 10)); $row = intval(I('row', 10));
$params = I('get.'); $params = I('get.');
$loginer = $this->getLoginPromote(); $loginer = $this->getLoginPromote();
$promoteService = new PromoteService();
$permPromote = $loginer;
if ($loginer['shift_over_apply'] == 1) {
$permPromote = $promoteService->getTopPromote($loginer);
}
$map = ['op_type' => 1, '_string' => '1=1']; $map = ['op_type' => 1, '_string' => '1=1'];
if(isset($params['account'])) { if(isset($params['account'])) {
@ -43,8 +49,7 @@ class MendController extends BaseController
$map['order_time'] = ['elt', strtotime($params['time_end']) + 86399]; $map['order_time'] = ['elt', strtotime($params['time_end']) + 86399];
} }
$promoteService = new PromoteService(); $subInSql = $promoteService->subInSql($permPromote);
$subInSql = $promoteService->subInSql($loginer);
$map['_string'] .= ' and (promote_id in (' . $subInSql . ') or promote_id_to in (' . $subInSql . '))'; $map['_string'] .= ' and (promote_id in (' . $subInSql . ') or promote_id_to in (' . $subInSql . '))';
$records = M('mend', 'tab_')->where($map)->order('create_time desc')->page($page, $row)->select(); $records = M('mend', 'tab_')->where($map)->order('create_time desc')->page($page, $row)->select();
@ -62,8 +67,8 @@ class MendController extends BaseController
$this->assign('_page', $page); $this->assign('_page', $page);
} }
$levelColumn = 'level'. $loginer['level'] . '_id'; $levelColumn = 'level'. $permPromote['level'] . '_id';
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $loginer['id']])->select(); $promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select();
$this->assign('promotes', $promotes); $this->assign('promotes', $promotes);
$this->assign('count', $count); $this->assign('count', $count);
@ -81,13 +86,19 @@ class MendController extends BaseController
} }
$loginer = $this->getLoginPromote(); $loginer = $this->getLoginPromote();
$levelColumn = 'level'. $loginer['level'] . '_id'; $permPromote = $loginer;
$promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $loginer['id']])->find(); $promoteService = new PromoteService();
if ($loginer['shift_over_apply'] == 1) {
$permPromote = $promoteService->getTopPromote($loginer);
}
$levelColumn = 'level'. $permPromote['level'] . '_id';
$promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $permPromote['id']])->find();
if (!$promote) { if (!$promote) {
return $this->error('所属推广员异常'); return $this->error('所属推广员异常');
} }
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $loginer['id']])->select(); $promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select();
$this->meta_title = '玩家补链'; $this->meta_title = '玩家补链';
$this->assign('user', $user); $this->assign('user', $user);
@ -99,9 +110,16 @@ class MendController extends BaseController
{ {
$params = I('post.'); $params = I('post.');
$loginer = $this->getLoginPromote(); $loginer = $this->getLoginPromote();
$permPromote = $loginer;
$promoteService = new PromoteService();
if ($loginer['shift_over_apply'] == 1) {
$permPromote = $promoteService->getTopPromote($loginer);
}
$service = new MendService(); $service = new MendService();
try { try {
$service->addMendTask($params, $loginer); $service->addMendTask($params, $permPromote, $loginer);
$this->ajaxReturn(['status' => 1, 'msg' => '补链申请成功']); $this->ajaxReturn(['status' => 1, 'msg' => '补链申请成功']);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->ajaxReturn(['status' => 0, 'msg' => $e->getMessage()]); $this->ajaxReturn(['status' => 0, 'msg' => $e->getMessage()]);

@ -1681,7 +1681,7 @@ class QueryController extends BaseController
return $levelPromote; return $levelPromote;
} }
private function getQueryPromote($levelPromote) private function getQueryPromote($levelPromote, \Closure $whenNotSearch = null)
{ {
$queryPromote = null; $queryPromote = null;
$promote = $this->getLoginPromote(); $promote = $this->getLoginPromote();
@ -1693,6 +1693,11 @@ class QueryController extends BaseController
} }
if ($queryPromoteId == 0) { if ($queryPromoteId == 0) {
$queryPromote = $this->getLoginPromote(); $queryPromote = $this->getLoginPromote();
if ($whenNotSearch) {
$queryPromote = $whenNotSearch();
} else {
$queryPromote = $this->getLoginPromote();
}
} else { } else {
$queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find(); $queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find();
} }
@ -1717,9 +1722,17 @@ class QueryController extends BaseController
$sortName = trim(I('sort_name', '')); $sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1)); $sort = intval(I('sort', 1));
$promote = $this->getLoginPromote(); $promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote); $queryPromote = $this->getQueryPromote($levelPromote, function() use ($promote) {
if ($promote['shift_over_apply'] == 1) {
$promoteService = new PromoteService();
return $promoteService->getTopPromote($promote);
} else {
return $promote;
}
});
$promoteService = new PromoteService(); $promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote); $subInSql = $promoteService->subInSql($queryPromote);
@ -1877,7 +1890,6 @@ class QueryController extends BaseController
$this->assign('unique_user_count', $uniqueCountRow['user_count']); $this->assign('unique_user_count', $uniqueCountRow['user_count']);
$this->assign('unique_count', $uniqueCountRow['count']); $this->assign('unique_count', $uniqueCountRow['count']);
$this->assign('sort', $sort); $this->assign('sort', $sort);
$this->assign('setdate', date('Y-m-d', $nowTime));
$this->assign('games', $games); $this->assign('games', $games);
$this->assign('records', $records); $this->assign('records', $records);
$this->assign('pagination', $pagination); $this->assign('pagination', $pagination);

@ -134,7 +134,7 @@
if(res.status==1){ if(res.status==1){
layer.msg(res.msg); layer.msg(res.msg);
setTimeout(function(){ setTimeout(function(){
window.location.href = "{:U('Query/userRoles')}"; window.location.href = "{:U('Mend/index')}";
}, 1500); }, 1500);
} else { } else {
layer.msg(res.msg); layer.msg(res.msg);

Loading…
Cancel
Save