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 cc3dbb0e0..3a3932abd 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -2836,3 +2836,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/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index 080955c5f..f90f42549 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -365,12 +365,10 @@ class FinanceController extends BaseController if (isset($_GET['status']) && $_GET['status'] !== '') { $status = intval($_GET['status']); if (!isset(FinanceController::$withdrawStatus[$status])) { - if (!isset(FinanceController::$withdrawStatus[$status])) { - $this->error('参数异常'); - } - - $map['status'] = $status; + $this->error('参数异常'); } + + $map['status'] = $status; } $data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond') @@ -485,4 +483,48 @@ class FinanceController extends BaseController $this->assign('modelList', $modelList); $this->display(); } + + //结算单 + public function settlementOrder() + { + //是否是会长 + $this->purview(); + //验证安全密码 + $metaTitle = '结算单'; + $modelList = ['财务管理', '提现记录', $metaTitle]; + $this->verifyPasswordView($modelList); + + $model = M('withdraw', 'tab_'); + $withdrawId = intval(I('get.id', 0)); + if ($withdrawId == 0) { + $this->error('参数异常'); + } + $withdraw = $model->find($withdrawId); + if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) { + $this->error('参数异常'); + } + $withdraw['create_time'] = date('Y-m-d H:i:s', $withdraw['create_time']); + $withdraw['settlement_end_time'] = date('Y-m-d H:i:s', $withdraw['settlement_end_time']); + $withdraw['status'] = FinanceController::$withdrawStatus[$withdraw['status']]; + + $map['withdraw_id'] = $withdrawId; + $data = M('spend', 'tab_') + ->field('game_name,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_way,sum(pay_amount) as pay_amount_all,sum(if(selle_ratio > 0,pay_amount * selle_ratio,0)) as income') + ->where($map) + ->group('game_id') + ->order('game_id') + ->select(); + if (!empty($data)) { + foreach ($data as &$list) { + $list['income'] = bcdiv($list['income'], 100, 2); + } + } + + $this->assign('withdraw', $withdraw); + $this->assign('listData', $data); + $this->assign('promoteData', $this->loginPromote); + $this->assign('meta_title', $metaTitle); + $this->assign('modelList', $modelList); + $this->display(); + } } \ No newline at end of file diff --git a/Application/Home/View/default/Finance/settlementOrder.html b/Application/Home/View/default/Finance/settlementOrder.html new file mode 100644 index 000000000..16dfbf387 --- /dev/null +++ b/Application/Home/View/default/Finance/settlementOrder.html @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/Finance/withdrawDtl.html b/Application/Home/View/default/Finance/withdrawDtl.html index 851cf4510..b7b1273e5 100644 --- a/Application/Home/View/default/Finance/withdrawDtl.html +++ b/Application/Home/View/default/Finance/withdrawDtl.html @@ -135,8 +135,11 @@ 玩家账号 订单总额 现金分成基数 + 现金分成比例 平台币分成基数 - 平台币分成比例(直充|内充) + 平台币分成比例 + 绑定币分成基数 + 绑定币分成比例 现金支付通道 收益 订单状态 @@ -157,14 +160,24 @@ {:getSDKTypeName($vo['sdk_version'])} {$vo.user_account} {$vo.pay_amount} - + + {$vo.pay_amount} + 0 + + {$vo.selle_ratio}% + {$vo.pay_amount} + 0 + + {$vo.selle_ratio}% + {$vo.pay_amount} + 0 - {$vo.selle_ratio}%|{$vo.selle_ratio}% + {$vo.selle_ratio}% {$vo.pay_way_name} {$vo.income} {$status} diff --git a/Application/Home/View/default/Finance/withdrawRecord.html b/Application/Home/View/default/Finance/withdrawRecord.html index 1685883b6..284b914bf 100644 --- a/Application/Home/View/default/Finance/withdrawRecord.html +++ b/Application/Home/View/default/Finance/withdrawRecord.html @@ -98,13 +98,13 @@
- +
- +
- +
@@ -172,7 +172,7 @@ 提现明细 汇款证明 - 结算单 + 结算单 diff --git a/Data/update.sql b/Data/update.sql index 64986aee4..2fec765a6 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -340,6 +340,8 @@ CREATE TABLE `tab_spend_user_count` ( 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`; +-- 2019-11-07 chenzhi +INSERT INTO `sys_menu` (`title`, `pid`, `sort`, `url`, `hide`, `tip`, `group`, `is_dev`, `status`) VALUES ('补链详情', '192', '0', 'Mend/shiftInfo', '0', '', '推广补链', '0', '1'); ALTER TABLE `tab_spend_user_count` ADD COLUMN `bind_coin_count` decimal(10,2) NULL DEFAULT 0.00 COMMENT '绑定币消耗' AFTER `balance_coin_count`;