|
|
@@ -9,6 +9,7 @@ import ( |
|
|
|
"applet/app/utils/cache" |
|
|
|
"encoding/json" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"github.com/tidwall/gjson" |
|
|
|
) |
|
|
@@ -28,11 +29,16 @@ func GetMenu(c *gin.Context) { |
|
|
|
} |
|
|
|
var offcialMenuList = make([]md.OffcialWechatButton, 0) |
|
|
|
menu, err := utils.GetWechatSelfMenu(token) |
|
|
|
fmt.Println(menu) |
|
|
|
menuStr := gjson.Get(menu, "selfmenu_info.button").String() |
|
|
|
json.Unmarshal([]byte(menuStr), &offcialMenuList) |
|
|
|
for _, v := range offcialMenuList { |
|
|
|
var tmp = md.WechatButton{ |
|
|
|
Name: v.Name, |
|
|
|
Type: v.Type, |
|
|
|
Url: v.Url, |
|
|
|
Pagepath: v.Pagepath, |
|
|
|
Appid: v.Appid, |
|
|
|
SubButton: []md.WechatSubButton{}, |
|
|
|
} |
|
|
|
for _, v1 := range v.SubButton.List { |
|
|
@@ -57,8 +63,16 @@ func GetMenu(c *gin.Context) { |
|
|
|
} |
|
|
|
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{}{ |
|
|
|
"button": menuList, |
|
|
|
"button": menuList, |
|
|
|
"replyContentSet": replyContentSet, |
|
|
|
} |
|
|
|
e.OutSuc(c, res, nil) |
|
|
|
} |
|
|
|