diff --git a/app/Controller/v3/GoodsController.php b/app/Controller/v3/GoodsController.php index 3425853..b81088f 100644 --- a/app/Controller/v3/GoodsController.php +++ b/app/Controller/v3/GoodsController.php @@ -6,6 +6,7 @@ use App\Constants\v3\ErrorCode; use App\Controller\BaseController; use App\Exception\ErrorCodeException; use App\Model\v3\Category; +use App\Model\v3\GoodsActivity; use App\Model\v3\GoodsCategory; use App\Request\v3\GoodsEditorRequest; use App\Service\v3\Interfaces\CategoryServiceInterface; @@ -199,4 +200,9 @@ class GoodsController extends BaseController $bannerId = $this->request->input('banner_id',0); return $this->success($this->goodsService->bannerDelete($bannerId)); } + + public function getList(){ + $goods = GoodsActivity::query()->limit(5)->orderByDesc('created_at')->get(); + return $this->success(['goods' => $goods]); + } } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index fbb8832..306e445 100644 --- a/config/routes.php +++ b/config/routes.php @@ -100,6 +100,7 @@ Router::addGroup('/v3/', function () { Router::post('home/market', 'App\Controller\v3\HomeController@marketInfo'); Router::post('location/addrSuggestion', 'App\Controller\v3\LocationController@addrSuggestion'); Router::post('userAddress/deliveryDistance', 'App\Controller\v3\UserAddressController@deliveryDistance'); + Router::post('goods/getList', 'App\Controller\v3\GoodsController@getList'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); // 需要登录的路由