diff --git a/app/Service/v3/Implementations/ParamsTokenSsdbService.php b/app/Service/v3/Implementations/ParamsTokenSsdbService.php index 39850c9..966c9ae 100644 --- a/app/Service/v3/Implementations/ParamsTokenSsdbService.php +++ b/app/Service/v3/Implementations/ParamsTokenSsdbService.php @@ -31,13 +31,7 @@ class ParamsTokenSsdbService implements ParamsTokenServiceInterface $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); - $kvs = []; - foreach ($params as $key => $value) { - $kvs[] = $key; - $kvs[] = $value; - } - - if(false === $ssdb->exec('multi_hset', SsdbKeys::PARAMS_TOKEN.$token, $kvs)) { + if(false === $ssdb->exec('hset', SsdbKeys::PARAMS_TOKEN, $token, json_encode($params))) { throw new ErrorCodeException(ErrorCode::TOKEN_GENERATE_ERROR, 'token生成失败'); } @@ -51,7 +45,7 @@ class ParamsTokenSsdbService implements ParamsTokenServiceInterface public function analyze($token) { $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); - $params = $ssdb->exec('hgetall', SsdbKeys::PARAMS_TOKEN.$token); + $params = $ssdb->exec('hget', SsdbKeys::PARAMS_TOKEN, $token); if (false === $params) { @@ -62,7 +56,7 @@ class ParamsTokenSsdbService implements ParamsTokenServiceInterface throw new ErrorCodeException(ErrorCode::TOKEN_NOT_EXISTS, 'token不存在'); } - return $params; + return json_decode($params, true); } } \ No newline at end of file