Commit ccfe4071 by xmy

cmq配置

parent 0bb14237
...@@ -24,18 +24,19 @@ class Account ...@@ -24,18 +24,19 @@ class Account
:: CMQClientParameterException host格式错误 :: CMQClientParameterException host格式错误
*/ */
public function __construct($host, $secretId, $secretKey) public function __construct($host = '', $secretId = '', $secretKey = '')
{ {
$this->host = $host; $config = include alias('@vendor/hdll/services/src/Common/Config') . '/config.php';
$this->secretId = $secretId; $this->host = $host ?? $config['host'];
$this->secretKey = $secretKey; $this->secretId = $secretId ?? $config['secretId'];
$this->cmq_client = new CMQClient($host, $secretId, $secretKey); $this->secretKey = $secretKey ?? $config['secretKey'];
} $this->cmq_client = new CMQClient($host, $secretId, $secretKey);
}
/*
* @type sign_method:string /*
* @param sign_method : only support sha1 and sha256 * @type sign_method:string
*/ * @param sign_method : only support sha1 and sha256
*/
public function set_sign_method($sign_method = 'sha1') public function set_sign_method($sign_method = 'sha1')
{ {
$this->cmq_client->set_sign_method($sign_method); $this->cmq_client->set_sign_method($sign_method);
......
...@@ -18,9 +18,10 @@ return [ ...@@ -18,9 +18,10 @@ return [
'secretKey' => 'IPL5g5PaaSAzd6NSO8gEmLxcN4pTzJSQ', 'secretKey' => 'IPL5g5PaaSAzd6NSO8gEmLxcN4pTzJSQ',
], ],
'cmq' => [ 'cmq' => [
'host' => '', // 'host' => 'http: //cmq-queue-bj.api.tencentyun.com',//内网
'secretId' => '', 'host' => 'http://cmq-queue-bj.api.qcloud.com',//外网
'secretKey' => '', 'secretId' => 'AKIDYRW1cG2iVIg8dAoCe86vhNuA7A5oNknk',
'secretKey' => 'z0ymS7xfLrP6Sk2EKHWaXN6d0EIxX0IQ',
], ],
'cryptKey' => 'ebf032f01aa2093be3ee2ee2c137hdll', 'cryptKey' => 'ebf032f01aa2093be3ee2ee2c137hdll',
]; ];
\ No newline at end of file
...@@ -26,7 +26,7 @@ class Xcrypt{ ...@@ -26,7 +26,7 @@ class Xcrypt{
{ {
$config = include alias('@vendor/hdll/services/src/Common/Config') . '/config.php'; $config = include alias('@vendor/hdll/services/src/Common/Config') . '/config.php';
$config = $config['qCloud']; $config = $config['qCloud'];
$key = isset($config['cryptKey']) ? $config['cryptKey'] : $key; $key = $key ?? $config['cryptKey'];
switch (strlen($key)) { switch (strlen($key)) {
case 8: case 8:
$this->mcrypt = MCRYPT_DES; $this->mcrypt = MCRYPT_DES;
......
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