示例#1
0
        public static WxOpenJsonResult UniformSend(string accessTokenOrAppId, UniformSendData msgData, int timeOut = WxConfig.TIME_OUT)
        {
            return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
            {
                string urlFormat = WxConfig.ApiMpHost + "/cgi-bin/message/wxopen/template/uniform_send?access_token={0}";

                return CommonJsonSend.Send <WxOpenJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#2
0
        /// <summary>
        /// 【异步方法】获取校验文件名称及内容
        /// 通过本接口下载随机校验文件,并将文件上传至服务器指定位置的目录下,方可通过所属权校验。
        /// 验证文件放置规则:放置于 URL 中声明的最后一级子目录下,若无子目录,则放置于 host 所属服务器的顶层目录下。
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="timeOut">请求超时时间</param>
        /// <returns></returns>
        public static async Task <DownloadJsonResult> DownloadAsync(string accessTokenOrAppId, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/cgi-bin/wxopen/qrcodejumpdownload?access_token={0}";

                return await CommonJsonSend.SendAsync <DownloadJsonResult>(accessToken, urlFormat, new { }, timeOut: timeOut).ConfigureAwait(false);
            }, accessTokenOrAppId).ConfigureAwait(false));
        }
        public static async Task <WxJsonResult> UniformSendAsync(string accessTokenOrAppId, UniformSendData msgData, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/cgi-bin/message/wxopen/template/uniform_send?access_token={0}";

                return await CommonJsonSend.SendAsync <WxJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#4
0
        public static DownloadJsonResult Download(string accessTokenOrAppId, int timeOut = Config.TIME_OUT)
        {
            return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/cgi-bin/wxopen/qrcodejumpdownload?access_token={0}";

                return CommonJsonSend.Send <DownloadJsonResult>(accessToken, urlFormat, new { }, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#5
0
 public static GetWeAnalysisAppidUserPortraitResultJson GetWeAnalysisAppidUserPortrait(string accessTokenOrAppId, string beginDate, string endDate, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/datacube/getweanalysisappiduserportrait?access_token={0}";
         var data = new { begin_date = beginDate, end_date = endDate };
         return CommonJsonSend.Send <GetWeAnalysisAppidUserPortraitResultJson>(accessToken, urlFormat, data, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#6
0
 public static async Task <CommonGetWeAnalysisAppidRetainInfoResultJson> GetWeAnalysisAppidMonthlyRetainInfoAsync(string accessTokenOrAppId, string beginDate, string endDate, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/datacube/getweanalysisappidmonthlyretaininfo?access_token={0}";
         var data = new { begin_date = beginDate, end_date = endDate };
         return await CommonJsonSend.SendAsync <CommonGetWeAnalysisAppidRetainInfoResultJson>(accessToken, urlFormat, data, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#7
0
 public static async Task <GetWeAnalysisAppidUserPortraitResultJson> GetWeAnalysisAppidUserPortraitAsync(string accessTokenOrAppId, string beginDate, string endDate, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/datacube/getweanalysisappiduserportrait?access_token={0}";
         var data = new { begin_date = beginDate, end_date = endDate };
         return await CommonJsonSend.SendAsync <GetWeAnalysisAppidUserPortraitResultJson>(accessToken, urlFormat, data, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
示例#8
0
        public static async Task <WxJsonResult> UniformSendAsync(string accessTokenOrAppId, UniformSendData msgData, int timeOut = Config.TIME_OUT)
        {
            //文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/uniform-message/uniformMessage.send.html
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/cgi-bin/message/wxopen/template/uniform_send?access_token={0}";

                return await CommonJsonSend.SendAsync <WxJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut).ConfigureAwait(false);
            }, accessTokenOrAppId).ConfigureAwait(false));
        }
示例#9
0
 /// <summary>
 /// 【异步方法】code换取用户手机号。
 /// </summary>
 /// <param name="accessTokenOrAppId"></param>
 /// <param name="code">每个code只能使用一次,code的有效期为5min</param>
 /// <param name="timeOut"></param>
 /// <returns></returns>
 public static async Task <GetUserPhoneNumberJsonResult> GetUserPhoneNumberAsync(string accessTokenOrAppId, string code, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/wxa/business/getuserphonenumber?access_token={0}";
         string url = string.Format(urlFormat, accessToken);
         var data = new { code = code };
         return await CommonJsonSend.SendAsync <GetUserPhoneNumberJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#10
0
        /// <summary>
        /// 获取在线客服列表
        /// </summary>
        /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
        /// <param name="timeOut">超时时间</param>
        /// <returns></returns>
        public static GetOnlineKfListResultJson GetOnlineKfList(string accessTokenOrAppId, int timeOut = Config.TIME_OUT)
        {
            return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var urlFormat = string.Format(Config.ApiMpHost + "/cgi-bin/customservice/getonlinekflist?access_token={0}", accessToken.AsUrlData());


                return CommonJsonSend.Send <GetOnlineKfListResultJson>(accessToken, urlFormat, null, CommonJsonSendType.GET, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#11
0
        /// <summary>
        /// 获取在线客服列表
        /// </summary>
        /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
        /// <param name="timeOut">超时时间</param>
        /// <returns></returns>
        public static async Task <GetOnlineKfListResultJson> GetOnlineKfListAsync(string accessTokenOrAppId, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                var urlFormat = string.Format(Config.ApiMpHost + "/cgi-bin/customservice/getonlinekflist?access_token={0}", accessToken.AsUrlData());


                return await CommonJsonSend.SendAsync <GetOnlineKfListResultJson>(accessToken, urlFormat, null, CommonJsonSendType.GET, timeOut: timeOut).ConfigureAwait(false);
            }, accessTokenOrAppId));
        }
示例#12
0
        public static async Task <WxJsonResult> CheckSessionAsync(string accessTokenOrAppId, string openId, string sessionKey, string buffer, string sigMethod = "hmac_sha256")
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/wxa/checksession?access_token={0}&signature={1}&openid={2}&sig_method={3}";
                var signature = EncryptHelper.GetHmacSha256("", sessionKey);
                var url = urlFormat.FormatWith(accessToken, signature, openId, sigMethod);

                return await CommonJsonSend.SendAsync <WxJsonResult>(null, url, null, CommonJsonSendType.GET);
            }, accessTokenOrAppId));
        }
示例#13
0
        public static async Task <WxJsonResult> MsgSecCheckAsync(string accessTokenOrAppId, string content, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/wxa/msg_sec_check?access_token={0}";

                var data = new { content = content };

                return await CommonJsonSend.SendAsync <WxJsonResult>(accessToken, urlFormat, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#14
0
 public static async Task <WxJsonResult> ImgSecCheckAsync(string accessTokenOrAppId, string filePath, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/wxa/img_sec_check?access_token={0}";
         var url = urlFormat.FormatWith(accessToken);
         var fileDic = new Dictionary <string, string>();
         fileDic["media"] = filePath;
         return await CO2NET.HttpUtility.Post.PostFileGetJsonAsync <WxJsonResult>(url, fileDictionary: fileDic, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#15
0
        public static async Task <AddNearbyPoiJsonResult> AddNearbyPoiAsync(string accessTokenOrAppId, string relatedName, string relatedCredential, string relatedAddress, string relatedProofMaterial, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/wxa/addnearbypoi?access_token={0}";
                string url = string.Format(urlFormat, accessToken);

                var data = new { related_name = relatedName, related_credential = relatedCredential, related_address = relatedAddress, related_proof_material = relatedProofMaterial };

                return await CommonJsonSend.SendAsync <AddNearbyPoiJsonResult>(accessToken, urlFormat, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#16
0
        public static async Task <GetNearbyPoiListJsonResult> GetNearbyPoiListAsync(string accessTokenOrAppId, int page = 1, int page_rows = 10, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/wxa/getnearbypoilist?access_token={0}";
                string url = string.Format(urlFormat, accessToken);

                var data = new { page = page, page_rows = page_rows };

                return await CommonJsonSend.SendAsync <GetNearbyPoiListJsonResult>(accessToken, urlFormat, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#17
0
        public static async Task <WxJsonResult> SetNearbyPoiListAsync(string accessTokenOrAppId, string poi_id, int status, int timeOut = Config.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/wxa/setnearbypoishowstatus?access_token={0}";
                string url = string.Format(urlFormat, accessToken);

                var data = new { poi_id = poi_id, status = status };

                return await CommonJsonSend.SendAsync <WxJsonResult>(accessToken, urlFormat, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#18
0
 /// <summary>
 /// 小程序开发者可以通过本接口提交小程序页面url及参数信息,让微信可以更及时的收录到小程序的页面信息,开发者提交的页面信息将可能被用于小程序搜索结果展示。
 /// </summary>
 /// <param name="accessTokenOrAppId">接口调用凭证</param>
 /// <param name="pages">小程序页面信息列表</param>
 /// <param name="timeOut"></param>
 /// <returns></returns>
 public static async Task <WxJsonResult> SubmitPagesAsync(string accessTokenOrAppId, List <Page> pages, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/wxa/search/wxaapi_submitpages?access_token={0}";
         var postBody = new
         {
             pages
         };
         return await CommonJsonSend.SendAsync <WxJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
示例#19
0
        public static WxJsonResult DelNearbyPoi(string accessTokenOrAppId, string poi_id, int timeOut = Config.TIME_OUT)
        {
            return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
            {
                string urlFormat = Config.ApiMpHost + "/wxa/delnearbypoi?access_token={0}";
                string url = string.Format(urlFormat, accessToken);

                var data = new { poi_id = poi_id };

                return CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
示例#20
0
 public static async Task <WxQcloudTokenJsonResult> GetQcloudTokenAsync(string accessTokenOrAppId, int lifespan, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/getqcloudtoken?access_token={0}";
         var postBody = new
         {
             lifespan
         };
         return await CommonJsonSend.SendAsync <WxQcloudTokenJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
示例#21
0
 /// <summary>
 /// 小程序开发者可以通过本接口提交小程序页面url及参数信息,让微信可以更及时的收录到小程序的页面信息,开发者提交的页面信息将可能被用于小程序搜索结果展示。
 /// </summary>
 /// <param name="accessTokenOrAppId">接口调用凭证</param>
 /// <param name="pages">小程序页面信息列表</param>
 /// <param name="timeOut"></param>
 /// <returns></returns>
 public static WxJsonResult SubmitPages(string accessTokenOrAppId, List <Page> pages, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/wxa/search/wxaapi_submitpages?access_token={0}";
         var postBody = new
         {
             pages
         };
         return CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#22
0
 public static WxQcloudTokenJsonResult GetQcloudToken(string accessTokenOrAppId, int lifespan, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/getqcloudtoken?access_token={0}";
         var postBody = new
         {
             lifespan
         };
         return CommonJsonSend.Send <WxQcloudTokenJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#23
0
 public static async Task <WxDeleteFileJsonResult> BatchDeleteFileAsync(string accessTokenOrAppId, string env, IEnumerable <string> fileid_list, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/batchdeletefile?access_token={0}";
         var postBody = new
         {
             env,
             fileid_list
         };
         return await CommonJsonSend.SendAsync <WxDeleteFileJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
示例#24
0
 public static async Task <WxUploadFileJsonResult> UploadFileAsync(string accessTokenOrAppId, string env, string path, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/uploadfile?access_token={0}";
         var postBody = new
         {
             env,
             path
         };
         return await CommonJsonSend.SendAsync <WxUploadFileJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
示例#25
0
 public static async Task <WxDatabaseCountJsonResult> DatabaseCountAsync(string accessTokenOrAppId, string env, string query, int timeOut = Config.TIME_OUT)
 {
     return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/databasecount?access_token={0}";
         var postBody = new
         {
             env,
             query
         };
         return await CommonJsonSend.SendAsync <WxDatabaseCountJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut).ConfigureAwait(false);
     }, accessTokenOrAppId).ConfigureAwait(false));
 }
示例#26
0
 public static WxDeleteFileJsonResult BatchDeleteFile(string accessTokenOrAppId, string env, IEnumerable <string> fileid_list, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/batchdeletefile?access_token={0}";
         var postBody = new
         {
             env,
             fileid_list
         };
         return CommonJsonSend.Send <WxDeleteFileJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#27
0
 public static WxUploadFileJsonResult UploadFile(string accessTokenOrAppId, string env, string path, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/uploadfile?access_token={0}";
         var postBody = new
         {
             env,
             path
         };
         return CommonJsonSend.Send <WxUploadFileJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#28
0
 public static WxDatabaseCountJsonResult DatabaseCount(string accessTokenOrAppId, string env, string query, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/databasecount?access_token={0}";
         var postBody = new
         {
             env,
             query
         };
         return CommonJsonSend.Send <WxDatabaseCountJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#29
0
 public static WxJsonResult DatabaseCollectionDelete(string accessTokenOrAppId, string env, string collection_name, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/databasecollectiondelete?access_token={0}";
         var postBody = new
         {
             env,
             collection_name
         };
         return CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }
示例#30
0
 public static WxDatabaseMigrateQueryInfoJsonResult DatabaseMigrateQueryInfo(string accessTokenOrAppId, string env, int job_id, int timeOut = Config.TIME_OUT)
 {
     return(WxOpenApiHandlerWapper.TryCommonApi(accessToken =>
     {
         string urlFormat = Config.ApiMpHost + "/tcb/databasemigratequeryinfo?access_token={0}";
         var postBody = new
         {
             env,
             job_id
         };
         return CommonJsonSend.Send <WxDatabaseMigrateQueryInfoJsonResult>(accessToken, urlFormat, postBody, timeOut: timeOut);
     }, accessTokenOrAppId));
 }