<%@Language="VBScript" CodePage="65001"%> <%On Error Resume Next%> <% '********************************************** '注意事项 'ASP文件需要以UTF-8的格式保存,否则乱码. '以下两行代码是为了通过微信接口验证的。 'response.write request("echostr") 'response.end '********************************************** dim signature '微信加密签名 dim timestamp '时间戳 dim nonce '随机数 'dim echostr '随机字符串 dim Token dim signaturetmp token="966120"'您在后台添写的 token signature = Request("signature") nonce = Request("nonce") timestamp = Request("timestamp") '********************************************** dim ToUserName '开发者微信号 dim FromUserName'发送方帐号(一个OpenID) dim CreateTime '消息创建时间(整型) dim MsgType 'text dim Content '文本消息内容 set xml_dom = Server.CreateObject("MSXML2.DOMDocument")'此处根据您的实际服务器情况改写 xml_dom.load request FromUserName=xml_dom.getelementsbytagname("FromUserName").item(0).text '发送者微信账号 ToUserName=xml_dom.getelementsbytagname("ToUserName").item(0).text '接收者微信账号。即我们的公众平台账号。 MsgType=xml_dom.getelementsbytagname("MsgType").item(0).Text strEventType=xml_dom.getelementsbytagname("Event").item(0).Text Content=xml_dom.getelementsbytagname("Content").item(0).Text EventKey = xml_dom.getelementsbytagname("EventKey").item(0).text Origin="FromUserName="&FromUserName&"&MsgType="&MsgType&"&strEventType="&strEventType&"&Content="&Content&"&EventKey="&EventKey sql="Insert into API_Json (method,Json,reserve) values ('weixin','"&Origin&"','"&reserve&"')" objConn.Execute sql 'response.end if MsgType="text" then Content=Trim(xml_dom.getelementsbytagname("Content").item(0).Text) '自动回复 If Content="52966120" Then strsend=Menu_52966120(FromUserName,ToUserName) elseIf IsNumeric(Content) And Len(Content)=4 Then EventKey=Content strsend=wx_QRscene(FromUserName,ToUserName,EventKey) 'elseIf InStr(Content,"投诉")>0 Then ' Content="尊敬的用户,我们的服务让您产生不好的体验在此表示十分抱歉,用户的客观评价是我们前进的动力!"&CHR(13)&"需要投诉/评价请点击下方菜单栏“我的-服务评价”进行反馈。"&CHR(13)&"或拨打我们的24小时服务热线:020-966120" ' strsend=text(fromusername,tousername,Content) 'elseIf InStr(Content,"费用")>0 Or InStr(Content,"多少钱")>0 Or InStr(Content,"收费")>0 Then ' Content="了解收费详情,可联系人工客服"&CHR(13)&"或拨打我们的24小时服务热线:020-966120" ' strsend=text(fromusername,tousername,Content) 'elseIf InStr(Content,"转运")>0 Or InStr(Content,"转院")>0 Then 'Content="您好,搜索“966120民航医疗快线”小程序,或点击下方对应入口下单,"&CHR(13)&"救护车转运|高铁转运|航空转运"&CHR(13)&"如需“电话服务”请拨打我们的24小时服务热线:020-966120" 'strsend=text(fromusername,tousername,Content) 'elseIf InStr(Content,"发票")>0 Then ' Content="您好,点击跳转发票申请"&CHR(10)&CHR(10)&"如需“电话服务”请拨打我们的24小时服务热线:020-966120" ' strsend=text(fromusername,tousername,Content) 'elseIf InStr(Content,"招聘")>0 Or InStr(Content,"招人")>0 Then ' Content="您好,请前往招聘网站搜索“广东民航医疗快线有限公司”查询岗位招聘详情,"&CHR(13)&"或致电我司行政人力管理中心咨询,电话:020-36774889" ' strsend=text(fromusername,tousername,Content) 'elseIf InStr(Content,"人工")>0 Or InStr(Content,"客服")>0 Then ' Content="点击跳转到人工客服"&CHR(10)&CHR(10)&"如需“电话服务”请拨打我们的24小时服务热线:020-966120" ' strsend=text(fromusername,tousername,Content) 'elseIf InStr(Content,"评价")>0 Then ' Content="感谢支持民航医疗快线!"&CHR(10)&CHR(10)&"请点击服务评价进行评价。"&CHR(10)&CHR(10)&"如需“电话服务”请拨打我们的24小时服务热线:020-966120" ' strsend=text(fromusername,tousername,Content) End If 'If Content="00" Then 'strsend=Menu_00(FromUserName,ToUserName) 'ElseIf Content="01" Then 'strsend=Menu_01(FromUserName,ToUserName) 'ElseIf Content<>"" Then 'strsend=ContentKey(FromUserName,ToUserName,Content) 'End if 'strsend=ContentKey(FromUserName,ToUserName,Content) 'Content="接收成功" End If if (MsgType="event") then strEventType=xml_dom.getelementsbytagname("Event").item(0).text '微信事件 EventKey = xml_dom.getelementsbytagname("EventKey").item(0).text '场景值ID if strEventType="subscribe" Or strEventType="SCAN" then '表示订阅微信公众平台或扫一扫 If EventKey<>"" Then '扫一扫二维码 strsend=wx_QRscene(FromUserName,ToUserName,EventKey) Else '一般用户关注 strsend=gz(FromUserName,ToUserName) End If ElseIf strEventType="unsubscribe" Then'取消关注 'strsend=gz(FromUserName,ToUserName) end if ElseIf strsend="" Then 'Content="欢迎关注966120民航医疗快线!"&CHR(10)&"本司服务详情如下:"&CHR(10)&""&CHR(10)&"关于费用/收费标准/收费?"&CHR(10)&"请点击收费公示查看或拨打客服热线:020-966120"&CHR(10)&""&CHR(10)&"需要转运/转院怎么做? "&CHR(10)&"请点击下方对应入口预约下单,"&CHR(10)&"救护车转运高铁转运航空转运"&CHR(10)&""&CHR(10)&"发票申请或查询?"&CHR(10)&"请点击发票申请"&CHR(10)&""&CHR(10)&"了解公司招聘信息?"&CHR(10)&"请致电行政人力管理中心,"&CHR(10)&"电话:020-36774889 "&CHR(10)&""&CHR(10)&"如何对服务评价/投诉?"&CHR(10)&"请点击服务评价"&CHR(10)&""&CHR(10)&"如果你想了解更多服务详情"&CHR(10)&"点击跳转到人工客服,或致电24小时人工服务热线:020-966120" 'strsend=text(fromusername,tousername,Content) strsend="" end If sql="insert into API_Json (method,Json,reserve) values ('微信事件','"&MsgType&","&strEventType&","&EventKey&"','"&FromUserName&"')" objConn.Execute sql If strsend<>"" Then response.write strsend set xml_dom=Nothing '*************以下代码只是为了调试作用*********** 'filepath=server.mappath(".")&"\wx.txt" 'Set fso = Server.CreateObject("Scripting.FileSystemObject") 'set fopen=fso.OpenTextFile(filepath, 8 ,true) 'fopen.writeline(strsend) 'set fso=nothing 'set fopen=Nothing '****************调试结束************************ '"" &_ '人工客服素材二维码 '"" &_ ' 黎晴-线下活动用 '关注微信公众平台 function gz(fromusername,tousername) gz="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ "" &_ "" &_ "" MsgType="text" Content="👏👏欢迎关注966120民航医疗快线!我司经广东省卫生健康委员会批准,拥有全国首个医疗转运资质,是正规专业的医疗转运机构。"&CHR(10)&CHR(10)&"Q:关于费用/收费标准/收费?"&CHR(10)&"A:请点击收费公示查看或拨打客服热线:020-966120"&CHR(10)&CHR(10)&"Q:需要预约转院/出院? "&CHR(10)&"A:请点击下方对应入口预约下单:"&CHR(10)&"救护车转运"&CHR(10)&"或点击跳转至人工客服"&CHR(10)&CHR(10)&"Q:转运后申请发票?"&CHR(10)&"A:请点击发票申请"&CHR(10)&CHR(10)&"Q:转运后对服务评价/投诉?"&CHR(10)&"A:请点击服务评价"&CHR(10)&CHR(10)&"如果你想了解更多服务详情"&CHR(10)&"点击跳转至人工客服,或致电24小时人工服务热线:020-966120" call GetCustom_send(fromusername,MsgType,Content) end Function '关键字回复 function ContentKey(fromusername,tousername,Content) If ToMsgType="text" Then ContentKey="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ " " elseIf ToMsgType="news" Then ContentKey="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "1" &_ "" &_ "" &_ "<![CDATA["&weixinTitle&"]]> " &_ "" &_ "" &_ "" &_ "" &_ "" &_ " " End If end Function '取消关注 function text(fromusername,tousername,returnstr) text="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ "0" &_ "" end Function '帮助菜单(回复0) function Menu_0(fromusername,tousername) Menu_0="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ " " end Function '员工ID认证(回复52966120) function Menu_52966120(fromusername,tousername) Set rs = Server.CreateObject("ADODB.Recordset") sql="select id from dictionary where vtitle='966120_OA_openid' and vType>=1 and vtext='"&fromusername&"'" rs.open sql,objConn,1,1 If rs.eof Then sql="Insert into dictionary (vID,vtext,vtitle,vType) values (0,'"&fromusername&"','966120_OA_openid',1)" objConn.Execute sql End If rs.close() Menu_52966120="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ " " end Function '查看OpenID(回复1) function Menu_1(fromusername,tousername) Menu_1="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ " " end Function '获得测试链接1(回复00) function Menu_00(fromusername,tousername) Menu_00="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "2" &_ "" &_ "" &_ "" &_ "" &_ "" &_ "" &_ "<![CDATA[V俱乐部 追求优质生活,享受全球同质同价]]> " &_ "" &_ "" &_ "" &_ "" &_ "" &_ " " end Function '获得测试链接2(回复02) function Menu_01(fromusername,tousername) Menu_01="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "1" &_ "" &_ "" &_ "<![CDATA[链接2]]> " &_ "" &_ "" &_ "" &_ "" &_ " " end Function '扫一扫 function wx_QRscene(fromusername,tousername,EventKey) scene_id=replace(EventKey,"qrscene_","") If IsNumeric(scene_id) Then Set rs = Server.CreateObject("ADODB.Recordset") sql="select * from weixinQR where QR_ID="&scene_id rs.open sql,objConn,1,1 If not rs.eof Then QR_Name = rs("QR_Name") QR_type = rs("QR_type") QR_Key = rs("QR_Key") 'weixinURL="https://wx.966120.com.cn/OrdEvaluate.asp" weixinURL="https://wx.966120.com.cn/MyOrder.php" If InStr(weixinURL,"?")>0 Then weixinURL = weixinURL&"&openid="&fromusername Else weixinURL = weixinURL&"?openid="&fromusername End If End If rs.close() If strEventType="subscribe" Then sql="update weixinQR set QR_ClickInt=QR_ClickInt+1,QR_SubscribeInt=QR_SubscribeInt+1 where QR_ID="&scene_id Else sql="update weixinQR set QR_ClickInt=QR_ClickInt+1 where QR_ID="&scene_id End If objConn.Execute sql End If If QR_type="1" Then '车牌 sql="select top 1 CarLicense,DispatchOrdClass,DispatchOrdID,ServiceOrdIDDt,DispatchOrdState,DispatchOrdTraSDTime,DispatchOrdTraStreet,DispatchOrdTraEnd,DispatchOrdTraVia,DispatchOrd_NS_Time,DispatchOrdNo,DispatchOrdActualDate,DispatchOrdCarID,ServiceOrdTraTxnPrice,ServiceOrdUnitID,HospNameA=(select HospName from HospData where HospID=ServiceOrdPtOutHospID),HospNameB=(select HospName from HospData where HospID=ServiceOrdPtInHospID) from DispatchOrd LEFT JOIN ServiceOrder on ServiceOrdIDDt=ServiceOrdID,CarData where DispatchOrdCarID=CarID and DispatchOrdState in (4,5,6,7) and DispatchOrdCarID="&QR_Key&" order by DispatchOrdActualDate desc" rs.open sql,objConn,1,1 If not rs.eof Then DispatchOrdClass = rs("DispatchOrdClass") DispatchOrdID = rs("DispatchOrdID") ServiceOrdID = rs("ServiceOrdIDDt") DispatchOrdState = rs("DispatchOrdState") SDTime = rs("DispatchOrdTraSDTime") DispatchOrdTraStreet= rs("DispatchOrdTraStreet") DispatchOrdTraEnd = rs("DispatchOrdTraEnd") DispatchOrdTraVia = rs("DispatchOrdTraVia") DispatchOrdActualDate=rs("DispatchOrdActualDate") DispatchOrdCarID = rs("DispatchOrdCarID") ServiceOrdTraTxnPrice=rs("ServiceOrdTraTxnPrice") ServiceOrdUnitID = rs("ServiceOrdUnitID") HospNameA = rs("HospNameA") HospNameB = rs("HospNameB") DispatchOrdNo = DispatchOrdClass& year(rs("DispatchOrd_NS_Time"))&Right("0"&month(rs("DispatchOrd_NS_Time")),2)&Right("0"&day(rs("DispatchOrd_NS_Time")),2) & "-"&Right("00"&rs("DispatchOrdNo"),3) '调度单编号 If DispatchOrdTraVia<>"" Then DispatchOrdTraStreet=DispatchOrdTraVia If HospNameA="" Or HospNameA="家中" Then HospNameA=DispatchOrdTraStreet If HospNameB="" Or HospNameB="家中" Then HospNameB=DispatchOrdTraEnd weixinTitle="" weixinTXT="" weixinPic="" weixinURL="" '发送模块信息---- weixinID=5738 Set wxrs = Server.CreateObject("ADODB.Recordset") sql="select * from dictionary where id="&weixinID 'Response.Write sql &"

" wxrs.open sql,objConn,1,1 APPID = "wx70f6a7346ee842c0" APPSECRET = "2d6c59de85e876b7eadebeba62e5417a" access_token = wxrs("vtext") access_token_time= wxrs("vMono") wxrs.close() If InStr(access_token,"40001")>0 Then access_token_time=now()-1 End If access_token=GetAccess_token(weixinID,access_token,access_token_time) appUrl="https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="&access_token args1="{" args1=args1&"""touser"":"""&fromusername&"""," args1=args1&"""template_id"":""TEFZzpdZWa77GUY4gv1AHTgiyrjiYjDzEg3_1jry2iU""," args1=args1&"""miniprogram"":{" args1=args1&"""appid"":""wx64efc68483366622""," args1=args1&"""pagepath"":""pages/order/detail/detail?ServiceOrdID="&ServiceOrdID&"""" args1=args1&"}," args1=args1&"""data"":{" args1=args1&"""first"": {" args1=args1&"""value"":""请您对我们的服务团队进行评价""" args1=args1&"}," args1=args1&"""keyword1"": {" args1=args1&"""value"":"""&datepart("yyyy",now())&"年"&datepart("m",now())&"月"&datepart("d",now())&"日""" args1=args1&"}," args1=args1&"""keyword2"": {" args1=args1&"""value"":"""&HospNameA&" 至 "&HospNameB&"""," args1=args1&"""color"":""#ff4d00""" args1=args1&"}," args1=args1&"""keyword3"": {" args1=args1&"""value"":""民航医疗快线""" args1=args1&"}," args1=args1&"""remark"": {" args1=args1&"""value"":""点击查看详情并对本次服务进行评价""" args1=args1&"}" args1=args1&"}" args1=args1&"}" call PostBody(appUrl,args1) '发送模块信息----end Else weixinTitle="民航医疗快线 966120" weixinTXT="车牌:"&QR_Name weixinPic="https://wx.966120.com.cn/img/success2.png" weixinURL="http://mp.weixin.qq.com/s/PrFHf6i0Fk7OE0iG98kbQg" End If rs.close() ElseIf QR_type="2" Then '人员 sql="select top 1 EntourageOAid,DispatchOrdClass,DispatchOrdID,ServiceOrdIDDt,DispatchOrdState,DispatchOrdTraSDTime,DispatchOrdTraStreet,DispatchOrdTraEnd,DispatchOrdTraVia,DispatchOrd_NS_Time,DispatchOrdNo,DispatchOrdActualDate,DispatchOrdCarID,ServiceOrdTraTxnPrice,ServiceOrdUnitID,HospNameA=(select HospName from HospData where HospID=ServiceOrdPtOutHospID),HospNameB=(select HospName from HospData where HospID=ServiceOrdPtInHospID) from DispatchOrd LEFT JOIN ServiceOrder on ServiceOrdIDDt=ServiceOrdID,DispatchOrd_Entourage where DispatchOrdID=DispatchOrdIDDt and DispatchOrdState in (4,5,6,7) and EntourageState<>4 and EntourageOAid="&QR_Key&" order by DispatchOrdActualDate desc" rs.open sql,objConn,1,1 If not rs.eof Then DispatchOrdClass = rs("DispatchOrdClass") DispatchOrdID = rs("DispatchOrdID") ServiceOrdID = rs("ServiceOrdIDDt") DispatchOrdState = rs("DispatchOrdState") SDTime = rs("DispatchOrdTraSDTime") DispatchOrdTraStreet= rs("DispatchOrdTraStreet") DispatchOrdTraEnd = rs("DispatchOrdTraEnd") DispatchOrdTraVia = rs("DispatchOrdTraVia") DispatchOrdActualDate=rs("DispatchOrdActualDate") DispatchOrdCarID = rs("DispatchOrdCarID") ServiceOrdTraTxnPrice=rs("ServiceOrdTraTxnPrice") ServiceOrdUnitID = rs("ServiceOrdUnitID") HospNameA = rs("HospNameA") HospNameB = rs("HospNameB") DispatchOrdNo = DispatchOrdClass& year(rs("DispatchOrd_NS_Time"))&Right("0"&month(rs("DispatchOrd_NS_Time")),2)&Right("0"&day(rs("DispatchOrd_NS_Time")),2) & "-"&Right("00"&rs("DispatchOrdNo"),3) '调度单编号 If DispatchOrdTraVia<>"" Then DispatchOrdTraStreet=DispatchOrdTraVia If HospNameA="" Or HospNameA="家中" Then HospNameA=DispatchOrdTraStreet If HospNameB="" Or HospNameB="家中" Then HospNameB=DispatchOrdTraEnd weixinTitle="" weixinTXT="" weixinPic="" weixinURL="" '发送模块信息---- weixinID=5738 Set wxrs = Server.CreateObject("ADODB.Recordset") sql="select * from dictionary where id="&weixinID 'Response.Write sql &"

" wxrs.open sql,objConn,1,1 APPID = "wx70f6a7346ee842c0" APPSECRET = "2d6c59de85e876b7eadebeba62e5417a" access_token = wxrs("vtext") access_token_time= wxrs("vMono") wxrs.close() If InStr(access_token,"40001")>0 Then access_token_time=now()-1 End If access_token=GetAccess_token(weixinID,access_token,access_token_time) appUrl="https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="&access_token args1="{" args1=args1&"""touser"":"""&fromusername&"""," args1=args1&"""template_id"":""TEFZzpdZWa77GUY4gv1AHTgiyrjiYjDzEg3_1jry2iU""," args1=args1&"""miniprogram"":{" args1=args1&"""appid"":""wx64efc68483366622""," args1=args1&"""pagepath"":""pages/order/detail/detail?ServiceOrdID="&ServiceOrdID&"""" args1=args1&"}," args1=args1&"""data"":{" args1=args1&"""first"": {" args1=args1&"""value"":""请您对我们的服务团队进行评价""" args1=args1&"}," args1=args1&"""keyword1"": {" args1=args1&"""value"":"""&datepart("yyyy",now())&"年"&datepart("m",now())&"月"&datepart("d",now())&"日""" args1=args1&"}," args1=args1&"""keyword2"": {" args1=args1&"""value"":"""&HospNameA&" 至 "&HospNameB&"""," args1=args1&"""color"":""#ff4d00""" args1=args1&"}," args1=args1&"""keyword3"": {" args1=args1&"""value"":""民航医疗快线""" args1=args1&"}," args1=args1&"""remark"": {" args1=args1&"""value"":""点击查看详情并对本次服务进行评价""" args1=args1&"}" args1=args1&"}" args1=args1&"}" call PostBody(appUrl,args1) '发送模块信息----end Else weixinTitle="民航医疗快线 966120" weixinTXT="员工:"&QR_Name weixinPic="https://wx.966120.com.cn/img/success2.png" weixinURL="http://mp.weixin.qq.com/s/PrFHf6i0Fk7OE0iG98kbQg" End If rs.close() ElseIf QR_type="3" Then '订单验证码 If QR_Key<>"" Then sql="select top 1 ServiceOrdID,DispatchOrdID,DispatchOrdState,ServiceOrdTraVia,ServiceOrdTraEnd,ServiceOrdTraTxnPrice,ServiceOrdTraPrePayment,ServiceOrdTraPaidPrice from ServiceOrder LEFT JOIN DispatchOrd on ServiceOrdIDDt=ServiceOrdID where (DispatchOrdState is null or DispatchOrdState in (0,1,2,3,4,5,6,7)) and ServiceOrdID="&QR_Key&" order by DispatchOrdActualDate desc" rs.open sql,objConn,1,1 If not rs.eof Then DispatchOrdID = rs("DispatchOrdID") ServiceOrdID = rs("ServiceOrdID") DispatchOrdState = rs("DispatchOrdState") ServiceOrdTraVia = rs("ServiceOrdTraVia") ServiceOrdTraEnd = rs("ServiceOrdTraEnd") ServiceOrdTraTxnPrice=rs("ServiceOrdTraTxnPrice") '成交价 ServiceOrdTraPrePayment = rs("ServiceOrdTraPrePayment") '需预付款 ServiceOrdTraPaidPrice=rs("ServiceOrdTraPaidPrice") '已支付金额 If DispatchOrdID<>"" And Not isnull(DispatchOrdID) then weixinURL = weixinURL&"&DispatchOrdID="&DispatchOrdID Else weixinURL = weixinURL&"&DispatchOrdID=0&ServiceOrdID="&ServiceOrdID End If If DispatchOrdTraVia<>"" Then DispatchOrdTraStreet=DispatchOrdTraVia If ServiceOrdTraPrePayment>ServiceOrdTraPaidPrice Then weixinTitle="您的转运订单需支付定金:"&(ServiceOrdTraPrePayment-ServiceOrdTraPaidPrice)&"元" weixinTXT="您的转运行程为:"&vbcrlf&ServiceOrdTraVia&vbcrlf&ServiceOrdTraEnd else weixinTitle="您的转运订单" weixinTXT="您的转运行程为:"&vbcrlf&ServiceOrdTraVia&vbcrlf&ServiceOrdTraEnd End If weixinPic="https://wx.966120.com.cn/img/success2.png" weixinURL=weixinURL Else weixinTitle="民航医疗快线 966120" weixinTXT="感谢您关注本公众号。若您有任何需要咨询了解的地方,请致电我们的24小时服务热线:(020)966120,广东民航医疗快线全心全意为您服务!!" weixinPic="" weixinURL="" End If Else weixinTitle="民航医疗快线 966120" weixinTXT="感谢您关注本公众号。若您有任何需要咨询了解的地方,请致电我们的24小时服务热线:(020)966120,广东民航医疗快线全心全意为您服务!" weixinURL="" End If ElseIf QR_type="4" Then '个人会员 sql="select UserID,UserSource,RecommendUserID from UserData where UserID="&QR_Key rs.open sql,objConn,1,1 If not rs.eof Then UserID = rs("UserID") UserSource = rs("UserSource") RecommendUserID = rs("RecommendUserID") Source = "Rid"&UserID If UserSource<>"" Then Source=Source&"/"&UserSource weixinTitle="" weixinTXT="" weixinPic="" weixinURL="" '发送模块信息---- weixinID=5738 Set wxrs = Server.CreateObject("ADODB.Recordset") sql="select * from dictionary where id="&weixinID 'Response.Write sql &"

" wxrs.open sql,objConn,1,1 APPID = "wx70f6a7346ee842c0" APPSECRET = "2d6c59de85e876b7eadebeba62e5417a" access_token = wxrs("vtext") access_token_time= wxrs("vMono") wxrs.close() If InStr(access_token,"40001")>0 Then access_token_time=now()-1 End If access_token=GetAccess_token(weixinID,access_token,access_token_time) appUrl="https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="&access_token args1="{" args1=args1&"""touser"":"""&fromusername&"""," args1=args1&"""template_id"":""tJcwe12crSql304L19h3vegLC6cSAkfRl0u_trHcSGI""," args1=args1&"""miniprogram"":{" args1=args1&"""appid"":""wx64efc68483366622""," args1=args1&"""pagepath"":""pages/my/login/login?S="&Source&"""" args1=args1&"}," args1=args1&"""data"":{" args1=args1&"""keyword1"": {" args1=args1&"""value"":""请点击此处,授权手机号。""," args1=args1&"""color"":""#ff4d00""" args1=args1&"}," args1=args1&"""keyword2"": {" args1=args1&"""value"":"""&datepart("yyyy",now())&"年"&datepart("m",now())&"月"&datepart("d",now())&"日""" args1=args1&"}" 'args1=args1&"""remark"": {" ' args1=args1&"""value"":""新注册的顾客,可获得价值350元的现金券""" 'args1=args1&"}" args1=args1&"}" args1=args1&"}" call PostBody(appUrl,args1) '发送模块信息----end Else weixinTitle="民航医疗快线 966120" weixinTXT="感谢您关注本公众号。若您有任何需要咨询了解的地方,请致电我们的24小时服务热线:(020)966120,广东民航医疗快线全心全意为您服务!!" weixinPic="" weixinURL="" End If rs.close() ElseIf QR_type="0" Then '现场扫码活动 sql="select QR_activityInt from QR_activity where QR_OpenID='"&fromusername&"' and QR_Key='"&QR_Key&"'" rs.open sql,objConn,1,1 If rs.eof Then rs.close() sql="select COUNT(*) from QR_activity where QR_Key='"&QR_Key&"'" rs.open sql,objConn,1,1 QR_activityInt=rs(0)+1 sql="Insert into QR_activity (QR_OpenID,QR_Key,QR_activityInt) values ('"&fromusername&"','"&QR_Key&"',"&QR_activityInt&")" objConn.Execute sql Else QR_activityInt=rs(0) End If rs.close() If QR_Key="2024051101" Then weixinTitle="民航医疗快线公益活动赢礼品" weixinPic="https://api.966120.com.cn/images/20240513162205.png" If QR_activityInt<=50 Then weixinTXT="拼手气,砸金蛋活动1" weixinURL="https://11651451-20.hd.ysfaisco.cn/11651451/k4sUGbOU4amzUt8_C3HkMQ/load-11651451-20.html?style=115&_source=1" ElseIf QR_activityInt<=100 Then weixinTXT="拼手气,砸金蛋活动2" weixinURL="https://11651451-24.hd.ysfaisco.cn/11651451/k4sUGbOU4amT5EJCsCaysg/load-11651451-24.html?style=115&_source=1" ElseIf QR_activityInt<=150 Then weixinTXT="拼手气,砸金蛋活动3" weixinURL="https://11651451-26.hd.ysfaisco.cn/11651451/k4sUGbOU4amXFF3YiUeELg/load-11651451-26.html?style=115&_source=1" ElseIf QR_activityInt<=200 Then weixinTXT="拼手气,砸金蛋活动4" weixinURL="https://11651451-14.hd.ysfaisco.cn/11651451/k4sUGbOU4amN1Upv-D1mtg/load-11651451-14.html?style=115&editQrcode=true&_source=1" ElseIf QR_activityInt<=250 Then weixinTXT="拼手气,砸金蛋活动5" weixinURL="https://11651451-14.hd.ysfaisco.cn/11651451/k4sUGbOU4amN1Upv-D1mtg/load-11651451-14.html?style=115&editQrcode=true&_source=1" Else weixinTXT="拼手气,砸金蛋活动6" weixinURL="https://11651451-14.hd.ysfaisco.cn/11651451/k4sUGbOU4amN1Upv-D1mtg/load-11651451-14.html?style=115&editQrcode=true&_source=1" End If End If Else weixinTitle="其它" weixinTXT="感谢您关注本公众号"&QR_type&"。若您有任何需要咨询了解的地方"&QR_Key&",请致电我们的24小时服务热线:(020)966120,广东民航医疗快线全心全意为您服务!" weixinPic="" weixinURL="" End If If weixinURL<>"" And weixinURL<>"http://mp.weixin.qq.com/s/PrFHf6i0Fk7OE0iG98kbQg" Then If DispatchOrdID<>"" And Not isnull(DispatchOrdID) Then Sign1=Md5Sign(DispatchOrdID,GPSKey,"utf-8") Else Sign1=Md5Sign(ServiceOrdID,GPSKey,"utf-8") End If weixinURL = weixinURL&"&sign="&Sign1 End If If weixinURL<>"" Then wx_QRscene="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "1" &_ "" &_ "" &_ "<![CDATA["&weixinTitle&"]]> " &_ "" &_ "" &_ "" &_ "" &_ "" &_ " " ElseIf weixinTXT<>"" Then wx_QRscene="" &_ "" &_ "" &_ ""&now&"" &_ "" &_ "" &_ " " End If end Function Function randKey(obj) Dim char_array(80) Dim temp For i = 0 To 9 char_array(i) = Cstr(i) Next For i = 10 To 35 char_array(i) = Chr(i + 55) Next For i = 36 To 61 char_array(i) = Chr(i + 61) Next Randomize For i = 1 To obj 'rnd函数返回的随机数在0~1之间,可等于0,但不等于1 '公式:int((上限-下限+1)*Rnd+下限)可取得从下限到上限之间的数,可等于下限但不可等于上限 temp = temp&char_array(int(62 - 0 + 1)*Rnd + 0) Next randKey = temp End Function 'Post方法 Function PostBody(appUrl,args1) Set https = Server.CreateObject("Msxml2.ServerXMLHTTP") 'Set https = Server.CreateObject("MSXML2.XMLHTTP") With https .Open "Post", appUrl, False .setRequestHeader "Content-Type","application/x-www-form-urlencoded" .Send args1 PostBody = .ResponseBody End With PostBody = BytesToBstr(PostBody,"utf-8") Set https = Nothing End Function 'Get方法 Function GetBody(appUrl,Origin) Set https = Server.CreateObject("Msxml2.ServerXMLHTTP") With https .Open "GET", appUrl&"?"&Origin, False .setRequestHeader "Content-Type","application/x-www-form-urlencoded" .Send "" GetBody = .ResponseBody End With GetBody = BytesToBstr(GetBody,"utf-8") Set https = Nothing End Function Function BytesToBstr(body,Cset) '飘易:转换GB2312 dim objstream set objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function '获取access_token Function GetAccess_token(weixinID,access_token,access_token_time) If DateDiff("s",access_token_time,now())>0 Then '获取新的access_token url="https://api.weixin.qq.com/cgi-bin/token" '//定义要获取源代码的网址,一般是通过变量传递过来 Origin="grant_type=client_credential&appid="&APPID&"&secret="&APPSECRET 'Response.Write url&"?"&Origin HTMLCODE= GetBody(url,Origin) access_token=replace(HTMLCODE,"{""access_token"":""","") access_token=Left(access_token,InStr(access_token,""",""")-1) access_token_time=DateAdd("s",7000,now()) '写入数据库 sql="update dictionary set vtext='"&access_token&"',vMono='"&access_token_time&"' where id="&weixinID objConn.Execute sql End if GetAccess_token = access_token End Function '发送客服信息 Function GetCustom_send(fromusername,MsgType,Content) If MsgType<>"" And Content<>"" Then weixinID=5738 Set wxrs = Server.CreateObject("ADODB.Recordset") sql="select * from dictionary where id="&weixinID 'Response.Write sql &"

" wxrs.open sql,objConn,1,1 APPID = "wx70f6a7346ee842c0" APPSECRET = "2d6c59de85e876b7eadebeba62e5417a" access_token = wxrs("vtext") access_token_time= wxrs("vMono") wxrs.close() If InStr(access_token,"40001")>0 Then access_token_time=now()-1 End If access_token=GetAccess_token(weixinID,access_token,access_token_time) appUrl="https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token="&access_token args1="{" args1=args1&"""touser"":"""&fromusername&"""," If MsgType="image" Then args1=args1&"""msgtype"":""image""," args1=args1&"""image"":{" args1=args1&"""media_id"":"""&Content&"""" args1=args1&"}" ElseIf MsgType="text" Then args1=args1&"""msgtype"":""text""," args1=args1&"""text"":{" args1=args1&"""content"":"""&Content&"""" args1=args1&"}" End If args1=args1&"}" call PostBody(appUrl,args1) End If End Function %>