|
@@ -9,6 +9,7 @@ import ( |
|
|
"applet/app/utils/cache" |
|
|
"applet/app/utils/cache" |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"errors" |
|
|
"errors" |
|
|
|
|
|
"fmt" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/tidwall/gjson" |
|
|
"github.com/tidwall/gjson" |
|
|
) |
|
|
) |
|
@@ -28,11 +29,16 @@ func GetMenu(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
var offcialMenuList = make([]md.OffcialWechatButton, 0) |
|
|
var offcialMenuList = make([]md.OffcialWechatButton, 0) |
|
|
menu, err := utils.GetWechatSelfMenu(token) |
|
|
menu, err := utils.GetWechatSelfMenu(token) |
|
|
|
|
|
fmt.Println(menu) |
|
|
menuStr := gjson.Get(menu, "selfmenu_info.button").String() |
|
|
menuStr := gjson.Get(menu, "selfmenu_info.button").String() |
|
|
json.Unmarshal([]byte(menuStr), &offcialMenuList) |
|
|
json.Unmarshal([]byte(menuStr), &offcialMenuList) |
|
|
for _, v := range offcialMenuList { |
|
|
for _, v := range offcialMenuList { |
|
|
var tmp = md.WechatButton{ |
|
|
var tmp = md.WechatButton{ |
|
|
Name: v.Name, |
|
|
Name: v.Name, |
|
|
|
|
|
Type: v.Type, |
|
|
|
|
|
Url: v.Url, |
|
|
|
|
|
Pagepath: v.Pagepath, |
|
|
|
|
|
Appid: v.Appid, |
|
|
SubButton: []md.WechatSubButton{}, |
|
|
SubButton: []md.WechatSubButton{}, |
|
|
} |
|
|
} |
|
|
for _, v1 := range v.SubButton.List { |
|
|
for _, v1 := range v.SubButton.List { |
|
@@ -57,8 +63,16 @@ func GetMenu(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
sysCfgDb.SysCfgUpdate("wechat_menu", utils.SerializeStr(menuList)) |
|
|
sysCfgDb.SysCfgUpdate("wechat_menu", utils.SerializeStr(menuList)) |
|
|
} |
|
|
} |
|
|
|
|
|
replyContentSet := []map[string]string{ |
|
|
|
|
|
{"msgType": "text", "name": "文本"}, |
|
|
|
|
|
{"msgType": "image", "name": "图片"}, |
|
|
|
|
|
{"msgType": "video", "name": "视频"}, |
|
|
|
|
|
{"msgType": "voice", "name": "语音"}, |
|
|
|
|
|
{"msgType": "article", "name": "文章"}, |
|
|
|
|
|
} |
|
|
res := map[string]interface{}{ |
|
|
res := map[string]interface{}{ |
|
|
"button": menuList, |
|
|
|
|
|
|
|
|
"button": menuList, |
|
|
|
|
|
"replyContentSet": replyContentSet, |
|
|
} |
|
|
} |
|
|
e.OutSuc(c, res, nil) |
|
|
e.OutSuc(c, res, nil) |
|
|
} |
|
|
} |
|
|