shish 6 роки тому
батько
коміт
edc1d5b8f6

+ 4 - 5
app/shop/controllers/AuthController.php

@@ -157,7 +157,7 @@ class AuthController extends PublicController
 		$token = jwt::getNewToken($adminId);
 		util::success(['token' => $token, 'account' => $admin['merchantId'], 'merchantId' => $admin['merchantId']]);
 	}
-	
+
 	//静默获取小程序用户信息
 	public function actionMiniInfo()
 	{
@@ -165,14 +165,13 @@ class AuthController extends PublicController
 		if (empty($code)) {
 			util::fail('没有CODE信息');
 		}
-		$merchant = WxOpenService::getOpenInfo();
-		$appId = $merchant['miniAppId'];
-		$appSecret = $merchant['miniAppSecret'];
+		$wxMiniBase = WxOpenService::getWxMiniBase();
+		$appId = $wxMiniBase['miniAppId'];
+		$appSecret = $wxMiniBase['miniAppSecret'];
 		if (empty($appSecret)) {
 			util::fail('没有找到小程序的密钥');
 		}
 		$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$appId}&secret={$appSecret}&js_code={$code}&grant_type=authorization_code";
-		
 		$curl = new curl\Curl();
 		$result = $curl->get($url);
 		$arr = Json::decode($result);

+ 13 - 1
biz/weixin/classes/WxOpenClass.php

@@ -45,11 +45,23 @@ class WxOpenClass extends BaseClass
 		}
 		util::fail('没有找到平台信息');
 	}
-
+	
 	//更新开放平台信息 shish 2020.4.13
 	public static function updateOpen($data)
 	{
 		self::updateById(self::ID, $data);
 	}
 	
+	//平台小程序信息 shish 2020.4.13
+	public static function getWxMiniBase()
+	{
+		$open = self::getOpen();
+		$wx_mini_base_id = isset($open['wx_mini_base_id']) ? $open['wx_mini_base_id'] : 0;
+		$base = WxMiniBaseClass::getById($wx_mini_base_id);
+		if (empty($base)) {
+			util::fail('没有找到平台小程序信息');
+		}
+		return $base;
+	}
+	
 }

+ 2 - 0
biz/weixin/services/WxMiniBaseService.php

@@ -14,4 +14,6 @@ class WxMiniBaseService extends BaseService
 
 	public static $baseFile = '\biz\weixin\classes\WxMiniBaseClass';
 
+	
+	
 }

+ 8 - 2
biz/weixin/services/WxOpenService.php

@@ -33,11 +33,17 @@ class WxOpenService extends BaseService
 	{
 		return WxOpenClass::getPlatformAccount();
 	}
-	
+
 	//获取平台微信信息
 	public static function getOpenInfo()
 	{
 		return WxOpenClass::getOpenInfo();
 	}
-	
+
+	//获取小程序信息 shish 2020.4.13
+	public static function getWxMiniBase()
+	{
+		return WxOpenClass::getWxMiniBase();
+	}
+
 }