From 115bafc067b035a96a74f5e3156f5cb373166f41 Mon Sep 17 00:00:00 2001 From: chenzhi <“chenzhi063@qq.com> Date: Thu, 7 Nov 2019 12:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A5=E9=93=BE=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E5=8F=8A=E5=8F=96=E6=B6=88=E8=A1=A5=E9=93=BE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/MendController.class.php | 83 +++++---- Application/Admin/View/Mend/edit.html | 8 +- Application/Admin/View/Mend/lists.html | 9 +- Application/Admin/View/Mend/shiftInfo.html | 173 ++++++++++++++++++ Application/Common/Common/extend.php | 20 ++ Data/update.sql | 5 +- 6 files changed, 257 insertions(+), 41 deletions(-) create mode 100644 Application/Admin/View/Mend/shiftInfo.html diff --git a/Application/Admin/Controller/MendController.class.php b/Application/Admin/Controller/MendController.class.php index df3846a4c..a1d9bc50f 100644 --- a/Application/Admin/Controller/MendController.class.php +++ b/Application/Admin/Controller/MendController.class.php @@ -58,9 +58,9 @@ class MendController extends ThinkController { public function edit($id = null) { - // $promoteService = new PromoteService(); - + if (IS_POST) { + $promoteService = new PromoteService(); if ($_POST['prmoote_id_to'] == -1){ $_POST['prmoote_id_to'] = 0; } @@ -70,44 +70,27 @@ class MendController extends ThinkController { if ($_POST['promote_id'] == $_POST['prmoote_id_to']) { $this->error('没有变更数据'); } + if ($_POST['order_time'] == '') { + $this->error('没有订单日期'); + } $create = $_REQUEST; - dump($create); - $map['id'] = $create['user_id']; - $map_['user_id'] = $create['user_id']; - $data['promote_id'] = $create['prmoote_id_to']; - $data['promote_account'] = get_promote_name($create['prmoote_id_to']); -// 加入补链时间 - $data['rebind_time'] = $create['rebind_time']; - dump($data); - $user_data = $data; - $promote = M('promote', 'tab_')->where(array("id"=>I('prmoote_id_to')))->find(); - if ($promote['parent_id'] != "0") { - $ppromote = M('promote', 'tab_')->where(array("id"=>$promote['parent_id']))->find(); - $user_data['parent_id']=$ppromote['id']; + $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']], + ); + if(!empty($create['remark'])){ + $params['remark'] = $create['remark']; + } + $res = $promoteService->addShiftTask($params); + if($res['status']){ + $this->success('补链成功', U('lists'), 2); }else{ - $user_data['parent_id'] = 0; + $this->error($res['msg']); } - - $user_data['parent_name']=get_promote_name($user_data['parent_id']); - - // $user = M('user', 'tab_')->where($map)->save($user_data); - // $user_ = M('UserPlay', 'tab_')->where($map_)->save($data); - // $puser_ = M('UserPlayInfo', 'tab_')->where($map_)->save($data); - // $spend = M('Spend', 'tab_')->where($map_)->where(array('is_check'=>array('in','1,2')))->save($data);// spend只改未对账的数据 - // $depost = M('Deposit', 'tab_')->where($map_)->save($data); - // $Bind_spend = M('Bind_spend', 'tab_')->where($map_)->save($data); - // $create['user_account'] = get_user_account($create['user_id']); - // $create['promote_account'] = get_promote_name($create['promote_id']); - // $create['promote_id_to'] = $create['prmoote_id_to']; - // $create['promote_account_to'] = get_promote_name($create['prmoote_id_to']); - // $create['create_time'] = time(); - // $create['op_id'] = UID; - // $create['op_account'] = session('user_auth.username'); - // $create['bind_type'] = $create['bind_type']; - // $mend = M('mend', 'tab_')->add($create); - // if ($mend) { - // $this->success('补链成功', U('lists'), 2); - // } } else { $user = A('User', 'Event'); $user_data = $user->user_entity($id); @@ -123,6 +106,30 @@ class MendController extends ThinkController { $this->display(); } } + //补链详情 + public function shiftInfo() + { + $id = I('id'); + $info = M("shift_task")->where("id = {$id} and status = 0")->find(); + if(empty($info)){ + $this->error("补链不存在或已处理"); + } + - + $info['user_id'] = json_decode($info['shift_ids'])[0]; + $info['order_time'] = date("Y-m-d",$info['order_time']); + $this->assign('data',$info); + $this->display(); + } + //取消补链 + public function cancelShift() + { + $id = I('id'); + $status = M('ShiftTask')->where(['id' => $id,'status' => 0])->save(['status' => 2]); + if ($status) { + $this->success('取消补链成功', U('lists'), 2); + } else { + $this->error("取消失败,或补链已生效",U('lists')); + } + } } diff --git a/Application/Admin/View/Mend/edit.html b/Application/Admin/View/Mend/edit.html index 38821314b..b1d310b39 100644 --- a/Application/Admin/View/Mend/edit.html +++ b/Application/Admin/View/Mend/edit.html @@ -84,6 +84,13 @@ + + 订单日期: + + + + + 换绑类型 @@ -159,7 +166,6 @@ Think.setValue("prmoote_id_to", {$data.promote_id|default = "''"}); $('#submit').click(function(){ $('#form').submit(); }); - $(function(){ $('.time').datetimepicker({ format: 'yyyy-mm-dd hh:ii', diff --git a/Application/Admin/View/Mend/lists.html b/Application/Admin/View/Mend/lists.html index 2c133330f..2e87bce63 100644 --- a/Application/Admin/View/Mend/lists.html +++ b/Application/Admin/View/Mend/lists.html @@ -80,7 +80,14 @@ {:get_promote_name($data['promote_id'])} - 补链 + + + 补链 + + 补链中 + + + diff --git a/Application/Admin/View/Mend/shiftInfo.html b/Application/Admin/View/Mend/shiftInfo.html new file mode 100644 index 000000000..dd6f0f9a8 --- /dev/null +++ b/Application/Admin/View/Mend/shiftInfo.html @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
用户账号 + +
修改前渠道 + + +
补链后渠道 + + +
订单日期: + +
换绑类型 + In + Out +
备注 + + +
+ + +
+ + + 返回 + +
+ +
+ + + + +
+ + + +if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index 0e0b103f4..f0acd5aa7 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -2834,3 +2834,23 @@ function index_by_column($column, $items) } return $records; } + +/** + * [获取用户是否补链中] + * @param integer $user_id [description] + * @return bool + */ +function getIsTask($user_id){ + + $shift = M("shift_task"); + $map=array( + "status"=>0, + "shift_ids"=>array("LIKE","%\"{$user_id}\"%") + ); + $shiftres = $shift->field("id")->where($map)->find(); + if(empty($shiftres)){ + return 0; + }else{ + return $shiftres['id']; + } +} diff --git a/Data/update.sql b/Data/update.sql index ffb537dea..a46614f99 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -338,4 +338,7 @@ CREATE TABLE `tab_spend_user_count` ( -- 2019-11-6 cxj ALTER TABLE `tab_spend` ADD COLUMN `withdraw_id` int(11) NOT NULL DEFAULT 0 COMMENT '提现ID' AFTER `pay_url`; -ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`; \ No newline at end of file +ALTER TABLE `tab_withdraw` ADD COLUMN `settlement_end_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算截止时间' AFTER `old_promote_account`; + + +INSERT INTO `sys_menu` (`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('补链详情', '192', '0', 'Mend/shiftInfo', '0', '', '推广补链', '0', '1');