Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cf3c8baf
authored
Jun 25, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更换注册接口
parent
953c3574
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletions
+37
-1
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/service/newapi/AiTokenService.java
+2
-1
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/service/newapi/NewApiClient.java
+35
-0
No files found.
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/service/newapi/AiTokenService.java
View file @
cf3c8baf
...
@@ -54,7 +54,8 @@ public class AiTokenService {
...
@@ -54,7 +54,8 @@ public class AiTokenService {
log
.
info
(
"[AiTokenService.createTokenFull] 准备注册: username={}"
,
username
);
log
.
info
(
"[AiTokenService.createTokenFull] 准备注册: username={}"
,
username
);
try
{
try
{
NewApiResponse
<
NewApiUserVO
>
registerResp
=
newApiClient
.
register
(
username
,
password
);
// 使用管理员接口注册(关闭游客注册后使用)
NewApiResponse
<
Void
>
registerResp
=
newApiClient
.
adminRegister
(
username
,
password
);
log
.
info
(
"[AiTokenService.createTokenFull] 注册结果: success={}, message={}"
,
registerResp
.
getSuccess
(),
registerResp
.
getMessage
());
log
.
info
(
"[AiTokenService.createTokenFull] 注册结果: success={}, message={}"
,
registerResp
.
getSuccess
(),
registerResp
.
getMessage
());
if
(!
Boolean
.
TRUE
.
equals
(
registerResp
.
getSuccess
()))
{
if
(!
Boolean
.
TRUE
.
equals
(
registerResp
.
getSuccess
()))
{
...
...
computility-module-apihub/computility-module-apihub-biz/src/main/java/com/luhu/computility/module/apihub/service/newapi/NewApiClient.java
View file @
cf3c8baf
...
@@ -60,6 +60,41 @@ public class NewApiClient {
...
@@ -60,6 +60,41 @@ public class NewApiClient {
}
}
}
}
/**
* 管理员注册用户(关闭游客注册后使用此接口)
* POST /api/user/
*/
public
NewApiResponse
<
Void
>
adminRegister
(
String
username
,
String
password
)
{
String
url
=
newApiProperties
.
getBaseUrl
()
+
"/api/user/"
;
log
.
info
(
"[NewApiClient.adminRegister] 请求URL: {}"
,
url
);
log
.
info
(
"[NewApiClient.adminRegister] 请求参数: username={}, password={}"
,
username
,
"***"
);
Map
<
String
,
Object
>
body
=
new
HashMap
<>();
body
.
put
(
"username"
,
username
);
body
.
put
(
"password"
,
password
);
try
{
HttpResponse
response
=
HttpRequest
.
post
(
url
)
.
header
(
HEADER_USER
,
String
.
valueOf
(
newApiProperties
.
getAdminUserId
()))
.
header
(
HEADER_AUTH
,
"Bearer "
+
newApiProperties
.
getAdminToken
())
.
body
(
JSONUtil
.
toJsonStr
(
body
))
.
contentType
(
"application/json"
)
.
timeout
(
30000
)
.
execute
();
log
.
info
(
"[NewApiClient.adminRegister] 响应状态: {}"
,
response
.
getStatus
());
log
.
info
(
"[NewApiClient.adminRegister] 响应内容: {}"
,
response
.
body
());
return
parseResponse
(
response
,
Void
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[NewApiClient.adminRegister] 请求异常"
,
e
);
return
NewApiResponse
.<
Void
>
builder
()
.
success
(
false
)
.
message
(
"请求异常: "
+
e
.
getMessage
())
.
build
();
}
}
public
NewApiResponse
<
NewApiUserVO
>
login
(
String
username
,
String
password
)
{
public
NewApiResponse
<
NewApiUserVO
>
login
(
String
username
,
String
password
)
{
String
url
=
newApiProperties
.
getBaseUrl
()
+
"/api/user/login"
;
String
url
=
newApiProperties
.
getBaseUrl
()
+
"/api/user/login"
;
log
.
info
(
"[NewApiClient.login] 请求URL: {}"
,
url
);
log
.
info
(
"[NewApiClient.login] 请求URL: {}"
,
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