ソースを参照

获取用户默认门店

shish 6 年 前
コミット
e38129bd5b

+ 1 - 1
app/business/controllers/BaseController.php

@@ -91,7 +91,7 @@ class BaseController extends PublicController
         util::success($re);
     }
 
-    public function actionGet()
+    public function actionGetInfo()
     {
         $id = Yii::$app->request->get('id');
 

+ 31 - 0
app/client/controllers/MerchantController.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace client\controllers;
+
+use biz\goods\services\CategoryService;
+use biz\goods\services\GoodsCategoryService;
+use biz\merchant\services\MerchantService;
+use biz\merchant\services\ShopService;
+use Yii;
+use yii\web\Controller;
+use common\components\util;
+
+class MerchantController extends BaseController
+{
+
+	//当前用户获取门店信息
+	public function actionGetShopInfo()
+	{
+		$merchant = $this->merchant;
+		$merchant['defaultShop'] = ShopService::getDefaultShopInfo($merchant);
+		util::success($merchant);
+	}
+
+	//当前用户获取商家信息
+	public function actionGetInfo()
+	{
+		$merchant = $this->merchant;
+		util::success($merchant);
+	}
+	
+}

+ 24 - 0
app/client/controllers/ShopController.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace client\controllers;
+
+use biz\goods\services\CategoryService;
+use biz\goods\services\GoodsCategoryService;
+use biz\merchant\services\MerchantService;
+use biz\merchant\services\ShopService;
+use Yii;
+use yii\web\Controller;
+use common\components\util;
+
+class ShopController extends BaseController
+{
+	
+	//获取用户所属商家的默认门店 shish 2019.12.6
+	public function actionGetDefaultShop()
+	{
+		$merchant = $this->merchant;
+		$shop = ShopService::getDefaultShopInfo($merchant);
+		util::success($shop);
+	}
+
+}

+ 8 - 0
biz/merchant/services/ShopService.php

@@ -3,6 +3,7 @@
 namespace biz\merchant\services;
 
 use biz\base\services\BaseService;
+use biz\merchant\classes\ShopClass;
 use common\components\stringUtil;
 use common\components\util;
 use Yii;
@@ -34,4 +35,11 @@ class ShopService extends BaseService
 		return $sendCost;
 	}
 	
+	//获取默认门店信息 shish 2019.12.6
+	public static function getDefaultShopInfo($merchant)
+	{
+		$defaultShopId = $merchant['defaultShopId'];
+		return ShopClass::getById($defaultShopId);
+	}
+
 }