Files
huangjingfen/pro_v3.5.1_副本/vendor/topthink/think-throttle/tests/Base.php
apple 434aa8c69d feat(fsgx): 完成全部24项开发任务 Phase1-7
Phase1 后端核心:
- 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess)
- SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机)
- StoreOrderCreateServices 周期循环佣金计算
- StoreOrderTakeServices 佣金发放后同步冻结积分
- StoreProductServices/StoreProduct 保存 is_queue_goods

Phase2 后端接口:
- GET /api/hjf/brokerage/progress 佣金周期进度
- GET /api/hjf/assets/overview 资产总览
- HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务
- PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口
- GET /adminapi/hjf/points/release_log 积分日志接口

Phase3 前端清理:
- hjfCustom.js 路由精简(仅保留 points/log)
- hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口
- pages.json 公排→推荐佣金/佣金记录/佣金规则

Phase4-5 前端改造:
- queue/status.vue 推荐佣金进度页整体重写
- 商品详情/订单确认/支付结果页文案与逻辑改造
- 个人中心/资产页/引导页/规则页文案改造
- HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造
- 推广中心嵌入佣金进度摘要
- hjfMockData.js 全量更新(公排字段→佣金字段)

Phase6 Admin 增强:
- 用户列表新增 frozen_points/available_points 列及不考核操作按钮
- hjfPoints.js USE_MOCK=false 对接真实积分日志接口

Phase7 配置文档:
- docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单

Made-with: Cursor
2026-03-23 22:32:19 +08:00

88 lines
2.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace tests;
use PHPUnit\Framework\TestCase;
abstract class Base extends TestCase {
static $ROOT_PATH = __DIR__ . "/../vendor/topthink/think";
static $RUNTIME_PATH = __DIR__ . "/../runtime/";
protected $app;
protected $throttle_config = [];
protected $middleware_file = __DIR__ . "/config/global-middleware.php";
protected $middleware_type = 'global';
/**
* thinkphp 一般运行在 php-fpm 模式下,每次处理请求都要重新加载配置文件
* @param \think\Request $request
* @return \think\Response
*/
function get_response(\think\Request $request): \think\Response {
// 创建 \think\App 对象,设置配置
$app = new GCApp(static::$ROOT_PATH);
$app->setRuntimePath(static::$RUNTIME_PATH);
// 加载中间件
$app->middleware->import(include $this->middleware_file, $this->middleware_type);
// 设置 throttle 配置
$app->config->set($this->throttle_config, 'throttle');
$response = $app->http->run($request);
$app->refClear();
return $response;
}
protected function tearDown(): void
{
parent::tearDown();
// 每次测试完毕都需要清理 runtime cache 目录,避免影响其他单元测试
$cache_dir = static::$RUNTIME_PATH . "cache";
$dirs = glob($cache_dir . '/*', GLOB_ONLYDIR);
foreach ($dirs as $dir) {
$files = glob($dir . '/*.php');
foreach ($files as $file) {
unlink($file);
}
}
// 删除 cache 下的空目录
foreach ($dirs as $dir) {
rmdir($dir);
}
unset($cache_dir);
unset($dirs);
gc_collect_cycles(); // 进行垃圾回收
}
/**
* 获取默认的 throttle 基础配置信息
* @return array
*/
function get_default_throttle_config(): array {
static $config = []; // 默认配置从文件中读取,可以设置为静态变量
if (!$config) {
$config = include dirname(__DIR__) . "/src/config.php";
}
return $config;
}
/**
* 设置中间件配置文件
* @param string $file 文件的路径 eg: $this->app->getBasePath() . 'middleware.php'
* @param string $type 类型global 全局route 路由controller 控制器
*/
function set_middleware(string $file, string $type = 'global') {
$this->middleware_file = $file;
$this->middleware_type = $type;
}
/**
* 设置 throttle 配置
* @param array $config
*/
function set_throttle_config(array $config) {
$this->throttle_config = $config;
}
}