diff --git a/app/Controller/v3/ExampleController.php b/app/Controller/v3/ExampleController.php index dadfd9e..3733bc0 100644 --- a/app/Controller/v3/ExampleController.php +++ b/app/Controller/v3/ExampleController.php @@ -11,11 +11,13 @@ class ExampleController extends BaseController } - public function check(){ + public function check() + { } - public function undo(){ + public function undo() + { } } \ No newline at end of file diff --git a/app/Controller/v3/GoodsController.php b/app/Controller/v3/GoodsController.php index 30b344a..0af2d77 100644 --- a/app/Controller/v3/GoodsController.php +++ b/app/Controller/v3/GoodsController.php @@ -12,7 +12,8 @@ class GoodsController extends BaseController * @var GoodsServiceInterface */ protected $goods; - public function detail(){ + public function detail() + { $res = $this->goods->detail(); return $this->success($res); } diff --git a/app/Controller/v3/OnlineOrderController.php b/app/Controller/v3/OnlineOrderController.php index adb18d6..1348581 100644 --- a/app/Controller/v3/OnlineOrderController.php +++ b/app/Controller/v3/OnlineOrderController.php @@ -41,7 +41,7 @@ class OnlineOrderController extends BaseController * 配送费独立接口 可根据距离动态计算费用 * 增值服务接口 * */ - public function do() + public function detail() { $params = $this->request->all(); //判断用户有没有绑定手机 @@ -115,11 +115,13 @@ class OnlineOrderController extends BaseController return $this->success($res); } - public function check(){ + public function check() + { } - public function undo(){ + public function undo() + { } } \ No newline at end of file diff --git a/app/Controller/v3/ShopCartController.php b/app/Controller/v3/ShopCartController.php new file mode 100644 index 0000000..b180dbb --- /dev/null +++ b/app/Controller/v3/ShopCartController.php @@ -0,0 +1,36 @@ +shopCart->detail(); + //获取购物车失效商品信息 + $res['store_invalid_goood_lists'] = $this->shopCart->undo(); + //计算购物车价格 + $res['total'] = '820.00'; + return $this->success($res); + } + + public function check() + { + + } + + public function undo() + { + + } +} \ No newline at end of file diff --git a/app/Controller/v3/UpdateShopCartController.php b/app/Controller/v3/UpdateShopCartController.php index 38820ef..79ccaef 100644 --- a/app/Controller/v3/UpdateShopCartController.php +++ b/app/Controller/v3/UpdateShopCartController.php @@ -13,17 +13,19 @@ class UpdateShopCartController extends BaseController * @var UpdateShopCartServiceInterface */ protected $updateShopCarService; - public function do() + public function update() { - $res = $this->updateShopCarService->do($this->request->all()); + $res = $this->updateShopCarService->update($this->request->all()); return $this->success($res); } - public function check(){ + public function check() + { } - public function undo(){ + public function delete() + { } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php index 86eb10e..b69d328 100644 --- a/app/Service/v3/Implementations/AppointmentTimeService.php +++ b/app/Service/v3/Implementations/AppointmentTimeService.php @@ -7,7 +7,7 @@ use phpDocumentor\Reflection\Types\Object_; class AppointmentTimeService implements AppointmentTimeServiceInterface { - public function do() + public function get() { return [ '08:30 - 09:00', diff --git a/app/Service/v3/Implementations/OnlineOrderService.php b/app/Service/v3/Implementations/OnlineOrderService.php index b3e5324..a18fd94 100644 --- a/app/Service/v3/Implementations/OnlineOrderService.php +++ b/app/Service/v3/Implementations/OnlineOrderService.php @@ -6,7 +6,7 @@ use Hyperf\Di\Annotation\Inject; use App\Service\v3\Interfaces\OnlineOrderServiceInterface; class OnlineOrderService implements OnlineOrderServiceInterface { - public function do($params){ + public function detail($params){ return []; } diff --git a/app/Service/v3/Implementations/ShopCartService.php b/app/Service/v3/Implementations/ShopCartService.php new file mode 100644 index 0000000..8b9c9b4 --- /dev/null +++ b/app/Service/v3/Implementations/ShopCartService.php @@ -0,0 +1,111 @@ + '五金杂货铺', + 'price' => '100.00', + 'note' => '多放辣椒', + 'store_id' => 66, + 'goods_list' => + [ + [ + 'id' => 3971, + 'goods_id' => 1301, + 'name' => '半边手撕鸡', + 'num' => 4, + 'price' => '90.00', + 'total' => '360.00' + ] + ] + ], + [ + 'store_nmae' => '回味手撕鸡J009', + 'note' => '手撕鸡加辣', + 'store_price' => '720.00', + 'store_id' => 123, + 'goods_list' => + [ + [ + 'id' => 3971, + 'goods_id' => 1301, + 'name' => '半边手撕鸡', + 'num' => 4, + 'price' => '90.00', + 'total' => '360.00' + ], + [ + 'id' => 3971, + 'goods_id' => 1301, + 'name' => '半边手撕鸡', + 'num' => 4, + 'price' => '90.00', + 'total' => '360.00' + ] + ] + ], + ]; + return $res; + } + + public function check() + { + // TODO: Implement check() method. + } + + public function undo() + { + $res = [ + [ + 'store_nmae' => '五金杂货铺', + 'price' => '100.00', + 'note' => '多放辣椒', + 'store_id' => 66, + 'goods_list' => + [ + [ + 'id' => 3971, + 'goods_id' => 1301, + 'name' => '半边手撕鸡', + 'num' => 4, + 'price' => '90.00', + 'total' => '360.00' + ] + ] + ], + [ + 'store_nmae' => '回味手撕鸡J009', + 'note' => '手撕鸡加辣', + 'store_price' => '720.00', + 'store_id' => 123, + 'goods_list' => + [ + [ + 'id' => 3971, + 'goods_id' => 1301, + 'name' => '半边手撕鸡', + 'num' => 4, + 'price' => '90.00', + 'total' => '360.00' + ], + [ + 'id' => 3971, + 'goods_id' => 1301, + 'name' => '半边手撕鸡', + 'num' => 4, + 'price' => '90.00', + 'total' => '360.00' + ] + ] + ], + ]; + return $res; + } +} \ No newline at end of file diff --git a/app/Service/v3/Implementations/UpdateShopCartService.php b/app/Service/v3/Implementations/UpdateShopCartService.php index 01d28c1..1dc996e 100644 --- a/app/Service/v3/Implementations/UpdateShopCartService.php +++ b/app/Service/v3/Implementations/UpdateShopCartService.php @@ -8,7 +8,7 @@ use App\Service\v3\Interfaces\UpdateShopCartServiceInterface; class UpdateShopCartService implements UpdateShopCartServiceInterface { - public function do($params) + public function update($params) { switch ($params['goods_id']) { @@ -31,8 +31,8 @@ class UpdateShopCartService implements UpdateShopCartServiceInterface // TODO: Implement check() method. } - public function undo() + public function delete() { - // TODO: Implement undo() method. + return true; } } \ No newline at end of file diff --git a/app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php b/app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php index 63ae2d4..db78e60 100644 --- a/app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php +++ b/app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php @@ -4,7 +4,7 @@ namespace App\Service\v3\Interfaces; interface AppointmentTimeServiceInterface { - public function do(); + public function get(); public function check(); diff --git a/app/Service/v3/Interfaces/OnlineOrderServiceInterface.php b/app/Service/v3/Interfaces/OnlineOrderServiceInterface.php index 4efb2e2..5da1e7f 100644 --- a/app/Service/v3/Interfaces/OnlineOrderServiceInterface.php +++ b/app/Service/v3/Interfaces/OnlineOrderServiceInterface.php @@ -4,7 +4,7 @@ namespace App\Service\v3\Interfaces; interface OnlineOrderServiceInterface { - public function do($params); + public function detail($params); public function check(); diff --git a/app/Service/v3/Interfaces/ShopCartServiceInterface.php b/app/Service/v3/Interfaces/ShopCartServiceInterface.php new file mode 100644 index 0000000..550808e --- /dev/null +++ b/app/Service/v3/Interfaces/ShopCartServiceInterface.php @@ -0,0 +1,12 @@ + \App\Service\v3\Implementations\AppointmentTimeService::class, \App\Service\v3\Interfaces\CategoryServiceInterface::class => \App\Service\v3\Implementations\CategoryService::class, \App\Service\v3\Interfaces\UpdateShopCartServiceInterface::class => \App\Service\v3\Implementations\UpdateShopCartService::class, + \App\Service\v3\Interfaces\ShopCartServiceInterface::class => \App\Service\v3\Implementations\ShopCartService::class, ]; diff --git a/config/routes.php b/config/routes.php index 8cf4b07..0d0f9e0 100644 --- a/config/routes.php +++ b/config/routes.php @@ -81,10 +81,11 @@ 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('distributionPrice/get', 'App\Controller\v3\DistributionPriceController@do'); + Router::post('onlineOrder/detail', 'App\Controller\v3\OnlineOrderController@detail'); + Router::post('distributionPrice/get', 'App\Controller\v3\DistributionPriceController@get'); Router::post('category/all', 'App\Controller\v3\CategoryController@all'); - Router::post('UpdateShopCart/update', 'App\Controller\v3\UpdateShopCartController@do'); + Router::post('UpdateShopCart/update', 'App\Controller\v3\UpdateShopCartController@update'); + Router::post('ShopCart/detail', 'App\Controller\v3\ShopCartController@detail'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); // 需要登录的路由