Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
services
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tencent
services
Commits
4d2e50af
Commit
4d2e50af
authored
Feb 12, 2019
by
xmy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:配置中心修改
parent
070b8765
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
src/Common/Config/config.php
+3
-2
src/Common/Lib/Xcrypt.php
+1
-3
No files found.
src/Common/Config/config.php
View file @
4d2e50af
...
@@ -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
);
}
}
...
...
src/Common/Lib/Xcrypt.php
View file @
4d2e50af
...
@@ -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
=
'crypt
Key
'
;
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
(
'加密密钥获取失败!'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment