Files
huangjingfen/pro_v3.5.1/app/controller/admin/v1/hjf/QueueController.php
apple 6e5bbee71d feat(hjf): 公排入队可配置,默认关闭时同步发放积分奖励
- 新增 hjf_queue_pool_enable(迁移 SQL),后台公排配置读写统一为该键
- Pay 监听:关闭公排时同步执行等级检查与 PointsRewardServices::reward,开启时仍派发 HjfOrderPayJob
- PointsRewardServices: bcInc 增量传 string,避免 PHP 类型错误
- hjf:patch-rewards 补偿命令补充等级检查与正确的幂等条件
- uniapp vue.config.js 本地 API 代理调整(H5 开发)
- docs/issues-0323-1 更新

Made-with: Cursor
2026-03-25 07:38:12 +08:00

106 lines
3.1 KiB
PHP

<?php
declare(strict_types=1);
namespace app\controller\admin\v1\hjf;
use app\controller\admin\AuthController;
use app\dao\hjf\QueuePoolDao;
use app\services\system\config\SystemConfigServices;
use crmeb\services\SystemConfigService;
use think\annotation\Inject;
/**
* Admin · 公排管理接口
*
* GET /adminapi/hjf/queue/order — 公排订单列表
* GET /adminapi/hjf/queue/config — 获取公排配置
* POST /adminapi/hjf/queue/config — 保存公排配置
* GET /adminapi/hjf/queue/finance — 公排退款财务流水
*
* Class QueueController
* @package app\controller\admin\v1\hjf
*/
class QueueController extends AuthController
{
#[Inject]
protected QueuePoolDao $dao;
/**
* 公排订单列表(分页 + 筛选)
*/
public function orderList(): mixed
{
$where = $this->request->getMore([
['keyword', ''],
['status', ''],
['start_time', ''],
['end_time', ''],
['page', 1],
['limit', 20],
]);
$page = (int)$where['page'];
$limit = (int)$where['limit'];
unset($where['page'], $where['limit']);
return $this->success($this->dao->getAdminList($where, $page, $limit));
}
/**
* 获取公排配置
*/
public function getConfig(): mixed
{
$config = [
'trigger_multiple' => (int)SystemConfigService::get('hjf_trigger_multiple', 4),
'release_rate' => (int)SystemConfigService::get('hjf_release_rate', 4),
'withdraw_fee_rate' => (int)SystemConfigService::get('hjf_withdraw_fee_rate', 7),
'enabled' => (bool)SystemConfigService::get('hjf_queue_pool_enable', 0),
];
return $this->success($config);
}
/**
* 保存公排配置
*/
public function saveConfig(SystemConfigServices $configServices): mixed
{
$data = $this->request->getMore([
['trigger_multiple', 4],
['release_rate', 4],
['withdraw_fee_rate', 7],
['enabled', 1],
]);
$map = [
'hjf_trigger_multiple' => (int)$data['trigger_multiple'],
'hjf_release_rate' => (int)$data['release_rate'],
'hjf_withdraw_fee_rate' => (int)$data['withdraw_fee_rate'],
'hjf_queue_pool_enable' => (int)$data['enabled'],
];
foreach ($map as $key => $value) {
$configServices->setConfig($key, (string)$value);
}
return $this->success('保存成功');
}
/**
* 公排退款财务流水(分页)
*/
public function financeList(): mixed
{
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['page', 1],
['limit', 20],
]);
$page = (int)$where['page'];
$limit = (int)$where['limit'];
unset($where['page'], $where['limit']);
return $this->success($this->dao->getFinanceList($where, $page, $limit));
}
}