Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
nizhengjia888
gin-vue-admin
提交
e4d3bb8b
G
gin-vue-admin
项目概览
nizhengjia888
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e4d3bb8b
编写于
5月 12, 2021
作者:
Mr.奇淼(
提交者:
GitHub
5月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
新增自动迁移创建路由后重启
新增自动迁移创建路由后重启
上级
f7ffbf2d
8d6f7008
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
24 deletion
+40
-24
server/api/v1/sys_system.go
server/api/v1/sys_system.go
+2
-11
server/config.yaml
server/config.yaml
+1
-0
server/config/auto_code.go
server/config/auto_code.go
+14
-13
server/service/sys_auto_code.go
server/service/sys_auto_code.go
+5
-0
server/utils/reload.go
server/utils/reload.go
+18
-0
未找到文件。
server/api/v1/sys_system.go
浏览文件 @
e4d3bb8b
...
...
@@ -5,10 +5,7 @@ import (
"gin-vue-admin/model"
"gin-vue-admin/model/response"
"gin-vue-admin/service"
"os"
"os/exec"
"runtime"
"strconv"
"gin-vue-admin/utils"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
...
...
@@ -54,13 +51,7 @@ func SetSystemConfig(c *gin.Context) {
// @Success 200 {string} string "{"code":0,"data":{},"msg":"重启系统成功"}"
// @Router /system/reloadSystem [post]
func
ReloadSystem
(
c
*
gin
.
Context
)
{
if
runtime
.
GOOS
==
"windows"
{
response
.
FailWithMessage
(
"系统不支持"
,
c
)
return
}
pid
:=
os
.
Getpid
()
cmd
:=
exec
.
Command
(
"kill"
,
"-1"
,
strconv
.
Itoa
(
pid
))
err
:=
cmd
.
Run
()
err
:=
utils
.
Reload
()
if
err
!=
nil
{
global
.
GVA_LOG
.
Error
(
"重启系统失败!"
,
zap
.
Any
(
"err"
,
err
))
response
.
FailWithMessage
(
"重启系统失败"
,
c
)
...
...
server/config.yaml
浏览文件 @
e4d3bb8b
...
...
@@ -70,6 +70,7 @@ local:
# autocode configuration
autocode
:
transfer-restart
:
true
root
:
"
"
server
:
/server
server-api
:
/api/v1
...
...
server/config/auto_code.go
浏览文件 @
e4d3bb8b
package
config
type
Autocode
struct
{
Root
string
`mapstructure:"root" json:"root" yaml:"root"`
Server
string
`mapstructure:"server" json:"server" yaml:"server"`
SApi
string
`mapstructure:"server-api" json:"serverApi" yaml:"server-api"`
SInitialize
string
`mapstructure:"server-initialize" json:"serverInitialize" yaml:"server-initialize"`
SModel
string
`mapstructure:"server-model" json:"serverModel" yaml:"server-model"`
SRequest
string
`mapstructure:"server-request" json:"serverRequest" yaml:"server-request"`
SRouter
string
`mapstructure:"server-router" json:"serverRouter" yaml:"server-router"`
SService
string
`mapstructure:"server-service" json:"serverService" yaml:"server-service"`
Web
string
`mapstructure:"web" json:"web" yaml:"web"`
WApi
string
`mapstructure:"web-api" json:"webApi" yaml:"web-api"`
WForm
string
`mapstructure:"web-form" json:"webForm" yaml:"web-form"`
WTable
string
`mapstructure:"web-table" json:"webTable" yaml:"web-table"`
WFlow
string
`mapstructure:"web-flow" json:"webFlow" yaml:"web-flow"`
TransferRestart
bool
`mapstructure:"transfer-restart" json:"transferRestart" yaml:"transfer-restart"`
Root
string
`mapstructure:"root" json:"root" yaml:"root"`
Server
string
`mapstructure:"server" json:"server" yaml:"server"`
SApi
string
`mapstructure:"server-api" json:"serverApi" yaml:"server-api"`
SInitialize
string
`mapstructure:"server-initialize" json:"serverInitialize" yaml:"server-initialize"`
SModel
string
`mapstructure:"server-model" json:"serverModel" yaml:"server-model"`
SRequest
string
`mapstructure:"server-request" json:"serverRequest" yaml:"server-request"`
SRouter
string
`mapstructure:"server-router" json:"serverRouter" yaml:"server-router"`
SService
string
`mapstructure:"server-service" json:"serverService" yaml:"server-service"`
Web
string
`mapstructure:"web" json:"web" yaml:"web"`
WApi
string
`mapstructure:"web-api" json:"webApi" yaml:"web-api"`
WForm
string
`mapstructure:"web-form" json:"webForm" yaml:"web-form"`
WTable
string
`mapstructure:"web-table" json:"webTable" yaml:"web-table"`
WFlow
string
`mapstructure:"web-flow" json:"webFlow" yaml:"web-flow"`
}
server/service/sys_auto_code.go
浏览文件 @
e4d3bb8b
...
...
@@ -146,6 +146,11 @@ func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
if
err
!=
nil
{
return
err
}
if
global
.
GVA_CONFIG
.
AutoCode
.
TransferRestart
{
go
func
()
{
_
=
utils
.
Reload
()
}()
}
return
errors
.
New
(
"创建代码成功并移动文件成功"
)
}
else
{
// 打包
if
err
:=
utils
.
ZipFiles
(
"./ginvueadmin.zip"
,
fileList
,
"."
,
"."
);
err
!=
nil
{
...
...
server/utils/reload.go
0 → 100644
浏览文件 @
e4d3bb8b
package
utils
import
(
"errors"
"os"
"os/exec"
"runtime"
"strconv"
)
func
Reload
()
error
{
if
runtime
.
GOOS
==
"windows"
{
return
errors
.
New
(
"系统不支持"
)
}
pid
:=
os
.
Getpid
()
cmd
:=
exec
.
Command
(
"kill"
,
"-1"
,
strconv
.
Itoa
(
pid
))
return
cmd
.
Run
()
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录