diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php index aacd4d736..bfb56c637 100644 --- a/Application/Admin/Controller/PresidentDepositController.class.php +++ b/Application/Admin/Controller/PresidentDepositController.class.php @@ -12,6 +12,8 @@ class PresidentDepositController extends ThinkController { public function records() { + $page = I('p', 1); + $row = I('row', 10); $companyType = I('company_type'); $payType = I('pay_type'); $status = I('status'); @@ -48,7 +50,16 @@ class PresidentDepositController extends ThinkController $query->where(['_string' => implode(' and ', $idStrWhere)]); } - $promotes = $query->select(); + $promotes = []; + $count = 0; + if (I('export', 0) == 1) { + $promotes = $query->select(); + } else { + $countQuery = clone $query; + $promotes = $query->page($page, $row)->select(); + $count = $countQuery->count(); + } + $relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']); $promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id'); $relationQuery = M('president_deposit', 'tab_'); @@ -63,11 +74,85 @@ class PresidentDepositController extends ThinkController 1 => '外团', 2 => '外团-分发联盟', ]; - $this->assign('payWays', PresidentDepositService::$payWays); - $this->assign('payTypes', PresidentDepositService::$payTypes); + $payWays = PresidentDepositService::$payWays; + $payTypes = PresidentDepositService::$payTypes; + $statusList = PresidentDepositService::$statusList; + + $records = []; + if (count($promotes) > 0) { + foreach ($promotes as $promote) { + $record = [ + 'id' => $promote['id'], + 'company_name' => $promote['company'] ? $promote['company']['company_name'] : '', + 'account' => $promote['account'], + 'company_belong_text' => $companyTypes[$promote['company_belong']], + ]; + if ($promote['presidentDeposit']) { + $presidentDeposit = $promote['presidentDeposit']; + $promoteBelong = $promote['promoteBelong']; + if ($presidentDeposit['pay_type'] == 3) { + $record['payer'] = '--'; + $record['pay_account'] = '--'; + $record['amount'] = '--'; + } else { + $record['payer'] = $presidentDeposit['payer']; + $record['pay_account'] = $presidentDeposit['pay_account']; + $record['amount'] = $presidentDeposit['amount']; + } + $record['pay_type_text'] = $payTypes[$presidentDeposit['pay_type']]; + $record['pay_way_text'] = $payWays[$presidentDeposit['pay_way']] ?? '--'; + $record['create_time'] = $presidentDeposit['create_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['create_time']); + $record['verify_time'] = $promoteBelong && $promoteBelong['verify_time'] != 0 ? date('Y-m-d H:i:s', $promoteBelong['verify_time']) : '--'; + $record['pay_confirm_time'] = $presidentDeposit['pay_confirm_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['pay_confirm_time']); + $record['status_text'] = $statusList[$presidentDeposit['status']]; + $record['has_record'] = true; + $record['status'] = $presidentDeposit['status']; + $record['pay_type'] = $presidentDeposit['pay_type']; + } else { + $record['payer'] = '--'; + $record['pay_account'] = '--'; + $record['amount'] = '--'; + $record['pay_type_text'] = '--'; + $record['pay_way_text'] = '--'; + $record['create_time'] = '--'; + $record['verify_time'] = '--'; + $record['pay_confirm_time'] = '--'; + $record['status_text'] = '--'; + $record['has_record'] = false; + $record['status'] = 0; + $record['pay_type'] = 0; + } + $records[] = $record; + } + if (I('export', 0) == 1) { + $field = [ + 'company_name' => '所属推广公司', + 'account' => '会长账号', + 'company_belong_text' => '工会类型', + 'payer' => '付款人', + 'pay_way_text' => '付款方式', + 'pay_account' => '账号', + 'pay_type_text' => '押金类型', + 'create_time' => '审批时间', + 'amount' => '押金金额', + 'verify_time' => '会长申请时间', + 'status_text' => '押金状态', + 'pay_confirm_time' => '押金确认时间', + ]; + data2csv($records, '会长押金记录', $field); + exit; + } + } + + $page = set_pagination($count, $row); + if($page) { + $this->assign('_page', $page); + } + $this->assign('payWays', $payWays); + $this->assign('payTypes', $payTypes); $this->assign('companyTypes', $companyTypes); - $this->assign('statusList', PresidentDepositService::$statusList); - $this->assign('promotes', $promotes); + $this->assign('statusList', $statusList); + $this->assign('records', $records); $this->display(); } @@ -110,7 +195,7 @@ class PresidentDepositController extends ThinkController $payType = I('pay_type', 0); $promoteId = I('id', 0); $payAccount = I('pay_account', ''); - $amount = floatval(I('amount', 0)); + $amount = I('amount', ''); $payer = I('payer', ''); $record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find(); @@ -123,13 +208,24 @@ class PresidentDepositController extends ThinkController if ($payWay == 0) { return $this->error('请选择付款方式'); } + if ($amount !== '') { + if (!is_numeric($amount)) { + return $this->error('请输入正确金额'); + } + if ($amount <= 0) { + return $this->error('金额必须大于0'); + } + if ($amount > 100000000) { + return $this->error('金额过高'); + } + } $data = []; $data['pay_way'] = $payWay; $data['pay_type'] = $payType; $data['promote_id'] = $promoteId; $data['pay_account'] = $payAccount; - $data['amount'] = $amount; + $data['amount'] = floatval($amount); $data['payer'] = $payer; $data['create_time'] = time(); $data['update_time'] = time(); @@ -141,9 +237,18 @@ class PresidentDepositController extends ThinkController return $this->error('该状态下不可编辑/修改'); } - if ($amount == 0) { + if ($amount === '') { return $this->error('请输入金额'); } + if (!is_numeric($amount)) { + return $this->error('请输入正确金额'); + } + if ($amount <= 0) { + return $this->error('金额必须大于0'); + } + if ($amount > 100000000) { + return $this->error('金额过高'); + } if ($payer == '') { return $this->error('请输入付款人'); } @@ -153,7 +258,7 @@ class PresidentDepositController extends ThinkController $data = []; $data['pay_account'] = $payAccount; - $data['amount'] = $amount; + $data['amount'] = floatval($amount); $data['payer'] = $payer; $data['update_time'] = time(); M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data); diff --git a/Application/Admin/View/PresidentDeposit/records.html b/Application/Admin/View/PresidentDeposit/records.html index 4bb45fbd0..b3078b3ba 100644 --- a/Application/Admin/View/PresidentDeposit/records.html +++ b/Application/Admin/View/PresidentDeposit/records.html @@ -133,34 +133,35 @@ - + aOh! 暂时还没有内容! - + - + - {$data.company.company_name} + {$data.company_name} {$data.account} - - - - - - - - - - - + {$data.company_belong_text} + {$data.payer} + {$data.pay_way_text} + {$data.pay_account} + {$data.pay_type_text} + {$data.create_time} + {$data.amount} + {$data.verify_time} + {$data.status_text} + {$data.pay_confirm_time} + +
- + 编辑 删除 @@ -169,15 +170,6 @@
- -- - -- - -- - -- - -- - -- - -- - -- - --
收取押金 diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 77d5d3550..ed99d068b 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -1013,6 +1013,14 @@ class ApplyController extends BaseController { if ($_POST['game_id']) { $loginPromote = $this->getLoginPromote(); + $promoteService = new PromoteService(); + if (!$promoteService->canPresidentApplyGame($loginPromote)) { + $this->ajaxReturn([ + 'status' => 0, + 'msg' => '请联系市场专员开启', + ]); + } + $gameMap['tab_game.id'] = $_POST['game_id']; $promoteId = I('promote_id'); @@ -1614,8 +1622,19 @@ class ApplyController extends BaseController $this->ajaxReturn($data); } - function getGameInfo() + public function getGameInfo() { + $promote = $this->getLoginPromote(); + $promoteService = new PromoteService(); + if (!$promoteService->canPresidentApplyGame($promote)) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '请联系市场专员开启', + 'data' => [ + ] + ]); + } + $gameId = I('game_id'); $promoteType = I('promote_type'); $gameData = array(); @@ -1648,7 +1667,11 @@ class ApplyController extends BaseController $data['game_data'] = $gameData; $data['promote_data'] = $newPromoteData; - $this->ajaxReturn($data); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '获取成功', + 'data' => $data + ]); } function addGameToPromote() diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index a709f5dd2..9525d66c3 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -678,8 +678,12 @@ url: "__URL__/getGameInfo", dataType: "json", data: {'game_id': gameId,'promote_type':promoteType}, - success: function (data) { - + success: function (res) { + if (res.status == 0) { + layer.msg(res.message, {icon: 2}); + return; + } + var data = res.data; $('#add_game_name').text(data.game_data.game_name); $('#add_game_id').val(data.game_data.id); $('#add_game_features').text(data.game_data.features);