以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 动态函数问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=173282) |
-- 作者:狐表(小白) -- 发布时间:2021/11/22 19:09:00 -- 动态函数问题 新增一个动态函数,编译时执行的下面加色出错,如图:怎么修改拼接符? Dim Code As string Code = "Static CreateTime As Date" & vbcrlf Code = Code & "Static Ticket As String" & vbcrlf Code = Code & "Dim tp As TimeSpan = Date.Now - CreateTime" & vbcrlf Code = Code & "Dim ul As String = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token={0}"" & vbcrlf Code = Code & "If tp.TotalSeconds > 3600 Then" & vbcrlf Code = Code & "Dim hc As New HttpClient(CExp(ul,Functions.Execute("GetQYAccessToken")))" & vbcrlf Code = Code & "Dim ret As String = hc.GetData()" & vbcrlf Code = Code & "If ret = "" Then" & vbcrlf Code = Code & "hc.GetData()" & vbcrlf Code = Code & "End If" & vbcrlf Code = Code & "CreateTime = Date.Now()" & vbcrlf Code = Code & "Dim jo As JObject = JObject.Parse(ret)" & vbcrlf Code = Code & "If jo("errcode") = "0" Then" & vbcrlf Code = Code & "Ticket = jo("ticket")" & vbcrlf Code = Code & "Else" & vbcrlf Code = Code & "MessageBox.show("获取jsapi_ticket,原因:" & vbcrlf & jo.ToString)" & vbcrlf Code = Code & "End If" & vbcrlf Code = Code & "End If" & vbcrlf Code = Code & "Dim signature As String = CExp("jsapi_ticket={0}&noncestr={1}×tamp={2}&url={3}",Ticket,args(0),args(1),args(2))" & vbcrlf Code = Code & "Return Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(signature, "SHA1").ToLower()" & vbcrlf Code = Code & "Return GetJsSignature" Functions.Add("GetJsSignature",Code) Functions.Complie()
|
-- 作者:有点蓝 -- 发布时间:2021/11/22 20:17:00 -- Code = Code & "Dim ul As String = ""https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token={0}""" & vbcrlf 另外新版已经去掉了动态编译功能,如果还考虑到升级的就不要使用动态编译了
|