update:后台申请提现列表接口

This commit is contained in:
chenbo 2023-09-11 11:58:26 +08:00
parent ae32006a6e
commit f4806e696a
4 changed files with 84 additions and 12 deletions

View File

@ -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)

View File

@ -0,0 +1,70 @@
<?php
namespace app\adminapi\lists\finance;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\user\Withdraw;
class WithdrawLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 搜索条件
* @return array
* @author 段誉
* @date 2023/2/24 15:26
*/
public function setSearch(): array
{
return [
'=' => ['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();
}
}

View File

@ -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('您已有一笔审核的提现申请,暂无法继续申请提现');
}
// 校验提现金额

View File

@ -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;
}