|
|
|
@ -22,6 +22,12 @@ class MendController extends BaseController
|
|
|
|
|
$row = intval(I('row', 10));
|
|
|
|
|
$params = I('get.');
|
|
|
|
|
$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'];
|
|
|
|
|
if(isset($params['account'])) {
|
|
|
|
@ -43,8 +49,7 @@ class MendController extends BaseController
|
|
|
|
|
$map['order_time'] = ['elt', strtotime($params['time_end']) + 86399];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
$subInSql = $promoteService->subInSql($loginer);
|
|
|
|
|
$subInSql = $promoteService->subInSql($permPromote);
|
|
|
|
|
$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();
|
|
|
|
@ -62,8 +67,8 @@ class MendController extends BaseController
|
|
|
|
|
$this->assign('_page', $page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$levelColumn = 'level'. $loginer['level'] . '_id';
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $loginer['id']])->select();
|
|
|
|
|
$levelColumn = 'level'. $permPromote['level'] . '_id';
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select();
|
|
|
|
|
|
|
|
|
|
$this->assign('promotes', $promotes);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
@ -81,13 +86,19 @@ class MendController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$loginer = $this->getLoginPromote();
|
|
|
|
|
$levelColumn = 'level'. $loginer['level'] . '_id';
|
|
|
|
|
$promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $loginer['id']])->find();
|
|
|
|
|
$permPromote = $loginer;
|
|
|
|
|
$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) {
|
|
|
|
|
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->assign('user', $user);
|
|
|
|
@ -99,9 +110,16 @@ class MendController extends BaseController
|
|
|
|
|
{
|
|
|
|
|
$params = I('post.');
|
|
|
|
|
$loginer = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
$permPromote = $loginer;
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
if ($loginer['shift_over_apply'] == 1) {
|
|
|
|
|
$permPromote = $promoteService->getTopPromote($loginer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$service = new MendService();
|
|
|
|
|
try {
|
|
|
|
|
$service->addMendTask($params, $loginer);
|
|
|
|
|
$service->addMendTask($params, $permPromote, $loginer);
|
|
|
|
|
$this->ajaxReturn(['status' => 1, 'msg' => '补链申请成功']);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
$this->ajaxReturn(['status' => 0, 'msg' => $e->getMessage()]);
|
|
|
|
|