feat : sts

This commit is contained in:
2025-04-14 17:46:06 +08:00
parent 217ed0c240
commit e996536bf5
10 changed files with 491 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ use App\Cache\Redis\Api\ApiRedisKey;
use App\Cache\Redis\Api\GoodCache;
use App\Cache\Redis\Api\SiteCache;
use App\Cache\Redis\RedisCache;
use App\Constants\ConfigCode;
use App\Exception\ErrException;
use App\Model\Category;
use App\Service\Api\BaseService;
@@ -87,6 +88,8 @@ class OptionalListService extends BaseService
*/
private function buildData($data): array
{
// 一键选购
$purchaseData = $this->goodCache->getPurchaseGoodList();
$categoryIds = $this->categoryModel->whereIn('id',array_column($data,'category_id'))->get();
if (empty($categoryIds)) throw new ErrException('数据错误');
@@ -111,6 +114,14 @@ class OptionalListService extends BaseService
$res[$item['category_id']]['spu_list'][] = $item;
}
if (!empty($purchaseData)) {
array_unshift($res,[
'category_name' => $this->configCache->getConfigValueByKey(ConfigCode::ONE_CLICK_SHOPPING_FOR_CATEGORY_NAME),
'category_image' => $this->getOssObjectById((int)$this->configCache->getConfigValueByKey(ConfigCode::ONE_CLICK_SHOPPING_FOR_CATEGORY_IMAGE)),
'spu_list' => $purchaseData
]);
}
return array_values($res);
}
}