/// <summary> /// 邀请码 /// </summary> /// <param name="qr"></param> /// <param name="context"></param> /// <returns></returns> public static EQRInfo CreateMasterUrlById(EQRInfo qr, HttpContext context) { try { if (qr.ID == 0) { throw new Exception("创建QR错误,QR ID 不存在"); } string url = "http://wx.iqianba.cn/api/wx/CreateInviteQR"; string data = string.Format("QRId={0}&QRType={1}", qr.ID, qr.Type); string res = HttpHelper.RequestUrlSendMsg(url, HttpHelper.HttpMethod.Post, data, "application/x-www-form-urlencoded"); SSOQR obj = JsonConvert.DeserializeObject <SSOQR>(res); qr.TargetUrl = obj.TargetUrl; System.Drawing.Image bkImg = ImgHelper.GetImgFromUrl(qr.TargetUrl); string filePath = "/Content/QR/Invite/Orig_QRInvite_" + qr.ID + ".jpg"; qr.OrigFilePath = filePath; string fullPath = context.Server.MapPath(filePath); bkImg.Save(fullPath); Bitmap logo = new Bitmap(context.Server.MapPath(@"/Content/QR/Logo_AR.png")); Bitmap finImg = ImgHelper.ImageWatermark(new Bitmap(bkImg), logo); filePath = "/Content/QR/Invite/QRInvite_" + qr.ID + ".jpg"; qr.FilePath = filePath; fullPath = context.Server.MapPath(filePath); finImg.Save(fullPath); finImg.Dispose(); bkImg.Dispose(); return(qr); } catch (Exception ex) { IQBLog log = new IQBLog(); log.log("CreateMasterUrlById Error:" + ex.Message); throw ex; } }
/// <summary> /// 刷单邀请码 /// </summary> /// <param name="qr"></param> /// <param name="context"></param> /// <returns></returns> #region ShuaDan public static OutAPIResult CreateShuaDan_InviteQR(HttpContext context) { OutAPIResult r = new OutAPIResult(); try { string url = "http://wx.iqianba.cn/api/wx/CreateShuDanInviteQR"; string data = string.Format("?sId={0}", 100); url += data; string res = HttpHelper.RequestUrlSendMsg(url, HttpHelper.HttpMethod.Post, data, "application/x-www-form-urlencoded"); SSOQR obj = JsonConvert.DeserializeObject <SSOQR>(res); //qr.TargetUrl = obj.TargetUrl; System.Drawing.Image bkImg = ImgHelper.GetImgFromUrl(obj.TargetUrl); string filePath = "/Content/QR/ShuaDan.jpg"; //// qr.OrigFilePath = filePath; string fullPath = context.Server.MapPath(filePath); // bkImg.Save(fullPath); Bitmap logo = new Bitmap(context.Server.MapPath(@"/Content/QR/TX_Logo_100.png")); Bitmap finImg = ImgHelper.ImageWatermark(new Bitmap(bkImg), logo); // filePath = "/Content/QR/ShuaDan.jpg"; // qr.FilePath = filePath; // fullPath = context.Server.MapPath(filePath); finImg.Save(fullPath); finImg.Dispose(); bkImg.Dispose(); // return qr; } catch (Exception ex) { r.ErrorMsg = ex.Message; throw ex; } return(r); }