function DecodePJItem(sText: string): TList<TDataItem>;
var
reg: TRegEx;
mc: TMatchCollection;
item: TMatch;
dataItem: TDataItem;
begin
Result := TList<TDataItem>.Create;
sText := reg.Replace(sText, '\n', '');
sText := reg.Replace(sText, '<tr style="">.*?</tr>', ''); //
sText := reg.Replace(sText, '<td width=".*?">', '');
sText := reg.Replace(sText, '<span class.*?">', '');
sText := reg.Replace(sText, '<td class=.*?>', '');
sText := reg.Replace(sText, '<p class.*?>', '');
sText := reg.Replace(sText, '<input .*?>', '');
sText := reg.Replace(sText, '<a.*?>', '');
sText := reg.Replace(sText, '</a>', '');
sText := reg.Replace(sText, '</span>', '');
sText := reg.Replace(sText, '</tr>', '|');
sText := reg.Replace(sText, '<tr>', '');
sText := reg.Replace(sText, '</p>', '');
sText := reg.Replace(sText, '</td>', ',');
sText := reg.Replace(sText, '<span.*?>', '');
reg := TRegEx.Create('(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),\|');
mc := reg.Matches(sText); for item in mc do
begin
if item.Groups.Count = then
begin
try
if item.Groups[].Value <> '我要买' then Continue; dataItem := TDataItem.Create;
dataItem.PublishTime := item.Groups[].Value;
dataItem.Company := item.Groups[].Value;
dataItem.Money := StrToFloatDef(item.Groups[].Value, );
dataItem.OutTime := item.Groups[].Value;
dataItem.Deduction := StrToIntDef(item.Groups[].Value, );
dataItem.Defect := item.Groups[].Value;
dataItem.TimeLength := item.Groups[].Value;
dataItem.Text := item.Groups[].Value;
dataItem.LeftDay := GetLeftValue(dataItem.OutTime); if dataItem.LeftDay <= then
begin
SendLog(TDataCollector.MainHandle,
Format('%s, %s, 数据异常,跳过!!!',[dataItem.PublishTime, dataItem.Company]));
dataItem.Free;
Continue;
end;
dataItem.YearRate := dataItem.Deduction / * / DataItem.LeftDay;
dataItem.New := True;
except
Continue;
end; Result.Add(dataItem);
end;
end;
end;