Foxtable(狐表)用户栏目专家坐堂 → 动态函数问题


  共有3668人关注过本帖树形打印复制链接

主题:动态函数问题

帅哥哟,离线,有人找我吗?
狐表(小白)
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小狐 帖子:371 积分:4017 威望:0 精华:0 注册:2019/9/17 10:06:00
动态函数问题  发帖心情 Post By:2021/11/22 19:09:00 [只看该作者]

新增一个动态函数,编译时执行的下面加色出错,如图:怎么修改拼接符?

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看

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}&timestamp={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()

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110574 积分:562760 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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 

另外新版已经去掉了动态编译功能,如果还考虑到升级的就不要使用动态编译了

 回到顶部