/// <summary> /// 创建菜单 /// </summary> /// <param name="Response"></param> /// <param name="msg"></param> public static void CreateMenu() { StringBuilder sb = new StringBuilder(); string url = ConfigurationManager.AppSettings["WeiXinDomain"]; string json = "{\"button\":[" + "{\"name\":\"我的\",\"sub_button\":[" + "{\"type\":\"view\",\"name\":\"我的账户\",\"url\":\"" + url + "component/personal\"}," + "{\"type\":\"view\",\"name\":\"我要注册\",\"url\":\"" + url + "component/register\"}," + "{\"type\":\"view\",\"name\":\"会员须知\",\"url\":\"" + url + "component/membernotice\"}," + "{\"type\": \"scancode_waitmsg\",\"name\": \"扫一扫\",\"key\": \"rselfmenu_0_1\",\"sub_button\": [ ]}]" + "}," + "{\"name\":\"家味\",\"sub_button\":[" + "{\"type\":\"view\",\"name\":\"积分红包\",\"url\":\"http://mp.weixin.qq.com/s/5H6_rnk86ai2fOs-ChI2Gg\"}," + "{\"type\":\"view\",\"name\":\"免费抽奖\",\"url\":\"" + url + "component/hometastedraw\"}," + "{\"type\":\"view\",\"name\":\"年夜饭菜谱\",\"url\":\"" + url + "component/menu\"}]" + "}," + "{\"name\":\"积分活动\",\"sub_button\":[" + "{\"type\":\"view\",\"name\":\"每日签到\",\"url\":\"" + url + "component/sign\"}," + "{\"type\":\"view\",\"name\":\"积分兑换\",\"url\":\"" + url + "component/shop\"}," + "{\"type\":\"view\",\"name\":\"积分抽奖\",\"url\":\"" + url + "component/integraldraw\"}," + "{\"type\":\"view\",\"name\":\"扫码规则\",\"url\":\"" + url + "component/activityrule\"}]" + "}" + "]}"; // string json = "{\"button\":[" + // "{\"name\":\"我的\",\"sub_button\":[" + // "{\"type\":\"view\",\"name\":\"我的账户\",\"url\":\"http://testjifenweixin.shinho.net.cn/#/component/personal\"}," + // "{\"type\":\"view\",\"name\":\"我要注册\",\"url\":\"http://testjifenweixin.shinho.net.cn/#/component/register\"}," + // "{\"type\":\"view\",\"name\":\"会员须知\",\"url\":\"http://testjifenweixin.shinho.net.cn/#/component/membernotice\"}," + // "{\"type\": \"scancode_waitmsg\",\"name\": \"扫一扫\",\"key\": \"rselfmenu_0_1\",\"sub_button\": [ ]}]" + // "}," + // "{\"name\":\"家味\",\"sub_button\":[" + // "{\"type\":\"view\",\"name\":\"每日资讯\",\"url\":\"http://m.linkshop.com/news/show.aspx?id=394095&from=singlemessage\"}," + // "{\"type\":\"view\",\"name\":\"年夜饭菜谱\",\"url\":\"" + url + "component/menu\"}]" + // "}," + // "{\"name\":\"积分活动\",\"sub_button\":[" + // "{\"type\":\"view\",\"name\":\"积分红包\",\"url\":\"http://mp.weixin.qq.com/s/5H6_rnk86ai2fOs-ChI2Gg\"}," + // "{\"type\":\"view\",\"name\":\"每日签到\",\"url\":\"http://testjifenweixin.shinho.net.cn/#/component/sign\"}," + // "{\"type\":\"view\",\"name\":\"积分兑换\",\"url\":\"" + url + "component/shop\"}," + // "{\"type\":\"view\",\"name\":\"积分抽奖\",\"url\":\"" + url + "component/integraldraw\"}," + // "{\"type\":\"view\",\"name\":\"扫码规则\",\"url\":\"" + url + "component/activityrule\"}]" + // "}" + //"]}"; PostJson("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + BasicApi.GetAccessToken(), json); }
/// <summary> /// 创建队员关注二维码 /// </summary> public static string CreateSubscribeQRcode(int salemanId) { string json = "{\"expire_seconds\": 1800, \"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": " + salemanId.ToString() + "}}}"; string ret = PostJson("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + BasicApi.GetAccessToken(), json); var q = JsonHelper.JsonToObject <QRcode>(ret); return(q.ticket); }
/// <summary> /// 1注册成功给1发模板消息 /// </summary> /// <param name="Response"></param> /// <param name="msg"></param> public static void SendMuBanMsg(string json) { PostJson("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + BasicApi.GetAccessToken(), json); }