Dim fl As String = "d:\web\" & e.Path
If filesys.FileExists(fl)
Dim idx As Integer = fl.LastIndexOf(".")
Dim ext As String = fl.SubString(idx)
Select Case ext
Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
e.WriteFile(fl)
Return '这里必须返回
End Select
End If
Select Case e.path
Case "Remuneration" '工资信息
' Dim e As RequestEventArgs = args(0)
Dim UserId As String
Dim UserName As String
Dim sb As New StringBuilder
sb.AppendLine("<meta name='viewport' c>")
If e.GetValues.ContainsKey("code") Then '如果通过授权链接跳转而来,就根据传递过来的code参数调用接口,获取用户的UserId
'MessageBox.Show("通过授权链接进入")
Dim ul As String = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token={0}&code={1}"
ul = CExp(ul,Functions.Execute("GetQYAccessToken"),e.GetValues("code"))
Dim hc As new HttpClient(ul)
Dim jo As JObject = JObject.Parse(hc.GetData)
If jo("UserId") IsNot Nothing Then
UserId = jo("UserId")
Else
MessageBox.Show("meiyou")
'MessageBox.Show("通过授权链接包含信息:" & userid)
End If
Else
UserId = e.Cookies("userid") '否则从cookie中提取userid
'MessageBox.Show("通过cookies获取:" & userid)
End If
Dim Verified As Boolean
Dim drc As DataRow = DataTables("员工花名册").SQLFind("企业微信号ID ='" & UserId & "'") '根据openid找出对应的行
If UserId > "" AndAlso drc IsNot Nothing AndAlso drc("微信权限") = True '授权成功
Verified = True
UserName = drc("姓名")
e.AppendCookie("userid",UserId) '将userid和username存储在Cookie中
ElseIf e.GetValues.ContainsKey("code") = False Then '如果授权失败,且不是通过授权链接跳转而来,那么就跳转到授权链接
'MessageBox.Show("跳转授权链接" & userid)
Dim ul As String = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope=snsapi_base&agentid={2}&state=STATE#wechat_redirect"
Dim ul2 As String = UrlEncode(Vars("yyzy"))
ul = CExp(ul,Vars("qyid"),ul2,Vars("yyid"))
'Dim ul As String = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww8bbc1c6c7bd8a2e7&redirect_uri=http%3a%2f%2fgz.crucg.top%3a8090%2fRemuneration&response_type=code&scope=snsapi_base&agentid=1000002&state=STATE#wechat_redirect"
sb.Append("<meta http-equiv='Refresh' c>") '跳转到授权链接%3a8090
e.WriteString(sb.ToString)
Return
End If
If Verified = False Then
'MessageBox.Show("授权不通过:" & userid)
sb.AppendLine("你无权访问本系统")
Else
'MessageBox.Show("通过,进入主页")
'MessageBox.Show("授权成功")
e.WriteString("<meta http-equiv='Refresh' c>")
' sb.AppendLine("欢迎" & UserName & "同志使用本系统,授权成功!请" & " , <a href='http://www.crucg.top/Remuneration2'>刷新页面后进去</a>")
End If
e.WriteString(sb.ToString)
Case "Remuneration2"
If e.Cookies.ContainsKey("userid") =False Then
e.WriteString("非法访问")
Return
End If
e.AsyncExecute = True
Functions.AsyncExecute("Remuneration2",e)
Case "mx"
If e.Cookies.ContainsKey("userid") =False Then
e.WriteString("非法访问")
Return
End If
e.AsyncExecute = True
Functions.AsyncExecute("mx",e)
Case "order.xls"
If e.Cookies.ContainsKey("userid") =False Then
e.WriteString("非法访问")
Return
End If
e.AsyncExecute = True
Functions.AsyncExecute("CreateXLS",e)
Case "tongji"
If e.Cookies.ContainsKey("userid") =False Then
e.WriteString("非法访问")
Return
End If
e.AsyncExecute = True
Functions.AsyncExecute("tongji",e)
Case "tongjit"
If e.Cookies.ContainsKey("userid") =False Then
e.WriteString("非法访问")
Return
End If
e.AsyncExecute = True
Functions.AsyncExecute("tongjit",e)
End S elect
可以成功推送到企业微信,但点开推送消息 总是空白页面,地址是
http://admgz.yogi.com.cn:3333/?code=BZCV6ZOzC9Uu9ksI7oG2KhPfl1NV8cltbEX9JWC5j0Q&state=STATE
我已经把admgz.yogi.com.cn:3333 设置成了可信域名
实在不理解 为什么 推送后 打开的页面是空白的,好像是少了个 参数