-
大小: 15.88MB文件类型: .rar金币: 1下载: 0 次发布日期: 2023-07-14
- 语言: Html/CSS
- 标签:
资源简介
调微信接口之上传图文消息内的图片获取URL,图文消息的具体内容,支持HTML标签,必须少于2万字符,小于1M,且此处会去除JS,涉及图片url必须来源 "上传图文消息内的图片获取URL"接口获取。外部图片url将被过滤。
代码片段和文件信息
using LitJson;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
namespace UploadImage
{
public class CacheData
{
//access_token
public static string access_token = string.Empty;
public static DateTime tokenSendTime = DateTime.Now;
//签名
public static string jsapi_ticket = string.Empty;
public static DateTime ticketSendTime = DateTime.Now;
//卡券签名
public static string api_ticket = string.Empty;
public static DateTime apiTicketSendTime = DateTime.Now;
public static object GlobalKeys { get; private set; }
//获取access_token
public static string GetToken(DateTime now)
{
TimeSpan timeSpan = now - tokenSendTime;
if (timeSpan.TotalSeconds > 7200 || string.IsNullOrEmpty(access_token))
{
//***公众号的
string oneUrl = “https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=“
+ ConfigurationManager.AppSettings[“WXpay_APPID“].Trim() + “ & secret=“ + ConfigurationManager.AppSettings[“WXpay_APPSECRET“].Trim(); //第一次请求文件换access_token
string result1 = HttpService.Get(oneUrl);
JsonData jd = JsonMapper.Toobject(result1);
access_token = (string)jd[“access_token“];
//LogHelper.GetInstance().Info(“access_token:“ + access_token);
}
return access_token;
}
//获取签名--获取jsapi
public static string GetTicket(DateTime now)
{
TimeSpan timeSpan = now - ticketSendTime;
if (timeSpan.TotalSeconds > 7200 || string.IsNullOrEmpty(jsapi_ticket))
{
string token = GetToken(now);
string twoUrl = “https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=“ + access_token + “&type=jsapi“; //第二次请求微信换ticket
string result2 = HttpService.Get(twoUrl);
LogHelper.GetInstance().Info(“进了GetTicket:twoUrl“ + twoUrl);
JsonData jd2 = JsonMapper.Toobject(result2);
string ticket = (string)jd2[“ticket“];
LogHelper.GetInstance().Info(“jsapi_ticket:“ + “ticket : “ + ticket + “ 时间:“ + DateTime.Now);
ticketSendTime = now;
jsapi_ticket = ticket;
}
return jsapi_ticket;
}
//获取卡券签名
public static string GetTicket_Card(DateTime now)
{
TimeSpan timeSpan = now - apiTicketSendTime;
if (timeSpan.TotalSeconds > 7200 || string.IsNullOrEmpty(api_ticket))
{
string token = GetToken(now);
string twoUrl = “https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=“ + access_token + “&type=wx_card“; //第二次请求微信换ticket
strin
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 83440 2019-04-23 11:18 UploadImage\.vs\config\applicationhost.config
..A..H. 44032 2019-04-23 12:01 UploadImage\.vs\UploadImage\v14\.suo
文件 161016 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\dotnet5.4\Microsoft.ApplicationInsights.dll
文件 150456 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\dotnet5.4\Microsoft.ApplicationInsights.xm
文件 164600 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\net40\Microsoft.ApplicationInsights.dll
文件 159012 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\net40\Microsoft.ApplicationInsights.xm
文件 162552 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\net45\Microsoft.ApplicationInsights.dll
文件 159442 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\net45\Microsoft.ApplicationInsights.xm
文件 165624 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\net46\Microsoft.ApplicationInsights.dll
文件 166971 2016-03-09 11:57 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\lib\net46\Microsoft.ApplicationInsights.xm
文件 346542 2019-04-23 11:18 UploadImage\packages\Microsoft.ApplicationInsights.2.0.0\Microsoft.ApplicationInsights.2.0.0.nupkg
文件 1840368 2015-12-07 19:04 UploadImage\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.1\lib\net40\Microsoft.AI.Agent.Intercept.dll
文件 1839344 2015-12-07 19:04 UploadImage\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.1\lib\net45\Microsoft.AI.Agent.Intercept.dll
文件 1453471 2019-04-23 11:18 UploadImage\packages\Microsoft.ApplicationInsights.Agent.Intercept.1.2.1\Microsoft.ApplicationInsights.Agent.Intercept.1.2.1.nupkg
文件 453 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\content\ApplicationInsights.config.install.xdt
文件 162 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\content\ApplicationInsights.config.transform
文件 494 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\content\ApplicationInsights.config.uninstall.xdt
文件 58112 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\lib\net40\Microsoft.AI.DependencyCollector.dll
文件 52673 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\lib\net40\Microsoft.AI.DependencyCollector.xm
文件 60680 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\lib\net45\Microsoft.AI.DependencyCollector.dll
文件 60439 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\lib\net45\Microsoft.AI.DependencyCollector.xm
文件 71348 2019-04-23 11:18 UploadImage\packages\Microsoft.ApplicationInsights.DependencyCollector.2.0.0\Microsoft.ApplicationInsights.DependencyCollector.2.0.0.nupkg
文件 200531 2016-03-22 13:56 UploadImage\packages\Microsoft.ApplicationInsights.ja
文件 85191 2016-03-22 13:56 UploadImage\packages\Microsoft.ApplicationInsights.ja
文件 49063 2019-04-23 11:19 UploadImage\packages\Microsoft.ApplicationInsights.ja
文件 1914 2016-03-22 13:56 UploadImage\packages\Microsoft.ApplicationInsights.ja
文件 1705 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.0.0\content\ApplicationInsights.config.install.xdt
文件 162 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.0.0\content\ApplicationInsights.config.transform
文件 506 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.0.0\content\ApplicationInsights.config.uninstall.xdt
文件 68872 2016-03-10 14:26 UploadImage\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.0.0\lib\net40\Microsoft.AI.PerfCounterCollector.dll
............此处省略187个文件信息
评论
共有 条评论