123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- 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"];
- }
- }
- }
|