package com.yeshi.fanli.service.impl.config; import org.springframework.stereotype.Service; import com.yeshi.fanli.service.inter.config.WXGZService; import com.yeshi.fanli.util.Constant; import org.yeshi.utils.wx.WXUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @Service public class WXGZServiceImpl implements WXGZService { @Override public void initMenu() { String appId = Constant.systemCommonConfig.getWxGZAppId(); String appSecret = Constant.systemCommonConfig.getWxGZAppSecret(); String accessToken = WXUtil.getAcessToken(appId, appSecret); JSONObject root = new JSONObject(); JSONArray items = new JSONArray(); JSONObject data1 = new JSONObject(); data1.put("type", "view"); data1.put("name", "下载" + Constant.systemCommonConfig.getProjectChineseName()); data1.put("url", Constant.wxGZConfig.getAppDownloadLink()); items.add(data1); data1 = new JSONObject(); data1.put("type", "view"); data1.put("name", "领取优惠券"); data1.put("url", Constant.wxGZConfig.getH5Url()); items.add(data1); data1 = new JSONObject(); data1.put("type", "view"); data1.put("name", "帮助中心"); data1.put("url", Constant.wxGZConfig.getHelpUrl()); items.add(data1); root.put("button", items); WXUtil.createMenu(accessToken, root); } }