|
@@ -517,6 +517,7 @@ function common.getFilesLinkByTag(href,tags,content,withend)
|
|
--dhtml=dhtml.."<a href='/123.doc'>123.doc</a>"
|
|
--dhtml=dhtml.."<a href='/123.doc'>123.doc</a>"
|
|
local alist = findListHtml(tags.." a", content)
|
|
local alist = findListHtml(tags.." a", content)
|
|
local flist={}
|
|
local flist={}
|
|
|
|
+ local ahref={}--对href进行判重处理
|
|
for k,v in pairs(alist) do
|
|
for k,v in pairs(alist) do
|
|
local item={}
|
|
local item={}
|
|
item["href"]="a:eq("..tostring(k-1).."):attr(href)"
|
|
item["href"]="a:eq("..tostring(k-1).."):attr(href)"
|
|
@@ -550,8 +551,16 @@ function common.getFilesLinkByTag(href,tags,content,withend)
|
|
end
|
|
end
|
|
|
|
|
|
if statehref~=nil and item["title"]~="" then
|
|
if statehref~=nil and item["title"]~="" then
|
|
-
|
|
|
|
- table.insert(flist,item)
|
|
|
|
|
|
+ local has = false
|
|
|
|
+ for _,tmphref in pairs(ahref) do
|
|
|
|
+ if tmphref == item["href"] then
|
|
|
|
+ has = true
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ if not has then
|
|
|
|
+ table.insert(ahref,item["href"])
|
|
|
|
+ table.insert(flist,item)
|
|
|
|
+ end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
return flist
|
|
return flist
|
|
@@ -568,7 +577,6 @@ function common.getFileAttachmentsArrayWithTag(href,tags,content,withend,param,h
|
|
--local nameTypeArr={"jpg","JPG","bid","pdf","PDF","doc","docx","xls","xlsx","zip","rar","swf","DOCX","DOC","PDF","XLS","XLSX","ZIP","RAR","SWF"}
|
|
--local nameTypeArr={"jpg","JPG","bid","pdf","PDF","doc","docx","xls","xlsx","zip","rar","swf","DOCX","DOC","PDF","XLS","XLSX","ZIP","RAR","SWF"}
|
|
local titleAndHrefList = common.getFilesLinkByTag(href,tags,content,withend)
|
|
local titleAndHrefList = common.getFilesLinkByTag(href,tags,content,withend)
|
|
for i,v in ipairs(titleAndHrefList) do
|
|
for i,v in ipairs(titleAndHrefList) do
|
|
-
|
|
|
|
local end_type = string.find(v["title"],v["ftype"].."$")
|
|
local end_type = string.find(v["title"],v["ftype"].."$")
|
|
local file_name = ""
|
|
local file_name = ""
|
|
if end_type==nil or end_type=="" then
|
|
if end_type==nil or end_type=="" then
|