Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
szh
chain33-pai
Commits
361cd0ae
Commit
361cd0ae
authored
Jan 10, 2020
by
ligaishun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update pai.go
parent
c6062c7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
7 deletions
+65
-7
pai.go
routers/api/v1/pai.go
+65
-7
No files found.
routers/api/v1/pai.go
View file @
361cd0ae
package
v1
package
v1
import
(
import
(
"github.com/gin-gonic/gin"
"chain33-pai/models"
"net/http"
"chain33-pai/pkg/app"
"chain33-pai/pkg/app"
"chain33-pai/pkg/e"
"chain33-pai/pkg/e"
"chain33-pai/pkg/logging"
"chain33-pai/service/pai_service"
"chain33-pai/service/pai_service"
"chain33-pai/service/stat_service"
"chain33-pai/service/stat_service"
"chain33-pai/pkg/logging"
"chain33-pai/models"
"chain33-pai/service/version_service"
"chain33-pai/service/version_service"
"fmt"
"github.com/gin-gonic/gin"
"log"
"net/http"
)
)
func
GetDevdetail
(
c
*
gin
.
Context
)
{
func
GetDevdetail
(
c
*
gin
.
Context
)
{
appG
:=
app
.
Gin
{
C
:
c
}
appG
:=
app
.
Gin
{
C
:
c
}
var
pai
pai_service
.
Pai
var
pai
pai_service
.
Pai
...
@@ -105,4 +106,62 @@ func GetVersion(c *gin.Context) {
...
@@ -105,4 +106,62 @@ func GetVersion(c *gin.Context) {
return
return
}
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
version
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
version
)
}
}
\ No newline at end of file
var
KP
map
[
string
]
string
func
IsComplete
(
c
*
gin
.
Context
){
appG
:=
app
.
Gin
{
C
:
c
}
err
:=
appG
.
C
.
ShouldBindJSON
(
&
KP
)
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
INVALID_PARAMS
,
nil
)
return
}
if
KP
[
"port"
]
!=
""
{
if
models
.
IsComplete
(
KP
[
"port"
])
{
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
gin
.
H
{
"status"
:
"ok"
,
})
return
}
appG
.
Response
(
http
.
StatusOK
,
e
.
UNDONE
,
nil
)
return
}
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
"参数错误"
)
}
func
FeedBack
(
c
*
gin
.
Context
){
appG
:=
app
.
Gin
{
C
:
c
}
err
:=
appG
.
C
.
ShouldBindJSON
(
&
KP
)
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
INVALID_PARAMS
,
nil
)
return
}
app
.
AppendKeyPair
(
KP
[
"public"
])
//fmt.Println(KP["public"])
port
,
daemonPort
,
err
:=
app
.
GennerPort
()
if
err
!=
nil
{
appG
.
C
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"nsg"
:
"fail"
,
"code"
:
"500"
,
"port"
:
fmt
.
Sprint
(
port
),
"daemon"
:
fmt
.
Sprint
(
daemonPort
),
})
log
.
Println
(
err
)
return
}
models
.
AddFeedBack
(
models
.
RaspFeedback
{
Id
:
fmt
.
Sprint
(
port
),
Description
:
KP
[
"description"
],
Complete
:
false
,
})
appG
.
C
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"msg"
:
"ok"
,
"code"
:
"200"
,
"port"
:
fmt
.
Sprint
(
port
),
"daemon"
:
fmt
.
Sprint
(
daemonPort
),
})
}
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