|
@@ -1,215 +0,0 @@
|
|
|
-export namespace backend {
|
|
|
-
|
|
|
- export class JobItem {
|
|
|
- code: string;
|
|
|
- site: string;
|
|
|
- channel: string;
|
|
|
- url: string;
|
|
|
- proxyServe: string;
|
|
|
- maxPages: number;
|
|
|
- threads: number;
|
|
|
- listDelay: number;
|
|
|
- trunPageDelay: number;
|
|
|
- contentDelay: number;
|
|
|
- needDownloadAttaches: boolean;
|
|
|
-
|
|
|
- static createFrom(source: any = {}) {
|
|
|
- return new JobItem(source);
|
|
|
- }
|
|
|
-
|
|
|
- constructor(source: any = {}) {
|
|
|
- if ('string' === typeof source) source = JSON.parse(source);
|
|
|
- this.code = source["code"];
|
|
|
- this.site = source["site"];
|
|
|
- this.channel = source["channel"];
|
|
|
- this.url = source["url"];
|
|
|
- this.proxyServe = source["proxyServe"];
|
|
|
- this.maxPages = source["maxPages"];
|
|
|
- this.threads = source["threads"];
|
|
|
- this.listDelay = source["listDelay"];
|
|
|
- this.trunPageDelay = source["trunPageDelay"];
|
|
|
- this.contentDelay = source["contentDelay"];
|
|
|
- this.needDownloadAttaches = source["needDownloadAttaches"];
|
|
|
- }
|
|
|
- }
|
|
|
- export class Job {
|
|
|
- code: string;
|
|
|
- name: string;
|
|
|
- items: JobItem[];
|
|
|
- proxyServe: string;
|
|
|
- maxPages: number;
|
|
|
- threads: number;
|
|
|
- listDelay: number;
|
|
|
- trunPageDelay: number;
|
|
|
- contentDelay: number;
|
|
|
- state: number;
|
|
|
- stateType: string;
|
|
|
- progress: number;
|
|
|
- needDownloadAttaches: boolean;
|
|
|
-
|
|
|
- static createFrom(source: any = {}) {
|
|
|
- return new Job(source);
|
|
|
- }
|
|
|
-
|
|
|
- constructor(source: any = {}) {
|
|
|
- if ('string' === typeof source) source = JSON.parse(source);
|
|
|
- this.code = source["code"];
|
|
|
- this.name = source["name"];
|
|
|
- this.items = this.convertValues(source["items"], JobItem);
|
|
|
- this.proxyServe = source["proxyServe"];
|
|
|
- this.maxPages = source["maxPages"];
|
|
|
- this.threads = source["threads"];
|
|
|
- this.listDelay = source["listDelay"];
|
|
|
- this.trunPageDelay = source["trunPageDelay"];
|
|
|
- this.contentDelay = source["contentDelay"];
|
|
|
- this.state = source["state"];
|
|
|
- this.stateType = source["stateType"];
|
|
|
- this.progress = source["progress"];
|
|
|
- this.needDownloadAttaches = source["needDownloadAttaches"];
|
|
|
- }
|
|
|
-
|
|
|
- convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
|
- if (!a) {
|
|
|
- return a;
|
|
|
- }
|
|
|
- if (a.slice && a.map) {
|
|
|
- return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
|
- } else if ("object" === typeof a) {
|
|
|
- if (asMap) {
|
|
|
- for (const key of Object.keys(a)) {
|
|
|
- a[key] = new classs(a[key]);
|
|
|
- }
|
|
|
- return a;
|
|
|
- }
|
|
|
- return new classs(a);
|
|
|
- }
|
|
|
- return a;
|
|
|
- }
|
|
|
- }
|
|
|
- export class AttachLink {
|
|
|
- title: string;
|
|
|
- href: string;
|
|
|
- fileName: string;
|
|
|
- fileType: string;
|
|
|
- fileSize: string;
|
|
|
- filePath: string;
|
|
|
-
|
|
|
- static createFrom(source: any = {}) {
|
|
|
- return new AttachLink(source);
|
|
|
- }
|
|
|
-
|
|
|
- constructor(source: any = {}) {
|
|
|
- if ('string' === typeof source) source = JSON.parse(source);
|
|
|
- this.title = source["title"];
|
|
|
- this.href = source["href"];
|
|
|
- this.fileName = source["fileName"];
|
|
|
- this.fileType = source["fileType"];
|
|
|
- this.fileSize = source["fileSize"];
|
|
|
- this.filePath = source["filePath"];
|
|
|
- }
|
|
|
- }
|
|
|
- export class ResultItem {
|
|
|
- no: number;
|
|
|
- site: string;
|
|
|
- channel: string;
|
|
|
- href: string;
|
|
|
- listTitle: string;
|
|
|
- listPubishTime: string;
|
|
|
- title: string;
|
|
|
- publishUnit: string;
|
|
|
- publishTime: string;
|
|
|
- content: string;
|
|
|
- contentHtml: string;
|
|
|
- attachLinks: AttachLink[];
|
|
|
- attachJson: string;
|
|
|
-
|
|
|
- static createFrom(source: any = {}) {
|
|
|
- return new ResultItem(source);
|
|
|
- }
|
|
|
-
|
|
|
- constructor(source: any = {}) {
|
|
|
- if ('string' === typeof source) source = JSON.parse(source);
|
|
|
- this.no = source["no"];
|
|
|
- this.site = source["site"];
|
|
|
- this.channel = source["channel"];
|
|
|
- this.href = source["href"];
|
|
|
- this.listTitle = source["listTitle"];
|
|
|
- this.listPubishTime = source["listPubishTime"];
|
|
|
- this.title = source["title"];
|
|
|
- this.publishUnit = source["publishUnit"];
|
|
|
- this.publishTime = source["publishTime"];
|
|
|
- this.content = source["content"];
|
|
|
- this.contentHtml = source["contentHtml"];
|
|
|
- this.attachLinks = this.convertValues(source["attachLinks"], AttachLink);
|
|
|
- this.attachJson = source["attachJson"];
|
|
|
- }
|
|
|
-
|
|
|
- convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
|
- if (!a) {
|
|
|
- return a;
|
|
|
- }
|
|
|
- if (a.slice && a.map) {
|
|
|
- return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
|
- } else if ("object" === typeof a) {
|
|
|
- if (asMap) {
|
|
|
- for (const key of Object.keys(a)) {
|
|
|
- a[key] = new classs(a[key]);
|
|
|
- }
|
|
|
- return a;
|
|
|
- }
|
|
|
- return new classs(a);
|
|
|
- }
|
|
|
- return a;
|
|
|
- }
|
|
|
- }
|
|
|
- export class SpiderConfig {
|
|
|
- site: string;
|
|
|
- channel: string;
|
|
|
- author: string;
|
|
|
- url: string;
|
|
|
- code: string;
|
|
|
- listBodyCss: string;
|
|
|
- listItemCss: string;
|
|
|
- listLinkCss: string;
|
|
|
- listPublishTimeCss: string;
|
|
|
- listNextPageCss: string;
|
|
|
- titleCss: string;
|
|
|
- publishUnitCss: string;
|
|
|
- publishTimeCss: string;
|
|
|
- contentCss: string;
|
|
|
- attachCss: string;
|
|
|
- listJs: string;
|
|
|
- contentJs: string;
|
|
|
- attachJs: string;
|
|
|
- listTrunPageJs: string;
|
|
|
-
|
|
|
- static createFrom(source: any = {}) {
|
|
|
- return new SpiderConfig(source);
|
|
|
- }
|
|
|
-
|
|
|
- constructor(source: any = {}) {
|
|
|
- if ('string' === typeof source) source = JSON.parse(source);
|
|
|
- this.site = source["site"];
|
|
|
- this.channel = source["channel"];
|
|
|
- this.author = source["author"];
|
|
|
- this.url = source["url"];
|
|
|
- this.code = source["code"];
|
|
|
- this.listBodyCss = source["listBodyCss"];
|
|
|
- this.listItemCss = source["listItemCss"];
|
|
|
- this.listLinkCss = source["listLinkCss"];
|
|
|
- this.listPublishTimeCss = source["listPublishTimeCss"];
|
|
|
- this.listNextPageCss = source["listNextPageCss"];
|
|
|
- this.titleCss = source["titleCss"];
|
|
|
- this.publishUnitCss = source["publishUnitCss"];
|
|
|
- this.publishTimeCss = source["publishTimeCss"];
|
|
|
- this.contentCss = source["contentCss"];
|
|
|
- this.attachCss = source["attachCss"];
|
|
|
- this.listJs = source["listJs"];
|
|
|
- this.contentJs = source["contentJs"];
|
|
|
- this.attachJs = source["attachJs"];
|
|
|
- this.listTrunPageJs = source["listTrunPageJs"];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|