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
182 lines
4.7 KiB
PHP
182 lines
4.7 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Component\HttpClient\Response;
|
|
|
|
use Symfony\Component\HttpClient\Exception\ClientException;
|
|
use Symfony\Component\HttpClient\Exception\JsonException;
|
|
use Symfony\Component\HttpClient\Exception\RedirectionException;
|
|
use Symfony\Component\HttpClient\Exception\ServerException;
|
|
use Symfony\Component\HttpClient\Exception\TransportException;
|
|
|
|
/**
|
|
* Implements common logic for response classes.
|
|
*
|
|
* @author Nicolas Grekas <p@tchwork.com>
|
|
*
|
|
* @internal
|
|
*/
|
|
trait CommonResponseTrait
|
|
{
|
|
/**
|
|
* @var callable|null A callback that tells whether we're waiting for response headers
|
|
*/
|
|
private $initializer;
|
|
private $shouldBuffer;
|
|
private $content;
|
|
private int $offset = 0;
|
|
private ?array $jsonData = null;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function getContent(bool $throw = true): string
|
|
{
|
|
if ($this->initializer) {
|
|
self::initialize($this);
|
|
}
|
|
|
|
if ($throw) {
|
|
$this->checkStatusCode();
|
|
}
|
|
|
|
if (null === $this->content) {
|
|
$content = null;
|
|
|
|
foreach (self::stream([$this]) as $chunk) {
|
|
if (!$chunk->isLast()) {
|
|
$content .= $chunk->getContent();
|
|
}
|
|
}
|
|
|
|
if (null !== $content) {
|
|
return $content;
|
|
}
|
|
|
|
if (null === $this->content) {
|
|
throw new TransportException('Cannot get the content of the response twice: buffering is disabled.');
|
|
}
|
|
} else {
|
|
foreach (self::stream([$this]) as $chunk) {
|
|
// Chunks are buffered in $this->content already
|
|
}
|
|
}
|
|
|
|
rewind($this->content);
|
|
|
|
return stream_get_contents($this->content);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toArray(bool $throw = true): array
|
|
{
|
|
if ('' === $content = $this->getContent($throw)) {
|
|
throw new JsonException('Response body is empty.');
|
|
}
|
|
|
|
if (null !== $this->jsonData) {
|
|
return $this->jsonData;
|
|
}
|
|
|
|
try {
|
|
$content = json_decode($content, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
|
|
} catch (\JsonException $e) {
|
|
throw new JsonException($e->getMessage().sprintf(' for "%s".', $this->getInfo('url')), $e->getCode());
|
|
}
|
|
|
|
if (!\is_array($content)) {
|
|
throw new JsonException(sprintf('JSON content was expected to decode to an array, "%s" returned for "%s".', get_debug_type($content), $this->getInfo('url')));
|
|
}
|
|
|
|
if (null !== $this->content) {
|
|
// Option "buffer" is true
|
|
return $this->jsonData = $content;
|
|
}
|
|
|
|
return $content;
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function toStream(bool $throw = true)
|
|
{
|
|
if ($throw) {
|
|
// Ensure headers arrived
|
|
$this->getHeaders($throw);
|
|
}
|
|
|
|
$stream = StreamWrapper::createResource($this);
|
|
stream_get_meta_data($stream)['wrapper_data']
|
|
->bindHandles($this->handle, $this->content);
|
|
|
|
return $stream;
|
|
}
|
|
|
|
public function __sleep(): array
|
|
{
|
|
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
|
|
}
|
|
|
|
public function __wakeup()
|
|
{
|
|
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
|
}
|
|
|
|
/**
|
|
* Closes the response and all its network handles.
|
|
*/
|
|
abstract protected function close(): void;
|
|
|
|
private static function initialize(self $response): void
|
|
{
|
|
if (null !== $response->getInfo('error')) {
|
|
throw new TransportException($response->getInfo('error'));
|
|
}
|
|
|
|
try {
|
|
if (($response->initializer)($response, -0.0)) {
|
|
foreach (self::stream([$response], -0.0) as $chunk) {
|
|
if ($chunk->isFirst()) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} catch (\Throwable $e) {
|
|
// Persist timeouts thrown during initialization
|
|
$response->info['error'] = $e->getMessage();
|
|
$response->close();
|
|
throw $e;
|
|
}
|
|
|
|
$response->initializer = null;
|
|
}
|
|
|
|
private function checkStatusCode()
|
|
{
|
|
$code = $this->getInfo('http_code');
|
|
|
|
if (500 <= $code) {
|
|
throw new ServerException($this);
|
|
}
|
|
|
|
if (400 <= $code) {
|
|
throw new ClientException($this);
|
|
}
|
|
|
|
if (300 <= $code) {
|
|
throw new RedirectionException($this);
|
|
}
|
|
}
|
|
}
|