new-admin-api/app/controller/admin/system/merchant/Quota.php

77 lines
2.0 KiB
PHP

<?php
namespace app\controller\admin\system\merchant;
use app\common\repositories\system\merchant\MerchantQuotaRecordRepository;
use app\common\repositories\system\merchant\MerchantQuotaRepository;
use crmeb\basic\BaseController;
use think\App;
class Quota extends BaseController{
protected $repository;
public function __construct(App $app, MerchantQuotaRepository $repository){
parent::__construct($app);
$this->repository = $repository;
}
/**
* Common: 额度列表
* Author: wu-hui
* Time: 2024/06/04 15:10
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function quotaList(){
[$page, $limit] = $this->getPage();
$params = $this->request->params([
['mer_id', ''],
'keyword',
'merchant_type'
]);
$result = $this->repository->getList((array)$params,(int)$page,(int)$limit);
return app('json')->success($result);
}
/**
* Common: 变更
* Author: wu-hui
* Time: 2024/05/27 11:51
* @return mixed
*/
public function quotaChange(){
$params = $this->request->params([
'change_type',
'quota_type',
['quantity', 0],
['mer_id', 0]
]);
app()->make(MerchantQuotaRecordRepository::class)->changeQuota($params);
return app('json')->success('变更成功');
}
/**
* Common: 变更记录明细
* Author: wu-hui
* Time: 2024/05/27 13:53
* @return mixed
*/
public function quotaChangeRecord(){
[$page, $limit] = $this->getPage();
$params = $this->request->params([
['mer_id', 0]
]);
$result = app()->make(MerchantQuotaRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit);
return app('json')->success($result);
}
}