Store the customized Shopro mall so it can be kept on the remote.

Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
wikiboss
2026-09-22 13:55:12 +08:00
当前提交 b87880e247
共有 2547 个文件被更改,包括 423496 次插入 和 0 次删除

查看文件

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Yansongda\Artful\Direction;
use Psr\Http\Message\ResponseInterface;
use Yansongda\Artful\Contract\DirectionInterface;
use Yansongda\Artful\Contract\PackerInterface;
use Yansongda\Artful\Exception\Exception;
use Yansongda\Artful\Exception\InvalidResponseException;
use Yansongda\Supports\Collection;
class CollectionDirection implements DirectionInterface
{
/**
* @throws InvalidResponseException
*/
public function guide(PackerInterface $packer, ?ResponseInterface $response, array $params = []): Collection
{
if (is_null($response)) {
throw new InvalidResponseException(Exception::RESPONSE_EMPTY, '响应异常: 响应为空,不能进行 direction');
}
$body = (string) $response->getBody();
if (!is_null($result = $packer->unpack($body, $params))) {
return new Collection($result);
}
throw new InvalidResponseException(Exception::RESPONSE_UNPACK_ERROR, '响应异常: 解包错误', ['body' => $body, 'response' => $response]);
}
}

查看文件

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace Yansongda\Artful\Direction;
use Psr\Http\Message\ResponseInterface;
use Yansongda\Artful\Contract\DirectionInterface;
use Yansongda\Artful\Contract\PackerInterface;
class NoHttpRequestDirection implements DirectionInterface
{
public function guide(PackerInterface $packer, ?ResponseInterface $response, array $params = []): ?ResponseInterface
{
return $response;
}
}

查看文件

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace Yansongda\Artful\Direction;
use Psr\Http\Message\ResponseInterface;
use Yansongda\Artful\Contract\DirectionInterface;
use Yansongda\Artful\Contract\PackerInterface;
use Yansongda\Artful\Exception\Exception;
use Yansongda\Artful\Exception\InvalidResponseException;
class OriginResponseDirection implements DirectionInterface
{
/**
* @throws InvalidResponseException
*/
public function guide(PackerInterface $packer, ?ResponseInterface $response, array $params = []): ?ResponseInterface
{
if (is_null($response)) {
throw new InvalidResponseException(Exception::RESPONSE_EMPTY, '响应异常: 响应为空,不能进行 direction');
}
return $response;
}
}

查看文件

@@ -0,0 +1,7 @@
<?php
declare(strict_types=1);
namespace Yansongda\Artful\Direction;
class ResponseDirection extends NoHttpRequestDirection {}