新增一个动态函数,编译时执行的下面加色出错,如图:怎么修改拼接符?
此主题相关图片如下: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}×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()