feat : chef name

This commit is contained in:
2025-04-10 15:48:09 +08:00
parent 35040679b5
commit c0d9dbd1c6

View File

@@ -5,6 +5,7 @@ namespace App\Cache\Redis\Api;
use App\Cache\Redis\RedisCache;
use App\Constants\Common\GoodCode;
use App\Extend\DateUtil;
use App\Model\AdminUser;
use App\Model\Sku;
use App\Model\Spu;
use App\Service\ServiceTrait\Common\OssTrait;
@@ -39,6 +40,12 @@ class GoodCache
*/
public int $cycleId;
/**
* @var AdminUser
*/
#[Inject]
protected AdminUser $adminUserModel;
/**
* @var int $kitchenId
*/
@@ -145,6 +152,9 @@ class GoodCache
$imageIdArr = array_column($skuList,'image_ids');
$imageList = $this->getOssObjects($imageIdArr);
$chefIds = array_column($imageList,'chef_id');
$chefList = $this->adminUserModel->getDataByIds($chefIds);
$skuListArr = [];
$imageArr = [];
$stockArr = [];
@@ -155,6 +165,7 @@ class GoodCache
}
$sku['url'] = $imageList[$sku['image_ids']]['url'] ?? '';
$sku['chef_name'] = $chefList[$sku['chef_id']]['chinese_name'] ?? '';
$skuListArr[$sku['spu_id']][] = $sku;
$price[$sku['spu_id']][] = $sku['price'];