Files
zzp-server/app/api/controller/FinanceController.php
2026-01-19 14:19:22 +08:00

261 lines
6.9 KiB
PHP

<?php
namespace app\api\controller;
use app\api\logic\FinanceLogic;
use app\api\validate\{FinanceValidate};
use app\api\lists\finance\{WithdrawRecordLists,RechargeRecordLists,UserFinanceLists,UserTransferRecordLists};
/**
* 资金控制器
* Class FinanceController
* @package app\shopapi\controller
*/
class FinanceController extends BaseApiController
{
/**
* @notes 首页数据
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/9/21 19:15
*/
public function index()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = FinanceLogic::getIndexData($params);
return $this->data($result);
}
/**
* @notes 获取资金明细
* @return \think\response\Json
* @author BD
* @date 2024/2/23 18:55
*/
public function lists()
{
return $this->dataLists(new UserFinanceLists());
}
/**
* @notes 资金记录详情
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function detail()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = FinanceLogic::detail($params);
return $this->data($result);
}
/**
* @notes 获取提现方式
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawMethod()
{
$lang = $this->request->get('lang/s');
$result = FinanceLogic::withdrawMethod($lang);
if ($result === false) {
return $this->fail(FinanceLogic::getError());
}
return $this->data($result);
}
/**
* @notes 获取提现钱包
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawWallet()
{
$lang = $this->request->get('lang/s');
$result = FinanceLogic::withdrawWallet($lang, $this->userId);
if ($result === false) {
return $this->fail(FinanceLogic::getError());
}
return $this->data($result);
}
/**
* @notes 获取提现银行
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawBanks()
{
$lang = $this->request->get('lang/s');
$result = FinanceLogic::withdrawBanks($lang);
if ($result === false) {
return $this->fail(FinanceLogic::getError());
}
return $this->data($result);
}
/**
* @notes 绑定提现钱包
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawWalletAdd()
{
$params = (new FinanceValidate())->post()->goCheck('walletAdd', [
'user_id' => $this->userId
]);
$result = FinanceLogic::withdrawWalletAdd($params);
if (false === $result) {
return $this->fail(FinanceLogic::getError());
}
return $this->data($result);
}
/**
* @notes 提现配置
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawConfig()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = FinanceLogic::withdrawConfig($params);
return $this->data($result);
}
/**
* @notes 提现
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function withdraw()
{
$params = (new FinanceValidate())->post()->goCheck('withdraw', [
'user_id' => $this->userId,
]);
$result = FinanceLogic::withdraw($params);
if (false === $result) {
return $this->fail(FinanceLogic::getError());
}
return $this->data($result);
}
/**
* @notes 提现记录
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawRecordLists()
{
return $this->dataLists(new WithdrawRecordLists());
}
/**
* @notes 提现记录详情
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function withdrawRecordDetail()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = FinanceLogic::withdrawRecordDetail($params);
return $this->data($result);
}
/**
* @notes 充值记录
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function rechargeRecordLists()
{
return $this->dataLists(new RechargeRecordLists());
}
/**
* @notes 充值记录详情
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function rechargeRecordDetail()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = FinanceLogic::rechargeRecordDetail($params);
return $this->data($result);
}
/**
* @notes 用户转账数据
* @return Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/9/21 19:15
*/
public function transferIndex()
{
$params = $this->request->get();
$params['user_id'] = $this->userId;
$result = FinanceLogic::transferIndex($params);
return $this->data($result);
}
/**
* @notes 转账
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function transfer()
{
$params = (new FinanceValidate())->post()->goCheck('transfer', [
'user_id' => $this->userId,
]);
$result = FinanceLogic::transfer($params);
if (false === $result) {
return $this->fail(FinanceLogic::getError());
}
return $this->data($result);
}
/**
* @notes 转账记录
* @return \think\response\Json
* @author BD
* @date 2024/02/22 10:54
*/
public function transferRecordLists()
{
return $this->dataLists(new UserTransferRecordLists());
}
}