Commit ae78351c by 王召彬

v2版本日志处理

parent a0de6949
...@@ -2,18 +2,19 @@ ...@@ -2,18 +2,19 @@
namespace Hdll\Services\V2\Common\ClsLogger; namespace Hdll\Services\V2\Common\ClsLogger;
use Hdll\Services\V2\Common\Config\CfgCenter;
class ClsSignature class ClsSignature
{ {
public static function create(){ public static function create(){
$signTime = (time()-10).';'.(time()+300); $signTime = (time()-10).';'.(time()+300);
$secretKey = 'IPL5g5PaaSAzd6NSO8gEmLxcN4pTzJSQ'; $cosCfg = CfgCenter::getByOemId('cls', 0);
$secretId = 'AKIDseHj18kua0KTSJ4g9SadbVEnEUZVjvPj';
$sha1edHttpString = sha1("post\n/structuredlog\n\n\n"); $sha1edHttpString = sha1("post\n/structuredlog\n\n\n");
$stringToSign = "sha1\n{$signTime}\n{$sha1edHttpString}\n"; $stringToSign = "sha1\n{$signTime}\n{$sha1edHttpString}\n";
$signKey = hash_hmac('sha1', $signTime, $secretKey); $signKey = hash_hmac('sha1', $signTime, $cosCfg['secretKey']);
$signature = hash_hmac('sha1', $stringToSign, $signKey); $signature = hash_hmac('sha1', $stringToSign, $signKey);
$authorization = 'q-sign-algorithm=sha1&q-ak='.$secretId $authorization = 'q-sign-algorithm=sha1&q-ak='.$cosCfg['secretId']
."&q-sign-time={$signTime}&q-key-time={$signTime}&q-header-list=&q-url-param-list=&q-signature={$signature}"; ."&q-sign-time={$signTime}&q-key-time={$signTime}&q-header-list=&q-url-param-list=&q-signature={$signature}";
return $authorization; return $authorization;
} }
......
...@@ -172,7 +172,7 @@ class CfgCenter ...@@ -172,7 +172,7 @@ class CfgCenter
if($database == '') { if($database == '') {
$database = 'config_center'; $database = 'config_center';
} }
if (\env('ENVIRONMENT', '') == '') { if (\env('APP_DEV') == 'prod') {
// 返回线上数据库连接 // 返回线上数据库连接
return new \Medoo\Medoo([ return new \Medoo\Medoo([
'database_type' => 'mysql', 'database_type' => 'mysql',
......
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