Commit 7e655e7e by 王召彬

配置中心优化

parent 4eea4ba4
...@@ -38,7 +38,34 @@ class CfgCenter ...@@ -38,7 +38,34 @@ class CfgCenter
} }
/** /**
* 用法同上 * 根据oemId获取支付证书
*
* @param integer $oemId
* @return array
*/
public static function getCertByOemId($keyName, int $oemId) {
$dbConn = self::dbConnect();//连接配置库
// 注意,需要返回oemId字段
$result = $dbConn->get("config", ['oemId', 'certPem', 'keyPem'], ['oemId' => $oemId, 'name' => $keyName]);
return $result;
}
/**
* 根据mchId获取对应的支付配置
*
* @param string $mchId
* @return mixed
*/
public static function getByMchId(int $mchId)
{
$dbConn = self::dbConnect();//连接配置库
$result = $dbConn->get("config", ['value'], ['mchId' => $mchId]);
$resArr = json_decode($result['value'], true);
return is_array($resArr) ? $resArr : $result['value'];
}
/**
* 如果有oemId,尽量使用方法getByOemId()读取配置
* 根据storeId获取所属OEM平台的配置 * 根据storeId获取所属OEM平台的配置
* *
* @param string $keyName * @param string $keyName
...@@ -53,7 +80,7 @@ class CfgCenter ...@@ -53,7 +80,7 @@ class CfgCenter
} }
/** /**
* 用法同上 * 如果有oemId,尽量使用方法getByOemId()读取配置
* 根据sellerId获取所属OEM平台的配置 * 根据sellerId获取所属OEM平台的配置
* *
* @param string $keyName * @param string $keyName
...@@ -68,7 +95,7 @@ class CfgCenter ...@@ -68,7 +95,7 @@ class CfgCenter
} }
/** /**
* 用法同上 * 如果有oemId,尽量使用方法getByOemId()读取配置
* 根据unionId获取所属OEM平台的配置 * 根据unionId获取所属OEM平台的配置
* *
* @param string $keyName * @param string $keyName
...@@ -83,20 +110,7 @@ class CfgCenter ...@@ -83,20 +110,7 @@ class CfgCenter
} }
/** /**
* 根据mchId获取对应的支付配置 * 如果有oemId,尽量使用方法getCertByOemId()读取证书
*
* @param string $mchId
* @return mixed
*/
public static function getByMchId(int $mchId)
{
$dbConn = self::dbConnect();//连接配置库
$result = $dbConn->get("config", ['value'], ['mchId' => $mchId]);
$resArr = json_decode($result['value'], true);
return is_array($resArr) ? $resArr : $result['value'];
}
/**
* 根据店铺id获取支付证书 * 根据店铺id获取支付证书
* *
* @param integer $storeId * @param integer $storeId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment