shish vor 6 Jahren
Ursprung
Commit
d8f7dc729f

+ 1 - 1
app/shop/controllers/AdminShopController.php

@@ -30,5 +30,5 @@ class AdminShopController extends BaseController
 		$miniCode = isset($respond['miniCode']) ? $respond['miniCode'] : '';
 		util::success(['miniCode' => $miniCode]);
 	}
-	
+
 }

+ 7 - 5
biz/admin/classes/AdminShopClass.php

@@ -13,13 +13,13 @@ class AdminShopClass extends BaseClass
 	public static $baseFile = '\biz\admin\models\AdminShop';
 	
 	const GENERATE_ADMIN_DATA = 'generate_admin_data_';//创建管理员需要的数据
-
+	
 	//创建管理准备数据key shish 2020.4.17
 	public static function getGenerateAdminDataKey($shopId, $adminId)
 	{
 		return self::GENERATE_ADMIN_DATA . $shopId . '_' . $adminId;
 	}
-
+	
 	//创建管理员数据准备 shish 2020.4.17
 	public static function prepareBindAdmin($data)
 	{
@@ -29,11 +29,13 @@ class AdminShopClass extends BaseClass
 		$params = [$cacheKey];
 		if (!empty($data)) {
 			foreach ($data as $key => $val) {
-				$params[] = $key;
-				$params[] = $val;
+				if (!is_array($val)) {
+					$params[] = $key;
+					$params[] = $val;
+				}
 			}
 		}
 		Yii::$app->redis->executeCommand('HMSET', $params);
 	}
-
+	
 }

+ 19 - 10
common/components/wxUtil.php

@@ -1414,10 +1414,15 @@ class wxUtil
 	//申请会员的小程序码
 	public static function generateMemberCode($merchant, $shopId, $isOpen = 0)
 	{
-		$behind = '/retail/mimiMemberCode/' . $merchant['id'] . '_' . $shopId . '_apply_member.jpg';
-		$file = dirUtil::getImgDir() . $behind;
+		$fileName = $merchant['id'] . '_' . $shopId . '_apply_member.jpg';
+		$behind = '/retail/mimiMemberCode/';
+		$filePath = dirUtil::getImgDir() . $behind;
+		if (!file_exists($filePath)) {
+			mkdir($filePath, 0777, true);
+		}
+		$file = $filePath . $fileName;
 		if (file_exists($file)) {
-			return $behind;
+			return $behind . $fileName;
 		}
 		$path = 'pages/home/user?scan=1&shopId=' . $shopId;
 		$accessToken = self::getMiniProgramAccessToken($merchant);
@@ -1429,18 +1434,22 @@ class wxUtil
 		];
 		$result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
 		file_put_contents($file, $result);
-		return $behind;
+		return $behind . $fileName;
 	}
-	
+
 	//临时小程序码生成 shish 2020.4.17
 	public static function generateUnlimitedMiniCode($merchant, $page, $scene = '', $isOpen = 0)
 	{
 		$id = isset($merchant['id']) ? $merchant['id'] : 0;
-		$shortPrefix = stringUtil::shortUniqueId($id);
-		$behind = '/retail/mimiCode/' . date("Ym") . '/' . date("d") . '/' . $id . '/' . $shortPrefix . '.jpg';
-		$file = dirUtil::getImgDir() . $behind;
+		$fileName = stringUtil::shortUniqueId($id) . '.jpg';
+		$behind = '/retail/mimiCode/' . date("Ym") . '/' . date("d") . '/' . $id . '/';
+		$filePath = dirUtil::getImgDir() . $behind;
+		if (!file_exists($filePath)) {
+			mkdir($filePath, 0777, true);
+		}
+		$file = $filePath . $fileName;
 		if (file_exists($file)) {
-			return $behind;
+			return $behind . $fileName;
 		}
 		$accessToken = self::getMiniProgramAccessToken($merchant);
 		$url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
@@ -1450,7 +1459,7 @@ class wxUtil
 		$data["scene"] = $scene;
 		$result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
 		file_put_contents($file, $result);
-		return $behind;
+		return $behind . $fileName;
 	}
 	
 	//微信开放平台获取component_access_token