From 180deeb2ae7419d1e82c8b0cde3f8e2700acf49c Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 19 May 2021 15:23:02 +0800 Subject: [PATCH 1/3] bug --- Application/Payment/Controller/PaymentController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index a38362616..b4c339c3c 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -1261,7 +1261,7 @@ class PaymentController extends BaseController } $count = M("pay_statement_info","tab_")->field("sum(final_statement_money) statement_money")->where("id in ({$ids})")->find(); - $paymentInfo = D("Admin/TransferMerchant")->getUnderPaymentInfo(); + $paymentInfo = D("Admin/TransferMerchant")->getStatementPaymentInfo(); $this->getAccountMoney(); // dd($CompanyInfo); From 8440c5d384645f5c044d0d5e5c4858c5444bc844 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 19 May 2021 21:23:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 10 + .../Admin/Controller/MendController.class.php | 94 +++------ Application/Admin/View/Mend/edit.html | 4 +- Application/Admin/View/Mend/lists.html | 13 +- Application/Admin/View/Mend/recordList.html | 2 + Application/Admin/View/Mend/shiftInfo.html | 8 +- .../Base/Service/MendService.class.php | 93 +++++++++ .../Base/Service/PromoteService.class.php | 104 +++++----- Application/Common/Common/extend.php | 5 + .../Home/Controller/MendController.class.php | 110 +++++++++++ .../Home/Controller/QueryController.class.php | 3 +- Application/Home/View/default/Mend/add.html | 168 ++++++++++++++++ Application/Home/View/default/Mend/index.html | 179 ++++++++++++++++++ .../View/default/Public/promote_base.html | 1 + .../Home/View/default/Query/userRoles.html | 3 + 15 files changed, 672 insertions(+), 125 deletions(-) create mode 100644 Application/Base/Service/MendService.class.php create mode 100644 Application/Home/Controller/MendController.class.php create mode 100644 Application/Home/View/default/Mend/add.html create mode 100644 Application/Home/View/default/Mend/index.html diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 88fa10232..2135e7aec 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -3277,4 +3277,14 @@ function array_repeat($array,$keyid="id",$desc=false) $c = array_rsort($c,true); } return $c; +} + +function getShiftingMends(array $userIds = null) +{ + $map = ['status' => 0]; + if (!is_null($userIds)) { + $map['user_id'] = ['in', $userIds]; + } + $mends = M('mend', 'tab_')->field(['id', 'user_id'])->where($map)->select(); + return index_by_column('user_id', $mends); } \ No newline at end of file diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 6b4bf9ca6..6a6c5a8fd 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -1,6 +1,8 @@ field("user_account,promote_account,pay_amount,promote_account_to,order_time,create_time,op_account,remark") + ->field("user_account,promote_account,pay_amount,promote_account_to,order_time,create_time,op_account,remark,status") ->where($map) ->order("create_time desc"); @@ -79,6 +81,7 @@ class MendController extends ThinkController { $data = $data->page($page, $row)->select(); } //格式化信息 + $mendService = new MendService(); foreach ($data as $key => $value) { ($data[$key]['promote_account']=='官方渠道')?($data[$key]['promote_account']=C('OFFICIEL_CHANNEL')):''; @@ -88,9 +91,10 @@ class MendController extends ThinkController { if(!$show_data_power){ $data[$key]['user_account'] = encryptStr($data[$key]['user_account']); } + $data[$key]['status'] = $mendService->getStatusText($value['status']); } - if($export) db2csv($data,"推广员管理_推广补链_补链记录",["玩家账号","补链前渠道","补链前归属金额","补链后渠道","切分时间","补链时间","操作人员","备注"]); + if($export) db2csv($data,"推广员管理_推广补链_补链记录",["玩家账号","补链前渠道","补链前归属金额","补链后渠道","切分时间","补链时间","操作人员","备注","处理状态"]); if(IS_POST){ $page = set_pagination($_REQUEST['row_count'],$row); @@ -112,73 +116,31 @@ class MendController extends ThinkController { $this->assign('show_data_power', $show_data_power); $this->display(); - // parent::lists("Mend",$p,$map); } public function edit($id = null) { if (IS_POST) { - $promoteService = new PromoteService(); - if ($_POST['prmoote_id_to'] == -1){ - $_POST['prmoote_id_to'] = 0; - } - if ($_POST['prmoote_id_to'] === ''){ - $this->error('请选择需要变更的渠道'); - } - if ($_POST['promote_id'] == $_POST['prmoote_id_to']) { - $this->error('没有变更数据'); - } - if ($_POST['order_time'] == '') { - $this->error('没有订单日期'); - } - //判断是否已经结算 - // if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){ - // $this->error('在订单日期内含有已经结算的订单,无法补链'); - // } - - // if(self::checkSpend(strtotime($_POST['order_time']),$_POST['account'])){ - // $this->error("在订单日期内含有已经结算的订单,无法补链。"); - // } - if(self::checkOrderTime(strtotime($_POST['order_time']))){ - $this->error('仅能补链本周数据,请重新选择补链时间'); - } - if(self::checkPromote(strtotime($_POST['order_time']),$_POST['account'])){ - $this->error('在订单日期内含有多个推广员,无法补链'); - } - - $create = $_REQUEST; - $create['order_time'] = date($create['order_time']); - $params = array( - "from_promote_id"=>$create['promote_id'], - "to_promote_id"=>$create['prmoote_id_to'], - "order_time"=>$create['order_time'], - "type"=>2, - "shift_ids"=>[$create['user_id']], - "creator_type"=>0, - "creator_id"=>$_SESSION["onethink_admin"]["user_auth"]["uid"] - ); - if(!empty($create['remark'])){ - $params['remark'] = $create['remark']; - } - -// dump($create);die(); - - $res = $promoteService->addShiftTask($params); - if($res['status']){ - - $userData = M('user','tab_')->field('account')->where(['id'=>$create['user_id']])->find(); - $promoteToData = M('promote','tab_')->field('account')->where(['id'=>$create['prmoote_id_to']])->find(); - $promoteFromData = M('promote','tab_')->field('account')->where(['id'=>$create['promote_id']])->find(); - if ($create['promote_id'] == '0') { - $promoteFromData['account'] = '官方渠道'; - } - - addOperationLog(['op_type'=>1,'key'=>$userData['account'].'/'.$promoteFromData['account'].'/'.$promoteToData['account'],'op_name'=>'编辑推广补链','url'=>U('Mend/edit',['id'=>$create['user_id']]),'menu'=>'推广员-推广员管理-推广补链-编辑推广补链']); + $params = I('post.'); + $service = new MendService(); + try { + + $service->addMendTask($params); + + $userData = M('user','tab_')->field(['account', 'promote_id', 'promote_account'])->where(['id' => $params['user_id']])->find(); + $promoteToData = M('promote','tab_')->field('account')->where(['id'=> $params['prmoote_id_to']])->find(); + addOperationLog([ + 'op_type' => 1, + 'key' => $userData['account'].'/'.$userData['promote_account'].'/'.$promoteToData['account'], + 'op_name' => '编辑推广补链', + 'url' => U('Mend/edit', ['id' => $userData['id']]), + 'menu' => '推广员-推广员管理-推广补链-编辑推广补链' + ]); $this->success('补链成功', U('lists'), 2); - }else{ - $this->error($res['msg']); + } catch (\Exception $e) { + $this->error($e->getMessage()); } } else { // echo 1;die(); @@ -300,17 +262,11 @@ class MendController extends ThinkController { public function shiftInfo() { $id = I('id'); - $info = M("shift_task")->where("id = {$id} and status = 0")->find(); - - if(empty($info)){ + $info = M("mend", 'tab_')->where("id = {$id} and status = 0")->find(); + if(empty($mend)){ $this->error("补链不存在或已处理"); } - - - $info['user_id'] = json_decode($info['shift_ids'])[0]; $info['order_time'] = date("Y-m-d",$info['order_time']); - $userid = $info['user_id']; - $info['account'] = M("User","tab_")->field("account")->where("id = '{$userid}'")->find()['account']; $this->assign('data',$info); $this->display(); } diff --git a/Application/Admin/View/Mend/edit.html b/Application/Admin/View/Mend/edit.html index 16f777fc6..07e05226d 100644 --- a/Application/Admin/View/Mend/edit.html +++ b/Application/Admin/View/Mend/edit.html @@ -72,7 +72,7 @@ 补链后渠道 - @@ -152,7 +152,7 @@ $(".select_gallery").select2(); //导航高亮 highlight_subnav('{:U('Mend/lists')}'); -Think.setValue("prmoote_id_to", {$data.promote_id|default = "''"}); +Think.setValue("promote_id_to", {$data.promote_id|default = "''"}); $('#submit').click(function(){ $('#form').submit(); }); diff --git a/Application/Admin/View/Mend/lists.html b/Application/Admin/View/Mend/lists.html index f84c816b9..4cc6f4019 100644 --- a/Application/Admin/View/Mend/lists.html +++ b/Application/Admin/View/Mend/lists.html @@ -65,7 +65,9 @@ aOh! 暂时还没有内容! + + @@ -96,12 +98,11 @@ - - 补链 - - 补链中 - - + + 补链 + + 补链中 + diff --git a/Application/Admin/View/Mend/recordList.html b/Application/Admin/View/Mend/recordList.html index 14bf92805..6e1fe62f8 100644 --- a/Application/Admin/View/Mend/recordList.html +++ b/Application/Admin/View/Mend/recordList.html @@ -75,6 +75,7 @@ 备注 切分时间 补链时间 + 处理状态 操作人员 @@ -115,6 +116,7 @@ {$data.order_time} {$data.create_time} + {$data.status} {$data.op_account} diff --git a/Application/Admin/View/Mend/shiftInfo.html b/Application/Admin/View/Mend/shiftInfo.html index c8a272de3..c37ffb375 100644 --- a/Application/Admin/View/Mend/shiftInfo.html +++ b/Application/Admin/View/Mend/shiftInfo.html @@ -57,20 +57,20 @@ 用户账号 - + 修改前渠道 - + 补链后渠道 - + @@ -102,7 +102,7 @@
- diff --git a/Application/Base/Service/MendService.class.php b/Application/Base/Service/MendService.class.php new file mode 100644 index 000000000..8d79e9683 --- /dev/null +++ b/Application/Base/Service/MendService.class.php @@ -0,0 +1,93 @@ + '处理中', + 1 => '处理成功', + 2 => '处理失败', + ]; + + public function getStatusText($status) + { + return self::$statusList[$status] ?? '未知'; + } + + public function addMendTask($params, $handlePromote = null) + { + $userId = $params['user_id'] ?? 0; + $remark = $params['remark'] ?? ''; + $orderTime = $params['order_time'] ?? ''; + $toPromoteId = $params['promote_id_to'] ?? ''; + + $promoteService = new PromoteService(); + if ($toPromoteId == -1) { + $toPromoteId = 0; + } + if ($toPromoteId === '') { + throw new \Exception('请选择需要变更的渠道'); + } + + $user = M('user', 'tab_')->where(['id' => $userId])->find(); + if (!$user) { + throw new \Exception('用户不存在'); + } + if ($user['promote_id'] == $toPromoteId) { + throw new \Exception('没有变更数据'); + } + if ($orderTime == '') { + throw new \Exception('没有订单日期'); + } + + if ($this->checkOrderTime(strtotime($orderTime))) { + throw new \Exception('仅能补链本周数据,请重新选择补链时间'); + } + + if ($this->checkPromote(strtotime($orderTime), $user['account'])) { + throw new \Exception('在订单日期内含有多个推广员,无法补链'); + } + + $data = [ + 'from_promote_id' => $user['promote_id'], + 'to_promote_id' => $toPromoteId, + 'order_time' => $orderTime, + 'type' => 2, + 'shift_ids' => [$userId], + 'creator_type' => $handlePromote ? 1 : 0, + 'creator_id' => $handlePromote ? $handlePromote['id'] : $_SESSION["onethink_admin"]["user_auth"]["uid"] + ]; + + if(!empty($params['remark'])){ + $data['remark'] = $params['remark']; + } + + $result = $promoteService->addShiftTask($data); + if (!$result['status']) { + throw new \Exception($result['msg']); + } + } + + private function checkOrderTime($orderTime) + { + $sdefaultDate = date('Y-m-d'); + $first = 1; //周一开始 + $w = date('w',strtotime($sdefaultDate)); + $checktime = strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) .' days'); //本周开始时间 + if($orderTime >= $checktime){ + //在本周允许换绑 + return false; + } + return true; + } + + private function checkPromote($orderTime, $account) + { + $res = M('Spend','tab_')->field('promote_id')->where(['pay_time' => array('EGT', $orderTime), 'user_account' => $account])->group('promote_id')->select(); + if(count($res)>1) { + return true; + } + return false; + } + +} \ No newline at end of file diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 885fd2019..cf9eb1c73 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -134,11 +134,6 @@ class PromoteService { ]; } - $isFuture = false; - if (strtotime($orderTime) > strtotime(date('Y-m-d 23:59:59'))) { - $isFuture = true; - } - $data = [ 'from_promote_id' => $fromPromoteId, 'to_promote_id' => $toPromoteId, @@ -154,6 +149,10 @@ class PromoteService { ]; if (M('shift_task', 'sys_')->add($data)) { + if ($type == 2) { + $data['id'] = M()->getLastInsID(); + $this->addMendsByTask($data); + } return [ 'status' => true, 'msg'=>'迁移任务创建成功' @@ -166,6 +165,49 @@ class PromoteService { } } + public function addMendsByTask($task) + { + $userIds = json_decode($task['shift_ids'], true); + $users = M('user', 'tab_')->field(['id', 'account', 'nickname'])->where(['id' => ['in', $userIds]])->select(); + $users = index_by_column('id', $users); + $toPromote = M('promote','tab_')->field(['id', 'account'])->where(['id' => $task['to_promote_id']])->find(); + $fromPromote = M('promote','tab_')->field(['id', 'account'])->where(['id' => $task['from_promote_id']])->find(); + + $creator = null; + $opAccount = ''; + if ($task['creator_type'] == 1) { + $creator = M('promote', 'tab_')->where(['id' => $task['creator_id']])->find(); + $opAccount = $creator ? $creator['account'] : ''; + } else { + $creator = M('ucenter_member', 'sys_')->where(['id' => $task['creator_id']])->find(); + $opAccount = $creator ? $creator['username'] : ''; + } + + $mends = []; + foreach ($userIds as $userId) { + $user = $users[$userId]; + $mends[] = [ + 'task_id' => $task['id'], + 'user_id' => $userId, + 'user_account' => $user['account'], + 'user_nickname' => $user['nickname'], + 'promote_id' => $fromPromote ? $fromPromote['id'] : 0, + 'promote_account' => $fromPromote ? $fromPromote['account'] : C('OFFICIEL_CHANNEL'), + 'promote_id_to' => $toPromote ? $toPromote['id'] : 0, + 'promote_account_to' => $toPromote ? $toPromote['account'] : C('OFFICIEL_CHANNEL'), + 'remark' => $task['remark'] == '' ? ($task['creator_type'] == 0 ? '后台补链' : '玩家迁移') : $task['remark'], + 'order_time' => $task['order_time'], + 'create_time' => time(), + 'pay_amount' => 0, + 'op_id' => $task['creator_id'], + 'op_account' => $opAccount, + 'op_type' => $task['creator_type'], + 'bind_type' => 1, + ]; + } + M('mend', 'tab_')->addAll($mends); + } + public function shiftPromote($task) { $model = new Model(); @@ -309,17 +351,6 @@ class PromoteService { $fromPromoteId = $task['from_promote_id']; $orderTime = $task['order_time']; $shiftIds = json_decode($task['shift_ids'], true) ?? []; - $remark = $task['remark'] ?? ''; - - $creator = null; - $opAccount = ''; - if ($task['creator_type'] == 1) { - $creator = M('promote', 'tab_')->where(['id' => $task['creator_id']])->find(); - $opAccount = $creator ? $creator['account'] : ''; - } else { - $creator = M('ucenter_member', 'sys_')->where(['id' => $task['creator_id']])->find(); - $opAccount = $creator ? $creator['username'] : ''; - } $toPromote = M('promote', 'tab_')->where(['id' => $toPromoteId])->find(); $fromPromote = M('promote', 'tab_')->where(['id' => $fromPromoteId])->find(); @@ -357,26 +388,17 @@ class PromoteService { $formConpany = M('promote_company', 'tab_')->field(['company_name', 'company_belong'])->where(['id' => $fromPromote['company_id']])->find(); $toConpany = M('promote_company', 'tab_')->field(['company_name', 'company_belong'])->where(['id' => $toPromote['company_id']])->find(); $belongs = PromoteCompanyService::$belongs; - $mends = []; + + $model = new Model(); + $model->startTrans(); + + $hasError = false; foreach ($users as $item) { $amount = isset($payAmountRows[$item['id']]) ? round(floatval($payAmountRows[$item['id']]['pay_amount']), 2) : 0; - $mends[] = [ - 'user_id' => $item['id'], - 'user_account' => $item['account'], - 'user_nickname' => $item['nickname'], - 'promote_id' => $fromPromote['id'], - 'promote_account' => $fromPromote['account'], - 'promote_id_to' => $toPromote['id'], - 'promote_account_to' => $toPromote['account'], - 'remark' => $remark == '' ? ($task['creator_type'] == 0 ? '后台补链' : '玩家迁移') : $remark, - 'order_time' => $orderTime, - 'create_time' => time(), - 'pay_amount' => $amount, - 'op_id' => $creator ? $creator['id'] : 0, - 'op_account' => $opAccount, - 'op_type' => $task['creator_type'], - 'bind_type' => 1, - ]; + $status = M('mend', 'tab_')->where(['task_id' => $task['id'], 'user_id' => $item['id']])->save(['status' => 1, 'pay_amount' => $amount, 'update_time' => time()]); + if (!$status) { + $hasError = true; + } if ($amount > 500) { $userWord = '玩家账号' . $item['account']; $fromWord = $fromPromote['account'] . ($formConpany ? '(' . $belongs[$formConpany['company_belong']] . '-' . $formConpany['company_name'] : ''); @@ -395,20 +417,16 @@ class PromoteService { } } + if ($hasError) { + $model->rollback(); + return ['status' => false, 'msg' => '系统异常,修改补链记录失败']; + } + $toTopPromote = $this->getTopPromote($toPromote); $hasGameIds = $toTopPromote['game_ids'] == '' ? [] : explode(',', $toTopPromote['game_ids']); $hasNotGameIds = M('game', 'tab_')->where(['game_id' => ['not in', $hasGameIds]])->getField('id', true); $hasNotGameIds = $hasNotGameIds ?? []; - $model = new Model(); - $model->startTrans(); - - $status = M('mend', 'tab_')->addAll($mends); - if (!$status) { - $model->rollback(); - return ['status' => false, 'msg' => '系统异常,添加变更记录失败']; - } - if (count($notices) > 0) { M('admin_notice', 'tab_')->addAll($notices); } diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 415a862d5..e9041ef69 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -3057,4 +3057,9 @@ function getAggExceptIds($gameSettings) } } return $exceptIds; +} + +function getHideAccount($account) +{ + return substr($account, 0, 2) . '******' . substr($account, 8); } \ No newline at end of file diff --git a/Application/Home/Controller/MendController.class.php b/Application/Home/Controller/MendController.class.php new file mode 100644 index 000000000..d46867079 --- /dev/null +++ b/Application/Home/Controller/MendController.class.php @@ -0,0 +1,110 @@ +getLoginPromote(); + + $map = ['op_type' => 1, '_string' => '1=1']; + if(isset($params['account'])) { + $map['user_account']= ['like', '%' . $params['account'] . '%']; + } + if(!empty($params['promote_id'])) { + $map['promote_id']= $params['promote_id']; + } + if(!empty($params['promote_id_to'])) { + $map['promote_id_to'] = $params['promote_id_to']; + } + if(!empty($params['op_id'])) { + $map['op_id'] = $params['op_id']; + } + if (!empty($params['time_start'])) { + $map['order_time'] = ['egt', strtotime($params['time_start'])]; + } + if (!empty($params['time_end'])) { + $map['order_time'] = ['elt', strtotime($params['time_end']) + 86399]; + } + + $promoteService = new PromoteService(); + $subInSql = $promoteService->subInSql($loginer); + $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(); + $count = M('mend', 'tab_')->where($map)->count(); + + $mendService = new MendService(); + foreach ($records as $key => $record) { + $record['status_text'] = $mendService->getStatusText($record['status']); + $records[$key] = $record; + } + + + $page = set_pagination($count, $row, $params); + if ($page) { + $this->assign('_page', $page); + } + + $levelColumn = 'level'. $loginer['level'] . '_id'; + $promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $loginer['id']])->select(); + + $this->assign('promotes', $promotes); + $this->assign('count', $count); + $this->assign('records', $records); + $this->meta_title = '补链记录'; + $this->display(); + } + + public function add() + { + $userId = I('user_id', 0); + $user = M('user', 'tab_')->where(['id' => $userId])->find(); + if (!$user) { + return $this->error('用户不存在'); + } + + $loginer = $this->getLoginPromote(); + $levelColumn = 'level'. $loginer['level'] . '_id'; + $promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $loginer['id']])->find(); + if (!$promote) { + return $this->error('所属推广员异常'); + } + + $promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $loginer['id']])->select(); + + $this->meta_title = '玩家补链'; + $this->assign('user', $user); + $this->assign('promotes', $promotes); + $this->display(); + } + + public function save() + { + $params = I('post.'); + $loginer = $this->getLoginPromote(); + $service = new MendService(); + try { + $service->addMendTask($params, $loginer); + $this->ajaxReturn(['status' => 1, 'msg' => '补链申请成功']); + } catch (\Exception $e) { + $this->ajaxReturn(['status' => 0, 'msg' => $e->getMessage()]); + } + } +} diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index ec413f8b3..3312f920a 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -341,7 +341,7 @@ class QueryController extends BaseController $list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']); $list['new_login_ip'] = $newLoginData['login_ip']; - $list['account'] = substr($list['account'], 0, 2) . '******' . substr($list['account'], 8); + $list['account'] = getHideAccount($list['account']); if(!empty($list['device_number'])) { $list['device_number'] = encryption($list['device_number']); } @@ -1786,6 +1786,7 @@ class QueryController extends BaseController } $columns = [ + 'role.user_id', 'user_account', 'role.promote_account', 'role.game_name', diff --git a/Application/Home/View/default/Mend/add.html b/Application/Home/View/default/Mend/add.html new file mode 100644 index 000000000..ca5bd7b69 --- /dev/null +++ b/Application/Home/View/default/Mend/add.html @@ -0,0 +1,168 @@ + + + + + + + + +
+ + + + + + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/Mend/index.html b/Application/Home/View/default/Mend/index.html new file mode 100644 index 000000000..9334c5bf0 --- /dev/null +++ b/Application/Home/View/default/Mend/index.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Application/Home/View/default/Public/promote_base.html b/Application/Home/View/default/Public/promote_base.html index eec420a4b..f76fba722 100644 --- a/Application/Home/View/default/Public/promote_base.html +++ b/Application/Home/View/default/Public/promote_base.html @@ -89,6 +89,7 @@ IOS下载数统计 用户留存率 游戏分区数据汇总 + 补链记录 diff --git a/Application/Home/View/default/Query/userRoles.html b/Application/Home/View/default/Query/userRoles.html index 31f4a578a..ba6c0e25f 100644 --- a/Application/Home/View/default/Query/userRoles.html +++ b/Application/Home/View/default/Query/userRoles.html @@ -157,6 +157,7 @@ + 操作

暂无数据

@@ -179,6 +180,8 @@ {$record.role_name} {$record.role_level} {$record.create_time} + 补链
From 90d82b1a8d00a0b73065d713bb354b2370632e00 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 20 May 2021 11:04:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9C=89=E5=AE=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 1 + Application/Admin/View/Promote/edit.html | 16 +++++++++ .../Base/Service/MendService.class.php | 10 +++++- .../Home/Controller/MendController.class.php | 34 ++++++++++++++----- .../Home/Controller/QueryController.class.php | 18 ++++++++-- Application/Home/View/default/Mend/add.html | 2 +- 6 files changed, 68 insertions(+), 13 deletions(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 76e2b3537..2fbc5ad0e 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -444,6 +444,7 @@ class PromoteController extends ThinkController $data['withdraw_done'] = $_POST['withdraw_done']; $data['can_view_recharge'] = $_POST['can_view_recharge']; $data['ts_over_apply'] = $_POST['ts_over_apply'] ?? 0; + $data['shift_over_apply'] = $_POST['shift_over_apply'] ?? 0; if (empty($pwd)) { unset($data['password']); } diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html index 2a6ee9578..dea384bf2 100644 --- a/Application/Admin/View/Promote/edit.html +++ b/Application/Admin/View/Promote/edit.html @@ -348,6 +348,22 @@ + 1):?> + + 公会内部换绑权限: + + + + + + 开启后该推广员有权限操作整个公会的玩家换绑 + + + 备注: diff --git a/Application/Base/Service/MendService.class.php b/Application/Base/Service/MendService.class.php index 8d79e9683..40e65b580 100644 --- a/Application/Base/Service/MendService.class.php +++ b/Application/Base/Service/MendService.class.php @@ -14,7 +14,7 @@ class MendService return self::$statusList[$status] ?? '未知'; } - public function addMendTask($params, $handlePromote = null) + public function addMendTask($params, $permPromote = null, $handlePromote = null) { $userId = $params['user_id'] ?? 0; $remark = $params['remark'] ?? ''; @@ -40,6 +40,14 @@ class MendService 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))) { throw new \Exception('仅能补链本周数据,请重新选择补链时间'); } diff --git a/Application/Home/Controller/MendController.class.php b/Application/Home/Controller/MendController.class.php index d46867079..d03fdcecd 100644 --- a/Application/Home/Controller/MendController.class.php +++ b/Application/Home/Controller/MendController.class.php @@ -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()]); diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 3312f920a..d6829874e 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1681,7 +1681,7 @@ class QueryController extends BaseController return $levelPromote; } - private function getQueryPromote($levelPromote) + private function getQueryPromote($levelPromote, \Closure $whenNotSearch = null) { $queryPromote = null; $promote = $this->getLoginPromote(); @@ -1693,6 +1693,11 @@ class QueryController extends BaseController } if ($queryPromoteId == 0) { $queryPromote = $this->getLoginPromote(); + if ($whenNotSearch) { + $queryPromote = $whenNotSearch(); + } else { + $queryPromote = $this->getLoginPromote(); + } } else { $queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find(); } @@ -1717,9 +1722,17 @@ class QueryController extends BaseController $sortName = trim(I('sort_name', '')); $sort = intval(I('sort', 1)); + $promote = $this->getLoginPromote(); $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(); $subInSql = $promoteService->subInSql($queryPromote); @@ -1877,7 +1890,6 @@ class QueryController extends BaseController $this->assign('unique_user_count', $uniqueCountRow['user_count']); $this->assign('unique_count', $uniqueCountRow['count']); $this->assign('sort', $sort); - $this->assign('setdate', date('Y-m-d', $nowTime)); $this->assign('games', $games); $this->assign('records', $records); $this->assign('pagination', $pagination); diff --git a/Application/Home/View/default/Mend/add.html b/Application/Home/View/default/Mend/add.html index ca5bd7b69..f3d024184 100644 --- a/Application/Home/View/default/Mend/add.html +++ b/Application/Home/View/default/Mend/add.html @@ -134,7 +134,7 @@ if(res.status==1){ layer.msg(res.msg); setTimeout(function(){ - window.location.href = "{:U('Query/userRoles')}"; + window.location.href = "{:U('Mend/index')}"; }, 1500); } else { layer.msg(res.msg);