VopSdk一个高逼格微信公众号开发SDK:自动化生产(装逼模式开启)

VopSdk一个高逼格微信公众号开发SDK(源码下载)

VopSdk一个高逼格微信公众号开发SDK:自动化生产(装逼模式开启)

 

针对第一版,我们搞了第二版本,老规矩先定个目标。

一 我们的目标

    a、移除PayExcute,统一执行入口,目前只保留一个入口Excute

    b、序列化特性统一,目前只用设置xml特性即可(反序列化时xml和json都可以直接用)

    c、支持文件上传,目前只有多客服管理上传头像接口用到过

    d、使用T4模板自动生产所有Request、Response、以及所有测试Test(装逼利器T4模板)

 

二 目标实现

    a、移除PayExcute,统一执行入口,目前只保留一个入口Excute

        public T Execute<T>(IVopRequest<T> request) where T : IVopResponse
        {
            return Execute<T>(request, null);
        }

        public T Execute<T>(IVopRequest<T> request, string accessToken) where T : IVopResponse
        {
            //设置请求参数值
            request.SetCharset(charset);
            request.SetAppId(appId);
            request.SetAppScret(appScret);
            request.SetMchId(mchId);
            request.SetMchScret(mchScret);
            request.SetSignType(signType);
            if (!string.IsNullOrEmpty(accessToken))
                request.SetAccessToken(accessToken);

            //初始参数
            string body;
            string url;
            url = request.GetApiUrl();

            //设置参数
            VopDictionary txtParams = request.GetParamter();
            txtParams = AddBizModel(txtParams, request.GetBizModel());

            //清洗url参数
            txtParams = FlashUrlParamter(txtParams, ref url);

            //添加签名
            if (request.GetNeedSign())
                txtParams.Add("sign", VopUtils.GetSign(txtParams, request.GetMchScret()));

            //最后请求参数
            string data = null;
            IDictionary<string, FileItem> filedata = null;
            if (request is VopMobilePublicUploadRequest<T>)
            {
                filedata = GetRequestFileParams(txtParams);
            }
            else
            {
                data = GetRequestParams(txtParams, request.GetFormat());
            }

            if ("POST".Equals(request.GetApiMethod(), StringComparison.OrdinalIgnoreCase))
            {
                if (request is VopMobilePublicUploadRequest<T>)
                {
                    body = webUtils.DoPost(url, filedata, this.charset);
                }
                else
                {
                    if (!request.GetNeedCert())
                        body = webUtils.DoPost(url, data, this.charset);
                    else
                        body = webUtils.DoPost(url, data, this.charset, VopUtils.GetCert(request.GetCertPath(), request.GetCertPassword()));
                }
            }
            else
            {
                if (!request.GetNeedCert())
                    body = webUtils.DoGet(url, data, this.charset);
                else
                    body = webUtils.DoGet(url, data, this.charset, VopUtils.GetCert(request.GetCertPath(), request.GetCertPassword()));
            }

            T rsp = null;
            if ("json".Equals(request.GetFormat(), StringComparison.OrdinalIgnoreCase))
            {
                rsp = JsonHelper.Deserialize<T>(body);
            }
            else
            {
                rsp = XmlHelper.Deserialize<T>(body);
            }
            if (rsp != null)
                rsp.Body = body;
            return rsp;
        }

 

 

    b、序列化特性统一

         所有Response标记只用xml的特性标记,如 VopMobilePublicAccessTokenResponse 这个最后我们其实序列化成json的,但是也是用的xml的来标记的。

    [XmlRoot("xml")]
    public class VopMobilePublicAccessTokenResponse : VopMobilePublicResponse
    {
        [XmlElement("access_token")]
        public string AccessToken { get; set; }
        [XmlElement("expires_in")]
        public int ExpiresIn { get; set; }
    }

 

 

 

    c、支持文件上传

        文件上传的接口Request需要继承 VopMobilePublicUploadRequest ,在执行时,判断如果继承了,就会执行

                if (request is VopMobilePublicUploadRequest<T>)
                {
                    body = webUtils.DoPost(url, filedata, this.charset);
                }
        public string DoPost(string url, IDictionary<string, FileItem> fileParams, string charset)
        {
            string boundary = DateTime.Now.Ticks.ToString("X"); // 随机分隔线

            HttpWebRequest req = GetWebRequest(url, "POST");
            req.ContentType = "multipart/form-data;charset=" + charset + ";boundary=" + boundary;

            Stream reqStream = req.GetRequestStream();
            byte[] itemBoundaryBytes = Encoding.GetEncoding(charset).GetBytes("\r\n--" + boundary + "\r\n");
            byte[] endBoundaryBytes = Encoding.GetEncoding(charset).GetBytes("\r\n--" + boundary + "--\r\n");

            // 组装文件请求参数
            string fileTemplate = "Content-Disposition:form-data;name=\"{0}\";filename=\"{1}\"\r\nContent-Type:{2}\r\n\r\n";
            IEnumerator<KeyValuePair<string, FileItem>> fileEnum = fileParams.GetEnumerator();
            while (fileEnum.MoveNext())
            {
                string key = fileEnum.Current.Key;
                FileItem fileItem = fileEnum.Current.Value;
                string fileEntry = string.Format(fileTemplate, key, fileItem.GetFileName(), fileItem.GetMimeType());
                byte[] itemBytes = Encoding.GetEncoding(charset).GetBytes(fileEntry);
                reqStream.Write(itemBoundaryBytes, 0, itemBoundaryBytes.Length);
                reqStream.Write(itemBytes, 0, itemBytes.Length);

                byte[] fileBytes = fileItem.GetContent();
                reqStream.Write(fileBytes, 0, fileBytes.Length);
            }

            reqStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
            reqStream.Close();

            HttpWebResponse rsp = (HttpWebResponse)req.GetResponse();
            Encoding encoding = Encoding.GetEncoding(rsp.CharacterSet);
            return GetResponseAsString(rsp, encoding);
        }

 

 

    d、使用T4模板自动生产所有Request、Response、以及所有测试Test(装逼利器T4模板)

        废话不多说,直接上其中一个模板 VopMobilePublicRequest.tt 

