string GetcmethodUrl() { string url = ""; if (wxacodepaty == null) { if (auto_color) { line_color = null; } switch (codetype) { case CodeType.code: page = null; scene = null; wxacodepaty = new wxaPath_code(path, width, auto_color, line_color, is_hyaline); break; case CodeType.codeunlimit: path = null; wxacodepaty = new wxaPath_codeunlimit(scene, width, page, auto_color, line_color, is_hyaline); break; case CodeType.appqrcode: auto_color = true; line_color = null; page = null; scene = null; wxacodepaty = new wxaPath_appqrcode(path, width); break; } } switch (wxacodepaty.GetType().Name) { case "wxaPath_appqrcode": url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="; break; case "wxaPath_code": url = "https://api.weixin.qq.com/wxa/getwxacode?access_token="; break; case "wxaPath_codeunlimit": url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="; break; } return(url + new HightToken(c).Token); }
public WxaCodeResponse send(string url) { var st = new Newtonsoft.Json.JsonSerializerSettings(); st.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; var pjson = Newtonsoft.Json.JsonConvert.SerializeObject(wxacodepaty, st); var stm = BaseClass.BaseMethod.WebRequestPostBase <System.Drawing.Image>(pjson, url, Encoding.UTF8, delegate(Stream stms, string ContentType, WebHeaderCollection headers) { Image mImage = Image.FromStream(stms); stms.Close(); return(mImage); }); WxaCodeResponse wr = new WxaCodeResponse(); wr.img = stm; wxacodepaty = null; return(wr); //return Newtonsoft.Json.JsonConvert.DeserializeObject<WxaCodeResponse>(json); }
/// <summary> /// 初始化(推荐使用) /// </summary> /// <param name="_c"></param> /// <param name="_wxacodepaty"></param> public WxaCodeRequest(Config _c, IwxaCodePath _wxacodepaty) { this.c = _c; this.wxacodepaty = _wxacodepaty; }