Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nacos-config
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Euan游根明
nacos-config
Commits
fad388ac
Commit
fad388ac
authored
Nov 30, 2023
by
Euan游根明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 注释
parent
9c49628b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
Nacos.php
src/Nacos/Nacos.php
+9
-10
No files found.
src/Nacos/Nacos.php
View file @
fad388ac
...
...
@@ -63,12 +63,12 @@ class Nacos
* @param $path
* @param $res
* @return void
* @throws Exception
* @throws
\
Exception
*/
public
static
function
write
(
$path
,
$res
){
$save
=
file_put_contents
(
$path
,
$res
);
if
(
$save
===
false
){
throw
new
Exception
(
'保存配置失败'
.
$path
);
throw
new
\
Exception
(
'保存配置失败'
.
$path
);
}
}
...
...
@@ -76,8 +76,8 @@ class Nacos
* 获取nacos配置
* @param $dataId
* @param $group
* @
param $isSync
* @
return false|\GuzzleHttp\Promise\PromiseInterface|mixed|string
* @
return false|mixed|string
* @
throws \Exception
*/
public
static
function
getConfig
(
$dataId
,
$group
=
'DEFAULT_GROUP'
)
{
...
...
@@ -97,9 +97,8 @@ class Nacos
* 发起请求
* @param $dataId
* @param $group
* @param $isSync
* @return \GuzzleHttp\Promise\PromiseInterface|mixed|string
* @throws \GuzzleHttp\Exception\GuzzleException
* @return mixed|string
* @throws \Exception
*/
public
static
function
requery
(
$dataId
,
$group
)
{
...
...
@@ -111,7 +110,6 @@ class Nacos
* 获取token
* @param $new
* @return mixed|string|null
* @throws \GuzzleHttp\Exception\GuzzleException
*/
private
static
function
getToken
(
$new
=
false
)
{
...
...
@@ -159,7 +157,7 @@ class Nacos
curl_close
(
$curl
);
$data
=
json_decode
(
$response
,
true
);
if
(
isset
(
$data
[
'status'
])
&&
$data
[
'status'
]
==
403
){
throw
new
Exception
(
'token过期'
,
403
);
throw
new
\
Exception
(
'token过期'
,
403
);
}
if
(
isset
(
$data
[
'code'
])
&&
$data
[
'code'
]
!==
0
){
self
::
info
(
'获取配置返回结果:'
.
$response
);
...
...
@@ -171,8 +169,9 @@ class Nacos
/**
* 登入
* @param $data
* @param $url
* @return mixed|string|void
* @throws \GuzzleHttp\Exception\GuzzleException
*/
private
static
function
login
(
$data
,
$url
)
{
...
...
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