<#@ template  debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core" #>
<#@ Assembly Name="System.Windows.Forms" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Collections" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ include file="$(ProjectDir)VopConfig.ttinclude"  #>
<#@ include file="$(ProjectDir)Manager.ttinclude"  #>
<# var manager = Manager.Create(Host, GenerationEnvironment); #>
<# var list = TempService.Instance.GetListModel("Vop.config"); #>
<# foreach (var item in list){var model = item; manager.StartNewFile(model.Name + "Request.cs" );#>
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由T4模板自动生成
//     生成时间 <#=DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")#>
//     对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失
//     作者QQ:63351550 微信:VopSdk
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using Vop.Api.Response;

namespace Vop.Api.Request
{
    public class <#= model.Name #>Request : VopMobilePublicRequest<VopMobilePublicAccessTokenResponse>, IVopRequest<VopMobilePublicAccessTokenResponse>
    {
        public override string GetApiUrl()
        {
            this.apiUrl = "<#= model.Url #>";
            return PreApiUrl(this.apiUrl);
        }

        public override string GetApiMethod()
        {
            this.apiMethod = "<#= model.Method #>";
            return this.apiMethod;
        }
    }
}

<# manager.EndBlock();}#>
<# manager.Process(true); #>

 为了装个逼,我也是费了不少力气的,首先得准备好各个接口名字、接口地址、接口调用方式,后期还得整理接口出参。

