📄 admin_collectionrun.asp
字号:
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<!--#Include File="../Conn.asp"-->
<!--#Include File="Admin_CheckPurview.asp"-->
<!--#Include File="Class/Admin_ClassCollection.asp"-->
<%
Dim ArticleCmd
Dim CollectionType, CollectionID, CollectionName, Charset, ListURL
Dim ListBegin, ListEnd, ListABegin, ListAEnd, ListPType, ListPNPBegin, ListPNPEnd, ListPIDString, ListPIDArea
Dim ListPURLString, ListThumbType, ListThumbBegin, ListThumbEnd, TitleBegin, TitleEnd, KeywordType, KeywordBegin
Dim KeywordEnd, KeywordString, AuthorType, AuthorBegin, AuthorEnd, AuthorString
Dim CopyfromType, CopyfromBegin, CopyfromEnd, CopyfromString, UpdateTimeType, UpdateTimeBegin, UpdateTimeEnd
Dim ContentBegin, ContentEnd, ContentPType, ContentPBegin, ContentPEnd, ContentPURLBegin, ContentPURLEnd
Dim ChannelID, ClassID, OnTop, Commended, Passed, Hits, SkinID, TemplateID, CollectionNum, ArrSetting, LastDateTime, Status
Dim ListNum, PageNum, NextPageURL, SourceContent, EL_Collection, ArrListItemURL, ListItemNum
Dim AppCache, AppFliter, CacheName, ArrCharset(2), tURL, ArrListPID, BeginPIDArea, EndPIDArea, PIDAreaType
Dim SuccNum, FailNum, TempArrSetting, CollectionOrderType, NextPageNum, RequestListURL
ArrCharset(0) = "GB2312"
ArrCharset(1) = "UTF-8"
ArrCharset(2) = "Big5"
ListNum = EL_Common.ELRequest("ListNum", 2)
PageNum = EL_Common.ELRequest("PageNum", 2)
SuccNum = EL_Common.ELRequest("SuccNum", 2)
FailNum = EL_Common.ELRequest("FailNum", 2)
RequestListURL = EL_Common.ELRequest("ListURL", 1)
CollectionType = EL_Common.ELRequest("CollectionType", 2)
CacheName = Request.ServerVariables("REMOTE_ADDR") &"_"& Request.ServerVariables("REMOTE_HOST") &"_"& Request.ServerVariables("REMOTE_USER")
AppCache = Application("Collection_"& CacheName)
AppFliter = Application("Fliter_"& CacheName)
If RequestListURL = "$Terminate" Then Call CollectionCompleted()
CollectionID = AppCache(0, 0)
CollectionName = AppCache(1, 0)
Charset = AppCache(2, 0)
ListURL = AppCache(3, 0)
ListBegin = AppCache(4, 0)
ListEnd = AppCache(5, 0)
ListABegin = AppCache(6, 0)
ListAEnd = AppCache(7, 0)
ListPType = AppCache(8, 0)
ListPNPBegin = AppCache(9, 0)
ListPNPEnd = AppCache(10, 0)
ListPIDString = AppCache(11, 0)
ListPIDArea = AppCache(12, 0)
ListPURLString = AppCache(13, 0)
ListThumbType = AppCache(14, 0)
ListThumbBegin = AppCache(15, 0)
ListThumbEnd = AppCache(16, 0)
TitleBegin = AppCache(17, 0)
TitleEnd = AppCache(18, 0)
KeywordType = AppCache(19, 0)
KeywordBegin = AppCache(20, 0)
KeywordEnd = AppCache(21, 0)
KeywordString = AppCache(22, 0)
AuthorType = AppCache(23, 0)
AuthorBegin = AppCache(24, 0)
AuthorEnd = AppCache(25, 0)
AuthorString = AppCache(26, 0)
CopyfromType = AppCache(27, 0)
CopyfromBegin = AppCache(28, 0)
CopyfromEnd = AppCache(29, 0)
CopyfromString = AppCache(30, 0)
UpdateTimeType = AppCache(31, 0)
UpdateTimeBegin = AppCache(32, 0)
UpdateTimeEnd = AppCache(33, 0)
ContentBegin = AppCache(34, 0)
ContentEnd = AppCache(35, 0)
ContentPType = AppCache(36, 0)
ContentPBegin = AppCache(37, 0)
ContentPEnd = AppCache(38, 0)
ContentPURLBegin = AppCache(39, 0)
ContentPURLEnd = AppCache(40, 0)
ChannelID = AppCache(41, 0)
ClassID = AppCache(42, 0)
OnTop = AppCache(43, 0)
Commended = AppCache(44, 0)
Passed = AppCache(45, 0)
Hits = AppCache(46, 0)
SkinID = AppCache(47, 0)
TemplateID = AppCache(48, 0)
CollectionNum = AppCache(49, 0)
ArrSetting = AppCache(50, 0)
LastDateTime = AppCache(51, 0)
Status = AppCache(52, 0)
If ArrSetting = "" Or ISNULL(ArrSetting) Then
TempArrSetting = Split(",", ",")
Else
TempArrSetting = Split(ArrSetting, ",")
End If
If EL_Common.FoundInArray(TempArrSetting, 14) = True Then
CollectionOrderType = 1
Else
CollectionOrderType = 0
End If
If ListNum < 0 Then ListNum = 0
If PageNum < 1 Then PageNum = 1
If ListNum >= CollectionNum And CollectionNum>0 Then
Call CollectionCompleted()
End If
If ListPType = 0 Then
If PageNum > 1 Then PageNum = 1
tURL = ListURL
NextPageNum = PageNum + 1
If RequestListURL = "$TheEnd" Then Call CollectionCompleted()
NextPageURL = "$TheEnd"
Else
If ListPType = 2 Then
tURL = RequestListURL
ArrListPID = Split(ListPIDArea, "-")
BeginPIDArea = EL_Common.ELClng(ArrListPID(0))
EndPIDArea = EL_Common.ELClng(ArrListPID(1))
If BeginPIDArea > EndPIDArea Then
If PageNum = 1 And tURL = "" Then PageNum = BeginPIDArea
PIDAreaType = 1
If PageNum<EndPIDArea Then Call CollectionCompleted()
If PageNum>BeginPIDArea Then PageNum = BeginPIDArea
NextPageNum = PageNum - 1
Else
If PageNum = 1 And tURL = "" Then PageNum = BeginPIDArea
PIDAreaType = 0
If PageNum>EndPIDArea Then Call CollectionCompleted()
If PageNum<BeginPIDArea Then PageNum = BeginPIDArea
NextPageNum = PageNum + 1
End If
If tURL = "" Then
tURL = EL_Common.ReplaceText(ListPIDString, "\{\$ID\}", CStr(PageNum))
ElseIf tURL = "$TheEnd" Then
Call CollectionCompleted()
End If
Else
If PageNum = 1 Then
tURL = ListURL
Else
tURL = RequestListURL
If tURL = "{$TheEnd}" Then
Call CollectionCompleted()
End If
End If
NextPageNum = PageNum + 1
End If
End If
Dim StartTime, EndTime
Set EL_Collection = New ClassCollection
StartTime=Timer()
SourceContent = EL_Collection.GetURLSource(tURL, ArrCharset(Charset))
If SourceContent = "$RequestError" Then
Application.Contents.Remove("Collection_"& CacheName)
Application.Contents.Remove("Fliter_"& CacheName)
EL_Common.ShowErrorMsg("获取信息列表源错误")
Set EL_Collection = Nothing
Call ApplicationTerminate()
End If
If ListPType > 0 Then
Select Case ListPType
Case 1:
NextPageURL = EL_Collection.GetBody(SourceContent, ListPNPBegin, ListPNPEnd, False, False)
If NextPageURL = "$RequestError" Then
NextPageURL = "$TheEnd"
End If
Case 2:
If PIDAreaType = 1 Then
If PageNum>EndPIDArea Then
NextPageURL = EL_Common.ReplaceText(ListPIDString, "\{\$ID\}", CStr(PageNum-1))
Else
NextPageURL = "$TheEnd"
End If
Else
If PageNum<EndPIDArea Then
NextPageURL = EL_Common.ReplaceText(ListPIDString, "\{\$ID\}", CStr(PageNum+1))
Else
NextPageURL = "$TheEnd"
End If
End If
Case 3:
Dim ArrListPURL, ListPCount
ArrListPURL = Split(ListPURLString, VBCRLF)
ListPCount = UBound(ArrListPURL)
If PageNum<ListPCount Then
NextPageURL = ArrListPURL(PageNum+1)
Else
NextPageURL = "$TheEnd"
End If
End Select
End If
SourceContent = EL_Collection.GetBody(SourceContent, ListBegin, ListEnd, False, False)
If SourceContent = "$RequestError" Then
Application.Contents.Remove("Collection_"& CacheName)
Application.Contents.Remove("Fliter_"& CacheName)
EL_Common.ShowErrorMsg("获取列表信息错误")
Set EL_Collection = Nothing
Call ApplicationTerminate()
End If
ArrListItemURL = EL_Collection.GetArray(SourceContent, ListABegin, ListAEnd, False, False)
If ArrListItemURL = "$RequestError" Then
Application.Contents.Remove("Collection_"& CacheName)
Application.Contents.Remove("Fliter_"& CacheName)
EL_Common.ShowErrorMsg("获取列表链接地址错误")
Set EL_Collection = Nothing
Call ApplicationTerminate()
End If
ArrListItemURL = Split(ArrListItemURL, "$Array$")
ListItemNum = UBound(ArrListItemURL)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href='Admin_Style.css' type='text/css' rel='stylesheet'>
<title>信息采集管理</title>
</head>
<body>
<script language="javascript">
function Show(id){
var e = document.getElementById("Content_"+id);
var f = document.getElementById("A_"+id);
e.style.display = e.style.display==""?"none":"";
f.innerText = f.innerText=="点击预览"?"关闭预览":"点击预览";
window.location.href = "#The_"+id;
f.focus();
}
function Terminate(){
var SuccNum = document.getElementById("succ").innerText;
var FailNum = document.getElementById("fail").innerText;
var ListNum = document.getElementById("list").innerText;
window.location.href = "Admin_CollectionRun.asp?ListURL=$Terminate&SuccNum="+ SuccNum +"&FailNum="+ FailNum +"&ListNum="+ ListNum;
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
<tr>
<td class="item_25"><span class="redText">采集过程中请不要刷新页面</span></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
<tr>
<td class="td_50">
<div>当前运行项目:<%=OUT(CollectionName)%></div>
<div>正在采集目标项目的第 <span class="redText"><%=PageNum%></span> 页列表[<span class="BlueText"><%=Out(tURL)%></span>],待采集信息 <span class="redText"><%=ListItemNum+1%></span> 条</div>
<div>
<div style="float:left;">已采集:<span id="list" class="redText"><%=ListNum%></span> 条 成功:<span id="succ" class="redText"><%=SuccNum%></span> 条 失败:<span id="fail" class="redText"><%=FailNum%></span> 条</div>
<div style="float:right; margin-right:5px;"><a href="javascript:Terminate()" style="text-decoration:underline; color:blue;">停止采集</a></div>
</div>
</td>
</tr>
</table>
<br>
<%
Response.Flush()
Dim i, RequestError, ErrorMsg, iStart, iEnd, iStep
Dim Title, Keyword, Author, Copyfrom, UpdateTime, Content, TargetURL, PageInfo, PictrueNum
If CollectionOrderType = 1 Then
iStart = ListItemNum
iEnd = 0
iStep = -1
Else
iStart = 0
iEnd = ListItemNum
iStep = 1
End If
If CollectionType = 1 Then
Call EL_Common.InitCommand(ArticleCmd, "EL_SP_Article")
End If
For i = iStart To iEnd Step iStep
RequestError = False
ErrorMsg = ""
Title = ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -