feat : rank

This commit is contained in:
2025-04-09 16:12:22 +08:00
parent aac53d8264
commit cd9c5afef2
3 changed files with 7 additions and 7 deletions

View File

@@ -98,9 +98,9 @@ class Sku extends Model
/** /**
* @param array $spuIds * @param array $spuIds
* @return Collection * @return Collection|null
*/ */
public function getAddStapleFoodListBySpuIds(array $spuIds): Collection public function getAddStapleFoodListBySpuIds(array $spuIds): Collection|null
{ {
return $this return $this
->whereIn('spu_id',$spuIds) ->whereIn('spu_id',$spuIds)
@@ -114,9 +114,9 @@ class Sku extends Model
/** /**
* @param int $spuId * @param int $spuId
* @return Collection * @return Collection|null
*/ */
public function getListBySpuId(int $spuId): Collection public function getListBySpuId(int $spuId): Collection|null
{ {
return $this return $this
->where('spu_id',$spuId) ->where('spu_id',$spuId)

View File

@@ -73,9 +73,9 @@ class Spu extends Model
* @param int $cycleId * @param int $cycleId
* @param int $kitchenId * @param int $kitchenId
* @param int $type * @param int $type
* @return Builder[]|Collection * @return Builder[]|Collection|null
*/ */
public function getListByCycleIdAndType(int $cycleId, int $kitchenId, int $type): Collection|array public function getListByCycleIdAndType(int $cycleId, int $kitchenId, int $type): Collection|array|null
{ {
return $this return $this
->where('cycle_id',$cycleId) ->where('cycle_id',$cycleId)

View File

@@ -71,7 +71,7 @@ class AddStapleFoodInfoService extends BaseService
$spuInfo = $this->spuModel->getListByCycleIdAndType($cycleId, $kitchenId,GoodCode::SPU_TYPE_MEAL); $spuInfo = $this->spuModel->getListByCycleIdAndType($cycleId, $kitchenId,GoodCode::SPU_TYPE_MEAL);
if (empty($spuInfo)) return $this->return->success('success', ['add_food_info' => []]); if (empty($spuInfo)) return $this->return->success('success', ['add_food_info' => []]);
$spuIds = array_column($spuInfo->toArray(), 'spu_id'); $spuIds = array_column($spuInfo->toArray(), 'id');
// $data = $this->goodCache->getMealGoodList(); // $data = $this->goodCache->getMealGoodList();
$skuInfo = $this->skuModel->getAddStapleFoodListBySpuIds($spuIds); $skuInfo = $this->skuModel->getAddStapleFoodListBySpuIds($spuIds);
if (empty($skuInfo)) return $this->return->success('success', ['add_food_info' => []]); if (empty($skuInfo)) return $this->return->success('success', ['add_food_info' => []]);