|
@@ -22,7 +22,7 @@ type menu struct {
|
|
deleteCache xweb.Mapper `xweb:"/manage/delMenuCache"` //清除缓存
|
|
deleteCache xweb.Mapper `xweb:"/manage/delMenuCache"` //清除缓存
|
|
}
|
|
}
|
|
|
|
|
|
-const menuCahceKey = "jyMenuCache"
|
|
|
|
|
|
+const menuCacheKey = "jyMenuCache"
|
|
|
|
|
|
func (m *menu) Menu() error {
|
|
func (m *menu) Menu() error {
|
|
return m.Render("/manage/menu/list.html")
|
|
return m.Render("/manage/menu/list.html")
|
|
@@ -30,7 +30,7 @@ func (m *menu) Menu() error {
|
|
|
|
|
|
func (m *menu) DeleteCache() {
|
|
func (m *menu) DeleteCache() {
|
|
m.ServeJson(map[string]interface{}{
|
|
m.ServeJson(map[string]interface{}{
|
|
- "status": redis.Del("other", menuCahceKey),
|
|
|
|
|
|
+ "status": redis.Del("other", menuCacheKey),
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -51,7 +51,7 @@ func (m *menu) MenuDelete() error {
|
|
res["success"] = mongodb.DelById("jy_topMenu", _id)
|
|
res["success"] = mongodb.DelById("jy_topMenu", _id)
|
|
}
|
|
}
|
|
//清首页缓存
|
|
//清首页缓存
|
|
- redis.Del("other", menuCahceKey)
|
|
|
|
|
|
+ redis.Del("other", menuCacheKey)
|
|
m.ServeJson(&res)
|
|
m.ServeJson(&res)
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
@@ -61,8 +61,25 @@ func (m *menu) MenuSave() error {
|
|
sort, _ := m.GetInteger("i_sort")
|
|
sort, _ := m.GetInteger("i_sort")
|
|
show, _ := m.GetInteger("s_show")
|
|
show, _ := m.GetInteger("s_show")
|
|
date := time.Now().Unix()
|
|
date := time.Now().Unix()
|
|
- siteVal := m.GetString("site")
|
|
|
|
- positionVal := m.GetString("position")
|
|
|
|
|
|
+
|
|
|
|
+ var topMenu, bottomLink []int
|
|
|
|
+
|
|
|
|
+ if arr := strings.Split(m.GetString("topMenu"), ","); len(arr) > 0 {
|
|
|
|
+ for _, v := range arr {
|
|
|
|
+ topMenu = append(topMenu, util.IntAll(v))
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ topMenu = []int{0}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if arr := strings.Split(m.GetString("bottomLink"), ","); len(arr) > 0 {
|
|
|
|
+ for _, v := range arr {
|
|
|
|
+ bottomLink = append(bottomLink, util.IntAll(v))
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ bottomLink = []int{0}
|
|
|
|
+ }
|
|
|
|
+
|
|
doc := map[string]interface{}{
|
|
doc := map[string]interface{}{
|
|
"title": m.GetString("s_title"),
|
|
"title": m.GetString("s_title"),
|
|
"link": m.GetString("link"),
|
|
"link": m.GetString("link"),
|
|
@@ -70,8 +87,8 @@ func (m *menu) MenuSave() error {
|
|
"attr": m.GetString("attr"),
|
|
"attr": m.GetString("attr"),
|
|
"style": m.GetString("style"),
|
|
"style": m.GetString("style"),
|
|
"flex": m.GetString("flex"),
|
|
"flex": m.GetString("flex"),
|
|
- "site": strings.Split(siteVal, ","),
|
|
|
|
- "position": strings.Split(positionVal, ","),
|
|
|
|
|
|
+ "top_menu": topMenu,
|
|
|
|
+ "bottom_link": bottomLink,
|
|
"i_sort": sort,
|
|
"i_sort": sort,
|
|
"i_status": show,
|
|
"i_status": show,
|
|
"l_modifydate": date,
|
|
"l_modifydate": date,
|
|
@@ -98,7 +115,7 @@ func (m *menu) MenuSave() error {
|
|
ok = mongodb.Save("jy_topMenu", doc) != ""
|
|
ok = mongodb.Save("jy_topMenu", doc) != ""
|
|
}
|
|
}
|
|
//清除菜单缓存
|
|
//清除菜单缓存
|
|
- redis.Del("other", menuCahceKey)
|
|
|
|
|
|
+ redis.Del("other", menuCacheKey)
|
|
res["flag"] = ok
|
|
res["flag"] = ok
|
|
res["msg"] = "保存成功"
|
|
res["msg"] = "保存成功"
|
|
m.ServeJson(&res)
|
|
m.ServeJson(&res)
|
|
@@ -116,7 +133,7 @@ func (m *menu) MenuList() error {
|
|
currentPage, _ := m.GetInteger("currentPage")
|
|
currentPage, _ := m.GetInteger("currentPage")
|
|
res := map[string]interface{}{}
|
|
res := map[string]interface{}{}
|
|
res["totalRows"] = mongodb.Count("jy_topMenu", nil)
|
|
res["totalRows"] = mongodb.Count("jy_topMenu", nil)
|
|
- data := *mongodb.Find("jy_topMenu", nil, `{"i_sort":1,"l_createdate":1}`, `{"title":1,"i_status":1,"i_sort":1,"l_createdate":1,"l_modifydate":1,"position":1,"site":1}`, false, (currentPage-1)*size, size)
|
|
|
|
|
|
+ data := *mongodb.Find("jy_topMenu", nil, `{"i_sort":1,"l_createdate":1}`, `{"title":1,"i_status":1,"i_sort":1,"l_createdate":1,"l_modifydate":1,"top_menu":1,"bottom_link":1}`, false, (currentPage-1)*size, size)
|
|
for _, v := range data {
|
|
for _, v := range data {
|
|
data_c := v["l_createdate"]
|
|
data_c := v["l_createdate"]
|
|
v["l_createdate"] = util.FormatDateWithObj(&data_c, util.Date_Full_Layout)
|
|
v["l_createdate"] = util.FormatDateWithObj(&data_c, util.Date_Full_Layout)
|