diff --git a/app/Controller/v3/CategoryController.php b/app/Controller/v3/CategoryController.php new file mode 100644 index 0000000..78aeb16 --- /dev/null +++ b/app/Controller/v3/CategoryController.php @@ -0,0 +1,21 @@ +success($this->categoryService->all()); + } +} \ No newline at end of file diff --git a/app/Model/v3/GoodsType.php b/app/Model/v3/GoodsType.php new file mode 100644 index 0000000..17c9e13 --- /dev/null +++ b/app/Model/v3/GoodsType.php @@ -0,0 +1,23 @@ +where(['status' => 1]); + }); + } + +} \ No newline at end of file diff --git a/app/Model/v3/StoreType.php b/app/Model/v3/StoreType.php new file mode 100644 index 0000000..c6761b5 --- /dev/null +++ b/app/Model/v3/StoreType.php @@ -0,0 +1,36 @@ +where(['status' => 1]); + }); + } + + public function goodsTypes() + { + // firstKey是中间表联当前表的列,secondKey是远程表对应中间表的列,localKey是当前表关联中间表的列,secondLocalKey是中间表关联远程表的列 + return $this->hasManyThrough( + GoodsType::class, + TypeCorrelation::class, + 'store_type_id', + 'id', + 'id', + 'goods_type_id' + ); + } + +} \ No newline at end of file diff --git a/app/Model/v3/TypeCorrelation.php b/app/Model/v3/TypeCorrelation.php new file mode 100644 index 0000000..6642513 --- /dev/null +++ b/app/Model/v3/TypeCorrelation.php @@ -0,0 +1,10 @@ +with('goodsTypes') + ->get() + ->toArray(); + } +} \ No newline at end of file diff --git a/app/Service/v3/Implementations/SmsAliSendService.php b/app/Service/v3/Implementations/SmsAliSendService.php index fe86434..a6cd9ac 100644 --- a/app/Service/v3/Implementations/SmsAliSendService.php +++ b/app/Service/v3/Implementations/SmsAliSendService.php @@ -69,7 +69,7 @@ class SmsAliSendService implements SmsSendServiceInterface { // TODO: Implement undo() method. } - + public function doVerifyCode($tel, $code) { $params = ['user_name' => '疯狂的水叔叔', 'market_name' => '验证码', 'money' => $code]; diff --git a/app/Service/v3/Interfaces/CategoryServiceInterface.php b/app/Service/v3/Interfaces/CategoryServiceInterface.php new file mode 100644 index 0000000..7107916 --- /dev/null +++ b/app/Service/v3/Interfaces/CategoryServiceInterface.php @@ -0,0 +1,13 @@ + \App\Service\v3\Implementations\OnlineOnlineOrderService::class, \App\Service\v3\Interfaces\DistributionPriceServiceInterface::class => \App\Service\v3\Implementations\DistributionPriceService::class, \App\Service\v3\Interfaces\AppointmentTimeServiceInterface::class => \App\Service\v3\Implementations\AppointmentTimeService::class, + \App\Service\v3\Interfaces\CategoryServiceInterface::class => \App\Service\v3\Implementations\CategoryService::class, ]; diff --git a/config/routes.php b/config/routes.php index 6b97a13..74eefc1 100644 --- a/config/routes.php +++ b/config/routes.php @@ -81,8 +81,9 @@ Router::addGroup('/v3/', function () { 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'); - Router::post('onlineOrder/confirm', 'App\Controller\v3\OnlineOrderController@do'); + Router::post('onlineOrder/confirm', 'App\Controller\v3\OnlineOrderController@do'); Router::post('distributionPrice/get', 'App\Controller\v3\DistributionPriceController@do'); + Router::post('category/all', 'App\Controller\v3\CategoryController@all'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); // 需要登录的路由