Explorar el Código

fix bug: 账号无效

shizhongqi hace 2 meses
padre
commit
38d35da85e
Se han modificado 1 ficheros con 6 adiciones y 4 borrados
  1. 6 4
      common/components/ChuanglanSmsApi.php

+ 6 - 4
common/components/ChuanglanSmsApi.php

@@ -113,9 +113,9 @@ class ChuanglanSmsApi {
 
 	private static function getAccountConfig($accountKey)
 	{
-		$accounts = self::env('SMS_ACCOUNTS');
-		if (!empty($accounts)) {
-			$accounts = json_decode($accounts, true);
+		$accountsConfig = self::env('SMS_ACCOUNTS');
+		if (!empty($accountsConfig)) {
+			$accounts = json_decode($accountsConfig, true);
 			if (!is_array($accounts)) {
 				util::fail('短信账号配置格式错误');
 			}
@@ -127,6 +127,8 @@ class ChuanglanSmsApi {
 			if ($accountKey !== 'default') {
 				util::fail('短信账号不存在');
 			}
+		} elseif ($accountKey !== 'default') {
+			util::fail('短信多账号配置不存在');
 		}
 
 		$account = self::env('CHUANGLAN_SMS_ACCOUNT', self::API_ACCOUNT);
@@ -154,7 +156,7 @@ class ChuanglanSmsApi {
 			return $value;
 		}
 
-		return '';
+		return $default;
 	}
 
 	/**