From e596d11cee6d40aa09bff62efbfefd5e6e541858 Mon Sep 17 00:00:00 2001 From: liaojinling <360197197@qq.com> Date: Sun, 9 Feb 2020 19:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E9=95=BF=E6=8A=BC=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PresidentDepositController.class.php | 150 +++++++ .../Admin/View/PresidentDeposit/form.html | 413 ++++++++++++++++++ .../Admin/View/PresidentDeposit/records.html | 354 +++++++++++++++ .../Service/PresidentDepositService.class.php | 33 ++ Data/update.sql | 18 + 5 files changed, 968 insertions(+) create mode 100644 Application/Admin/Controller/PresidentDepositController.class.php create mode 100644 Application/Admin/View/PresidentDeposit/form.html create mode 100644 Application/Admin/View/PresidentDeposit/records.html create mode 100644 Application/Base/Service/PresidentDepositService.class.php diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php new file mode 100644 index 000000000..43e4a6c7a --- /dev/null +++ b/Application/Admin/Controller/PresidentDepositController.class.php @@ -0,0 +1,150 @@ +where(['company_belong' => 1, 'level' => 1])->select(); + $relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']); + $promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id'); + $relationQuery = M('president_deposit', 'tab_'); + $promotes = $this->mergeOneReletions('presidentDeposit', $promotes, $relationQuery, 'id', 'promote_id'); + /*echo '
'; + var_dump($promotes); + echo ''; + die();*/ + $this->assign('payWays', PresidentDepositService::$payWays); + $this->assign('payTypes', PresidentDepositService::$payTypes); + $this->assign('statusList', PresidentDepositService::$statusList); + $this->assign('promotes', $promotes); + $this->display(); + } + + private function mergeOneReletions($name, $records, $relationQuery, $selfColumn, $relationColumn = 'id') + { + $values = array_column($records, $selfColumn); + $rows = $relationQuery->where([$relationColumn => ['in', $values]])->select(); + foreach ($records as &$record) { + $record[$name] = null; + } + foreach ($records as &$record) { + foreach ($rows as $row) { + if ($record[$selfColumn] == $row[$relationColumn]) { + $record[$name] = $row; + } + } + } + return $records; + } + + public function edit() + { + $id = I('id', 0); + $promote = M('promote', 'tab_')->field(['account', 'id'])->where(['id' => $id])->find(); + $this->assign('payWays', PresidentDepositService::$payWays); + $this->assign('payTypes', PresidentDepositService::$payTypes); + $this->assign('promote', $promote); + $this->display('form'); + } + + public function save() + { + $payWay = I('pay_way', 0); + $payType = I('pay_type', 0); + $promoteId = I('id', 0); + $payAccount = I('pay_account', 0); + $amount = I('amount', 0); + $payer = I('payer', 0); + + $record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find(); + + if (!$record) { + $data = []; + $data['pay_way'] = $payWay; + $data['pay_type'] = $payType; + $data['promote_id'] = $promoteId; + $data['pay_account'] = $payAccount; + $data['amount'] = $amount; + $data['payer'] = $payer; + M('president_deposit', 'tab_')->add($data); + } + } + + public function delete() + { + $promoteId = I('id', 0); + M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->delete(); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '删除成功' + ]); + } + + public function noDeposit() + { + $promoteId = I('id', 0); + $record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find(); + + if (!$record) { + $data = []; + $data['pay_way'] = 0; + $data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE; + $data['promote_id'] = $promoteId; + $data['pay_account'] = ''; + $data['amount'] = 0; + $data['payer'] = ''; + $data['create_time'] = time(); + $data['update_time'] = time(); + M('president_deposit', 'tab_')->add($data); + } + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } + + public function refund() + { + $promoteIds = I('ids', []); + if (count($promoteIds) == 0) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '无选中项' + ]); + } + M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->update([ + 'status' => $payType, + 'refund_time' => time() + ]); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } + + public function payConfirm() + { + $promoteIds = I('ids', []); + if (count($promoteIds) == 0) { + $this->ajaxReturn([ + 'status' => 0, + 'message' => '无选中项' + ]); + } + M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->update([ + 'status' => $payType, + 'pay_confirm_time' => time() + ]); + $this->ajaxReturn([ + 'status' => 1, + 'message' => '操作成功' + ]); + } +} diff --git a/Application/Admin/View/PresidentDeposit/form.html b/Application/Admin/View/PresidentDeposit/form.html new file mode 100644 index 000000000..48ca11a4a --- /dev/null +++ b/Application/Admin/View/PresidentDeposit/form.html @@ -0,0 +1,413 @@ +
说明:推广员后台申请提现的记录,后台审批操作
+ ++ + | +所属推广公司 | +会长账号 | +工会类型 | +付款人 | +付款方式 | +账号 | +押金类型 | +审批时间 | +押金金额 | +会长申请时间 | +押金状态 | +押金确认时间 | +操作 | +aOh! 暂时还没有内容! | +|||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ |
+ {$data.company.company_name} | +{$data.account} | +{$data.company_belong} | + +=$data['presidentDeposit']['payer']?> | +=$payWays[$data['presidentDeposit']['pay_way']] ?? '--'?> | +=$data['presidentDeposit']['pay_account']?> | +=$payTypes[$data['presidentDeposit']['pay_type']] ?? '--'?> | +=date('Y-m-d H:i:s', $data['presidentDeposit']['verify_time'])?> | +=$data['presidentDeposit']['amount']?> | +=date('Y-m-d H:i:s', $data['presidentDeposit']['verify_time'])?> | +=$statusList[$data['presidentDeposit']['status']]?> | +=date('Y-m-d H:i:s', $data['presidentDeposit']['pay_confirm_time'])?> | ++ + | + +-- | +-- | +-- | +-- | +-- | +-- | +-- | +-- | +-- | ++ + | + +