• 大小: 7KB
    文件类型: .cs
    金币: 1
    下载: 0 次
    发布日期: 2021-05-06
  • 语言: C#
  • 标签: 微信海报  

资源简介

C#微信开发,生成待参二维码合成海报

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Web;
using System.xml;
using Ailend.Distribution.Www.BIZ;
using Ailend.Distribution.Www.Utils;
using Newtonsoft.Json;

/// 
/// PtxmlToCode 的摘要说明
/// 

public class PtxmlToCode
{
public PtxmlToCode()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
   Ailend_PubNumject> keywork = new Ailend_PubNumject>();
        public string repsponContent(string Tid xmlDocument xmldoc)
        {
            string respontext = ““;
            xmlNode ToUserName = xmldoc.SelectSingleNode(“/xml/ToUserName“);
            xmlNode FromUserName = xmldoc.SelectSingleNode(“/xml/FromUserName“);
            string accesstoken = keywork.GetAccessTokenByTid(Tid ““ ““);

            string postdata = “{    \“touser\“:\““ + FromUserName.InnerText + “\“    \“msgtype\“:\“text\“    \“text\“:    {         \“content\“:\“正在为您生成个性海报!\“    }}“;
            string sws = PtxmlToRequest.GetPage(“https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=“ + accesstoken + ““ postdata); //吊起客服 发送等待消息
            var swsresult = JsonConvert.DeserializeobjectlGetTicet>(sws);
            if (swsresult.errcode == 42001 || swsresult.errcode == 40014 || swsresult.errcode == 40001)
            {
                accesstoken = PtxmlToGetback.regetAccess_token(Tid);//从新获取Access_Token
                sws = PtxmlToRequest.GetPage(“https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=“ + accesstoken + ““ postdata);
            }
            string userid = keywork.GetMyOwnId(FromUserName.InnerText Tid);
            string postData = “{\“expire_seconds\“: 2591000 \“action_name\“: \“QR_SCENE\“ \“action_info\“: {\“scene\“: {\“scene_id\“:\““ + userid + “\“}}}“;
            string content = PtxmlToRequest.GetPage(“https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=“ + accesstoken + ““ postData);
            var ss = JsonConvert.DeserializeobjectlGetTicet>(content);
            if (ss.errcode == 42001 || ss.errcode == 40014 || ss.errcode == 40001)
            {
                accesstoken = PtxmlToGetback.regetAccess_token(Tid);//从新获取Access_Token
                content = PtxmlToRequest.GetPage(“https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=“ + accesstoken + ““ postData);
                ss = JsonConvert.DeserializeobjectlGetTicet>(content);
            }
            string ticket = HttpUtility.UrlEncode(ss.ticket); //获取到带参二维码Ticket openId
            string imagename = DateTime.Now.ToString(“yyMMddhhmmss“);
            PtxmlToRequest.GetAndCreatePic(“https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=“ + ticket + ““ HttpContext.Current.Server.MapPath(“.“) + “\\piccode\\“ + imagename + “.jpg“);  //获取二维码图片      

            EnxmlToFans codeclass = GetFansUserData(accesstoken FromUserName.InnerText Tid);  //获取粉丝基本信息   

           

评论

共有 条评论

相关资源