|
@@ -17,6 +17,7 @@ import (
|
|
|
gojs "gorunjs/client"
|
|
|
"io"
|
|
|
"io/ioutil"
|
|
|
+ login "login/client"
|
|
|
mu "mfw/util"
|
|
|
"mime/multipart"
|
|
|
"net/http"
|
|
@@ -51,7 +52,7 @@ type Script struct {
|
|
|
}
|
|
|
|
|
|
//加载文件
|
|
|
-func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
|
|
|
+func (s *Script) LoadScript(site *string, downloadnode, script string, isfile ...string) {
|
|
|
s.ScriptFile = script
|
|
|
options := lua.Options{
|
|
|
RegistrySize: 256 * 20,
|
|
@@ -714,6 +715,19 @@ func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
|
|
|
S.Push(lua.LString(contentHtml))
|
|
|
return 1
|
|
|
}))
|
|
|
+ //渲染页面下载
|
|
|
+ s.L.SetGlobal("getSimulateLoginInfo", s.L.NewFunction(func(S *lua.LState) int {
|
|
|
+ param := S.ToTable(-1)
|
|
|
+ header := S.ToTable(-2)
|
|
|
+ byteParam, _ := json.Marshal(util.TableToMap(param))
|
|
|
+ headerParam, _ := json.Marshal(util.TableToMap(header))
|
|
|
+ stype := S.ToString(-3) //login:登陆,get:获取cookie
|
|
|
+ qu.Debug(string(headerParam))
|
|
|
+ qu.Debug(string(byteParam))
|
|
|
+ cookie := login.GetSimulateLoginInfo(*site, stype, string(headerParam), string(byteParam))
|
|
|
+ S.Push(lua.LString(cookie))
|
|
|
+ return 1
|
|
|
+ }))
|
|
|
//辽宁省招标投标监管网
|
|
|
s.L.SetGlobal("multipartRequest", s.L.NewFunction(func(S *lua.LState) int {
|
|
|
yzm := S.ToString(-5)
|
|
@@ -791,7 +805,8 @@ func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
|
|
|
//
|
|
|
func (s *Script) Reload() {
|
|
|
s.L.Close()
|
|
|
- s.LoadScript("", s.ScriptFile)
|
|
|
+ site := ""
|
|
|
+ s.LoadScript(&site, "", s.ScriptFile)
|
|
|
}
|
|
|
|
|
|
//unicode转码
|