From f4806e696a0bf34754a4253ef4a5446c7ab2c53e Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 11 Sep 2023 11:58:26 +0800 Subject: [PATCH] =?UTF-8?q?update:=E5=90=8E=E5=8F=B0=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/finance/WithdrawController.php | 20 +++--- app/adminapi/lists/finance/WithdrawLists.php | 70 +++++++++++++++++++ app/api/logic/UserLogic.php | 4 +- app/common/logic/finance/WithdrawLogic.php | 2 +- 4 files changed, 84 insertions(+), 12 deletions(-) create mode 100644 app/adminapi/lists/finance/WithdrawLists.php diff --git a/app/adminapi/controller/finance/WithdrawController.php b/app/adminapi/controller/finance/WithdrawController.php index b69c8c872..ab5743567 100644 --- a/app/adminapi/controller/finance/WithdrawController.php +++ b/app/adminapi/controller/finance/WithdrawController.php @@ -3,6 +3,7 @@ namespace app\adminapi\controller\finance; use app\adminapi\controller\BaseAdminController; +use app\adminapi\lists\finance\WithdrawLists; use app\common\logic\finance\WithdrawLogic; use app\common\model\user\Withdraw; use think\Exception; @@ -12,15 +13,16 @@ class WithdrawController extends BaseAdminController public function index() { - [$page, $limit] = $this->getPage(); - $status = $this->request->param('status'); - $query = Withdraw::with('user'); - if ($status !== '') { - $query->where('status', $status); - } - $count = $query->count(); - $list = $query->order('id', 'desc')->page($page)->limit($limit)->select()->toArray(); - return $this->success('success', ['count' => $count, 'data' => $list]); + return $this->dataLists(new WithdrawLists()); +// [$page, $limit] = $this->getPage(); +// $status = $this->request->param('status'); +// $query = Withdraw::with('user'); +// if ($status !== '') { +// $query->where('status', $status); +// } +// $count = $query->count(); +// $list = $query->order('id', 'desc')->page($page)->limit($limit)->select()->toArray(); +// return $this->success('success', ['count' => $count, 'data' => $list]); } public function update($id) diff --git a/app/adminapi/lists/finance/WithdrawLists.php b/app/adminapi/lists/finance/WithdrawLists.php new file mode 100644 index 000000000..2376d9861 --- /dev/null +++ b/app/adminapi/lists/finance/WithdrawLists.php @@ -0,0 +1,70 @@ + ['order_sn','user_id', 'amount', 'status'], + ]; + } + + + /** + * @notes 搜索条件 + * @author 段誉 + * @date 2023/2/24 15:26 + */ + public function queryWhere() + { + $where = []; + // 用户余额 + return $where; + } + + + /** + * @notes 获取列表 + * @return array + * @author 段誉 + * @date 2023/2/24 15:31 + */ + public function lists(): array + { + $lists = Withdraw::where($this->searchWhere) + ->where($this->queryWhere()) + ->order('id', 'desc') + ->limit($this->limitOffset, $this->limitLength) + ->select() + ->toArray(); + return $lists; + } + + + /** + * @notes 获取数量 + * @return int + * @author 段誉 + * @date 2023/2/24 15:36 + */ + public function count(): int + { + return Withdraw::where($this->queryWhere()) + ->where($this->searchWhere) + ->count(); + } + +} \ No newline at end of file diff --git a/app/api/logic/UserLogic.php b/app/api/logic/UserLogic.php index d88206e84..729e3e143 100755 --- a/app/api/logic/UserLogic.php +++ b/app/api/logic/UserLogic.php @@ -313,9 +313,9 @@ class UserLogic extends BaseLogic } // 是否有在途的提现申请 - $withdraw = Withdraw::where(['user_id'=>$params['user_id'], 'company_id'=>$company->id, 'status'=>0])->find(); + $withdraw = Withdraw::where(['user_id'=>$params['user_id'], 'status'=>0])->find(); if (!empty($withdraw)) { - throw new ValidateException('您已有一笔待审核的提现申请'); + throw new ValidateException('您已有一笔审核中的提现申请,暂无法继续申请提现'); } // 校验提现金额 diff --git a/app/common/logic/finance/WithdrawLogic.php b/app/common/logic/finance/WithdrawLogic.php index 8694bd508..740b5f8e4 100644 --- a/app/common/logic/finance/WithdrawLogic.php +++ b/app/common/logic/finance/WithdrawLogic.php @@ -43,7 +43,7 @@ class WithdrawLogic extends BaseLogic // 拒绝通过审核,记录备注原因 if ($params['status'] == 2) { - Withdraw::where(['id'=>$withDrawInfo['id']])->update(['status'=>2, 'deny_desc'=>$params['deny_desc']]); + Withdraw::where(['id'=>$withDrawInfo['id']])->update(['status'=>2, 'deny_desc'=>$params['notes']]); return true; }