目前整理微信公众号、微信支付所有接口,不行你看

 Vop.config 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <apis>
    <!--微信网页开发-->
    <api>
      <name>VopMobilePublicOAuthAuthorize</name>
      <url><![CDATA[https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={redirect_uri}&response_type=code&scope={scope}&state={state}#wechat_redirect]]></url>
      <method>GET</method>
      <desc>第一步:用户同意授权,获取code</desc>
      <doc>https://mp.weixin.qq.com/wiki/4/9ac2e7b1f1d22e9e57260f6553822520.html</doc>
    </api>
    <api>
      <name>VopMobilePublicOAuthAccessToken</name>
      <url><![CDATA[https://api.weixin.qq.com/sns/oauth2/access_token?appid={appid}&secret={secret}&code={code}&grant_type=authorization_code]]></url>
      <method>GET</method>
      <desc>第二步:通过code换取网页授权access_token</desc>
      <doc>https://mp.weixin.qq.com/wiki/4/9ac2e7b1f1d22e9e57260f6553822520.html</doc>
    </api>
    <api>
      <name>VopMobilePublicOAuthRefreshToken</name>
      <url><![CDATA[https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={appid}&grant_type=refresh_token&refresh_token={refresh_token}]]></url>
      <method>GET</method>
      <desc>第三步:刷新access_token(如果需要)</desc>
      <doc>https://mp.weixin.qq.com/wiki/4/9ac2e7b1f1d22e9e57260f6553822520.html</doc>
    </api>
    <api>
      <name>VopMobilePublicOAuthUserInfo</name>
      <url><![CDATA[https://api.weixin.qq.com/sns/userinfo?access_token={access_token}&openid={openid}&lang={lang}]]></url>
      <method>GET</method>
      <desc>第四步:拉取用户信息(需scope为 snsapi_userinfo)</desc>
      <doc>https://mp.weixin.qq.com/wiki/4/9ac2e7b1f1d22e9e57260f6553822520.html</doc>
    </api>
    <api>
      <name>VopMobilePublicOAuthAccessTokenCheck</name>
      <url><![CDATA[https://api.weixin.qq.com/sns/auth?access_token={access_token}&openid={openid}]]></url>
      <method>GET</method>
      <desc>附:检验授权凭证(access_token)是否有效</desc>
      <doc>https://mp.weixin.qq.com/wiki/4/9ac2e7b1f1d22e9e57260f6553822520.html</doc>
    </api>
    <!--开始开发-->
    <!--<api>
      <name>VopMobilePublicAccessToken</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appid}&secret={secret}]]></url>
      <method>GET</method>
      <desc>获取access_token</desc>
      <doc>https://mp.weixin.qq.com/wiki/14/9f9c82c1af308e3b14ba9b973f99a8ba.html</doc>
    </api>-->
    <api>
      <name>VopMobilePublicServerIp</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>获取微信服务器IP地址</desc>
      <doc>https://mp.weixin.qq.com/wiki/4/41ef0843d6e108cf6b5649480207561c.html</doc>
    </api>
    <!--自定义菜单-->
    <api>
      <name>VopMobilePublicMenuAdd</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/menu/create?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>自定义菜单创建接口</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/0234e39a2025342c17a7d23595c6b40a.html</doc>
    </api>
    <api>
      <name>VopMobilePublicMenuGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/menu/get?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>自定义菜单查询接口</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/f287d1a5b78a35a8884326312ac3e4ed.html</doc>
    </api>
    <api>
      <name>VopMobilePublicMenuDel</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>自定义菜单删除接口</desc>
      <doc>https://mp.weixin.qq.com/wiki/3/de21624f2d0d3dafde085dafaa226743.html</doc>
    </api>
    <api>
      <name>VopMobilePublicMenuConditionalAdd</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/menu/addconditional?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>创建个性化菜单</desc>
      <doc>https://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html</doc>
    </api>
    <api>
      <name>VopMobilePublicMenuConditionalDel</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/menu/delconditional?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>删除个性化菜单</desc>
      <doc>https://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html</doc>
    </api>
    <api>
      <name>VopMobilePublicMenuConditionalGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/menu/trymatch?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>测试个性化菜单匹配结果</desc>
      <doc>https://mp.weixin.qq.com/wiki/0/c48ccd12b69ae023159b4bfaa7c39c20.html</doc>
    </api>
    <api>
      <name>VopMobilePublicMenuConfigGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取自定义菜单配置接口</desc>
      <doc>https://mp.weixin.qq.com/wiki/14/293d0cb8de95e916d1216a33fcb81fd6.html</doc>
    </api>
    <!--消息管理-->
    <api>
      <name>VopMobilePublicKfaccountAdd</name>
      <url><![CDATA[https://api.weixin.qq.com/customservice/kfaccount/add?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>添加客服帐号</desc>
      <doc>https://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html</doc>
    </api>
    <api>
      <name>VopMobilePublicKfaccountEdt</name>
      <url><![CDATA[https://api.weixin.qq.com/customservice/kfaccount/update?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>修改客服帐号</desc>
      <doc>https://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html</doc>
    </api>
    <api>
      <name>VopMobilePublicKfaccountDel</name>
      <url><![CDATA[https://api.weixin.qq.com/customservice/kfaccount/del?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>删除客服帐号</desc>
      <doc>https://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html</doc>
    </api>
    <!--<api>
      <name>VopMobilePublicKfaccountUploadHeadImg</name>
      <url><![CDATA[http://api.weixin.qq.com/customservice/kfaccount/uploadheadimg?access_token={access_token}&kf_account={kf_account}]]></url>
      <method>POST</method>
      <desc>设置客服帐号的头像</desc>
      <doc>https://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html</doc>
    </api>-->
    <api>
      <name>VopMobilePublicKfaccountGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>获取所有客服账号</desc>
      <doc>https://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html</doc>
    </api>
    <api>
      <name>VopMobilePublicCustomMessageSend</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>客服接口-发消息</desc>
      <doc>https://mp.weixin.qq.com/wiki/11/c88c270ae8935291626538f9c64bd123.html</doc>
    </api>
    <api>
      <name>VopMobilePublicTemplateIndustrySet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>设置所属行业</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html</doc>
    </api>
    <api>
      <name>VopMobilePublicTemplateIndustryGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>获取设置的行业信息</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html</doc>
    </api>
    <api>
      <name>VopMobilePublicTemplatePrivateAdd</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获得模板ID</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html</doc>
    </api>
    <api>
      <name>VopMobilePublicTemplatePrivateGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>获取模板列表</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html</doc>
    </api>
    <api>
      <name>VopMobilePublicTemplatePrivateDel</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>删除模板</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html</doc>
    </api>
    <api>
      <name>VopMobilePublicTemplateMessageSend</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>发送模板消息</desc>
      <doc>https://mp.weixin.qq.com/wiki/5/6dde9eaa909f83354e0094dc3ad99e05.html</doc>
    </api>
    <!--用户管理-->
    <api>
      <name>VopMobilePublicGroupsAdd</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/create?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>创建分组</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicGroupsGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/get?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>查询所有分组</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicGroupsUserGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/getid?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>查询用户所在分组</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicGroupsEdt</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/update?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>修改分组名</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicGroupsUserEdt</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/members/update?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>移动用户分组</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicGroupsUserBatchEdt</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/members/batchupdate?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>批量移动用户分组</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicGroupsDel</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/groups/delete?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>删除分组</desc>
      <doc>https://mp.weixin.qq.com/wiki/8/d6d33cf60bce2a2e4fb10a21be9591b8.html</doc>
    </api>
    <api>
      <name>VopMobilePublicUserEdt</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/user/info/updateremark?access_token={access_token}]]></url>
      <method>GET</method>
      <desc>设置备注名</desc>
      <doc>https://mp.weixin.qq.com/wiki/16/528098c4a6a87b05120a7665c8db0460.html</doc>
    </api>
    <api>
      <name>VopMobilePublicUserGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/user/info?access_token={access_token}&openid={openid}&lang={lang}]]></url>
      <method>POST</method>
      <desc>获取用户基本信息(包括UnionID机制)</desc>
      <doc>https://mp.weixin.qq.com/wiki/1/8a5ce6257f1d3b2afb20f83e72b72ce9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicUserBatchGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>批量获取用户基本信息</desc>
      <doc>https://mp.weixin.qq.com/wiki/1/8a5ce6257f1d3b2afb20f83e72b72ce9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicUserListGet</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/user/get?access_token={access_token}&next_openid={next_openid}]]></url>
      <method>GET</method>
      <desc>获取用户列表</desc>
      <doc>https://mp.weixin.qq.com/wiki/12/54773ff6da7b8bdc95b7d2667d84b1d4.html</doc>
    </api>
    <!--账号管理-->
    <api>
      <name>VopMobilePublicQrcode</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>创建二维码ticket</desc>
      <doc>https://mp.weixin.qq.com/wiki/18/167e7d94df85d8389df6c94a7a8f78ba.html</doc>
    </api>
    <api>
      <name>VopMobilePublicShortUrl</name>
      <url><![CDATA[https://api.weixin.qq.com/cgi-bin/shorturl?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>长链接转短链接接口</desc>
      <doc>https://mp.weixin.qq.com/wiki/6/856aaeb492026466277ea39233dc23ee.html</doc>
    </api>
    <!--数据统计-->
    <api>
      <name>VopMobilePublicDataCubeUserSummary</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getusersummary?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取用户增减数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/15/88726a421bfc54654a3095821c3ca3bb.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUserCumulate</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getusercumulate?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取累计用户数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/15/88726a421bfc54654a3095821c3ca3bb.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeArticleSummary</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getarticlesummary?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取图文群发每日数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/9/d347c6ddb6f86ab11ec3b41c2729c8d9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeArticleTotal</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getarticletotal?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取图文群发总数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/9/d347c6ddb6f86ab11ec3b41c2729c8d9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUserRead</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getuserread?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取图文统计数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/9/d347c6ddb6f86ab11ec3b41c2729c8d9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUserReadHour</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getuserreadhour?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取图文统计分时数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/9/d347c6ddb6f86ab11ec3b41c2729c8d9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUserShare</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getusershare?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取图文分享转发数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/9/d347c6ddb6f86ab11ec3b41c2729c8d9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUserShareHour</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getusersharehour?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取图文分享转发分时数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/9/d347c6ddb6f86ab11ec3b41c2729c8d9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsg</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsg?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送概况数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsgHour</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsghour?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息分送分时数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsgWeek</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsgweek?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送周数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsgMonth</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsgmonth?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送月数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsgDist</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsgdist?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送分布数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsgDistWeek</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsgdistweek?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送分布周数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeUpStreamMsgDistMonth</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getupstreammsgdistmonth?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送分布月数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/10/b29e8ca8bf1b0dce033ccb70273f90fa.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeInterfaceSummary</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getinterfacesummary?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取消息发送分布月数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/17/252a976f20bd3062af3f03a45f30cff9.html</doc>
    </api>
    <api>
      <name>VopMobilePublicDataCubeInterfaceSummaryHour</name>
      <url><![CDATA[https://api.weixin.qq.com/datacube/getinterfacesummaryhour?access_token={access_token}]]></url>
      <method>POST</method>
      <desc>获取接口分析分时数据</desc>
      <doc>https://mp.weixin.qq.com/wiki/17/252a976f20bd3062af3f03a45f30cff9.html</doc>
    </api>
  </apis>
</configuration>

 VopTrade.config 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <apis>
    <!--微信支付-->
    <api>
      <name>VopTradeUnifiedOrder</name>
      <url><![CDATA[https://api.mch.weixin.qq.com/pay/unifiedorder]]></url>
      <method>POST</method>
      <desc>统一下单</desc>
      <doc>https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1</doc>
    </api>
    <api>
      <name>VopTradeOrderQuery</name>
      <url><![CDATA[https://api.mch.weixin.qq.com/pay/orderquery]]></url>
      <method>POST</method>
      <desc>查询订单</desc>
      <doc>https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2</doc>
    </api>
    <api>
      <name>VopTradeCloseOrder</name>
      <url><![CDATA[https://api.mch.weixin.qq.com/pay/closeorder]]></url>
      <method>POST</method>
      <desc>关闭订单</desc>
      <doc>https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3</doc>
    </api>
    <api>
      <name>VopTradeRefund</name>
      <url><![CDATA[https://api.mch.weixin.qq.com/secapi/pay/refund]]></url>
      <method>POST</method>
      <desc>申请退款</desc>
      <doc>https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4</doc>
    </api>
    <api>
      <name>VopTradeRefundQuery</name>
      <url><![CDATA[https://api.mch.weixin.qq.com/pay/refundquery]]></url>
      <method>POST</method>
      <desc>查询退款</desc>
      <doc>https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5</doc>
    </api>
    <api>
      <name>VopTradeDownloadBill</name>
      <url><![CDATA[https://api.mch.weixin.qq.com/pay/downloadbill]]></url>
      <method>POST</method>
      <desc>下载对账单</desc>
      <doc>https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6</doc>
    </api>
  </apis>
</configuration>

 

有了这两个配置文件,T4模板引擎就可以开工了,只需读取配置文件,一个一个cs给我生产就行了啊,哈哈哈哈

只需保存下T4模板就可生产所有cs文件了,不信你看

VopSdk一个高逼格微信公众号开发SDK:自动化生产(装逼模式开启)

 

 

 

 

 

原文地址:http://www.cnblogs.com/deeround/p/6847671.html 

源码下载:

 

VopSdk一个高逼格微信公众号开发SDK:自动化生产(装逼模式开启)

上一篇:微信授权网页登陆,oauth


下一篇:问题集录--如何本地调试微信接口(未测试)