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.
89 lines
2.8 KiB
89 lines
2.8 KiB
<?php
|
|
|
|
namespace App\Controller\v3;
|
|
|
|
use App\Constants\v3\ErrorCode;
|
|
use App\Constants\v3\UserType;
|
|
use App\Controller\BaseController;
|
|
use App\Exception\ErrorCodeException;
|
|
use App\Model\v3\FinancialRecord;
|
|
use App\Model\v3\Store;
|
|
use App\Model\v3\UserBalance;
|
|
use App\Service\v3\Interfaces\FinancialRecordServiceInterface;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Hyperf\Validation\ValidationException;
|
|
|
|
class WithdrawController extends BaseController
|
|
{
|
|
|
|
/**
|
|
* @Inject
|
|
* @var FinancialRecordServiceInterface
|
|
*/
|
|
protected $financialService;
|
|
|
|
/**
|
|
* 商户提现页数据
|
|
* 1、可提现金额
|
|
* 2、获得的奖励金额(历史总奖励金额)
|
|
* 3、用户须知
|
|
* 4、提现须知
|
|
*/
|
|
public function pageByStore()
|
|
{
|
|
$validator = $this->validationFactory->make(
|
|
$this->request->all(),
|
|
[
|
|
'user_id' => 'required|nonempty|integer',
|
|
'store_id' => 'required|nonempty|integer',
|
|
],
|
|
['*.*' => ':attribute 参数不正确']
|
|
);
|
|
|
|
if ($validator->fails()) {
|
|
throw new ValidationException($validator);
|
|
}
|
|
|
|
$userId = $this->request->input('user_id', 0);
|
|
$storeId = $this->request->input('store_id', 0);
|
|
$store = Store::query()->where(['user_id' => $userId, 'id' => $storeId])->first();
|
|
if (empty($store)) {
|
|
throw new ErrorCodeException(ErrorCode::STORE_NOT_AVAILABLE);
|
|
}
|
|
|
|
$data['balance'] = UserBalance::query()
|
|
->where(['source_id' => $store->user_id, 'user_type' => UserType::STORE])
|
|
->value('balance');
|
|
|
|
$data['award'] = $this->financialService->sumAmount(
|
|
$store->user_id,
|
|
UserType::STORE,
|
|
[FinancialRecord::MONEY_TYPE_STORE_PLAT_NEW_USER, FinancialRecord::MONEY_TYPE_STORE_FIRST_ORDER]
|
|
);
|
|
|
|
$data['notice'] = [
|
|
[
|
|
'title' => '用户须知',
|
|
'content' => '<p>请仔细填写相关信息,如果由于您填写的信息有误导致资金流失,平台概不负责。</p><p>注意:因微信限制当前用户账户余额满<span style="color:red;">1</span>元后才可提现</p>'
|
|
],
|
|
[
|
|
'title' => '提现须知',
|
|
'content' => '<p>一次提现金额最低为<span style="color:red;">1</span>元</p>'
|
|
.'<p>一次提现金额最高为<span style="color:red;">5000</span>元</p>'
|
|
.'<p>每天可提现<span style="color:red;">10</span>次</p>'
|
|
],
|
|
];
|
|
|
|
return $this->success($data);
|
|
}
|
|
|
|
public function applyByStore()
|
|
{
|
|
$validator = $this->validationFactory->make(
|
|
$this->request->all(),
|
|
[
|
|
'user_id' => 'required|nonempty'
|
|
]
|
|
);
|
|
}
|
|
}
|