|
|
@ -67,17 +67,13 @@ class GoodsService implements GoodsServiceInterface |
|
|
|
|
|
|
|
|
public function detail($goodsId) |
|
|
public function detail($goodsId) |
|
|
{ |
|
|
{ |
|
|
$res = Goods::query()->with('store')->where('id',$goodsId)->first(); |
|
|
|
|
|
|
|
|
$res = Goods::query()->with('store')->where('id',$goodsId)->select('*','name as goods_name')->first(); |
|
|
return $res; |
|
|
return $res; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getByType($storeId,$typeId, $page=1, $pagesize=10) |
|
|
|
|
|
|
|
|
public function getByType($storeId,$typeId) |
|
|
{ |
|
|
{ |
|
|
$builder = Goods::query()->where(['store_id' => $storeId,'category_id' => $typeId]); |
|
|
|
|
|
|
|
|
|
|
|
$paginate = $builder->orderByDesc('on_sale')->orderByDesc('created_at')->paginate($pagesize); |
|
|
|
|
|
$goods = $paginate->toArray(); |
|
|
|
|
|
return ['has_more_pages' => $paginate->hasMorePages(), 'goods' => $goods['data']]; |
|
|
|
|
|
|
|
|
return Goods::query()->where(['store_id' => $storeId,'category_id' => $typeId])->orderByDesc('on_sale')->orderByDesc('created_at')->get()->toArray(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function update($params) |
|
|
public function update($params) |
|
|
|