diff --git a/app/Controller/v3/GoodsRecommendController.php b/app/Controller/v3/GoodsRecommendController.php index a4e8207..5981719 100644 --- a/app/Controller/v3/GoodsRecommendController.php +++ b/app/Controller/v3/GoodsRecommendController.php @@ -207,6 +207,12 @@ class GoodsRecommendController extends BaseController ] ]; + $goods = Goods::query() + ->with(['store']) + ->forPage($this->request->input('page', 1), $this->request->input('pagesize', 15)) + ->get()->toArray(); + return $this->success(['tab_data' => $goods]); + return $this->success([ 'tab_data' => $tabsData[$this->request->post('tab', 'applet_index_recommend')] ]); diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php index 7bc8d43..4c71abc 100644 --- a/app/Model/v3/Goods.php +++ b/app/Model/v3/Goods.php @@ -51,6 +51,8 @@ class Goods extends Model protected $appends = [ 'month_sales', 'cart_num', + 'is_effective', + 'noneffective_note', ]; protected function boot(): void @@ -87,6 +89,16 @@ class Goods extends Model return (integer)$this->shopCartService->check($this->id); } + public function getIsEffectiveAttribute() + { + return 1; + } + + public function getNoneffectiveNoteAttribute() + { + return ''; + } + public function store() { return $this->belongsTo(Store::class, 'store_id', 'id'); diff --git a/app/Service/v3/Implementations/BannerService.php b/app/Service/v3/Implementations/BannerService.php index 5cd4541..dd46f35 100644 --- a/app/Service/v3/Implementations/BannerService.php +++ b/app/Service/v3/Implementations/BannerService.php @@ -9,6 +9,9 @@ class BannerService implements BannerServiceInterface { public function all($type, $marketId) { - return Banner::query()->where(['type' => $type, 'market_id' => $marketId])->get()->toArray(); + return Banner::query() + ->where(['type' => $type]) + ->whereIn('market_id', [0,$marketId]) + ->get()->toArray(); } } \ No newline at end of file