feat: 添加获取退款订单列表API
This commit is contained in:
parent
fbecb264d5
commit
56b7588e54
@ -5,6 +5,7 @@ namespace app\admin\controller\store_order;
|
|||||||
|
|
||||||
use app\admin\controller\BaseAdminController;
|
use app\admin\controller\BaseAdminController;
|
||||||
use app\admin\lists\store_order\StoreOrderLists;
|
use app\admin\lists\store_order\StoreOrderLists;
|
||||||
|
use app\admin\lists\store_order\StoreRefundOrderLists;
|
||||||
use app\admin\logic\store_order\StoreOrderLogic;
|
use app\admin\logic\store_order\StoreOrderLogic;
|
||||||
use app\admin\validate\store_order\StoreOrderValidate;
|
use app\admin\validate\store_order\StoreOrderValidate;
|
||||||
|
|
||||||
@ -29,7 +30,16 @@ class StoreOrderController extends BaseAdminController
|
|||||||
return $this->dataLists(new StoreOrderLists());
|
return $this->dataLists(new StoreOrderLists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取退款订单列表
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 16:02
|
||||||
|
*/
|
||||||
|
public function refund_order()
|
||||||
|
{
|
||||||
|
return $this->dataLists(new StoreRefundOrderLists());
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @notes 添加订单列表
|
* @notes 添加订单列表
|
||||||
* @return \think\response\Json
|
* @return \think\response\Json
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录控制器
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -73,7 +73,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
|
|||||||
$item['nickname'] = '游客';
|
$item['nickname'] = '游客';
|
||||||
} else {
|
} else {
|
||||||
$id = $item['user_id'];
|
$id = $item['user_id'];
|
||||||
$item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "($id)";
|
$item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id";
|
||||||
}
|
}
|
||||||
if (!empty($this->request->adminInfo['store_id'])) {
|
if (!empty($this->request->adminInfo['store_id'])) {
|
||||||
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
$item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0;
|
||||||
|
68
app/admin/lists/store_order/StoreRefundOrderLists.php
Normal file
68
app/admin/lists/store_order/StoreRefundOrderLists.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\lists\store_order;
|
||||||
|
|
||||||
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\enum\OrderEnum;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\common\model\store_order\StoreOrder;
|
||||||
|
|
||||||
|
class StoreRefundOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 16:02
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['order_id', 'refund_type'],
|
||||||
|
'between_time' => 'create_time',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取订单列表列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 16:02
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
$this->searchWhere['refund_status'] = ['>', 0];
|
||||||
|
return StoreOrder::with(['user', 'staff', 'product' => function ($query) {
|
||||||
|
$query->field(['id', 'oid', 'product_id', 'cart_info']);
|
||||||
|
}])
|
||||||
|
->where($this->searchWhere)
|
||||||
|
->field(['id', 'store_id', 'staff_id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status', 'uid', 'refund_status', 'refund_type', 'refund_reason_wap', 'refund_reason_time', 'refund_reason_wap_explain', 'refund_reason_wap_img', 'refund_reason'])
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()->each(function ($item) {
|
||||||
|
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
|
||||||
|
$item['refund_status_name'] = OrderEnum::refundStatus($item['refund_status']) ?? '';
|
||||||
|
$item['refund_type_name'] = OrderEnum::refundType($item['refund_type']) ?? '';
|
||||||
|
return $item;
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取订单列表数量
|
||||||
|
* @return int
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/05/31 16:02
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return StoreOrder::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
}
|
@ -44,7 +44,7 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return SystemStore::where($this->searchWhere)
|
return SystemStore::where($this->searchWhere)
|
||||||
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show'])
|
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show','day_start','day_end'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()
|
->select()
|
||||||
|
65
app/admin/lists/user_recharge/UserRechargeLists.php
Normal file
65
app/admin/lists/user_recharge/UserRechargeLists.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\lists\user_recharge;
|
||||||
|
|
||||||
|
|
||||||
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录列表
|
||||||
|
* Class UserRechargeLists
|
||||||
|
* @package app\admin\listsuser_recharge
|
||||||
|
*/
|
||||||
|
class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 设置搜索条件
|
||||||
|
* @return \string[][]
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function setSearch(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'=' => ['paid', 'pay_time'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取充值记录列表
|
||||||
|
* @return array
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function lists(): array
|
||||||
|
{
|
||||||
|
return UserRecharge::where($this->searchWhere)
|
||||||
|
->field(['id', 'uid', 'order_id', 'price', 'recharge_type', 'paid', 'pay_time'])
|
||||||
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取充值记录数量
|
||||||
|
* @return int
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
return UserRecharge::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
94
app/admin/logic/user_recharge/UserRechargeLogic.php
Normal file
94
app/admin/logic/user_recharge/UserRechargeLogic.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\logic\user_recharge;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
|
use app\common\logic\BaseLogic;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录逻辑
|
||||||
|
* Class UserRechargeLogic
|
||||||
|
* @package app\admin\logic\user_recharge
|
||||||
|
*/
|
||||||
|
class UserRechargeLogic extends BaseLogic
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加充值记录
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public static function add(array $params): bool
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
UserRecharge::create([
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
self::setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑充值记录
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public static function edit(array $params): bool
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
UserRecharge::where('id', $params['id'])->update([
|
||||||
|
|
||||||
|
]);
|
||||||
|
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
self::setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除充值记录
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public static function delete(array $params): bool
|
||||||
|
{
|
||||||
|
return UserRecharge::destroy($params['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取充值记录详情
|
||||||
|
* @param $params
|
||||||
|
* @return array
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public static function detail($params): array
|
||||||
|
{
|
||||||
|
return UserRecharge::findOrEmpty($params['id'])->toArray();
|
||||||
|
}
|
||||||
|
}
|
82
app/admin/validate/user_recharge/UserRechargeValidate.php
Normal file
82
app/admin/validate/user_recharge/UserRechargeValidate.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\validate\user_recharge;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\validate\BaseValidate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录验证器
|
||||||
|
* Class UserRechargeValidate
|
||||||
|
* @package app\admin\validate\user_recharge
|
||||||
|
*/
|
||||||
|
class UserRechargeValidate extends BaseValidate
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置校验规则
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $rule = [
|
||||||
|
'id' => 'require',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数描述
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
protected $field = [
|
||||||
|
'id' => 'id',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加场景
|
||||||
|
* @return UserRechargeValidate
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function sceneAdd()
|
||||||
|
{
|
||||||
|
return $this->remove('id', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑场景
|
||||||
|
* @return UserRechargeValidate
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function sceneEdit()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除场景
|
||||||
|
* @return UserRechargeValidate
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function sceneDelete()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 详情场景
|
||||||
|
* @return UserRechargeValidate
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/06/06 14:29
|
||||||
|
*/
|
||||||
|
public function sceneDetail()
|
||||||
|
{
|
||||||
|
return $this->only(['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
22
app/common/model/user_recharge/UserRecharge.php
Normal file
22
app/common/model/user_recharge/UserRecharge.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\user_recharge;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录模型
|
||||||
|
* Class UserRecharge
|
||||||
|
* @package app\common\model\user_recharge
|
||||||
|
*/
|
||||||
|
class UserRecharge extends BaseModel
|
||||||
|
{
|
||||||
|
use SoftDelete;
|
||||||
|
protected $name = 'user_recharge';
|
||||||
|
protected $deleteTime = 'delete_time';
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user