From 60305d59387fb50b354afb3bbaec1004df239748 Mon Sep 17 00:00:00 2001
From: Lemon <15040771@qq.com>
Date: Wed, 2 Sep 2020 10:03:11 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=20?=
=?UTF-8?q?=E8=A7=84=E6=A0=BC=E8=BD=AC=E6=95=B0=E7=BB=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Model/v3/Goods.php | 2 +-
.../v3/Implementations/GoodsService.php | 43 +------------------
2 files changed, 3 insertions(+), 42 deletions(-)
diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php
index 4e89989..c94b0c3 100644
--- a/app/Model/v3/Goods.php
+++ b/app/Model/v3/Goods.php
@@ -74,7 +74,7 @@ class Goods extends Model
public function getCartNumAttribute()
{
- return (integer)$this->shopCartService->check($this->id);
+ return (integer)$this->shopCartService->getGoodsNum($this->id);
}
public function store()
diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php
index 6551b89..50802f3 100644
--- a/app/Service/v3/Implementations/GoodsService.php
+++ b/app/Service/v3/Implementations/GoodsService.php
@@ -4,52 +4,13 @@ namespace App\Service\v3\Implementations;
use App\Service\v3\Interfaces\GoodsServiceInterface;
use Hyperf\DbConnection\Db;
+use App\Model\v3\Goods;
class GoodsService implements GoodsServiceInterface
{
public function detail()
{
- /*
- * 返回商品 封面图
- * * 返回商品 轮播图
- * 返回商品信息 包括名称 规格 tag等
- * 返回店铺信息
- * 返回商品规格信息
- * 猜你喜欢
- * 限时抢购
- * 为你推荐
- * */
- // $goods['detail'] = [
- // "id" => 170,
- // "market_id" => 2,
- // "store_id" => 39,
- // "goods_type_id" => 39,
- // "on_sale" => 1,
- // "sort" => 0,
- // "is_infinite" => 2,
- // "start_num" => 0,
- // "restrict_num" => 0,
- // "inventory" => 1000,
- // "name" => "冬菜",
- // "cover_img" => "https => //store.lanzu.vip/attachment/images/2/2020/06/en2nQYncqN4f44qnA7CwnNOG2WqQ2q.jpg",
- // "price" => "2.50",
- // "original_price" => "2.50",
- // "vip_price" => "0.00",
- // "sales" => 0,
- // "good_unit" => "",
- // "tags" => null,
- // "details_imgs" => null,
- // "spec" => null,
- // "content" => "",
- // "details" => "
//store.lanzu.vip/attachment/images/2/2020/06/J1Z5N818NqCt581LF1V1Tqd88151fV.jpg\" _src=\"https => //store.lanzu.vip/attachment/images/2/2020/06/J1Z5N818NqCt581LF1V1Tqd88151fV.jpg\" alt=\"冬菜.jpg\" style=\"max-width => 100%\">
",
- // "created_at" => null,
- // "updated_at" => 1598769782,
- // "deleted_at" => null,
- // '净含量' => '约500G',
- // '保存条件' => '常温',
- // '保质期' => '10天'
- // ];
- $goods['detail'] = Db::table('lanzu_goods')->where('id',35)->get();
+ $goods['detail'] = Goods::query()->where('id',35)->get();
$goods['banner'] = $this->getBanner();
return $goods;
}
From e41801d04f2f936f36af2cad1b5c167574a9eecf Mon Sep 17 00:00:00 2001
From: Lemon <15040771@qq.com>
Date: Wed, 2 Sep 2020 20:18:20 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83?=
=?UTF-8?q?=E5=8C=96=20=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Constants/v3/SsdbKeys.php | 15 ++++++
app/Controller/v3/CollectStoreController.php | 31 +++++++++++
app/Controller/v3/GoodsController.php | 5 +-
...ntroller.php => OrderOnlineController.php} | 23 ++------
app/Controller/v3/ShopCartController.php | 14 +----
.../v3/ShopCartUpdateController.php | 27 ++++++++++
.../v3/UpdateShopCartController.php | 32 -----------
app/Model/v3/Goods.php | 2 +-
.../AppointmentTimeService.php | 3 +-
.../Implementations/CollectStoreService.php | 54 +++++++++++++++++++
.../v3/Implementations/GoodsService.php | 34 +++++-------
...rderService.php => OrderOnlineService.php} | 6 +--
.../v3/Implementations/ShopCartService.php | 9 +++-
...tService.php => ShopCartUpdateService.php} | 8 +--
.../AppointmentTimeServiceInterface.php | 2 +-
.../CollectStoreServiceInterface.php | 16 ++++++
.../v3/Interfaces/GoodsServiceInterface.php | 2 +-
...ce.php => OrderOnlineServiceInterface.php} | 4 +-
.../Interfaces/ShopCartServiceInterface.php | 6 ++-
.../ShopCartUpdateServiceInterface.php | 12 +++++
.../UpdateShopCartServiceInterface.php | 12 -----
config/autoload/dependencies.php | 5 +-
config/routes.php | 15 +++---
23 files changed, 214 insertions(+), 123 deletions(-)
create mode 100644 app/Controller/v3/CollectStoreController.php
rename app/Controller/v3/{OnlineOrderController.php => OrderOnlineController.php} (90%)
create mode 100644 app/Controller/v3/ShopCartUpdateController.php
delete mode 100644 app/Controller/v3/UpdateShopCartController.php
create mode 100644 app/Service/v3/Implementations/CollectStoreService.php
rename app/Service/v3/Implementations/{OnlineOrderService.php => OrderOnlineService.php} (62%)
rename app/Service/v3/Implementations/{UpdateShopCartService.php => ShopCartUpdateService.php} (78%)
create mode 100644 app/Service/v3/Interfaces/CollectStoreServiceInterface.php
rename app/Service/v3/Interfaces/{OnlineOrderServiceInterface.php => OrderOnlineServiceInterface.php} (58%)
create mode 100644 app/Service/v3/Interfaces/ShopCartUpdateServiceInterface.php
delete mode 100644 app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php
diff --git a/app/Constants/v3/SsdbKeys.php b/app/Constants/v3/SsdbKeys.php
index 7a0a693..985c197 100644
--- a/app/Constants/v3/SsdbKeys.php
+++ b/app/Constants/v3/SsdbKeys.php
@@ -19,4 +19,19 @@ class SsdbKeys extends AbstractConstants
* @Message("商品月销")
*/
const GOODS_MONTH_SALES = 'goods_m_sales_';
+
+ /**
+ * @Message("收藏店铺")
+ */
+ const COLLECT_STORE_USER = 'collect_store_user_';
+
+ /**
+ * @Message("用户收藏店铺数量")
+ */
+ const COLLECT_STORE_NUM_USER = 'collect_store_num_user_';
+
+ /**
+ * @Message("店铺被收藏数量")
+ */
+ const COLLECT_NUM_STORE = 'collect_num_store_';
}
\ No newline at end of file
diff --git a/app/Controller/v3/CollectStoreController.php b/app/Controller/v3/CollectStoreController.php
new file mode 100644
index 0000000..6f26b1e
--- /dev/null
+++ b/app/Controller/v3/CollectStoreController.php
@@ -0,0 +1,31 @@
+request->all();
+ //判断是否已收藏店铺
+ $exists = $this->collectStoreService->check($params['user_id'],$params['store_id']);
+ //如果已收藏则删除
+ if($exists){
+ $res = $this->collectStoreService->undo($params['user_id'],$params['store_id']);
+ }else{
+ $res = $this->collectStoreService->do($params['user_id'],$params['store_id']);
+ }
+ return $this->success($res);
+ }
+}
\ No newline at end of file
diff --git a/app/Controller/v3/GoodsController.php b/app/Controller/v3/GoodsController.php
index 0af2d77..edd4984 100644
--- a/app/Controller/v3/GoodsController.php
+++ b/app/Controller/v3/GoodsController.php
@@ -11,10 +11,11 @@ class GoodsController extends BaseController
* @Inject
* @var GoodsServiceInterface
*/
- protected $goods;
+ protected $goodsService;
public function detail()
{
- $res = $this->goods->detail();
+ $res['detail'] = $this->goodsService->do();
+ $res['banner'] = $this->goodsService->getBanner();
return $this->success($res);
}
}
\ No newline at end of file
diff --git a/app/Controller/v3/OnlineOrderController.php b/app/Controller/v3/OrderOnlineController.php
similarity index 90%
rename from app/Controller/v3/OnlineOrderController.php
rename to app/Controller/v3/OrderOnlineController.php
index 3ded7f3..5f23386 100644
--- a/app/Controller/v3/OnlineOrderController.php
+++ b/app/Controller/v3/OrderOnlineController.php
@@ -7,10 +7,10 @@ use App\Controller\BaseController;
use App\Exception\ErrorCodeException;
use App\Service\CouponServiceInterface;
use Hyperf\Di\Annotation\Inject;
-use App\Service\v3\Interfaces\OnlineOrderServiceInterface;
+use App\Service\v3\Interfaces\OrderOnlineServiceInterface;
use App\Service\v3\Interfaces\UserBindTelServiceInterface;
use App\Service\v3\Interfaces\AppointmentTimeServiceInterface;
-class OnlineOrderController extends BaseController
+class OrderOnlineController extends BaseController
{
/**
* @Inject
@@ -26,7 +26,7 @@ class OnlineOrderController extends BaseController
* @Inject
* @var AppointmentTimeServiceInterface
*/
- protected $appointmentTime;
+ protected $appointmentTimeService;
/*
* 如果没有绑手机号去绑定页面
* 收货地址接口
@@ -56,12 +56,7 @@ class OnlineOrderController extends BaseController
'user_id' => '214'
];
//返回预约送达时间 数组
- $res['appointment_time'] = [
- '08:30 - 09:00',
- '09:00 - 09:30',
- '09:30 - 10:00',
- '10:00 - 10:30'
- ];
+ $res['appointment_time'] = $this->appointmentTimeService->do();
//
$res['store_list'] = [
[
@@ -118,14 +113,4 @@ class OnlineOrderController extends BaseController
];
return $this->success($res);
}
-
- public function check()
- {
-
- }
-
- public function undo()
- {
-
- }
}
\ No newline at end of file
diff --git a/app/Controller/v3/ShopCartController.php b/app/Controller/v3/ShopCartController.php
index 63d5ee6..9a6da33 100644
--- a/app/Controller/v3/ShopCartController.php
+++ b/app/Controller/v3/ShopCartController.php
@@ -16,21 +16,11 @@ class ShopCartController extends BaseController
public function detail()
{
//获取购物车商品信息
- $res['store_goood_lists'] = $this->shopCartService->detail();
+ $res['store_lists'] = $this->shopCartService->do();
//获取购物车失效商品信息
- $res['store_invalid_goood_lists'] = $this->shopCartService->undo();
+ $res['store_lists_invalid'] = $this->shopCartService->undo();
//计算购物车价格
$res['total'] = '820.00';
return $this->success($res);
}
-
- public function getGoodsNum()
- {
-
- }
-
- public function undo()
- {
-
- }
}
\ No newline at end of file
diff --git a/app/Controller/v3/ShopCartUpdateController.php b/app/Controller/v3/ShopCartUpdateController.php
new file mode 100644
index 0000000..3955952
--- /dev/null
+++ b/app/Controller/v3/ShopCartUpdateController.php
@@ -0,0 +1,27 @@
+shopCarServiceUpdate->do($this->request->all());
+ return $this->success($res);
+ }
+
+ public function delete()
+ {
+ $res = $this->shopCarServiceUpdate->undo($this->request->all());
+ return $this->success($res);
+ }
+}
\ No newline at end of file
diff --git a/app/Controller/v3/UpdateShopCartController.php b/app/Controller/v3/UpdateShopCartController.php
deleted file mode 100644
index 71414b6..0000000
--- a/app/Controller/v3/UpdateShopCartController.php
+++ /dev/null
@@ -1,32 +0,0 @@
-updateShopCarService->update($this->request->all());
- return $this->success($res);
- }
-
- public function check()
- {
-
- }
-
- public function delete()
- {
- $res = $this->updateShopCarService->delete($this->request->all());
- return $this->success($res);
- }
-}
\ No newline at end of file
diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php
index c94b0c3..4e89989 100644
--- a/app/Model/v3/Goods.php
+++ b/app/Model/v3/Goods.php
@@ -74,7 +74,7 @@ class Goods extends Model
public function getCartNumAttribute()
{
- return (integer)$this->shopCartService->getGoodsNum($this->id);
+ return (integer)$this->shopCartService->check($this->id);
}
public function store()
diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php
index b69d328..510af38 100644
--- a/app/Service/v3/Implementations/AppointmentTimeService.php
+++ b/app/Service/v3/Implementations/AppointmentTimeService.php
@@ -7,9 +7,10 @@ use phpDocumentor\Reflection\Types\Object_;
class AppointmentTimeService implements AppointmentTimeServiceInterface
{
- public function get()
+ public function do()
{
return [
+ '尽快送达',
'08:30 - 09:00',
'09:00 - 09:30',
'09:30 - 10:00',
diff --git a/app/Service/v3/Implementations/CollectStoreService.php b/app/Service/v3/Implementations/CollectStoreService.php
new file mode 100644
index 0000000..d53b650
--- /dev/null
+++ b/app/Service/v3/Implementations/CollectStoreService.php
@@ -0,0 +1,54 @@
+get(SSDBTask::class);
+ //收藏店铺
+ $userSet = $ssdb->exec('set', SsdbKeys::COLLECT_STORE_USER.$userId.'_store_'.$storeId,time());
+ //用户收藏数量自增
+ $userIncr = $ssdb->exec('incr', SsdbKeys::COLLECT_STORE_NUM_USER.$userId,1);
+ //店铺被收藏数自增
+ $storeIncr = $ssdb->exec('incr', SsdbKeys::COLLECT_NUM_STORE.$storeId,1);
+ return $userSet && $userIncr && $storeIncr;
+ }
+
+ public function check($userId,$storeId)
+ {
+ $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
+ return $ssdb->exec('exists', SsdbKeys::COLLECT_STORE_USER.$userId.'_store_'.$storeId);
+ }
+
+ public function undo($userId,$storeId)
+ {
+ $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
+ //取消收藏店铺
+ $userDel = $ssdb->exec('del', SsdbKeys::COLLECT_STORE_USER.$userId.'_store_'.$storeId,time());
+ //用户收藏数量自减
+ $userIncr = $ssdb->exec('incr', SsdbKeys::COLLECT_STORE_NUM_USER.$userId,'-1');
+ //店铺被收藏数自减
+ $storeIncr = $ssdb->exec('incr', SsdbKeys::COLLECT_NUM_STORE.$userId,'-1');
+ return $userDel && $userIncr && $storeIncr;
+ }
+
+ public function countByUser($userId)
+ {
+ $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
+ $num = $ssdb->exec('get',SsdbKeys::COLLECT_STORE_NUM_USER.$userId);
+ return $num;
+ }
+
+ public function countByStore($storeId)
+ {
+ $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
+ $num = $ssdb->exec('get',SsdbKeys::COLLECT_NUM_STORE.$storeId);
+ return $num;
+ }
+}
\ No newline at end of file
diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php
index 50802f3..c59830a 100644
--- a/app/Service/v3/Implementations/GoodsService.php
+++ b/app/Service/v3/Implementations/GoodsService.php
@@ -8,11 +8,21 @@ use App\Model\v3\Goods;
class GoodsService implements GoodsServiceInterface
{
- public function detail()
+ public function do()
+ {
+ $res = Goods::query()->where('id',35)->get();
+ return $res;
+ }
+
+
+ public function check($goodsId)
+ {
+ // TODO: Implement check() method.
+ }
+
+ public function undo()
{
- $goods['detail'] = Goods::query()->where('id',35)->get();
- $goods['banner'] = $this->getBanner();
- return $goods;
+ // TODO: Implement undo() method.
}
public function getBanner()
@@ -31,20 +41,4 @@ class GoodsService implements GoodsServiceInterface
];
return $banner;
}
-
-
- public function do()
- {
- // TODO: Implement do() method.
- }
-
- public function check($goodsId)
- {
- // TODO: Implement check() method.
- }
-
- public function undo()
- {
- // TODO: Implement undo() method.
- }
}
\ No newline at end of file
diff --git a/app/Service/v3/Implementations/OnlineOrderService.php b/app/Service/v3/Implementations/OrderOnlineService.php
similarity index 62%
rename from app/Service/v3/Implementations/OnlineOrderService.php
rename to app/Service/v3/Implementations/OrderOnlineService.php
index a18fd94..a6f1a19 100644
--- a/app/Service/v3/Implementations/OnlineOrderService.php
+++ b/app/Service/v3/Implementations/OrderOnlineService.php
@@ -3,10 +3,10 @@
namespace App\Service\v3\Implementations;
use Hyperf\Di\Annotation\Inject;
-use App\Service\v3\Interfaces\OnlineOrderServiceInterface;
-class OnlineOrderService implements OnlineOrderServiceInterface
+use App\Service\v3\Interfaces\OrderOnlineServiceInterface;
+class OrderOnlineService implements OrderOnlineServiceInterface
{
- public function detail($params){
+ public function do($params){
return [];
}
diff --git a/app/Service/v3/Implementations/ShopCartService.php b/app/Service/v3/Implementations/ShopCartService.php
index 4f1a451..0f0ba09 100644
--- a/app/Service/v3/Implementations/ShopCartService.php
+++ b/app/Service/v3/Implementations/ShopCartService.php
@@ -6,7 +6,7 @@ use App\Service\v3\Interfaces\ShopCartServiceInterface;
class ShopCartService implements ShopCartServiceInterface
{
- public function detail()
+ public function do()
{
$res = [
[
@@ -55,7 +55,7 @@ class ShopCartService implements ShopCartServiceInterface
return $res;
}
- public function getGoodsNum()
+ public function check()
{
return mt_rand(0,6);
}
@@ -108,4 +108,9 @@ class ShopCartService implements ShopCartServiceInterface
];
return $res;
}
+
+ public function countGoods()
+ {
+ return mt_rand(1,100);
+ }
}
\ No newline at end of file
diff --git a/app/Service/v3/Implementations/UpdateShopCartService.php b/app/Service/v3/Implementations/ShopCartUpdateService.php
similarity index 78%
rename from app/Service/v3/Implementations/UpdateShopCartService.php
rename to app/Service/v3/Implementations/ShopCartUpdateService.php
index 0cf3977..0400c47 100644
--- a/app/Service/v3/Implementations/UpdateShopCartService.php
+++ b/app/Service/v3/Implementations/ShopCartUpdateService.php
@@ -4,11 +4,11 @@ namespace App\Service\v3\Implementations;
use App\Constants\v3\ErrorCode;
use App\Exception\ErrorCodeException;
-use App\Service\v3\Interfaces\UpdateShopCartServiceInterface;
+use App\Service\v3\Interfaces\ShopCartUpdateServiceInterface;
-class UpdateShopCartService implements UpdateShopCartServiceInterface
+class ShopCartUpdateService implements ShopCartUpdateServiceInterface
{
- public function update($params)
+ public function do($params)
{
switch ($params['goods_id'])
{
@@ -31,7 +31,7 @@ class UpdateShopCartService implements UpdateShopCartServiceInterface
// TODO: Implement check() method.
}
- public function delete($params)
+ public function undo($params)
{
return true;
}
diff --git a/app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php b/app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php
index db78e60..63ae2d4 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 get();
+ public function do();
public function check();
diff --git a/app/Service/v3/Interfaces/CollectStoreServiceInterface.php b/app/Service/v3/Interfaces/CollectStoreServiceInterface.php
new file mode 100644
index 0000000..36917a2
--- /dev/null
+++ b/app/Service/v3/Interfaces/CollectStoreServiceInterface.php
@@ -0,0 +1,16 @@
+ \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\OnlineOrderService::class,
+ \App\Service\v3\Interfaces\OrderOnlineServiceInterface::class => \App\Service\v3\Implementations\OrderOnlineService::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,
- \App\Service\v3\Interfaces\UpdateShopCartServiceInterface::class => \App\Service\v3\Implementations\UpdateShopCartService::class,
+ \App\Service\v3\Interfaces\ShopCartUpdateServiceInterface::class => \App\Service\v3\Implementations\ShopCartUpdateService::class,
\App\Service\v3\Interfaces\ShopCartServiceInterface::class => \App\Service\v3\Implementations\ShopCartService::class,
\App\Service\v3\Interfaces\WxLoginServiceInterface::class => \App\Service\v3\Implementations\WxLoginService::class,
\App\Service\v3\Interfaces\UserInfoServiceInterface::class => \App\Service\v3\Implementations\UserInfoService::class,
\App\Service\v3\Interfaces\SearchServiceInterface::class => \App\Service\v3\Implementations\SearchService::class,
+ \App\Service\v3\Interfaces\CollectStoreServiceInterface::class => \App\Service\v3\Implementations\CollectStoreService::class,
];
diff --git a/config/routes.php b/config/routes.php
index 9e015eb..2d4a043 100644
--- a/config/routes.php
+++ b/config/routes.php
@@ -81,17 +81,10 @@ 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/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@update');
- Router::post('shopCart/detail', 'App\Controller\v3\ShopCartController@detail');
Router::post('login/wxLogin', 'App\Controller\v3\LoginController@wxLogin');
Router::post('location/getMarketListByLocation', 'App\Controller\v3\LocationController@getMarketListByLocation');
- Router::post('userDeliveryAddress/update', 'App\Controller\v3\UserDeliveryAddressController@update');
- Router::post('userDeliveryAddress/get', 'App\Controller\v3\UserDeliveryAddressController@get');
- Router::post('userDeliveryAddress/delete', 'App\Controller\v3\UserDeliveryAddressController@delete');
- Router::post('userDeliveryAddress/getList', 'App\Controller\v3\UserDeliveryAddressController@getList');
Router::post('search/hotKeywords', 'App\Controller\v3\SearchController@hotKeywords');
Router::post('search/goods', 'App\Controller\v3\SearchController@goods');
Router::post('search/stores', 'App\Controller\v3\SearchController@stores');
@@ -102,4 +95,12 @@ Router::addGroup('/v3/', function () {
Router::post('sms/getVerifyCode', 'App\Controller\v3\SmsController@getVerifyCode');
Router::post('user/bindTel', 'App\Controller\v3\UserController@bindTel');
Router::post('user/updateInfo', 'App\Controller\v3\UserController@updateInfo');
+ Router::post('orderOnline/detail', 'App\Controller\v3\OrderOnlineController@detail');
+ Router::post('userDeliveryAddress/update', 'App\Controller\v3\UserDeliveryAddressController@update');
+ Router::post('userDeliveryAddress/get', 'App\Controller\v3\UserDeliveryAddressController@get');
+ Router::post('userDeliveryAddress/delete', 'App\Controller\v3\UserDeliveryAddressController@delete');
+ Router::post('userDeliveryAddress/getList', 'App\Controller\v3\UserDeliveryAddressController@getList');
+ Router::post('collectStore/update', 'App\Controller\v3\CollectStoreController@update');
+ Router::post('shopCartUpdate/update', 'App\Controller\v3\ShopCartUpdateController@update');
+ Router::post('shopCart/detail', 'App\Controller\v3\ShopCartController@detail');
},['middleware' => [\App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\Auth\UserMiddleware::class]]);
\ No newline at end of file
From ca2c7b7b29082e35864f8703231e7f8c6f3de2e8 Mon Sep 17 00:00:00 2001
From: Lemon <15040771@qq.com>
Date: Wed, 2 Sep 2020 21:06:35 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=20?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=97=E9=93=BA=E4=BF=A1=E6=81=AF=20?=
=?UTF-8?q?=E5=BA=97=E9=93=BA=E8=AF=A6=E6=83=85=E9=A1=B5=20=E5=88=A4?=
=?UTF-8?q?=E6=96=AD=E8=AF=A5=E5=BA=97=E9=93=BA=E6=98=AF=E5=90=A6=E6=94=B6?=
=?UTF-8?q?=E8=97=8F=E8=BF=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Constants/v3/SsdbKeys.php | 7 ++++++-
app/Controller/v3/GoodsController.php | 9 +++++++++
app/Controller/v3/StoreController.php | 4 ++--
app/Service/v3/Implementations/StoreService.php | 4 ++--
app/Service/v3/Interfaces/StoreServiceInterface.php | 2 +-
5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/app/Constants/v3/SsdbKeys.php b/app/Constants/v3/SsdbKeys.php
index 3298784..4462edd 100644
--- a/app/Constants/v3/SsdbKeys.php
+++ b/app/Constants/v3/SsdbKeys.php
@@ -19,7 +19,12 @@ class SsdbKeys extends AbstractConstants
* @Message("商品月销")
*/
const GOODS_MONTH_SALES = 'goods_m_sales_';
-
+
+ /**
+ * @Message("商户月销")
+ */
+ const STORE_MONTH_SALES = 'store_m_sales_';
+
/**
* @Message("用户新订单统计")
*/
diff --git a/app/Controller/v3/GoodsController.php b/app/Controller/v3/GoodsController.php
index edd4984..b5468f3 100644
--- a/app/Controller/v3/GoodsController.php
+++ b/app/Controller/v3/GoodsController.php
@@ -3,6 +3,7 @@
namespace App\Controller\v3;
use App\Controller\BaseController;
+use App\Service\v3\Interfaces\StoreServiceInterface;
use Hyperf\Di\Annotation\Inject;
use App\Service\v3\Interfaces\GoodsServiceInterface;
class GoodsController extends BaseController
@@ -12,10 +13,18 @@ class GoodsController extends BaseController
* @var GoodsServiceInterface
*/
protected $goodsService;
+
+ /**
+ * @Inject
+ * @var StoreServiceInterface
+ */
+ protected $storeService;
public function detail()
{
+ $params = $this->request->all();
$res['detail'] = $this->goodsService->do();
$res['banner'] = $this->goodsService->getBanner();
+ $res['store'] = $this->storeService->detail($params['store_id']);
return $this->success($res);
}
}
\ No newline at end of file
diff --git a/app/Controller/v3/StoreController.php b/app/Controller/v3/StoreController.php
index f53d5be..5ace039 100644
--- a/app/Controller/v3/StoreController.php
+++ b/app/Controller/v3/StoreController.php
@@ -43,8 +43,8 @@ class StoreController extends BaseController
public function index(StoreIndexRequest $request)
{
$params = $request->validated();
- $data = $this->storeService->detail($params['store_id'], $params['market_id']);
- $data['is_collected'] = (bool)$this->collectService->check($params['market_id'], $params['store_id'], $params['user_id']);
+ $data = $this->storeService->detail($params['store_id']);
+ $data['is_collected'] = (bool)$this->collectService->check($params['user_id'],$params['store_id']);
$data['goods_types'] = $this->categoryService->allForStore($params['store_id']);
return $this->success(['store' => $data]);
}
diff --git a/app/Service/v3/Implementations/StoreService.php b/app/Service/v3/Implementations/StoreService.php
index 63ad632..04df5c5 100644
--- a/app/Service/v3/Implementations/StoreService.php
+++ b/app/Service/v3/Implementations/StoreService.php
@@ -24,14 +24,14 @@ class StoreService implements StoreServiceInterface
// TODO: Implement undo() method.
}
- public function detail($storeId, $marketId)
+ public function detail($storeId)
{
return Store::query()
->select([
'id', 'name', 'logo', 'introduction', 'announcement', 'address', 'tel', 'stall_info',
'is_rest','time1', 'time2', 'time3', 'time4',
])
- ->where(['id' => $storeId, 'market_id' => $marketId])
+ ->where('id',$storeId)
->first()->toArray();
}
}
\ No newline at end of file
diff --git a/app/Service/v3/Interfaces/StoreServiceInterface.php b/app/Service/v3/Interfaces/StoreServiceInterface.php
index f7d06eb..452c429 100644
--- a/app/Service/v3/Interfaces/StoreServiceInterface.php
+++ b/app/Service/v3/Interfaces/StoreServiceInterface.php
@@ -7,5 +7,5 @@ interface StoreServiceInterface
public function do();
public function check();
public function undo();
- public function detail($storeId, $marketId);
+ public function detail($storeId);
}
\ No newline at end of file