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 @@
玩家账号 | +补链前推广账号 | +补链前归属金额 | +补链后推广账号 | +备注 | +切分时间 | +补链时间 | +状态 | +操作人员 | +
---|---|---|---|---|---|---|---|---|
+
+ 暂无数据 + |
+ ||||||||
=getHideAccount($vo['user_account'])?> | +{$vo.promote_account} | +{$vo.pay_amount} | +{$vo.promote_account_to} | +{$vo.remark} | +{$vo.order_time|date='Y-m-d H:i:s',###} | +{$vo.create_time|date='Y-m-d H:i:s',###} | +{$vo.status_text} | +{$vo.op_account} | +
暂无数据