You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crmeb_php/app/controller/api/user/UserExtract.php

79 lines
2.6 KiB

12 months ago
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\user;
use crmeb\basic\BaseController;
use app\common\repositories\system\groupData\GroupDataRepository;
use think\App;
use app\validate\api\UserExtractValidate as validate;
use app\common\repositories\user\UserExtractRepository as repository;
class UserExtract extends BaseController
{
/**
* @var repository
*/
public $repository;
/**
* UserExtract constructor.
* @param App $app
* @param repository $repository
*/
11 months ago
public function __construct(App $app, repository $repository)
12 months ago
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
11 months ago
[$page, $limit] = $this->getPage();
12 months ago
$where = $this->request->params(['status']);
$where['uid'] = $this->request->uid();
11 months ago
return app('json')->success($this->repository->getList($where, $page, $limit));
12 months ago
}
public function create(validate $validate)
{
$data = $this->checkParams($validate);
$user = $this->request->userInfo();
11 months ago
if ($data['extract_type'] == 3 && !systemConfig('sys_extension_type')) return app('json')->fail('未开启付款到零钱');
$this->repository->create($user, $data);
12 months ago
return app('json')->success('申请已提交');
}
public function checkParams(validate $validate)
{
11 months ago
$data = $this->request->params(['extract_type', 'bank_code', 'bank_address', 'alipay_code', 'wechat',
'extract_pic', 'extract_price', 'real_name', 'bank_name', 'real_price', 'pre_price']);
12 months ago
$validate->check($data);
return $data;
}
public function bankLst()
{
11 months ago
[$page, $limit] = $this->getPage();
$data = app()->make(GroupDataRepository::class)->groupData('bank_list', 0, $page, 100);
12 months ago
return app('json')->success($data);
}
public function historyBank()
{
$data = $this->repository->getHistoryBank($this->request->userInfo()->uid);
return app('json')->success($data ?? []);
}
}