From ca2935763ba4627d6334e8d08bccf18e3dcbd1e1 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Fri, 22 Nov 2019 16:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0->=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E7=AE=A1=E7=90=86->=E6=8F=90=E7=8E=B0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95--=E6=B7=BB=E5=8A=A0=E6=92=A4=E9=94=80=E6=8F=90?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/FinanceController.class.php | 92 ++++++++++++++++--- .../View/default/Finance/settlementDtl.html | 4 +- .../View/default/Finance/withdrawRecord.html | 36 ++++++++ Data/update.sql | 7 +- 4 files changed, 125 insertions(+), 14 deletions(-) diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index 605c26ad4..f8b4e8ceb 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -15,6 +15,7 @@ class FinanceController extends BaseController { //提现状态 public static $withdrawStatus = [ + -2 => '已撤销', -1 => '审核未通过', 0 => '待审核', 1 => '汇款中', @@ -200,7 +201,7 @@ class FinanceController extends BaseController $map['pay_order_number'] = $payOrderNumber; } if (isset($_GET['status'])) { - if ($status == -2) { + if ($status == -99) { $map['selle_status'] = 0; } else { $withdrawMap['promote_id'] = $this->loginPromote['id']; @@ -277,8 +278,7 @@ class FinanceController extends BaseController //是否是会长 $this->purview(); //验证安全密码 - $metaTitle = '结算明细'; - $modelList = ['财务管理', $metaTitle]; + $modelList = []; $res = $this->verifyPasswordView($modelList, false); if ($res == false) { $data['status'] = 0; @@ -329,6 +329,7 @@ class FinanceController extends BaseController $add['status'] = 0; $add['widthdraw_number'] = $this->produceWithdrawNumber(); $add['settlement_end_time'] = $thisDay - 1; + $add['spend_ids'] = ''; M()->startTrans();//开启事物 $withdrawId = M('withdraw', 'tab_')->add($add); @@ -399,11 +400,9 @@ class FinanceController extends BaseController } if (isset($_GET['status']) && $_GET['status'] !== '') { $status = intval($_GET['status']); - if (!isset(FinanceController::$withdrawStatus[$status])) { - $this->error('参数异常'); + if (isset(FinanceController::$withdrawStatus[$status])) { + $map['status'] = $status; } - - $map['status'] = $status; } $data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof') @@ -420,8 +419,15 @@ class FinanceController extends BaseController $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); $list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']); $list['status_name'] = FinanceController::$withdrawStatus[$list['status']]; - if ($list['status'] == -1) { - $list['status_name'] = '' . $list['status_name'] . ''; + switch ($list['status']) { + case -2: + $list['status_name'] = '' . $list['status_name'] . ''; + break; + case -1: + $list['status_name'] = '' . $list['status_name'] . ''; + break; + default: + break; } } } @@ -572,8 +578,7 @@ class FinanceController extends BaseController //是否是会长 $this->purview(); //验证安全密码 - $metaTitle = '结算明细'; - $modelList = ['财务管理', $metaTitle]; + $modelList = []; $res = $this->verifyPasswordView($modelList, false); if ($res == false) { $data['status'] = 0; @@ -606,4 +611,69 @@ class FinanceController extends BaseController } $this->ajaxReturn($data); } + + //撤销提现 + public function cancelWithdraw() + { + //是否是会长 + $this->purview(); + //验证安全密码 + $modelList = []; + $res = $this->verifyPasswordView($modelList, false); + if ($res == false) { + $data['status'] = 0; + $data['msg'] = '权限异常'; + $this->ajaxReturn($data); + } + + $id = intval(I('id', 0)); + $data = M('withdraw', 'tab_')->find($id); + if (empty($data) || !in_array($data['status'], [-1, 0])) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + if ($data['promote_id'] != $this->loginPromote['id']) { + $data['status'] = 0; + $data['msg'] = '权限异常'; + $this->ajaxReturn($data); + } + + $spendMap['withdraw_id'] = $id; + $spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true); + if (empty($spendIds)) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + $spendIds = implode(',', $spendIds); + $time = time(); + $withdrawSave['id'] = $id; + $withdrawSave['status'] = -2; + $withdrawSave['spend_ids'] = $spendIds; + $withdrawSave['last_up_update_time'] = $time; + + M('withdraw', 'tab_')->startTrans();//开启事物 + $withdrawRes = M('withdraw', 'tab_')->save($withdrawSave); + if ($withdrawRes === false) { + M('withdraw', 'tab_')->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '撤销失败'; + $this->ajaxReturn($data); + } + + $spendSave['selle_status'] = 0; + $spendSave['withdraw_id'] = 0; + $spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave); + if ($spendRes === false) { + M('withdraw', 'tab_')->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '撤销失败'; + } else { + M('withdraw', 'tab_')->commit();//事物提交 + $data['status'] = 1; + $data['msg'] = '撤销成功'; + } + $this->ajaxReturn($data); + } } \ No newline at end of file diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html index 2cbb07ea2..aefcaf46a 100644 --- a/Application/Home/View/default/Finance/settlementDtl.html +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -103,8 +103,8 @@