From 83e634446184e526c21c50f2e75688d0150aee55 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 31 Aug 2020 17:05:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=88=9D=E5=A7=8B=E5=8C=96=20mock?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/v3/ErrorCode.php | 7 + app/Controller/v3/ExampleController.php | 11 ++ app/Controller/v3/OnlineOrderController.php | 125 ++++++++++++++++++ app/Controller/v3/OrderController.php | 19 --- .../AppointmentTimeService.php | 29 ++++ .../DistributionPriceService.php | 25 ++++ .../v3/Implementations/ExampleService.php | 13 ++ .../OnlineOnlineOrderService.php | 22 +++ .../v3/Implementations/OrderService.php | 12 -- .../AppointmentTimeServiceInterface.php | 12 ++ .../DistributionPriceServiceInterface.php | 12 ++ .../v3/Interfaces/ExampleServiceInterface.php | 4 + .../OnlineOrderServiceInterface.php | 12 ++ .../v3/Interfaces/OrderServiceInterface.php | 8 -- config/autoload/dependencies.php | 4 +- config/routes.php | 5 +- 16 files changed, 278 insertions(+), 42 deletions(-) create mode 100644 app/Controller/v3/OnlineOrderController.php delete mode 100644 app/Controller/v3/OrderController.php create mode 100644 app/Service/v3/Implementations/AppointmentTimeService.php create mode 100644 app/Service/v3/Implementations/DistributionPriceService.php create mode 100644 app/Service/v3/Implementations/OnlineOnlineOrderService.php delete mode 100644 app/Service/v3/Implementations/OrderService.php create mode 100644 app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php create mode 100644 app/Service/v3/Interfaces/DistributionPriceServiceInterface.php create mode 100644 app/Service/v3/Interfaces/OnlineOrderServiceInterface.php delete mode 100644 app/Service/v3/Interfaces/OrderServiceInterface.php diff --git a/app/Constants/v3/ErrorCode.php b/app/Constants/v3/ErrorCode.php index b49c2ea..a4984d8 100644 --- a/app/Constants/v3/ErrorCode.php +++ b/app/Constants/v3/ErrorCode.php @@ -30,6 +30,7 @@ class ErrorCode extends AbstractConstants /************************************/ /* 用户相关 701-750 */ /************************************/ + /** * 验证码错误或已失效 * @Message("验证码错误或已失效") @@ -48,6 +49,12 @@ class ErrorCode extends AbstractConstants */ const UNBIND_TEL_ERROR = 703; + /** + * 用户未绑定手机号 + * @Message("请绑定手机号") + */ + const NOT_BIND_TEL_ERROR = 704; + /************************************/ /* 定位相关 751-800 */ /************************************/ diff --git a/app/Controller/v3/ExampleController.php b/app/Controller/v3/ExampleController.php index 78821c4..dadfd9e 100644 --- a/app/Controller/v3/ExampleController.php +++ b/app/Controller/v3/ExampleController.php @@ -6,5 +6,16 @@ use App\Controller\BaseController; class ExampleController extends BaseController { + public function do() + { + } + + public function check(){ + + } + + public function undo(){ + + } } \ No newline at end of file diff --git a/app/Controller/v3/OnlineOrderController.php b/app/Controller/v3/OnlineOrderController.php new file mode 100644 index 0000000..adb18d6 --- /dev/null +++ b/app/Controller/v3/OnlineOrderController.php @@ -0,0 +1,125 @@ +request->all(); + //判断用户有没有绑定手机 + $telExists = $this->userBindTel->check($params['user_id']); + if(!$telExists){ + throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR); + } + //获取用户收货地址 + $res['address'] = [ + 'address' => '南宁市良庆区五象海尔·青啤联合广场', + 'area' => 'A栋八单元' , + 'lat' => '22.759950637817383', + 'lng' => '108.3835678100586', + 'sex' => '1', + 'tel' => '15677717734', + 'user_name' => '李小龙', + 'user_id' => '214' + ]; + //返回预约送达时间 数组 + $res['appointment_time'] = [ + '08:30 - 09:00', + '09:00 - 09:30', + '09:30 - 10:00', + '10:00 - 10:30' + ]; + // + $res['store_list'] = [ + '50' => [ + 'store_nmae' => '五金杂货铺', + 'goods_list' => [ + 'id' => 3765, + 'goods_id' => 836, + 'name' => '扳手', + 'num' => 2, + 'price' => '50.00', + 'total' => '100.00' + ] + ], + '99' => [ + 'store_nmae' => '回味手撕鸡J009', + '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' + ] + ] + ], + ]; + //获取用户优惠券 + $res['coupon'] = $this->couponService->getUserAvailableCoupons('',$params['user_id'],'',2,'',''); + //获取配送费 + $res['distribution'] = '5.0'; + //增值服务接口 + $res['value_added_service'] = [ + 'select' => 1, + 'price' => 3.50 + ]; + return $this->success($res); + } + + public function check(){ + + } + + public function undo(){ + + } +} \ No newline at end of file diff --git a/app/Controller/v3/OrderController.php b/app/Controller/v3/OrderController.php deleted file mode 100644 index ecbb5f9..0000000 --- a/app/Controller/v3/OrderController.php +++ /dev/null @@ -1,19 +0,0 @@ -order->detail(); - return $this->success($res); - } -} \ No newline at end of file diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php new file mode 100644 index 0000000..86eb10e --- /dev/null +++ b/app/Service/v3/Implementations/AppointmentTimeService.php @@ -0,0 +1,29 @@ + \App\Service\v3\Implementations\HelperService::class, \App\Service\v3\Interfaces\VerifyCodeServiceInterface::class => \App\Service\v3\Implementations\VerifyCodeService::class, \App\Service\v3\Interfaces\UserBindTelServiceInterface::class => \App\Service\v3\Implementations\UserBindTelService::class, - \App\Service\v3\Interfaces\OrderServiceInterface::class => \App\Service\v3\Implementations\OrderService::class, + \App\Service\v3\Interfaces\OnlineOrderServiceInterface::class => \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, ]; diff --git a/config/routes.php b/config/routes.php index f29d6c5..6b97a13 100644 --- a/config/routes.php +++ b/config/routes.php @@ -79,9 +79,10 @@ Router::addGroup('/wechat/',function () { 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('goods/detail', 'App\Controller\v3\GoodsController@detail'); Router::post('goodsRecommend/getByTabsForAppletIndex', 'App\Controller\v3\GoodsRecommendController@getByTabsForAppletIndex'); - Router::post('Order/detail', 'App\Controller\v3\OrderController@detail'); + Router::post('onlineOrder/confirm', 'App\Controller\v3\OnlineOrderController@do'); + Router::post('distributionPrice/get', 'App\Controller\v3\DistributionPriceController@do'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); // 需要登录的路由 From 899803590ddc4f1af4a09e2c5c4c3d7563fa1ee9 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 31 Aug 2020 17:21:13 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E6=8E=A5=E5=8F=A3=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v3/UpdateShopCartController.php | 21 +++++++++++++++++ ...rderService.php => OnlineOrderService.php} | 2 +- .../Implementations/UpdateShopCartService.php | 23 +++++++++++++++++++ .../UpdateShopCartServiceInterface.php | 12 ++++++++++ config/autoload/dependencies.php | 2 +- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 app/Controller/v3/UpdateShopCartController.php rename app/Service/v3/Implementations/{OnlineOnlineOrderService.php => OnlineOrderService.php} (83%) create mode 100644 app/Service/v3/Implementations/UpdateShopCartService.php create mode 100644 app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php diff --git a/app/Controller/v3/UpdateShopCartController.php b/app/Controller/v3/UpdateShopCartController.php new file mode 100644 index 0000000..292b34f --- /dev/null +++ b/app/Controller/v3/UpdateShopCartController.php @@ -0,0 +1,21 @@ + \App\Service\v3\Implementations\HelperService::class, \App\Service\v3\Interfaces\VerifyCodeServiceInterface::class => \App\Service\v3\Implementations\VerifyCodeService::class, \App\Service\v3\Interfaces\UserBindTelServiceInterface::class => \App\Service\v3\Implementations\UserBindTelService::class, - \App\Service\v3\Interfaces\OnlineOrderServiceInterface::class => \App\Service\v3\Implementations\OnlineOnlineOrderService::class, + \App\Service\v3\Interfaces\OnlineOrderServiceInterface::class => \App\Service\v3\Implementations\OnlineOrderService::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, From 77fb4603b20c331494a7c56756b82814a37e9b1e Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 31 Aug 2020 18:18:41 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=20mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/v3/ErrorCode.php | 21 +++++++++++++++++++ .../v3/UpdateShopCartController.php | 10 ++++++++- .../Implementations/UpdateShopCartService.php | 19 +++++++++++++++-- .../UpdateShopCartServiceInterface.php | 2 +- config/autoload/dependencies.php | 1 + config/routes.php | 1 + 6 files changed, 50 insertions(+), 4 deletions(-) diff --git a/app/Constants/v3/ErrorCode.php b/app/Constants/v3/ErrorCode.php index a4984d8..87d03d1 100644 --- a/app/Constants/v3/ErrorCode.php +++ b/app/Constants/v3/ErrorCode.php @@ -79,4 +79,25 @@ class ErrorCode extends AbstractConstants * @Message("短信发送失败") */ const SMS_SEND_FAILURE = 1003; + + /************************************/ + /* 商品相关 1101-1200 */ + /************************************/ + /** + * 库存不足 + * @Message("库存不足") + */ + const GOODS_INVENTORY_ERROR = 1101; + + /** + * 超过商品购买数量限制 + * @Message("超过商品购买数量限制") + */ + const PURCHASE_LIMIT_ERROR = 1102; + + /** + * 当前特价商品已被购买过 + * @Message("当前特价商品已被购买过") + */ + const SPERCIAL_OFFER_GOODS_ERROR = 1103; } \ No newline at end of file diff --git a/app/Controller/v3/UpdateShopCartController.php b/app/Controller/v3/UpdateShopCartController.php index 292b34f..38820ef 100644 --- a/app/Controller/v3/UpdateShopCartController.php +++ b/app/Controller/v3/UpdateShopCartController.php @@ -3,12 +3,20 @@ namespace App\Controller\v3; use App\Controller\BaseController; +use Hyperf\Di\Annotation\Inject; +use App\Service\v3\Interfaces\UpdateShopCartServiceInterface; class UpdateShopCartController extends BaseController { + /** + * @Inject + * @var UpdateShopCartServiceInterface + */ + protected $updateShopCarService; public function do() { - + $res = $this->updateShopCarService->do($this->request->all()); + return $this->success($res); } public function check(){ diff --git a/app/Service/v3/Implementations/UpdateShopCartService.php b/app/Service/v3/Implementations/UpdateShopCartService.php index 90efa68..01d28c1 100644 --- a/app/Service/v3/Implementations/UpdateShopCartService.php +++ b/app/Service/v3/Implementations/UpdateShopCartService.php @@ -2,13 +2,28 @@ namespace App\Service\v3\Implementations; +use App\Constants\v3\ErrorCode; +use App\Exception\ErrorCodeException; use App\Service\v3\Interfaces\UpdateShopCartServiceInterface; class UpdateShopCartService implements UpdateShopCartServiceInterface { - public function do() + public function do($params) { - // TODO: Implement check() method. + switch ($params['goods_id']) + { + case 1000: + throw new ErrorCodeException(ErrorCode::GOODS_INVENTORY_ERROR); + break; + case 2000: + throw new ErrorCodeException(ErrorCode::PURCHASE_LIMIT_ERROR); + break; + case 3000: + throw new ErrorCodeException(ErrorCode::SPERCIAL_OFFER_GOODS_ERROR); + break; + default: + return true; + } } public function check() diff --git a/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php b/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php index fe46b6d..e6fe034 100644 --- a/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php +++ b/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php @@ -4,7 +4,7 @@ namespace App\Service\v3\Interfaces; interface UpdateShopCartServiceInterface { - public function do(); + public function do($params); public function check(); diff --git a/config/autoload/dependencies.php b/config/autoload/dependencies.php index b17471f..5e87da1 100644 --- a/config/autoload/dependencies.php +++ b/config/autoload/dependencies.php @@ -44,4 +44,5 @@ return [ \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, + \App\Service\v3\Interfaces\UpdateShopCartServiceInterface::class => \App\Service\v3\Implementations\UpdateShopCartService::class, ]; diff --git a/config/routes.php b/config/routes.php index 74eefc1..8cf4b07 100644 --- a/config/routes.php +++ b/config/routes.php @@ -84,6 +84,7 @@ Router::addGroup('/v3/', function () { 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'); + Router::post('UpdateShopCart/update', 'App\Controller\v3\UpdateShopCartController@do'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); // 需要登录的路由 From b7405d550934e252573fbe03c98e5219cb4a6298 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 31 Aug 2020 20:38:26 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83=20?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/v3/ExampleController.php | 6 +- app/Controller/v3/GoodsController.php | 3 +- app/Controller/v3/OnlineOrderController.php | 8 +- app/Controller/v3/ShopCartController.php | 36 ++++++ .../v3/UpdateShopCartController.php | 10 +- .../AppointmentTimeService.php | 2 +- .../v3/Implementations/OnlineOrderService.php | 2 +- .../v3/Implementations/ShopCartService.php | 111 ++++++++++++++++++ .../Implementations/UpdateShopCartService.php | 6 +- .../AppointmentTimeServiceInterface.php | 2 +- .../OnlineOrderServiceInterface.php | 2 +- .../Interfaces/ShopCartServiceInterface.php | 12 ++ .../UpdateShopCartServiceInterface.php | 4 +- config/autoload/dependencies.php | 1 + config/routes.php | 7 +- 15 files changed, 190 insertions(+), 22 deletions(-) create mode 100644 app/Controller/v3/ShopCartController.php create mode 100644 app/Service/v3/Implementations/ShopCartService.php create mode 100644 app/Service/v3/Interfaces/ShopCartServiceInterface.php 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]]); // 需要登录的路由 From e7a3600be17a798aa4851d170b6c0fdc63c1ed46 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 31 Aug 2020 20:43:31 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/v3/UpdateShopCartController.php | 3 ++- app/Service/v3/Implementations/UpdateShopCartService.php | 2 +- app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Controller/v3/UpdateShopCartController.php b/app/Controller/v3/UpdateShopCartController.php index 79ccaef..71414b6 100644 --- a/app/Controller/v3/UpdateShopCartController.php +++ b/app/Controller/v3/UpdateShopCartController.php @@ -26,6 +26,7 @@ class UpdateShopCartController extends BaseController public function delete() { - + $res = $this->updateShopCarService->delete($this->request->all()); + return $this->success($res); } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/UpdateShopCartService.php b/app/Service/v3/Implementations/UpdateShopCartService.php index 1dc996e..0cf3977 100644 --- a/app/Service/v3/Implementations/UpdateShopCartService.php +++ b/app/Service/v3/Implementations/UpdateShopCartService.php @@ -31,7 +31,7 @@ class UpdateShopCartService implements UpdateShopCartServiceInterface // TODO: Implement check() method. } - public function delete() + public function delete($params) { return true; } diff --git a/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php b/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php index 5da5822..8edcbbe 100644 --- a/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php +++ b/app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php @@ -8,5 +8,5 @@ interface UpdateShopCartServiceInterface public function check(); - public function delete(); + public function delete($params); } \ No newline at end of file