feat : sts

This commit is contained in:
2025-04-15 10:54:31 +08:00
parent f3589ed994
commit 39be37f9a5
10 changed files with 249 additions and 16 deletions

View File

@@ -96,7 +96,7 @@ class EvaluationService extends BaseService
$orderGoodInfo->is_comment = OrderCode::GOOD_COMMENT_FINISH;
if (!$orderGoodInfo->save()) throw new ErrException('评论失败-002');
//todo 厨师商品评分]
// 厨师商品评分]
return $insertModel;
});

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\Common\GoodCode;
use App\Constants\ConfigCode;
use App\Exception\ErrException;
use App\Model\Category;
@@ -98,11 +99,17 @@ class OptionalListService extends BaseService
$res = [];
$stockKey = ApiRedisKey::goodStockKey($this->goodCache->cycleId, $this->goodCache->kitchenId);
foreach ($data as &$item) {
$favorable = [];
foreach ($data as $key => &$item) {
foreach ($item['sku_list'] as &$v) {
$v['surplus_stock'] = $this->redisCache->zScore($stockKey,$v['id']) ?? 0;
}
if ($item['favorable'] == GoodCode::IS_FAVORABLE) {
unset($data[$key]);
$favorable = $item;
}
if (empty($res[$item['category_id']])) {
$res[$item['category_id']] = [
'category_name' => $categoryList[$item['category_id']]['name'] ?? '',
@@ -122,6 +129,14 @@ class OptionalListService extends BaseService
]);
}
if (!empty($favorable)) {
array_unshift($res,[
'category_name' => $this->configCache->getConfigValueByKey(ConfigCode::SPECIALS_CATEGORY_NAME),
'category_image' => $this->configCache->getConfigValueByKey(ConfigCode::SPECIALS_CATEGORY_IMAGE),
'spu_list' => $favorable
]);
}
return array_values($res);
}
}