From 747bba16b0119c99f4ab06c4f7d4346bf075edce Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Mon, 17 Feb 2020 11:30:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=87=E6=80=BB=E7=BB=93=E7=AE=97=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/MsgController.class.php | 11 +++- .../Controller/SettlementController.class.php | 60 ++++++++++++++++--- Application/Admin/View/Msg/lists.html | 2 +- .../Settlement/generatesettlementsheet.html | 24 +++++--- .../Admin/View/Settlement/sheetDetail.html | 10 ++-- .../Admin/View/Settlement/sheetList.html | 12 +++- Data/update.sql | 23 ++++++- 7 files changed, 115 insertions(+), 27 deletions(-) diff --git a/Application/Admin/Controller/MsgController.class.php b/Application/Admin/Controller/MsgController.class.php index a23901b59..683bcaef4 100644 --- a/Application/Admin/Controller/MsgController.class.php +++ b/Application/Admin/Controller/MsgController.class.php @@ -70,8 +70,15 @@ class MsgController extends ThinkController{ } $look= $model->where(['id'=>$ids])->find(); - - redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']); + switch($look['type']) { + case 1: + redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Apply/and_lists/type/'.$look['sdk_version'].'/game_id/'.$look['game_id']); + break; + case 3: + redirect("http://".$_SERVER['HTTP_HOST'] . '/admin.php?s=/Settlement/sheetDetail/id/'.$look['game_id']); + break; + } + diff --git a/Application/Admin/Controller/SettlementController.class.php b/Application/Admin/Controller/SettlementController.class.php index b13647e74..0068f55ca 100644 --- a/Application/Admin/Controller/SettlementController.class.php +++ b/Application/Admin/Controller/SettlementController.class.php @@ -19,13 +19,17 @@ class SettlementController extends ThinkController if (I('creater_id')) { $map['creater_id'] = I('creater_id'); } + if (I('all_status')) { + $map['all_status'] = I('all_status'); + } if (I('create_time_start')) { $map['_string'] = "create_time >= ".strtotime(I('create_time_start')); } if (I('create_time_end')) { $map['_string'] = "create_time <= ".strtotime(I('create_time_end')); } - $list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->select(); + $login_uid = is_login(); + $list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->order("if (audit_user ={$login_uid}, 0,1 ) and status = 3, all_status desc, create_time desc")->select(); $count = M('settlement_sheet', 'tab_')->where($map)->count(); if (!empty($list)) { foreach ($list as &$item) { @@ -79,11 +83,12 @@ class SettlementController extends ThinkController // 生成结算单 月结算补点 周结不算 public function generateSettlementSheet($settlement_type = 0, $settlement_time_type = 0, $time_start=0, $time_end = 0, $delete=0, $id=0, $action='') { + $msg = ''; $this->assign(I('')); $this->assign('action', $action); if ($delete) { - $res = M('settlement_sheet', 'tab_'->where(['id'=>$id]))->delete(); - return $res ? $this->success('删除成功', true, true) : $this->success('删除失败', true, true); + $res = M('settlement_sheet', 'tab_')->where(['id'=>$id])->delete(); + return $res ? $this->success('删除成功', '', true) : $this->success('删除失败', '', true); } $this->meta_title = '结算单管理'; if (empty($settlement_type)) { @@ -106,14 +111,19 @@ class SettlementController extends ThinkController $time_start = strtotime($settlement_time); $time_end = strtotime('+1 month', $time_start) - 1; } + if ($time_end > time()) { + $msg = "结算结算时间无法大于当前时间"; + } if (empty($time_start) || empty($time_end)) { $msg = '请选择正确的时间区间'; } if (IS_GET) { - $msg = ''; // 判断结算时间是否冲突 - + $isExsist = M('settlement_sheet', 'tab_')->where(['settlement_type'=>$settlement_type, 'time_start'=>$time_start, 'time_end'=>$time_end, 'settlement_time_type'=>$settlement_time_type])->find(); + if ($isExsist) { + $msg = "已存在此类型结算单"; + } // 生成结算单数据 $generate = false; if (!$msg) { @@ -153,6 +163,8 @@ class SettlementController extends ThinkController 'fine'=>isset($reward[2]) ? $reward[2] : 0 , 'channel_rate' => $item['channel_rate'], // 渠道费 'invoice_rate' => $item['invoice_rate'], // 税费 + 'time_start' => date('Y-m-d', $time_start), + 'time_end' => date('Y-m-d', $time_end) ]; } $data = []; @@ -220,7 +232,9 @@ class SettlementController extends ThinkController 'bonuses'=>isset($reward[1]) ? $reward[1] : 0, 'fine'=>isset($reward[2]) ? $reward[2] : 0 , 'settlement_contact' => $item['settlement_contact'], - 'create_time' => time() + 'create_time' => time(), + 'time_start' => date('Y-m-d', $time_start), + 'time_end' => date('Y-m-d', $time_end) ]; $list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine']; } @@ -292,7 +306,9 @@ class SettlementController extends ThinkController 'settlement_contact' => $item['settlement_contact'], 'bank_card' => $item['bank_card'], 'bank_address' => $item['bank_address'], - 'create_time' => time() + 'create_time' => time(), + 'time_start' => date('Y-m-d', $time_start), + 'time_end' => date('Y-m-d', $time_end) ]; $list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine']; } @@ -362,7 +378,16 @@ class SettlementController extends ThinkController $data['time_end'] = $time_end; $data['audit_users'] = json_encode($_POST['audit_users']); $data['settlement_sheet'] = json_encode($_POST['settlement_sheet']); + $data['audit_user'] = $_POST['audit_users'][0]; $res = M('settlement_sheet', 'tab_')->add($data); + // 生成消息 + $notice['user_id'] = $_POST['audit_users'][0]; + $notice['content'] = "结算单汇总审核:有一个结算单待你审核,请尽快处理!"; + $notice['type'] = 3; + $notice['status'] = 2; + $notice['create_time'] = time(); + $notice['game_id'] = $res; + M('msg', 'tab_')->add($notice); return $res ? $this->success('生成成功', true, true) : $this->error('生成失败', true, true); } } @@ -410,9 +435,26 @@ class SettlementController extends ThinkController } else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) { return $this->error('该结算单已经审核完毕', true, true); } + $is_last = ($info['setp'] + 1 >= sizeof($info['audit_users'])); $update['remark'] = $remark; - $update['status'] = $audit_type == 1 ? 3 : 2; - $update['step'] = $audit_type == 1 ? $info['step'] + 1 : $info['step']; + $update['status'] = $audit_type == 1 ? ($is_last ? 1 : 3) : 2; + $update['step'] = ($audit_type == 1 && !$is_last) ? $info['step'] + 1 : $info['step']; + $update['audit_user'] = $login_uid; + if ($audit_type == 1 && $is_last) { + $update['all_status'] = 1; + } else if ($audit_type == 2) { + $update['all_status'] = 2; + } + // 通知审核 + if ($update['status'] == 3 && !$is_last) { + $notice['user_id'] = $info['audit_users'][$info['step']]; + $notice['content'] = "结算单汇总审核:有一个结算单待你审核,请尽快处理!"; + $notice['type'] = 3; + $notice['status'] = 2; + $notice['create_time'] = time(); + $notice['game_id'] = $id; + M('msg', 'tab_')->add($notice); + } $upt = M('settlement_sheet', 'tab_')->where(['id'=>$id])->save($update); return $upt ? $this->success('审核成功', true, true) : $this->error('审核失败', true, true); } diff --git a/Application/Admin/View/Msg/lists.html b/Application/Admin/View/Msg/lists.html index 2e53f1a6a..26dc75f3f 100644 --- a/Application/Admin/View/Msg/lists.html +++ b/Application/Admin/View/Msg/lists.html @@ -58,7 +58,7 @@ {$data.id} - + {$data.content} diff --git a/Application/Admin/View/Settlement/generatesettlementsheet.html b/Application/Admin/View/Settlement/generatesettlementsheet.html index 30a6d247b..e4bdedc73 100644 --- a/Application/Admin/View/Settlement/generatesettlementsheet.html +++ b/Application/Admin/View/Settlement/generatesettlementsheet.html @@ -81,7 +81,6 @@
@@ -123,7 +122,18 @@
- {$msg} +
+
+ + + + + + + +
{$msg}
+
+
上游-汇总结算单
@@ -235,7 +245,7 @@ {$item['bonuses']} {$item['total_amount']} {$item['settlement_contact']} - 时间 + {$item['time_start']} 至 {$item['time_end']} 备注 @@ -246,7 +256,7 @@ {$channel['game_ratio']}% {$channel['game_ratio_max']}% {$channel['price']} - 时间 + {$item['time_start']} 至 {$item['time_end']} @@ -301,7 +311,7 @@ {$channel['company_relation_name']} {$channel['type_name']} {$channel['relation_game_name']} - 结算时间 + {$item['time_start']} 至 {$item['time_end']} {$channel['amount']} {$channel['game_ratio']}% {$channel['game_ratio_max']}% @@ -320,7 +330,7 @@ {$channel['company_relation_name']} {$channel['type_name']} {$channel['relation_game_name']} - 结算时间 + {$item['time_start']} 至 {$item['time_end']} {$channel['amount']} {$channel['game_ratio']}% {$channel['game_ratio_max']}% @@ -394,7 +404,7 @@