data_center/app/adminapi/controller/finance/RefundController.php

88 lines
2.4 KiB
PHP

<?php
namespace app\adminapi\controller\finance;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\finance\RefundLogLists;
use app\adminapi\lists\finance\RefundRecordLists;
use app\adminapi\logic\finance\RefundLogic;
use think\response\Json;
/**
* 退款控制器
* Class RefundController
* @package app\adminapi\controller\finance
*/
class RefundController extends BaseAdminController
{
/**
* @notes 退还统计
* @return \think\response\Json
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/3/3 12:10
*/
public function stat()
{
$result = RefundLogic::stat();
return $this->success('', $result);
}
public function taskStat(): Json
{
$params=$this->request->get();
$result = curl_post(env('project.worker_domain').'/middleapi/refund/stat',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
/**
* @notes 退款记录
* @return \think\response\Json
* @author 段誉
* @date 2023/3/1 9:47
*/
public function record()
{
return $this->dataLists(new RefundRecordLists());
}
public function taskRecord(): Json
{
$params=$this->request->get(['user_info', 'start_time', 'end_time', 'sn', 'order_sn', 'refund_type', 'refund_status']);
$result = curl_post(env('project.worker_domain').'/middleapi/refund/record',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
/**
* @notes 退款日志
* @return \think\response\Json
* @author 段誉
* @date 2023/3/1 9:47
*/
public function log()
{
$recordId = $this->request->get('record_id', 0);
$result = RefundLogic::refundLog($recordId);
return $this->success('', $result);
}
public function taskLog(): Json
{
$params=$this->request->get(['record_id']);
$result = curl_post(env('project.worker_domain').'/middleapi/refund/log',$params,$this->reqHeader);
if($result['code'] == 0){
return $this->fail($result['msg']);
}
return json($result);
}
}