Skip to content

Commit

Permalink
feat: 修改配置后免重启
Browse files Browse the repository at this point in the history
  • Loading branch information
rehiy committed Mar 2, 2024
1 parent a658f69 commit c30d92a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions httpd/wrobot/chatroom.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"

"github.com/opentdp/wechat-rest/dbase/chatroom"
"github.com/opentdp/wechat-rest/wclient/robot"
)

type Chatroom struct{}
Expand Down Expand Up @@ -72,6 +73,7 @@ func (*Chatroom) create(c *gin.Context) {
if id, err := chatroom.Create(rq); err == nil {
c.Set("Message", "添加成功")
c.Set("Payload", id)
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -95,6 +97,7 @@ func (*Chatroom) update(c *gin.Context) {

if err := chatroom.Update(rq); err == nil {
c.Set("Message", "更新成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -118,6 +121,7 @@ func (*Chatroom) delete(c *gin.Context) {

if err := chatroom.Delete(rq); err == nil {
c.Set("Message", "删除成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand Down
4 changes: 4 additions & 0 deletions httpd/wrobot/keyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"

"github.com/opentdp/wechat-rest/dbase/keyword"
"github.com/opentdp/wechat-rest/wclient/robot"
)

type Keyword struct{}
Expand Down Expand Up @@ -72,6 +73,7 @@ func (*Keyword) create(c *gin.Context) {
if id, err := keyword.Create(rq); err == nil {
c.Set("Message", "添加成功")
c.Set("Payload", id)
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -95,6 +97,7 @@ func (*Keyword) update(c *gin.Context) {

if err := keyword.Update(rq); err == nil {
c.Set("Message", "更新成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -118,6 +121,7 @@ func (*Keyword) delete(c *gin.Context) {

if err := keyword.Delete(rq); err == nil {
c.Set("Message", "删除成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand Down
4 changes: 4 additions & 0 deletions httpd/wrobot/llmodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"

"github.com/opentdp/wechat-rest/dbase/llmodel"
"github.com/opentdp/wechat-rest/wclient/robot"
)

type LLModel struct{}
Expand Down Expand Up @@ -72,6 +73,7 @@ func (*LLModel) create(c *gin.Context) {
if id, err := llmodel.Create(rq); err == nil {
c.Set("Message", "添加成功")
c.Set("Payload", id)
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -95,6 +97,7 @@ func (*LLModel) update(c *gin.Context) {

if err := llmodel.Update(rq); err == nil {
c.Set("Message", "更新成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -118,6 +121,7 @@ func (*LLModel) delete(c *gin.Context) {

if err := llmodel.Delete(rq); err == nil {
c.Set("Message", "删除成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand Down
4 changes: 4 additions & 0 deletions httpd/wrobot/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"

"github.com/opentdp/wechat-rest/dbase/profile"
"github.com/opentdp/wechat-rest/wclient/robot"
)

type Profile struct{}
Expand Down Expand Up @@ -72,6 +73,7 @@ func (*Profile) create(c *gin.Context) {
if id, err := profile.Create(rq); err == nil {
c.Set("Message", "添加成功")
c.Set("Payload", id)
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -95,6 +97,7 @@ func (*Profile) update(c *gin.Context) {

if err := profile.Update(rq); err == nil {
c.Set("Message", "更新成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand All @@ -118,6 +121,7 @@ func (*Profile) delete(c *gin.Context) {

if err := profile.Delete(rq); err == nil {
c.Set("Message", "删除成功")
robot.Redo()
} else {
c.Set("Error", err)
}
Expand Down
2 changes: 2 additions & 0 deletions httpd/wrobot/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (*Setting) create(c *gin.Context) {
if id, err := setting.Create(rq); err == nil {
c.Set("Message", "添加成功")
c.Set("Payload", id)
setting.Laod()
} else {
c.Set("Error", err)
}
Expand Down Expand Up @@ -119,6 +120,7 @@ func (*Setting) delete(c *gin.Context) {

if err := setting.Delete(rq); err == nil {
c.Set("Message", "删除成功")
setting.Laod()
} else {
c.Set("Error", err)
}
Expand Down

0 comments on commit c30d92a

Please sign in to comment.