From 9fb91c4a66ced49355c4ffa8809cdbaf8c023b6d Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Fri, 18 Jun 2021 17:27:26 +0800 Subject: [PATCH] =?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 | 5 ++++- .../Controller/AuthManagerController.class.php | 5 ++++- .../Admin/Controller/MendController.class.php | 13 +++++++++---- Application/Admin/Model/MemberModel.class.php | 1 + .../Admin/View/AuthManager/dataempower.html | 17 +++++++++++++++++ Application/Admin/View/Mend/edit.html | 16 ++++++++++++++++ Application/Base/Service/MendService.class.php | 16 ++++++++-------- Data/update.sql | 4 +++- 8 files changed, 62 insertions(+), 15 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index ecbb4c51d..9b59e1d3b 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1621,7 +1621,7 @@ function getGameList($partner_id) { function getAdminData ($uid) { $adminData = SM('auth_group_access','sys_') - ->field('data_empower_type,data_president,show_data,show_market_admin,show_promote') + ->field('data_empower_type,data_president,show_data,show_market_admin,show_promote,allow_over_week') ->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id') ->where(array('uid'=>$uid))->find(); @@ -1697,6 +1697,9 @@ function resetUserAuth() $userAuth['data_empower_type'] = $adminData['data_empower_type']; $userAuth['data_president'] = $adminData['data_president']; $userAuth['show_data'] = $adminData['show_data']; + $userAuth['show_market_admin'] = $adminData['show_market_admin']; + $userAuth['allow_over_week'] = $adminData['allow_over_week']; + $userAuth['show_promote'] = $adminData['show_promote']; session('user_group_id',$groupId); session('user_auth', $userAuth); session('user_auth_sign', data_auth_sign($userAuth)); diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index 76176d0ac..577327e58 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -529,7 +529,7 @@ class AuthManagerController extends AdminController{ $auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) ->getfield('id,id,title,rules'); // var_dump($auth_group);die(); - $empower_type = M('AuthGroup')->field('data_empower_type,show_data,show_market_admin,show_promote')->where(array('id'=>$_GET['group_id']))->find(); + $empower_type = M('AuthGroup')->field('data_empower_type,show_data,show_market_admin,show_promote,allow_over_week')->where(array('id'=>$_GET['group_id']))->find(); // var_dump($empower_type);die(); $this->assign('data_empower_type', $empower_type['data_empower_type']); @@ -537,6 +537,7 @@ class AuthManagerController extends AdminController{ $this->assign('auth_group', $auth_group); $this->assign('show_market_admin', $empower_type['show_market_admin']); $this->assign('show_promote', $empower_type['show_promote']); + $this->assign('allow_over_week', $empower_type['allow_over_week']); $this->display(); } @@ -547,6 +548,7 @@ class AuthManagerController extends AdminController{ $data_empower_type = I('data_empower_type'); $show_data = I('show_data'); $show_market_admin = I('show_market_admin'); + $allow_over_week = I('allow_over_week'); $show_promote = I('show_promote'); $promoteData = I('promote_data'); @@ -577,6 +579,7 @@ class AuthManagerController extends AdminController{ 'data_president' => $promoteData, 'show_data' => $show_data, 'show_market_admin' => $show_market_admin, + 'allow_over_week' => $allow_over_week, 'show_promote' => $show_promote, ))) { diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index 2705ede07..e937f5b80 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -127,6 +127,11 @@ class MendController extends ThinkController { $service = new MendService(); try { + if (session('user_auth')['allow_over_week'] && $params['allow_over_week'] == 1) { + $params['allow_over_week'] = 1; + } else { + $params['allow_over_week'] = 0; + } $service->addMendTask($params); $userData = M('user','tab_')->field(['account', 'promote_id', 'promote_account'])->where(['id' => $params['user_id']])->find(); @@ -136,7 +141,8 @@ class MendController extends ThinkController { 'key' => $userData['account'].'/'.$userData['promote_account'].'/'.$promoteToData['account'], 'op_name' => '编辑推广补链', 'url' => U('Mend/edit', ['id' => $userData['id']]), - 'menu' => '推广员-推广员管理-推广补链-编辑推广补链' + 'menu' => '推广员-推广员管理-推广补链-编辑推广补链', + 'content' => json_encode($params) ]); $this->success('补链成功', U('lists'), 2); @@ -157,8 +163,7 @@ class MendController extends ThinkController { $this->m_title = '推广补链'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find()); - - + $this->assign('allow_over_week', session('user_auth')['allow_over_week']); $this->display(); } } @@ -264,7 +269,7 @@ class MendController extends ThinkController { { $id = I('id'); $info = M("mend", 'tab_')->where("id = {$id} and status = 0")->find(); - if(empty($mend)){ + if(empty($info)){ $this->error("补链不存在或已处理"); } $info['order_time'] = date("Y-m-d",$info['order_time']); diff --git a/Application/Admin/Model/MemberModel.class.php b/Application/Admin/Model/MemberModel.class.php index 811fb087b..4742829ee 100644 --- a/Application/Admin/Model/MemberModel.class.php +++ b/Application/Admin/Model/MemberModel.class.php @@ -81,6 +81,7 @@ class MemberModel extends Model { 'data_president'=>$adminData['data_president'], 'show_data'=>$adminData['show_data'], 'show_market_admin'=>$adminData['show_market_admin'], + 'allow_over_week' => $adminData['allow_over_week'], 'show_promote'=>$adminData['show_promote'], ); session('user_group_id',$groupId); diff --git a/Application/Admin/View/AuthManager/dataempower.html b/Application/Admin/View/AuthManager/dataempower.html index b2037ce38..5ee3d36fe 100644 --- a/Application/Admin/View/AuthManager/dataempower.html +++ b/Application/Admin/View/AuthManager/dataempower.html @@ -113,6 +113,23 @@ + + 是否允许跨周补链: + + + + + + + + + diff --git a/Application/Admin/View/Mend/edit.html b/Application/Admin/View/Mend/edit.html index 07e05226d..30b5e336f 100644 --- a/Application/Admin/View/Mend/edit.html +++ b/Application/Admin/View/Mend/edit.html @@ -90,6 +90,22 @@ + + + 是否跨周补链: + + + + + + + + + 备注 diff --git a/Application/Base/Service/MendService.class.php b/Application/Base/Service/MendService.class.php index 0e4692179..552097c55 100644 --- a/Application/Base/Service/MendService.class.php +++ b/Application/Base/Service/MendService.class.php @@ -17,9 +17,9 @@ class MendService public function addMendTask($params, $permPromote = null, $handlePromote = null) { $userId = $params['user_id'] ?? 0; - $remark = $params['remark'] ?? ''; $orderTime = $params['order_time'] ?? ''; $toPromoteId = $params['promote_id_to'] ?? ''; + $allowOverWeek = $params['allow_over_week'] ?? 0; $promoteService = new PromoteService(); if ($toPromoteId == -1) { @@ -51,11 +51,11 @@ class MendService } } - if ($this->checkOrderTime(strtotime($orderTime))) { + if (!$allowOverWeek && !$this->checkOrderTime(strtotime($orderTime))) { throw new \Exception('仅能补链本周数据,请重新选择补链时间'); } - if ($this->checkPromote(strtotime($orderTime), $user['account'])) { + if (!$this->checkPromote(strtotime($orderTime), $user['account'])) { throw new \Exception('在订单日期内含有多个推广员,无法补链'); } @@ -87,18 +87,18 @@ class MendService $checktime = strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) .' days'); //本周开始时间 if($orderTime >= $checktime){ //在本周允许换绑 - return false; + return true; } - return true; + return false; } 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; + if(count($res) > 1) { + return false; } - return false; + return true; } } \ No newline at end of file diff --git a/Data/update.sql b/Data/update.sql index 10c5e08be..bf0b9f9bd 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2833,4 +2833,6 @@ ADD COLUMN `status` tinyint(1) NULL DEFAULT 0 COMMENT '退款状态' AFTER `crea ADD COLUMN `check_time` int(11) NULL DEFAULT 0 COMMENT '确认时间' AFTER `status`; ALTER TABLE `tab_spend_refund` -ADD COLUMN `admin` varchar(50) NULL DEFAULT '' COMMENT '操作人' AFTER `check_time`; \ No newline at end of file +ADD COLUMN `admin` varchar(50) NULL DEFAULT '' COMMENT '操作人' AFTER `check_time`; + +alter table sys_auth_group add column `allow_over_week` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否允许跨周补链' after show_promote; \ No newline at end of file