pull/1/head
Michael_xu 4 years ago
parent e51d4b3683
commit 27b720957c

@ -173,11 +173,11 @@ function sendRequest($url, $params = array() , $headers = array()) {
/** /**
* 验证序列号 * 验证序列号
* @param * @param
* @return * @return
*/ */
function checkWkCode($wkcode) { function checkWkCode($wkcode) {
$pub = config('public_key'); $pub = formatPubKey(config('public_key'));
$openssl_pub = openssl_pkey_get_public($pub); $openssl_pub = openssl_pkey_get_public($pub);
// 验签 // 验签
$resArr = openssl_public_decrypt(Hex2String($wkcode), $decrypted, $pub); $resArr = openssl_public_decrypt(Hex2String($wkcode), $decrypted, $pub);
@ -192,3 +192,15 @@ function Hex2String($hex){
} }
return $string; return $string;
} }
//公钥格式处理
function formatPubKey($pubKey) {
$fKey = "-----BEGIN PUBLIC KEY-----\n";
$len = strlen($pubKey);
for($i = 0; $i < $len; ) {
$fKey = $fKey . substr($pubKey, $i, 64) . "\n";
$i += 64;
}
$fKey .= "-----END PUBLIC KEY-----";
return $fKey;
}

@ -187,7 +187,7 @@ return [
// 缓存前缀 // 缓存前缀
'prefix' => '', 'prefix' => '',
// 缓存有效期 0表示永久缓存 // 缓存有效期 0表示永久缓存
'expire' => 86400*3, 'expire' => 86400*30,
// 禁用缓存子目录 // 禁用缓存子目录
'cache_subdir' => false, 'cache_subdir' => false,
'redis' => [ 'redis' => [
@ -266,7 +266,5 @@ return [
'bi_cache_time' => 1800, 'bi_cache_time' => 1800,
// 商业智能慢查询查询时间(查询超过该时间进行数据缓存)(毫秒) // 商业智能慢查询查询时间(查询超过该时间进行数据缓存)(毫秒)
'bi_slow_query_time' => 500, 'bi_slow_query_time' => 500,
'public_key' => '-----BEGIN PUBLIC KEY----- 'public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkqKFcAQtIp4rlkB5LOMnViyVY/hhA6x0R9ftwtEXsAFu4hBZrm9txdEvxSrDCUsx3Zwv/gdimeOzTtfSKffdoE/DwllNP9Zu6nsr2kGRgPrRwjtlO+j2FOM0b9UY1SQ/bWE+a9oQL2jL9xMSbtX1xG/+HcMo1bT+pa6FNQzs3egmvMt75/jaxINPSraj4kgNFawSBk7qDBEqDYiQwtPTuaNW1YZIs++/gZHsCRgGs/JrAbxNpl7+v/+Z503I3I2rs/8eUM5d16NXR8M7vtobUDCTIiQOgRahO8WMadgFlwavyVCYhy/TBXyj5RUfWaS26LrEN3vkj4TjoJu5m9LQ5QIDAQAB',
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkqKFcAQtIp4rlkB5LOMnViyVY/hhA6x0R9ftwtEXsAFu4hBZrm9txdEvxSrDCUsx3Zwv/gdimeOzTtfSKffdoE/DwllNP9Zu6nsr2kGRgPrRwjtlO+j2FOM0b9UY1SQ/bWE+a9oQL2jL9xMSbtX1xG/+HcMo1bT+pa6FNQzs3egmvMt75/jaxINPSraj4kgNFawSBk7qDBEqDYiQwtPTuaNW1YZIs++/gZHsCRgGs/JrAbxNpl7+v/+Z503I3I2rs/8eUM5d16NXR8M7vtobUDCTIiQOgRahO8WMadgFlwavyVCYhy/TBXyj5RUfWaS26LrEN3vkj4TjoJu5m9LQ5QIDAQAB
-----END PUBLIC KEY-----',
]; ];

Loading…
Cancel
Save