From e3275ba9f6a19b9ced2ff5a0667f9af4bc4851ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=B6=E5=A3=AB=E6=B6=B5?= <630892807@qq.com>
Date: Thu, 27 Aug 2020 23:06:19 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=AC=A2=E8=BF=8E=E8=AF=AD?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
controller/notice.go | 9 +++++++++
main.go | 1 +
models/welcomes.go | 5 +++++
static/html/setting_bottom.html | 6 ++++++
static/html/setting_left.html | 2 +-
tmpl/setting.go | 4 ++--
6 files changed, 24 insertions(+), 3 deletions(-)
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",
})
}