shish 5 роки тому
батько
коміт
e4568664a1

+ 2 - 2
app/ghs/controllers/ShopController.php

@@ -145,8 +145,8 @@ class ShopController extends BaseController
     {
         $res = [];
         //adminId 为 super 才有权限看到所有的门店
-        if($this->adminId['super']==1){
-            $res = ShopClass::getAllShop($this->sjId,$filed = 'id,shopName,avatar');
+        if($this->admin['super']==1){
+            $res = ShopClass::getAllShop($this->sjId);
         }
         util::success($res);
     }

+ 68 - 68
biz-ghs/merchant/classes/ShopClass.php

@@ -13,81 +13,81 @@ use biz\base\classes\BaseClass;
 class ShopClass extends BaseClass
 {
 
-	public static $baseFile = '\bizGhs\merchant\models\Shop';
+    public static $baseFile = '\bizGhs\merchant\models\Shop';
 
-	public static function getShopList($where)
-	{
-		$list = self::getList('*', $where, 'addTime DESC');
-		return $list;
-	}
+    public static function getShopList($where)
+    {
+        $list = self::getList('*', $where, 'addTime DESC');
+        return $list;
+    }
 
-	//获取商家默认的门店ID shish 2020.1.19
-	public static function getDefaultShopId($merchant)
-	{
-		return isset($merchant['defaultShopId']) ? $merchant['defaultShopId'] : 0;
-	}
+    //获取商家默认的门店ID shish 2020.1.19
+    public static function getDefaultShopId($merchant)
+    {
+        return isset($merchant['defaultShopId']) ? $merchant['defaultShopId'] : 0;
+    }
 
-	//创建门店 shish 2021.1.14
-	public static function addShop($data)
-	{
-		$data['createTime'] = date("Y-m-d H:i:s");
-		$shopName = isset($data['shopName']) ? $data['shopName'] : '';
-		if (empty($shopName)) {
-			util::fail('请填写门店名称');
-		}
-		$exists = self::getByCondition(['merchantId' => $data['merchantId'], 'shopName' => $shopName]);
-		if (!empty($exists)) {
-			util::fail('门店名称已经存在');
-		}
-		$shop = self::add($data);
-		return $shop;
-	}
+    //创建门店 shish 2021.1.14
+    public static function addShop($data)
+    {
+        $data['createTime'] = date("Y-m-d H:i:s");
+        $shopName = isset($data['shopName']) ? $data['shopName'] : '';
+        if (empty($shopName)) {
+            util::fail('请填写门店名称');
+        }
+        $exists = self::getByCondition(['merchantId' => $data['merchantId'], 'shopName' => $shopName]);
+        if (!empty($exists)) {
+            util::fail('门店名称已经存在');
+        }
+        $shop = self::add($data);
+        return $shop;
+    }
 
-	//更新门店 shish 2020.2.29
-	public static function updateShop($id, $data)
-	{
-		$shopName = isset($data['shopName']) ? $data['shopName'] : '';
-		$merchantId = $data['merchantId'];
-		$findShop = self::getByCondition(['merchantId' => $merchantId, 'shopName' => $shopName]);
-		if (!empty($findShop) && $findShop['id'] != $id) {
-			util::fail('门店名称已经存在');
-		}
-		return self::updateById($id, $data);
-	}
+    //更新门店 shish 2020.2.29
+    public static function updateShop($id, $data)
+    {
+        $shopName = isset($data['shopName']) ? $data['shopName'] : '';
+        $merchantId = $data['merchantId'];
+        $findShop = self::getByCondition(['merchantId' => $merchantId, 'shopName' => $shopName]);
+        if (!empty($findShop) && $findShop['id'] != $id) {
+            util::fail('门店名称已经存在');
+        }
+        return self::updateById($id, $data);
+    }
 
-	//取商家所有门店 shish 2020.2.29
-	public static function getAllShop($merchantId,$filed="",$order=null)
-	{
-		return self::getAllByCondition(['merchantId' => $merchantId],$order,$filed);
-	}
+    //取商家所有门店 shish 2020.2.29
+    public static function getAllShop($merchantId)
+    {
+        return self::getAllByCondition(['merchantId' => $merchantId], null, 'id,shopName,avatar');
+    }
 
-	//验证权限 shish 2021.1.14
-	public static function valid($shop, $merchantId)
-	{
-		if (isset($shop['merchantId']) && $shop['merchantId'] == $merchantId) {
-			return true;
-		}
-		util::fail('您没有权限访问此店铺');
-	}
+    //验证权限 shish 2021.1.14
+    public static function valid($shop, $merchantId)
+    {
+        if (isset($shop['merchantId']) && $shop['merchantId'] == $merchantId) {
+            return true;
+        }
+        util::fail('您没有权限访问此店铺');
+    }
 
-	//删除门店 shish 2020.3.1
-	public static function deleteShop($shop)
-	{
-		if (isset($shop['default']) && $shop['default'] == 1) {
-			util::fail('默认门店不允许删除');
-		}
-		$id = $shop['id'];
-		self::updateById($id, ['delStatus' => 1]);
-	}
+    //删除门店 shish 2020.3.1
+    public static function deleteShop($shop)
+    {
+        if (isset($shop['default']) && $shop['default'] == 1) {
+            util::fail('默认门店不允许删除');
+        }
+        $id = $shop['id'];
+        self::updateById($id, ['delStatus' => 1]);
+    }
 
-	//生成收款码 shish 2021.1.14
-	public static function generateGatheringCode($merchantId, $shopId)
-	{
-		$url = Yii::$app->params['ghsDomain'] . "/#/pages/pay/index?account={$merchantId}&shopId=" . $shopId;
-		//强制转成https
-		$url = httpUtil::becomeHttps($url);
-		$gatheringCode = qrCodeUtil::generateGatheringQrCode($url, $merchantId, $shopId, '', 10);
-		return $gatheringCode;
-	}
+    //生成收款码 shish 2021.1.14
+    public static function generateGatheringCode($merchantId, $shopId)
+    {
+        $url = Yii::$app->params['ghsDomain'] . "/#/pages/pay/index?account={$merchantId}&shopId=" . $shopId;
+        //强制转成https
+        $url = httpUtil::becomeHttps($url);
+        $gatheringCode = qrCodeUtil::generateGatheringQrCode($url, $merchantId, $shopId, '', 10);
+        return $gatheringCode;
+    }
 
 }