121 lines
3.1 KiB
PHP
121 lines
3.1 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\user_recharge;
|
|
|
|
|
|
use app\admin\controller\BaseAdminController;
|
|
use app\admin\lists\user_recharge\UserRechargeLists;
|
|
use app\admin\logic\user_recharge\UserRechargeLogic;
|
|
use app\admin\validate\user_recharge\UserRechargeValidate;
|
|
use app\common\logic\PayNotifyLogic;
|
|
use app\common\model\user\UserRecharge;
|
|
|
|
|
|
/**
|
|
* 充值记录控制器
|
|
* Class UserRechargeController
|
|
* @package app\admin\controller\user_recharge
|
|
*/
|
|
class UserRechargeController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取充值记录列表
|
|
* @return \think\response\Json
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new UserRechargeLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加充值记录
|
|
* @return \think\response\Json
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new UserRechargeValidate())->post()->goCheck('add');
|
|
$result = UserRechargeLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(UserRechargeLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑充值记录
|
|
* @return \think\response\Json
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new UserRechargeValidate())->post()->goCheck('edit');
|
|
$result = UserRechargeLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(UserRechargeLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除充值记录
|
|
* @return \think\response\Json
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new UserRechargeValidate())->post()->goCheck('delete');
|
|
UserRechargeLogic::delete($params);
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取充值记录详情
|
|
* @return \think\response\Json
|
|
* @author admin
|
|
* @date 2024/06/06 14:29
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new UserRechargeValidate())->goCheck('detail');
|
|
$result = UserRechargeLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
public function refund()
|
|
{
|
|
$params = (new UserRechargeValidate())->goCheck('refund');
|
|
$detail = UserRecharge::where('id',$params['id'])->findOrEmpty();
|
|
if(empty($detail)){
|
|
return $this->fail('无该充值订单请检查');
|
|
}
|
|
//现金
|
|
if($detail['recharge_type'] =='CASH_PAY'){
|
|
PayNotifyLogic::recharge_cash_refund($params['id']);
|
|
return $this->success();
|
|
}
|
|
//微信
|
|
if($detail['recharge_type'] == 'INDUSTRYMEMBERS'){
|
|
$money = (int)bcmul($detail['price'],100);
|
|
(new \app\common\logic\store_order\StoreOrderLogic())
|
|
->refund($detail['order_id'],$money,$money);
|
|
return $this->success();
|
|
}
|
|
|
|
//支付宝
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |