【调度系统】广东民航医疗快线调度系统源代码
wanglizhong
2025-04-22 72c0df785d4838d35dc694071c61e3f9a54e7e81
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<%
'接口信息
If weixinID="" Then weixinID=1
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from GBR.dbo.weixinAPP where id="&weixinID
'Response.Write sql &"<br><br>"
rs.open sql,objConn,1,1
wx_Name        = rs("wx_Name")
APPID        = rs("APPID")
APPSECRET    = rs("APPSECRET")
token        = rs("token")
access_token    = rs("access_tokenID")
access_token_time= rs("access_tokenTime")
jsapi_ticket    = rs("jsapi_ticketID")
jsapi_ticket_time= rs("jsapi_ticketTime")
mch_id    = rs("mch_id")
mch_key    = rs("mch_key")
mch_customs    = rs("mch_customs")
mch_customs_no    = rs("mch_customs_no")
OriginalID=rs("OriginalID")
rs.close()
If InStr(jsapi_ticket,"40001")>0 Or InStr(access_token,"40001")>0 Then
    access_token_time=now()-1
    jsapi_ticket_time=now()-1
End If
 
'access_token_time="2016-10-1 10:00:00"
If weixinID="10" Then
    access_token=GetAccess_token_qy(weixinID,access_token,access_token_time)
Else
    access_token=GetAccess_token(weixinID,access_token,access_token_time)
End If
 
 
'--------------------------UNIX时间戳---------------------begin
'ToUnixTime(now(), +8)
Function ToUnixTime(strTime, intTimeZone)        
    If IsEmpty(strTime) or Not IsDate(strTime) Then strTime = Now        
    If IsEmpty(intTimeZone) or Not isNumeric(intTimeZone) Then intTimeZone = 0        
     ToUnixTime = DateAdd("h",-intTimeZone,strTime)        
     ToUnixTime = DateDiff("s","1970-1-1 0:0:0", ToUnixTime)        
End Function
'--------------------------UNIX时间戳---------------------end
 
'把UNIX时间戳转换为标准时间---------------------begin
Function FromUnixTime(intTime, intTimeZone)
    If IsEmpty(intTime) or Not IsNumeric(intTime) Then
        FromUnixTime = Now()
        Exit Function
    End If         
    If IsEmpty(intTime) or Not IsNumeric(intTimeZone) Then intTimeZone = 0
    FromUnixTime = DateAdd("s", intTime, "1970-01-01 00:00:00")
    FromUnixTime = DateAdd("h", intTimeZone, FromUnixTime)
End Function
'把UNIX时间戳转换为标准时间---------------------end
 
'获取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
    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 GBR.dbo.weixinAPP set access_tokenID='"&access_token&"',access_tokenTime='"&access_token_time&"' where id="&weixinID
    objConn.Execute sql
End if
GetAccess_token = access_token
End Function
 
'获取jsapi_ticket
Function Getjsapi_ticket(weixinID,jsapi_ticket,jsapi_ticket_time)
If DateDiff("s",jsapi_ticket_time,now())>0 then
    '获取新的jsapi_ticket
    url="https://api.weixin.qq.com/cgi-bin/ticket/getticket"  '//定义要获取源代码的网址,一般是通过变量传递过来
    Origin="access_token="&access_token&"&type=jsapi"
    HTMLCODE= GetBody(url,Origin)
    jsapi_ticket=replace(replace(HTMLCODE,"{""errcode"":0,""errmsg"":""ok"",""ticket"":""",""),""",""expires_in"":7200}","")    
    jsapi_ticket_time=DateAdd("s",7000,now())
    '写入数据库
    sql="update GBR.dbo.weixinAPP set jsapi_ticketID='"&jsapi_ticket&"',jsapi_ticketTime='"&jsapi_ticket_time&"' where id="&weixinID
    objConn.Execute sql
End if 
Getjsapi_ticket = jsapi_ticket
End Function
 
'获取企业号access_token
Function GetAccess_token_qy(weixinID,access_token,access_token_time)
If DateDiff("s",access_token_time,now())>0 Then
    '获取新的access_token
    url="https://qyapi.weixin.qq.com/cgi-bin/gettoken"  '//定义要获取源代码的网址,一般是通过变量传递过来
    Origin="corpid="&APPID&"&corpsecret="&APPSECRET
    HTMLCODE= GetBody(url,Origin)
    str="["&HTMLCODE&"]"
    set obj = getjson(str)
    access_token    = obj.get(0).access_token
    expires_in        = obj.get(0).expires_in
    access_token_time=DateAdd("s",(expires_in-100),now())
    '写入数据库
    sql="update GBR.dbo.weixinAPP set access_tokenID='"&access_token&"',access_tokenTime='"&access_token_time&"' where id="&weixinID
    objConn.Execute sql
End if
GetAccess_token_qy = access_token
End Function
 
'获取企业号jsapi_ticket
Function Getjsapi_ticket_qy(weixinID,jsapi_ticket,jsapi_ticket_time)
If DateDiff("s",jsapi_ticket_time,now())>0 then
    '获取新的jsapi_ticket
    url="https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket"  '//定义要获取源代码的网址,一般是通过变量传递过来
    Origin="access_token="&access_token
    HTMLCODE= GetBody(url,Origin)
    If InStr(HTMLCODE,"""errmsg"":""ok""")>=1 Then
        jsapi_ticket=replace(replace(HTMLCODE,"{""errcode"":0,""errmsg"":""ok"",""ticket"":""",""),""",""expires_in"":7200}","")    
        jsapi_ticket_time=DateAdd("s",7000,now())
        '写入数据库
        sql="update GBR.dbo.weixinAPP set jsapi_ticketID='"&jsapi_ticket&"',jsapi_ticketTime='"&jsapi_ticket_time&"' where id="&weixinID
        objConn.Execute sql
    End If
End if 
Getjsapi_ticket_qy = jsapi_ticket
End Function
 
'获取用户OpenID
Function GetOpenID(code)
    '获取OpenID
    url="https://api.weixin.qq.com/sns/oauth2/access_token"  '//定义要获取源代码的网址,一般是通过变量传递过来
    Origin="appid="&APPID&"&secret="&APPSECRET&"&code="&code&"&grant_type=authorization_code"
    HTMLCODE= GetBody(url,Origin)
    If InStr(HTMLCODE,"""openid"":""")>0 then
        OpenID=Mid(HTMLCODE,InStr(HTMLCODE,"""openid"":""")+10)
        OpenID=Mid(OpenID,1,InStr(OpenID,""",""")-1)
    Else
        OpenID=""
    End If
GetOpenID = OpenID
End Function
 
'获取用户OpenID2
Function GetOpenID2(code)
    '获取OpenID
    url="https://api.weixin.qq.com/sns/oauth2/access_token"  '//定义要获取源代码的网址,一般是通过变量传递过来
    Origin="appid="&APPID&"&secret="&APPSECRET&"&code="&code&"&grant_type=authorization_code"
    HTMLCODE= GetBody(url,Origin)
    GetOpenID2 = HTMLCODE
End Function
 
'获取用户OpenID_CX    小程序专用
Function GetOpenID_CX(code)
    '获取OpenID
    url="https://api.weixin.qq.com/sns/jscode2session"  '//定义要获取源代码的网址,一般是通过变量传递过来
    Origin="appid="&APPID&"&secret="&APPSECRET&"&js_code="&code&"&grant_type=authorization_code"
    HTMLCODE= GetBody(url,Origin)
    GetOpenID_CX = HTMLCODE
End Function
 
'获取code
Function GetCode(state)
    redirectUrl    = "http://"&Request.ServerVariables("SERVER_NAME")&Request.ServerVariables("URL")
    state=state&"|N"
    url="https://open.weixin.qq.com/connect/oauth2/authorize"
    Origin="appid="&APPID&"&redirect_uri="&redirectUrl&"&response_type=code&scope=snsapi_base&state="&state&"#wechat_redirect"
    Response.Redirect url&"?"&Origin
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
 
'Post方法
Function PostBody(appUrl,args1)
    Set PBrs = Server.CreateObject("ADODB.Recordset")
    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
 
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
 
'微信支付统一下单
Function PostXML(pUrl, pXml)  
    PostXML = ""  
    Dim https, ResponseBody  
    Set https = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")  
    https.setOption(3) = "LOCAL_MACHINE\My\MMPay"
      
    Dim xmlDoc  
    Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")  
    xmlDoc.async = false  
    xmlDoc.loadXML pXml  
      
    With https   
        .Open "POST", pUrl, False  
        .setRequestHeader "Content-Type","application/xml;charset=UTF-8"  
        .Send xmlDoc    'pXml  
        PostXML = .ResponseText  
    End With   
    Set https = Nothing   
End Function
%>
<!--#include virtual="/weixin/sha1.asp"-->