From 6f3a33239908feda5ff3e0a428b23cb3e3609808 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Tue, 3 Nov 2020 14:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/v3/GoodsController.php | 6 ++++++ config/routes.php | 1 + 2 files changed, 7 insertions(+) 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]]); // 需要登录的路由