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
7e1b435e
Commit
7e1b435e
authored
Dec 18, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pai下载更新
parent
bebe8928
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
code.go
pkg/e/code.go
+1
-1
msg.go
pkg/e/msg.go
+1
-0
pai.go
routers/api/v1/pai.go
+15
-1
No files found.
pkg/e/code.go
View file @
7e1b435e
...
@@ -12,7 +12,7 @@ const (
...
@@ -12,7 +12,7 @@ const (
DOWNLOAD_ERROR
=
5005
DOWNLOAD_ERROR
=
5005
TAR_XVF_ERROR
=
5006
TAR_XVF_ERROR
=
5006
CP_ERROR
=
5007
CP_ERROR
=
5007
RM_ERROR
=
5008
ERROR_EXIST_TAG
=
10001
ERROR_EXIST_TAG
=
10001
ERROR_EXIST_TAG_FAIL
=
10002
ERROR_EXIST_TAG_FAIL
=
10002
ERROR_NOT_EXIST_TAG
=
10003
ERROR_NOT_EXIST_TAG
=
10003
...
...
pkg/e/msg.go
View file @
7e1b435e
...
@@ -7,6 +7,7 @@ var MsgFlags = map[int]string{
...
@@ -7,6 +7,7 @@ var MsgFlags = map[int]string{
DOWNLOAD_ERROR
:
"下载出错"
,
DOWNLOAD_ERROR
:
"下载出错"
,
TAR_XVF_ERROR
:
"解压文件出错"
,
TAR_XVF_ERROR
:
"解压文件出错"
,
CP_ERROR
:
"拷贝文件出错"
,
CP_ERROR
:
"拷贝文件出错"
,
RM_ERROR
:
"删除文件出错"
,
ERROR_EXIST_TAG
:
"已存在该标签名称"
,
ERROR_EXIST_TAG
:
"已存在该标签名称"
,
ERROR_EXIST_TAG_FAIL
:
"获取已存在标签失败"
,
ERROR_EXIST_TAG_FAIL
:
"获取已存在标签失败"
,
ERROR_NOT_EXIST_TAG
:
"该标签不存在"
,
ERROR_NOT_EXIST_TAG
:
"该标签不存在"
,
...
...
routers/api/v1/pai.go
View file @
7e1b435e
...
@@ -104,7 +104,7 @@ func UpdatePai(c *gin.Context) {
...
@@ -104,7 +104,7 @@ func UpdatePai(c *gin.Context) {
return
return
}
}
//替换原执行文件
//替换原执行文件
replace
:=
exec
.
Command
(
"
cp
"
,
setting
.
Chain33Pai
.
DownloadDir
+
"/"
+
setting
.
Chain33Pai
.
Name
,
setting
.
Chain33Pai
.
Name
)
replace
:=
exec
.
Command
(
"
mv
"
,
setting
.
Chain33Pai
.
DownloadDir
+
"/"
+
setting
.
Chain33Pai
.
Name
,
setting
.
Chain33Pai
.
Name
)
err
=
replace
.
Start
()
err
=
replace
.
Start
()
if
err
!=
nil
{
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
CP_ERROR
,
nil
)
appG
.
Response
(
http
.
StatusOK
,
e
.
CP_ERROR
,
nil
)
...
@@ -117,5 +117,18 @@ func UpdatePai(c *gin.Context) {
...
@@ -117,5 +117,18 @@ func UpdatePai(c *gin.Context) {
}
}
//对比配置文件 比较麻烦
//对比配置文件 比较麻烦
//删除temp文件夹
//替换原执行文件
remove
:=
exec
.
Command
(
"rm"
,
"-rf"
,
setting
.
Chain33Pai
.
DownloadDir
,
name
)
err
=
remove
.
Start
()
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
RM_ERROR
,
nil
)
return
}
err
=
remove
.
Wait
()
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
RM_ERROR
,
nil
)
return
}
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
appG
.
Response
(
http
.
StatusOK
,
e
.
SUCCESS
,
nil
)
}
}
\ No newline at end of file
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