diff --git a/app/Constants/v3/ActivityType.php b/app/Constants/v3/ActivityType.php new file mode 100644 index 0000000..1ef89e7 --- /dev/null +++ b/app/Constants/v3/ActivityType.php @@ -0,0 +1,28 @@ + [ + [ + 'goods' => [ + 'id' => 1, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜11', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'tag' => ['限时', '折扣'], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 10, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 2, + 'noneffective_note' => '已卖完', + ], + 'store' => ['id' => 111, 'logo' => '', 'name' => '我是一个商家'] + ], + + ], + Tabs::APPLET_INDEX_NEW => [ + [ + 'goods' => [ + 'id' => 2, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜11', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'tag' => ['限时', '折扣'], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 10, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 2, + 'noneffective_note' => '已卖完', + ], + 'store' => ['id' => 222, 'logo' => '', 'name' => '我是一个商家222'] + ], + ], + Tabs::APPLET_INDEX_FRESH => [ + [ + 'goods' => [ + 'id' => 3, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜11', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'tag' => ['限时', '折扣'], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 10, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 2, + 'noneffective_note' => '已卖完', + ], + 'store' => ['id' => 333, 'logo' => '', 'name' => '我是一个商家333'] + ], + ], + Tabs::APPLET_INDEX_OFFICE => [ + [ + 'goods' => [ + 'id' => 4, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜11', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'tag' => ['限时', '折扣'], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 10, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 2, + 'noneffective_note' => '已卖完', + ], + 'store' => ['id' => 444, 'logo' => '', 'name' => '我是一个商家444'] + ], + ] + ]; + + return $this->success([ + 'tab_data' => $tabsData[$this->request->post('tab', 'applet_index_recommend')] + ]); + } +} \ No newline at end of file diff --git a/app/Controller/v3/HomeController.php b/app/Controller/v3/HomeController.php new file mode 100644 index 0000000..67df996 --- /dev/null +++ b/app/Controller/v3/HomeController.php @@ -0,0 +1,157 @@ +success([ + 'banners' => [ + [ + 'id' => 2, + 'img' => 'https://store.lanzu.vip/attachment/images/2/2020/06/nfXxIhEgH71hcSxSz2hHnaaEaF1g3A.jpg', + 'title' => '懒族生活', + 'subtitle' => '满足您的美味生活', + 'redirect_type' => '', + 'redirect_url' => '', + ], + [ + 'id' => 3, + 'img' => 'http://lanzutest.lanzulive.com/attachment/images/2/2020/08/PY55Y3Mz17yJo17rv1Z7vImX1V5159.jpg', + 'title' => '鲜菜有爱', + 'subtitle' => '很实在', + 'redirect_type' => 'page', + 'redirect_url' => '/pages/index', + ], + ], + 'categories' => [ + ['id' => 1, 'icon' => config('alioss.img_host').'/attachment/types/卤菜.png', 'name' => '卤菜'], + ['id' => 2, 'icon' => config('alioss.img_host').'/attachment/types/水果.png', 'name' => '水果'], + ['id' => 3, 'icon' => config('alioss.img_host').'/attachment/types/肉.png', 'name' => '肉'], + ['id' => 4, 'icon' => config('alioss.img_host').'/attachment/types/蔬菜.png', 'name' => '蔬菜'], + ['id' => 5, 'icon' => config('alioss.img_host').'/attachment/types/蔬菜.png', 'name' => '蔬菜'], + ['id' => 6, 'icon' => config('alioss.img_host').'/attachment/types/肉.png', 'name' => '肉'], + ['id' => 7, 'icon' => config('alioss.img_host').'/attachment/types/水果.png', 'name' => '水果'], + ['id' => 8, 'icon' => config('alioss.img_host').'/attachment/types/卤菜.png', 'name' => '卤菜'], + ], + 'activity' => [ + 'type' => ActivityType::FLASH_SALE, + 'goods' => [ + [ + 'id' => 1, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 0, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 1, + 'noneffective_note' => '已抢光', + 'total_seconds' => $seconds, + 'days' => $days, + 'hours' => $hours, + 'minutes' => $minutes, + 'seconds' => $leftSeconds, + ],[ + 'id' => 1, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 0, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 1, + 'noneffective_note' => '已抢光', + 'total_seconds' => $seconds, + 'days' => $days, + 'hours' => $hours, + 'minutes' => $minutes, + 'seconds' => $leftSeconds, + ],[ + 'id' => 1, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 0, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 1, + 'noneffective_note' => '已抢光', + 'total_seconds' => $seconds, + 'days' => $days, + 'hours' => $hours, + 'minutes' => $minutes, + 'seconds' => $leftSeconds, + ],[ + 'id' => 1, + 'cover_img' => config('alioss.img_host').'/attachment/types/c9b656181bbbc463624ca3803c5be7539f2fd62253f9a-cwVLri.png', + 'name' => '【优质】大白菜', + 'spec' => [ + ['key' => '净含量', 'value' => '500g'] + ], + 'original_price' => 50.5, + 'price' => 25.25, + 'inventory' => 0, + 'month_sales' => 20, + 'total_sales' => 20, + 'cart_num' => 0, + 'is_effective' => 1, + 'noneffective_note' => '已抢光', + 'total_seconds' => $seconds, + 'days' => $days, + 'hours' => $hours, + 'minutes' => $minutes, + 'seconds' => $leftSeconds, + ], + ] + ], + 'tabs' => [ + ['tab' => Tabs::APPLET_INDEX_RECOMMEND, 'title' => '推荐', 'subtitle' => '猜你喜欢', 'badge' => '', 'bg_color' => '#FF0000', 'font_color' => '#FFFFFF'], + ['tab' => Tabs::APPLET_INDEX_NEW, 'title' => '懒族上新', 'subtitle' => '买点不一样', 'badge' => '限时', 'bg_color' => '#FF0000', 'font_color' => '#FFFFFF'], + ['tab' => Tabs::APPLET_INDEX_FRESH, 'title' => '实时鲜货', 'subtitle' => '今天辛苦了', 'badge' => '好新鲜', 'bg_color' => '#FF0000', 'font_color' => '#FFFFFF'], + ['tab' => Tabs::APPLET_INDEX_OFFICE, 'title' => '上班带餐', 'subtitle' => '轻奢快手菜', 'badge' => '不慌', 'bg_color' => '#FF0000', 'font_color' => '#FFFFFF'], + ] + ]); + + } +} \ No newline at end of file diff --git a/app/Controller/v3/LocationController.php b/app/Controller/v3/LocationController.php new file mode 100644 index 0000000..a70384f --- /dev/null +++ b/app/Controller/v3/LocationController.php @@ -0,0 +1,39 @@ +success([ + 'market' => [ + 'id' => 1, + 'name' => '海尔青啤', + 'province_id' => 1, + 'province_name' => '广西', + 'city_id' => 2, + 'city_name' => '南宁市', + 'area_id' => 3, + 'area_name' => '良庆区', + 'address' => '海尔青啤广场', + 'lng' => '108.383566', + 'lat' => '22.759946', + ] + ]); + } +} \ No newline at end of file diff --git a/config/config.php b/config/config.php index d416f7f..66529cf 100644 --- a/config/config.php +++ b/config/config.php @@ -47,5 +47,8 @@ return [ 'regionid' => env('ALI_SMS_REGION_ID', ''), 'product' => env('ALI_SMS_PRODUCT', ''), 'host' => env('ALI_SMS_HOST', ''), - ] + ], + 'alioss' => [ + 'img_host' => env('OSS_IMG_HOST', ''), + ], ]; diff --git a/config/routes.php b/config/routes.php index cf42f1f..d975362 100644 --- a/config/routes.php +++ b/config/routes.php @@ -80,6 +80,7 @@ Router::addGroup('/v3/', function () { Router::post('location/getNearestMarket', 'App\Controller\v3\LocationController@getNearestMarket'); Router::post('home/appletIndex', 'App\Controller\v3\HomeController@appletIndex'); Router::post('Goods/detail', 'App\Controller\v3\GoodsController@detail'); + Router::post('goodsRecommend/getByTabsForAppletIndex', 'App\Controller\v3\GoodsRecommendController@getByTabsForAppletIndex'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); // 需要登录的路由