编辑修改自动回复内容

pull/23/head
陶士涵 4 years ago
parent 1581b69627
commit f0ea379b16

@ -52,6 +52,17 @@ func PostNotice(c *gin.Context) {
"result": "",
})
}
func PostNoticeSave(c *gin.Context) {
kefuId, _ := c.Get("kefu_name")
content := c.PostForm("content")
id := c.PostForm("id")
models.UpdateWelcome(fmt.Sprintf("%s", kefuId),id, content)
c.JSON(200, gin.H{
"code": 200,
"msg": "ok",
"result": "",
})
}
func DelNotice(c *gin.Context) {
kefuId, _ := c.Get("kefu_name")
id := c.Query("id")

@ -22,6 +22,16 @@ func CreateWelcome(userId string, content string) uint {
DB.Create(w)
return w.ID
}
func UpdateWelcome(userId string,id string, content string) uint {
if userId == "" || content == "" {
return 0
}
w := &Welcome{
Content: content,
}
DB.Model(w).Where("user_id = ? and id = ?", userId,id).Update(w)
return w.ID
}
func FindWelcomeByUserId(userId interface{}) Welcome {
var w Welcome
DB.Where("user_id = ? and is_default=?", userId, 1).First(&w)

@ -50,6 +50,7 @@ func InitApiRouter(engine *gin.Engine) {
engine.GET("/notice", middleware.SetLanguage, controller.GetNotice)
engine.POST("/notice", middleware.JwtApiMiddleware, controller.PostNotice)
engine.DELETE("/notice", middleware.JwtApiMiddleware, controller.DelNotice)
engine.POST("/notice_save", middleware.JwtApiMiddleware, controller.PostNoticeSave)
engine.GET("/notices", middleware.JwtApiMiddleware, controller.GetNotices)
engine.POST("/ipblack", middleware.JwtApiMiddleware, controller.PostIpblack)
engine.DELETE("/ipblack", middleware.JwtApiMiddleware, controller.DelIpblack)

@ -342,6 +342,15 @@
});
});
},
//设置配置项
setWelcomeItem(id,content){
let _this=this;
this.sendAjax("/notice_save","POST",{id:id,content:content},function(result){
_this.sendAjax("/notices","get",{},function(result){
_this.noticeList=result;
});
});
},
//提交角色表单
submitRoleForm(formName){
let _this=this;

@ -13,6 +13,9 @@
<el-table-column
prop="content"
label="回复内容">
<template slot-scope="scope">
<el-input @change="setWelcomeItem(scope.row.id,scope.row.content)" v-model="scope.row.content"></el-input>
</template>
</el-table-column>
<el-table-column
prop="ctime"

Loading…
Cancel
Save