164 lines
4.2 KiB
PHP
164 lines
4.2 KiB
PHP
<?php
|
|
namespace app\api\controller;
|
|
|
|
use app\api\lists\recharge\RechargeLists;
|
|
use app\api\logic\RechargeLogic;
|
|
use app\api\validate\{RechargeValidate};
|
|
|
|
|
|
/**
|
|
* 充值控制器
|
|
* Class RechargeController
|
|
* @package app\shopapi\controller
|
|
*/
|
|
class RechargeController extends BaseApiController
|
|
{
|
|
|
|
/**
|
|
* @notes 获取充值列表
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/2/23 18:55
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new RechargeLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 充值
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/2/23 18:56
|
|
*/
|
|
public function recharge()
|
|
{
|
|
$params = (new RechargeValidate())->post()->goCheck('recharge', [
|
|
'user_id' => $this->userId,
|
|
'terminal' => $this->userInfo['terminal'],
|
|
]);
|
|
$result = RechargeLogic::recharge($params);
|
|
if (false === $result) {
|
|
return $this->fail(RechargeLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 充值配置
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/2/24 16:56
|
|
*/
|
|
public function config()
|
|
{
|
|
return $this->data(RechargeLogic::config($this->userId));
|
|
}
|
|
|
|
/**
|
|
* @notes 获取充值方式
|
|
* @return \think\response\Json
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author BD
|
|
* @date 2024/4/13 10:54
|
|
*/
|
|
public function method()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = RechargeLogic::getAllMethod($params);
|
|
if ($result === false) {
|
|
return $this->fail(RechargeLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 充值方式详情
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/4/20 17:09
|
|
*/
|
|
public function methodDetail()
|
|
{
|
|
$id = $this->request->get('id/d');
|
|
$lang = $this->request->get('lang/s');
|
|
$result = RechargeLogic::methodDetail($id,$lang);
|
|
if ($result === false) {
|
|
return $this->fail(RechargeLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
/**
|
|
* @notes 充值方式详情-优盾
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/4/20 17:09
|
|
*/
|
|
public function methodDetailUdun()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = RechargeLogic::methodDetailUdun($params);
|
|
if ($result === false) {
|
|
return $this->fail(RechargeLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 充值方式详情-波场
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/4/20 17:09
|
|
*/
|
|
public function methodDetailTron()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = RechargeLogic::methodDetailTron($params);
|
|
if ($result === false) {
|
|
return $this->fail(RechargeLogic::getError());
|
|
}
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 充值方式详情-自定义地址
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/4/20 17:09
|
|
*/
|
|
public function methodDetailAddress()
|
|
{
|
|
$params = $this->request->get();
|
|
$params['user_id'] = $this->userId;
|
|
$result = RechargeLogic::methodDetailAddress($params);
|
|
if ($result === false) {
|
|
return $this->fail(RechargeLogic::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/4/13 10:54
|
|
*/
|
|
public function commonMoney()
|
|
{
|
|
$lang = $this->request->get('lang/s');
|
|
$result = RechargeLogic::getCommonMoney($lang);
|
|
return $this->data($result);
|
|
}
|
|
|
|
|
|
} |