Commit 4d2e50af by xmy

fix:配置中心修改

parent 070b8765
...@@ -13,9 +13,10 @@ if (empty($data)) { ...@@ -13,9 +13,10 @@ if (empty($data)) {
$db = CfgCenter::dbConnect(); $db = CfgCenter::dbConnect();
$arr = $db->select('config', ['name', 'value']); $arr = $db->select('config', ['name', 'value']);
foreach ($arr as $key => $value) { foreach ($arr as $key => $value) {
$data[$value['name']] = json_decode($value['value'],true); $v_arr = json_decode($value['value'], true);
$data[$value['name']] = empty($v_arr) ? $value['value'] : $v_arr;
} }
$redis->set(CACHE_PREFIX . 'all', empty(json_encode($data)) ? $data : json_encode($data)); $redis->set(CACHE_PREFIX . 'all', json_encode($data));
} else { } else {
$data = json_decode($data, true); $data = json_decode($data, true);
} }
......
...@@ -8,7 +8,7 @@ use Swoft\Redis\Redis; ...@@ -8,7 +8,7 @@ use Swoft\Redis\Redis;
class Xcrypt class Xcrypt
{ {
const CRYPT = 'crypt'; const CRYPT = 'cryptKey';
public static function encrypt(string $str, $key = '') public static function encrypt(string $str, $key = '')
...@@ -42,8 +42,6 @@ class Xcrypt ...@@ -42,8 +42,6 @@ class Xcrypt
} }
private static function getKey(){ private static function getKey(){
// $redis = App::getBean(Redis::class);
// $key = $redis->get(self::CRYPT);
$key = CfgCenter::get(self::CRYPT); $key = CfgCenter::get(self::CRYPT);
if (empty($key)){ if (empty($key)){
throw new \Exception('加密密钥获取失败!'); throw new \Exception('加密密钥获取失败!');
......
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