feat : spu
This commit is contained in:
@@ -79,11 +79,11 @@ class CycleListService extends CateringBaseService
|
||||
|
||||
public function skuList()
|
||||
{
|
||||
$spuList = $this->spuModel->where('caterer_id',$this->adminId)->select(['title','sub_title','id as spu_id'])->get();
|
||||
$spuList = $this->spuModel->where('caterer_id',$this->adminId)->select(['title','sub_title','id'])->get();
|
||||
if (empty($spuList)) return $this->return->success('success',['list' => []]);
|
||||
$spuList = $spuList->toArray();
|
||||
|
||||
$skuList = $this->skuModel->where('spu_id',array_column($spuList,'spu_id'))->pluck('id','spu_id');
|
||||
$skuList = $this->skuModel->where('spu_id',array_column($spuList,'id'))->pluck('id','spu_id');
|
||||
|
||||
foreach ($spuList as &$v) {
|
||||
$v['sku_id'] = $skuList[$v['spu_id']] ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user