Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
admin-backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Odysseus
admin-backend
Commits
ea110516
Commit
ea110516
authored
May 17, 2024
by
brent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify client api
parent
a55025c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
kong.go
libs/kong/kong.go
+5
-0
main.go
main.go
+14
-4
No files found.
libs/kong/kong.go
View file @
ea110516
...
@@ -18,6 +18,8 @@ func kongApi(path string, method string, payload io.Reader, headers map[string]s
...
@@ -18,6 +18,8 @@ func kongApi(path string, method string, payload io.Reader, headers map[string]s
url
:=
base_url
+
"/"
+
path
url
:=
base_url
+
"/"
+
path
logs
.
Debug
(
"kongApi in"
,
url
,
payload
)
reqest
,
err
:=
http
.
NewRequest
(
method
,
url
,
payload
)
reqest
,
err
:=
http
.
NewRequest
(
method
,
url
,
payload
)
for
key
,
value
:=
range
headers
{
for
key
,
value
:=
range
headers
{
reqest
.
Header
.
Add
(
key
,
value
)
reqest
.
Header
.
Add
(
key
,
value
)
...
@@ -25,14 +27,17 @@ func kongApi(path string, method string, payload io.Reader, headers map[string]s
...
@@ -25,14 +27,17 @@ func kongApi(path string, method string, payload io.Reader, headers map[string]s
//reqest.Header.Add("Content-Type", "application/json")
//reqest.Header.Add("Content-Type", "application/json")
resp
,
err
:=
client
.
Do
(
reqest
)
resp
,
err
:=
client
.
Do
(
reqest
)
if
err
!=
nil
{
if
err
!=
nil
{
logs
.
Debug
(
"kongApi err"
,
err
.
Error
())
return
nil
,
err
return
nil
,
err
}
}
//fmt.Printf("resp status code: %s\n", resp.Body)
//fmt.Printf("resp status code: %s\n", resp.Body)
defer
resp
.
Body
.
Close
()
defer
resp
.
Body
.
Close
()
body
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
body
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
if
err
!=
nil
{
logs
.
Debug
(
"kongApi err"
,
err
.
Error
())
return
nil
,
err
return
nil
,
err
}
}
logs
.
Debug
(
"kongApi out"
,
url
,
string
(
body
))
return
body
,
nil
return
body
,
nil
}
}
...
...
main.go
View file @
ea110516
...
@@ -28,6 +28,16 @@ func init() {
...
@@ -28,6 +28,16 @@ func init() {
}
}
func
main
()
{
func
main
()
{
//createUser := models.CreateUserRequest{
// Username: "123",
// CustomId: "2323",
//}
//payload := new(bytes.Buffer)
//json.NewEncoder(payload).Encode(createUser)
//
//logs.Debug("temp = ", payload)
//t := time.Now()
//t := time.Now()
//temp := fmt.Sprintf(t.Format("2006-01-02T15:04:05.000000Z"))
//temp := fmt.Sprintf(t.Format("2006-01-02T15:04:05.000000Z"))
//logs.Debug("temp = ", temp)
//logs.Debug("temp = ", temp)
...
@@ -42,10 +52,10 @@ func main() {
...
@@ -42,10 +52,10 @@ func main() {
// logs.SetLogger(logs.AdapterFile, config)
// logs.SetLogger(logs.AdapterFile, config)
//}
//}
str
:=
"2024-02-01T18:41:30"
//
str := "2024-02-01T18:41:30"
layout
:=
"2006-01-02T15:04:05"
//
layout := "2006-01-02T15:04:05"
t
,
_
:=
time
.
Parse
(
layout
,
str
)
//
t, _ := time.Parse(layout, str)
fmt
.
Print
(
"t = %s"
,
t
)
//
fmt.Print("t = %s", t)
//currentTime := time.Now()
//currentTime := time.Now()
////if appRequest.EndTime == nil {
////if appRequest.EndTime == nil {
//tempendTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location())
//tempendTime := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, currentTime.Location())
...
...
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