Commit ae78351c by 王召彬

v2版本日志处理

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