|
@@ -6,6 +6,7 @@ import (
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"mongodb"
|
|
|
+ "regexp"
|
|
|
"sort"
|
|
|
"spider"
|
|
|
"strconv"
|
|
@@ -526,7 +527,7 @@ func LuaSaveLog(code, user string, data *map[string]interface{}, stype int) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//检查列表页和三级页代码中是否含lua原生方法
|
|
|
+//爬虫保存时,检查列表页和三级页代码中是否含lua原生方法
|
|
|
func LuaTextCheck(list, detail string, type_list int) (b bool, msg string) {
|
|
|
defer qu.Catch()
|
|
|
if LuaReg.MatchString(list) || LuaReg.MatchString(detail) {
|
|
@@ -537,9 +538,20 @@ func LuaTextCheck(list, detail string, type_list int) (b bool, msg string) {
|
|
|
b = true
|
|
|
msg = `三级页缺少data["delete"]="true"`
|
|
|
}
|
|
|
- if type_list != 0 && !strings.Contains(list, "sendListNum") { //列表页专家模式且不含sendListNum
|
|
|
+ reg1 := regexp.MustCompile("sendListNum")
|
|
|
+ slIndexArr := reg1.FindAllStringIndex(list, -1)
|
|
|
+ if type_list != 0 && len(slIndexArr) == 0 { //列表页专家模式且不含sendListNum
|
|
|
b = true
|
|
|
msg = "代码中缺少sendListNum方法;" + msg
|
|
|
+ } else if type_list == 1 && len(slIndexArr) > 0 { //判断sendListNum方法的位置
|
|
|
+ reg2 := regexp.MustCompile("insert")
|
|
|
+ tsIndexArr := reg2.FindAllStringIndex(list, -1)
|
|
|
+ slIndex := slIndexArr[len(slIndexArr)-1]
|
|
|
+ tsIndex := tsIndexArr[len(tsIndexArr)-1]
|
|
|
+ if slIndex[1] < tsIndex[1] { //sendListNum方法必须在table.inset方法后
|
|
|
+ b = true
|
|
|
+ msg = "sendListNum方法位置错误;" + msg
|
|
|
+ }
|
|
|
}
|
|
|
return
|
|
|
}
|