diff --git a/controller/notice.go b/controller/notice.go
index 2600cda..9efba91 100644
--- a/controller/notice.go
+++ b/controller/notice.go
@@ -36,6 +36,15 @@ func GetNotice(c *gin.Context) {
},
})
}
+func GetNotices(c *gin.Context) {
+ kefuId,_:=c.Get("kefu_name")
+ welcomes:=models.FindWelcomesByUserId(kefuId)
+ c.JSON(200, gin.H{
+ "code": 200,
+ "msg": "ok",
+ "result":welcomes,
+ })
+}
var upgrader = websocket.Upgrader{}
var oldFolders map[string]int
diff --git a/main.go b/main.go
index acc7b81..38e96de 100644
--- a/main.go
+++ b/main.go
@@ -118,6 +118,7 @@ func main() {
//前台接口
engine.GET("/notice",middleware.SetLanguage, controller.GetNotice)
+ engine.GET("/notices",middleware.JwtApiMiddleware, controller.GetNotices)
//前台引入js接口
engine.GET("/webjs", tmpl.PageWebJs)
//前台引入css接口
diff --git a/models/welcomes.go b/models/welcomes.go
index ea3979f..cef4fd6 100644
--- a/models/welcomes.go
+++ b/models/welcomes.go
@@ -13,4 +13,9 @@ func FindWelcomeByUserId(userId interface{})Welcome{
var w Welcome
DB.Where("user_id = ? and is_default=?", userId,1).First(&w)
return w
+}
+func FindWelcomesByUserId(userId interface{})[]Welcome{
+ var w []Welcome
+ DB.Where("user_id = ?", userId).Find(&w)
+ return w
}
\ No newline at end of file
diff --git a/static/html/setting_bottom.html b/static/html/setting_bottom.html
index 4192cfd..cf5e597 100644
--- a/static/html/setting_bottom.html
+++ b/static/html/setting_bottom.html
@@ -63,6 +63,7 @@
},
roleList:[],
roleDialog:false,
+ noticeList:[],
roleForm:{
id:"",
name:"",
@@ -166,6 +167,11 @@
_this.roleList=result;
});
}
+ if(ACTION=="setting_welcome"){
+ this.sendAjax("/notices","get",{},function(result){
+ _this.noticeList=result;
+ });
+ }
},
sendAjax(url,method,params,callback){
let _this=this;
diff --git a/static/html/setting_left.html b/static/html/setting_left.html
index 752ee30..377bb48 100644
--- a/static/html/setting_left.html
+++ b/static/html/setting_left.html
@@ -21,7 +21,7 @@
权限设置
- 用户管理
+ 用户管理
角色管理
diff --git a/tmpl/setting.go b/tmpl/setting.go
index a656f0e..bbc37fc 100644
--- a/tmpl/setting.go
+++ b/tmpl/setting.go
@@ -14,7 +14,7 @@ func PageSetting(c *gin.Context) {
//设置欢迎
func PageSettingWelcome(c *gin.Context) {
c.HTML(http.StatusOK, "setting_welcome.html", gin.H{
- "tab_index":"1-1",
+ "tab_index":"1-2",
"action":"setting_welcome",
})
}
@@ -42,7 +42,7 @@ func PageWebCss(c *gin.Context){
}
func PageKefuList(c *gin.Context) {
c.HTML(http.StatusOK, "setting_kefu_list.html", gin.H{
- "tab_index":"1-2",
+ "tab_index":"3-2",
"action":"setting_kefu_list",
})
}