Ver código fonte

add project - 中国招标投标公共服务平台(未按规范数据)

dongzhaorui 2 anos atrás
pai
commit
bf6dd15afd

+ 189 - 0
zgztb_cookie/acw_sc_v2.js

@@ -0,0 +1,189 @@
+var _0x4818 = ["csKHwqMI", "ZsKJwr8VeAsy", "UcKiN8O/wplwMA==", "JR8CTg==", "YsOnbSEQw7ozwqZKesKUw7kwX8ORIQ==", "w7oVS8OSwoPCl3jChMKhw6HDlsKXw4s/YsOG", "fwVmI1AtwplaY8Otw5cNfSgpw6M=", "OcONwrjCqsKxTGTChsOjEWE8PcOcJ8K6", "U8K5LcOtwpV0EMOkw47DrMOX", "HMO2woHCiMK9SlXClcOoC1k=", "asKIwqMDdgMuPsOKBMKcwrrCtkLDrMKBw64d", "wqImMT0tw6RNw5k=", "DMKcU0JmUwUv", "VjHDlMOHVcONX3fDicKJHQ==", "wqhBH8Knw4TDhSDDgMOdwrjCncOWwphhN8KCGcKqw6dHAU5+wrg2JcKaw4IEJcOcwrRJwoZ0wqF9YgAV", "dzd2w5bDm3jDpsK3wpY=", "w4PDgcKXwo3CkcKLwr5qwrY=", "wrJOTcOQWMOg", "wqTDvcOjw447wr4=", "w5XDqsKhMF1/", "wrAyHsOfwppc", "J3dVPcOxLg==", "wrdHw7p9Zw==", "w4rDo8KmNEw=", "IMKAUkBt", "w6bDrcKQwpVHwpNQwqU=", "d8OsWhAUw7YzwrU=", "wqnCksOeezrDhw==", "UsKnIMKWV8K/", "w4zDocK8NUZv", "c8OxZhAJw6skwqJj", "PcKIw4nCkkVb", "KHgodMO2VQ==", "wpsmwqvDnGFq", "wqLDt8Okw4c=", "w7w1w4PCpsO4wqA=", "wq9FRsOqWMOq", "byBhw7rDm34=", "LHg+S8OtTw==", "wqhOw715dsOH", "U8O7VsO0wqvDvcKuKsOqX8Kr", "Yittw5DDnWnDrA==", "YMKIwqUUfgIk", "aB7DlMODTQ==", "wpfDh8Orw6kk", "w7vCqMOrY8KAVk5OwpnCu8OaXsKZP3DClcKyw6HDrQ==", "wow+w6vDmHpsw7Rtwo98LC7CiG7CksORT8KlW8O5wr3Di8OTHsODeHjDmcKlJsKqVA==", "NwV+", "w7HDrcKtwpJawpZb", "wpQswqvDiHpuw6I=", "YMKUwqMJZQ==", "KH1VKcOqKsK1", "fQ5sFUkkwpI=", "wrvCrcOBR8Kk", "M3w0fQ==", "w6xXwqPDvMOFwo5d"];
+(function (params, content) {
+        /**
+         * @param {?} selected_image
+         * @return {undefined}
+         */
+        var fn = function (selected_image) {
+            for (; --selected_image;) {
+                params["push"](params["shift"]());
+            }
+        };
+
+        var test = function (callback, i) {
+            callback(++i);
+        };
+        test(fn, content);
+
+    }
+)(_0x4818, 347);
+var _0x55f3 = function (str, desiredLength) {
+    /** @type {number} */
+    str = parseInt(str, 16);
+    var ret = _0x4818[str];
+    if (!_0x55f3["atobPolyfillAppended"]) {
+        (function () {
+                var evaluate = Function("return (function () " + '{}.constructor("return this")()' + ");");
+                var lval = evaluate();
+                /** @type {string} */
+                var listeners = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+                if (!lval["atob"]) {
+                    /**
+                     * @param {?} i
+                     * @return {?}
+                     */
+                    lval["atob"] = function (i) {
+                        var str = String(i)["replace"](/=+$/, "");
+                        /** @type {number} */
+                        var bc = 0;
+                        var bs;
+                        var buffer;
+                        /** @type {number} */
+                        var Y = 0;
+                        /** @type {string} */
+                        var pix_color = "";
+                        for (; buffer = str["charAt"](Y++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
+                        bc++ % 4) ? pix_color = pix_color + String["fromCharCode"](255 & bs >> (-2 * bc & 6)) : 0) {
+                            buffer = listeners["indexOf"](buffer);
+                        }
+                        return pix_color;
+                    }
+                    ;
+                }
+            }
+        )();
+        /** @type {boolean} */
+        _0x55f3["atobPolyfillAppended"] = !![];
+    }
+    if (!_0x55f3["rc4"]) {
+        /**
+         * @param {string} data
+         * @param {!Object} fn
+         * @return {?}
+         */
+        var testcase = function (data, fn) {
+            /** @type {!Array} */
+            var secretKey = [];
+            /** @type {number} */
+            var y = 0;
+            var temp;
+            /** @type {string} */
+            var testResult = "";
+            /** @type {string} */
+            var tempData = "";
+            /** @type {string} */
+            data = atob(data);
+            /** @type {number} */
+            var val = 0;
+            var key = data["length"];
+            for (; val < key; val++) {
+                /** @type {string} */
+                tempData = tempData + ("%" + ("00" + data["charCodeAt"](val)["toString"](16))["slice"](-2));
+            }
+            /** @type {string} */
+            data = decodeURIComponent(tempData);
+            /** @type {number} */
+            var x = 0;
+            for (; x < 256; x++) {
+                /** @type {number} */
+                secretKey[x] = x;
+            }
+            /** @type {number} */
+            x = 0;
+            for (; x < 256; x++) {
+                /** @type {number} */
+                y = (y + secretKey[x] + fn["charCodeAt"](x % fn["length"])) % 256;
+                temp = secretKey[x];
+                secretKey[x] = secretKey[y];
+                secretKey[y] = temp;
+            }
+            /** @type {number} */
+            x = 0;
+            /** @type {number} */
+            y = 0;
+            /** @type {number} */
+            var i = 0;
+            for (; i < data["length"]; i++) {
+                /** @type {number} */
+                x = (x + 1) % 256;
+                /** @type {number} */
+                y = (y + secretKey[x]) % 256;
+                temp = secretKey[x];
+                secretKey[x] = secretKey[y];
+                secretKey[y] = temp;
+                testResult = testResult + String["fromCharCode"](data["charCodeAt"](i) ^ secretKey[(secretKey[x] + secretKey[y]) % 256]);
+            }
+            return testResult;
+        };
+        /** @type {function(string, !Object): ?} */
+        _0x55f3["rc4"] = testcase;
+    }
+    if (!_0x55f3["data"]) {
+        _0x55f3["data"] = {};
+    }
+    if (_0x55f3["data"][str] === undefined) {
+        ret = _0x55f3["rc4"](ret, desiredLength);
+        _0x55f3["data"][str] = ret;
+    } else {
+        ret = _0x55f3["data"][str];
+    }
+    return ret;
+};
+var l = function (arg1) {
+    var data = _0x55f3("0x3", "jS1Y");
+    /**
+     * @param {?} array
+     * @return {?}
+     */
+    String[_0x55f3("0x5", "n]fR")][_0x55f3("0x6", "Pg54")] = function (array) {
+        /** @type {string} */
+        var pix_color = "";
+        /** @type {number} */
+        var i = 0;
+        for (; i < this[_0x55f3("0x8", ")hRc")] && i < array[_0x55f3("0xa", "jE&^")]; i = i + 2) {
+            /** @type {number} */
+            var $111 = parseInt(this[_0x55f3("0xb", "V2KE")](i, i + 2), 16);
+            /** @type {number} */
+            var $y = parseInt(array[_0x55f3("0xd", "XMW^")](i, i + 2), 16);
+            var pix_base = ($111 ^ $y)[_0x55f3("0xf", "W1FE")](16);
+            if (pix_base[_0x55f3("0x11", "MGrv")] == 1) {
+                /** @type {string} */
+                pix_base = "0" + pix_base;
+            }
+            /** @type {string} */
+            pix_color = pix_color + pix_base;
+        }
+        return pix_color;
+    }
+    ;
+    /**
+     * @return {?}
+     */
+    String["prototype"][_0x55f3("0x14", "Z*DM")] = function () {
+        /** @type {!Array} */
+        var animationConfigs = [15, 35, 29, 24, 33, 16, 1, 38, 10, 9, 19, 31, 40, 27, 22, 23, 25, 13, 6, 11, 39, 18, 20, 8, 14, 21, 32, 26, 2, 30, 7, 4, 17, 5, 3, 28, 34, 37, 12, 36];
+        /** @type {!Array} */
+        var a = [];
+        /** @type {string} */
+        var folderToList = "";
+        /** @type {number} */
+        var i = 0;
+        for (; i < this["length"]; i++) {
+            var className = this[i];
+            /** @type {number} */
+            var event = 0;
+            for (; event < animationConfigs[_0x55f3("0x16", "aH*N")]; event++) {
+                if (animationConfigs[event] == i + 1) {
+                    a[event] = className;
+                }
+            }
+        }
+        folderToList = a["join"]("");
+        return folderToList;
+    }
+    ;
+    var loader_calback = arg1[_0x55f3("0x19", "Pg54")]();
+    arg2 = loader_calback[_0x55f3("0x1b", "z5O&")](data);
+    // console.log('arg2 ' + arg2)
+    return arg2
+};

+ 162 - 0
zgztb_cookie/ces_detail.py

@@ -0,0 +1,162 @@
+import requests
+import unittest
+import re
+
+import execjs
+import requests
+import sys
+sys.path.append('/mnt/topic_spider/zgztb_cookie/FworkSpider')
+from untils.tools import int2long, substitute, text_search
+from feapder.db.mongodb import MongoDB
+from encode_info import encode_info
+from cookie_pool import WebCookiePool
+import time
+db_name="zgzb_list"
+cookie_pool = WebCookiePool(redis_key='zgztbcookie',
+                                page_url="http://www.cebpubservice.com/ctpsp_iiss/SecondaryAction/findDetails.do")
+def get_proxy():
+    headers = {
+        "Authorization": "Basic amlhbnl1MDAxOjEyM3F3ZSFB"
+    }
+    proxy = requests.get("http://cc.spdata.jianyu360.com/crawl/proxy/socks5/fetch", headers=headers).json()
+    print("切换代理:", proxy.get("data"))
+    return proxy.get("data")
+def get_acw_sc_v2(arg1):
+    path = 'acw_sc_v2.js'
+    with open(path, encoding='utf-8') as rp:
+        js_script = rp.read()
+        ctx = execjs.compile(js_script)
+        arg2 = ctx.call('l', arg1)
+        print(f'acw_sc_v2 >>> {arg2}')
+        return arg2
+def get_response():
+    session = requests.session()
+    # proxy = get_proxy()
+    session.headers={
+            "Host": "www.cebpubservice.com",
+            "Accept": "application/json, text/javascript, */*; q=0.01",
+            "X-Requested-With": "XMLHttpRequest",
+            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0",
+            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
+            "Origin": "http://www.cebpubservice.com",
+            "Referer": "http://www.cebpubservice.com/ctpsp_iiss/SecondaryAction/findDetails.do",
+            "Accept-Language": "zh-CN,zh;q=0.9"
+        }
+    session.proxies=get_proxy()
+    if True:
+        data_lsit = MongoDB().find("zgzb_list", {"type": "0","timeout":None}, sort={"publishtime": -1}, limit=100)
+        for item in data_lsit:
+            tenderprojectcode = item.get("href").split("&")[1]
+            businessid = item.get("href").split("&")[0]
+            businesskeyword = item.get("businessKeyWord")
+            businessoObjectname = item.get("title")
+            schemaversion = item.pop("schemaVersion")
+            rowguid = item.pop("rowGuid")
+            print(businessoObjectname)
+            detail_data = {
+                "schemaVersion": schemaversion,
+                "businessKeyWord": businesskeyword,
+                "tenderProjectCode": encode_info(tenderprojectcode),
+                "businessObjectName": businessoObjectname,
+                "businessId": encode_info(businessid),
+            }
+            detail_url = 'http://www.cebpubservice.com/ctpsp_iiss/SecondaryAction/findDetails.do'
+            try:
+                response = session.post(url=detail_url,data=detail_data,timeout=5)
+                response.encoding = response.apparent_encoding
+            except :
+                print("timeout")
+                print(detail_data)
+                MongoDB().update(db_name, {"timeout": 1}, {"_id": item["_id"]})
+
+                continue
+            if "arg1" in response.text:
+                print(response.text)
+                arg1 = "".join(re.findall("arg1='(\w+)';", response.text)).strip()
+                if arg1 != '':
+                    acw_sc_v2 = get_acw_sc_v2(arg1)
+                    session.cookies.update({'acw_sc__v2': acw_sc_v2})
+                    response = session.post(url=detail_url,data=detail_data,timeout=5)
+            elif '滑动验证页面' in response.text:
+                cookies = cookie_pool.create_cookies(proxies=session.proxies.get("http"))
+                print("cookies", cookies)
+
+                session.cookies.update(cookies)
+                try:
+                    response = session.post(url=detail_url,data=detail_data,timeout=5)
+                    if '滑动验证页面' in response.text:
+                        continue
+                except:
+                    print("timeout")
+                    print(detail_data)
+                    MongoDB().update(db_name,{"timeout":1}, {"_id": item["_id"]})
+                    continue
+            try:
+                res = response.json()
+            except Exception as e:
+                print(response.text)
+                print(e)
+                continue
+            else:
+                # print(response.json())
+                detail_response = response.json()
+                print('ok 请求成功')
+                tenderprojectcode = item.get("href").split("&")[1]
+                businessid = item.get("href").split("&")[0]
+                businesskeyword = "businessKeyWord"
+                if item.__contains__("businessKeyWord"):
+                    businesskeyword = item.pop("businessKeyWord")
+
+                detail_info = detail_response.get("object").get(businesskeyword)
+                if not detail_info:
+                    businesskeywords = detail_response.get("object").keys()
+                    for businesskeyword in businesskeywords:
+                        businesskeyword = businesskeyword
+                    detail_info = detail_response.get("object").get(businesskeyword)
+
+                area = item.get("area")
+                if area is None:
+                    item["area"] = "全国"
+                    item["city"] = ""
+                elif " " in area:
+                    item["area"] = area.split(" ")[0]
+                    item["city"] = area.split(" ")[-1]
+                else:
+                    item["area"] = "全国"
+                    item["city"] = ""
+                if detail_info is None or detail_info == []:
+                    businessKeyWords = detail_response.get("object").keys()
+                    for key in businessKeyWords:
+                        businesskeyword = key
+                    detail_info = detail_response.get("object").get(businesskeyword)
+                    if detail_info is None or detail_info == []:
+                        item[
+                            "href"] = f"http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/showDetails.do#uuid={businessid + tenderprojectcode}"
+                        item["sendflag"] = "true"
+                        item["comeintime"] = int(time.time())
+                        result = MongoDB().to_db.add("data_bak", item)
+                        MongoDB().delete(db_name, {"_id": item["_id"]})
+
+                        print(f"mongo add _id:{item.get('title')}<空结果")
+                    else:
+                        pass
+                detail_info = detail_info[0]
+                item["contenthtml"] = detail_info.get("bulletinContent")
+                if item["contenthtml"] is None:
+                    item["detail"] = None
+                    item["sendflag"] = "true"
+                else:
+                    item["detail"] = substitute(item["contenthtml"])
+                item[
+                    "href"] = f"http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/showDetails.do#uuid={businessid + tenderprojectcode}"
+                if text_search(item["detail"]).total == 0:
+                    item["sendflag"] = "true"
+                item["comeintime"] = int2long(int(time.time()))
+                ss = {"": ""}
+                result = MongoDB().add("data_bak", item)
+                MongoDB().delete(db_name, {"_id": item["_id"]})
+                print(f"mongo add _id:{item.get('title')}")
+
+if __name__ == '__main__':
+    get_response()
+    #

+ 25 - 0
zgztb_cookie/configuration/conf.yaml

@@ -0,0 +1,25 @@
+# mongo configuration
+mongo:
+#  host: 127.0.0.1
+##  port: !!int 27001
+#  port: !!int 27017
+  host: 172.17.4.87
+  port: !!int 27080
+
+
+# redis configuration
+redis:
+  host: 127.0.0.1
+  port: !!int 6379
+  pwd: ""
+  db: !!int 10
+
+
+# 阿里oss
+ali_oss:
+  key_id: LTAI4G5x9aoZx8dDamQ7vfZi
+  key_secret: Bk98FsbPYXcJe72n1bG3Ssf73acuNh
+  endpoint: oss-cn-beijing.aliyuncs.com
+  bucket_name: jy-datafile
+
+

+ 8 - 0
zgztb_cookie/configuration/constants.yaml

@@ -0,0 +1,8 @@
+headers:
+  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
+  Accept: application/json, text/plain, */*
+
+proxy:
+  socks5:
+    url: http://socks.spdata.jianyu360.com/socks/getips?limit=100
+    decrypt: ABNOPqrceQRSTklmUDEFGXYZabnopfghHVWdijstuvwCIJKLMxyz0123456789+/

+ 27 - 0
zgztb_cookie/configuration/load.py

@@ -0,0 +1,27 @@
+from pathlib import Path
+
+import yaml
+
+__all__ = [
+    'mongo_conf', 'redis_conf', 'oss_conf',
+    'constants',
+    'headers', 'jy_proxy'
+]
+
+base_path = Path(__file__).parent
+yaml_conf = (base_path / 'conf.yaml').resolve()
+yaml_constants = (base_path / 'constants.yaml').resolve()
+yaml_thesaurus = (base_path / 'words.yaml').resolve()
+yaml_areas = (base_path / 'areas.yaml').resolve()
+
+
+with open(yaml_conf, encoding="utf-8") as f:
+    conf = yaml.safe_load(f)
+    mongo_conf = conf['mongo']
+    redis_conf = conf['redis']
+    oss_conf: dict = conf['ali_oss']
+
+with open(yaml_constants, encoding="utf-8") as fp:
+    constants = yaml.safe_load(fp)
+    headers: dict = constants['headers']
+    jy_proxy: dict = constants['proxy']

+ 78 - 0
zgztb_cookie/cookie_pool.py

@@ -0,0 +1,78 @@
+import json
+import sys
+import time
+
+import requests
+import re,execjs
+
+from selenium.webdriver import ActionChains
+
+sys.path.append('/mnt/topic_spider/zgztb_cookie/FworkSpider')#
+from feapder.utils.webdriver import WebDriver
+from feapder.utils.log import log
+from FworkSpider.untils.cookie_pool import PageCookiePool
+from feapder.utils import tools
+from feapder.utils.redis_lock import RedisLock
+
+
+class WebCookiePool(PageCookiePool):
+    def __init__(self, redis_key, page_url=None,cookie_key=None,
+                 min_cookies=10000, must_contained_keys=(), keep_alive=False, **kwargs):
+        super(WebCookiePool, self).__init__(redis_key, page_url=None,
+                                           min_cookies=10000, must_contained_keys=(), keep_alive=False, **kwargs)
+        self.page_url = page_url
+        self.cookie_key = cookie_key
+        self._kwargs = kwargs
+        self._kwargs.setdefault("load_images", False)
+        self._kwargs.setdefault("headless", True)
+        # self._kwargs.setdefault("executable_path", "D:\\geckodriver.exe")
+        self._kwargs.setdefault("driver_type", "FIREFOX")
+        self.proxies = None
+
+    def create_cookies(self,proxies):
+        # print('此时代理ip使用的是:',self.proxies)
+        self._kwargs.setdefault("proxy", proxies)
+        with WebDriver(**self._kwargs) as driver_pool:
+            import time
+            # print(driver_pool.page_source)
+            try:
+                # driver_pool = self.driver_pool.get()
+                js = "return window.navigator.webdriver"
+                result = driver_pool.execute_script(js)
+                print(' window.navigator.webdriver >>> ', result)
+                driver_pool.get(self.page_url)
+                # print(driver_pool.page_source)
+
+
+                # import pdb
+                # pdb.set_trace()
+                time.sleep(3)
+                for i in range(4):
+                    try:
+                        slider = driver_pool.find_element_by_xpath("//span[contains(@class, 'nc_iconfont btn_slide')]")
+                        if slider.is_displayed():
+                            # 点击并且不松开鼠标
+                            ActionChains(driver_pool).click_and_hold(on_element=slider).perform()
+                            # 往右边移动258个位置
+                            ActionChains(driver_pool).move_by_offset(xoffset=258, yoffset=0).perform()
+                            # 松开鼠标
+                            ActionChains(driver_pool).pause(1).release().perform()
+                    except Exception as e:
+                        print(e)
+                    time.sleep(10)
+                    if 'nc_iconfont btn_slide' in driver_pool.page_source:
+                        continue
+                    else:
+                        break
+                # print(driver_pool.page_source)
+                cookies = driver_pool.cookies
+                return cookies
+            except Exception as e:
+                log.error(f"获取cookie失败,{e}")
+
+
+
+if __name__ == '__main__':
+    # for i in range(1):
+        cookies =WebCookiePool(redis_key='gdcookie',page_url="http://www.user-agent.cn/").create_cookies("socks5://36.7.252.15:8860")
+        print(cookies)

+ 141 - 0
zgztb_cookie/detail_firefox.py

@@ -0,0 +1,141 @@
+# -*- coding: utf-8 -*-
+"""
+Created on 2021-12-13 13:25:15
+---------
+@summary:
+---------
+@author: 马国鹏
+"""
+import json
+import sys
+import time
+
+from lxml import etree
+
+sys.path.append('/mnt/topic_spider/zgztb_cookie/FworkSpider')
+sys.path.append('C:/Users/topnet/Desktop/FworkSpider')
+from untils.cleaner import cleaner
+import feapder
+from feapder.utils.tools import wechat_warning
+from feapder.utils.log import log
+
+from items.spider_item import DataBakItem, MgpListItem
+from feapder.db.mongodb import MongoDB
+from typing import Optional
+from lxml.html import HtmlElement
+from lxml.html.clean import Cleaner
+from untils.tools import int2long,substitute,text_search
+
+class ParseElement:
+
+    def __init__(self, ):
+        self.__element: Optional[HtmlElement] = None
+
+    @property
+    def html(self) -> str:
+        return etree.tostring(self.elem, method="html", encoding="utf-8").decode()
+
+    @property
+    def clean_html(self) -> str:
+        cleaner = Cleaner()
+        cleaner.javascript = False
+        cleaner.remove_unknown_tags = False
+        cleaner.safe_attrs = ['href', 'src']
+        return cleaner.clean_html(self.html)
+
+    @property
+    def elem(self):
+        return self.__element
+
+    @elem.setter
+    def elem(self, element: HtmlElement):
+        self.__element = element
+class Details(feapder.Spider):
+    _to_db = None
+    db_name = 'zgzb_list'
+    send_list = []
+    # 定义mongo链接
+    @property
+    def to_db(self):
+        if not self._to_db:
+            self._to_db = MongoDB()
+        return self._to_db
+
+    def start_requests(self):
+        base_url = 'http://www.ccgp-jilin.gov.cn/ext/search/gotoHelpFrontList.action'
+        while True:
+            data_lsit = self.to_db.find(self.db_name,{"type" : "1","timeout":None},sort={"publishtime":1},limit=100)
+            for item in data_lsit:
+                rowguid = item.pop("rowGuid")
+                detail_url = f'http://connect.cebpubservice.com/PSPFrame/infobasemis/socialpublic/publicyewu/Frame_yewuDetail?rowguid={rowguid}'
+                yield feapder.Request(url=detail_url, item=item,
+                                      callback=self.detail_get, splash=True,render_time=3,iframes=1)
+
+            break
+
+    def detail_get(self,request,response):
+        item = request.item
+        html = ''
+
+        res_html = response.json.get("html")
+        childFrames = response.json.get("childFrames")
+        for frame in childFrames:
+            res_html += frame.get("html")
+        if 1:
+
+            html_etree = etree.HTML(res_html)
+            xpath_list = ['//div[@class="fui-accordions"]',
+                          '//div[@class="mini-panel-viewport mini-grid-viewport"]']
+            for xpath in xpath_list:
+                htmls = html_etree.xpath(xpath)
+                if len(htmls) > 0:
+                    html = '\n'.join([etree.tounicode(html) for html in htmls])
+                    break
+        area = item.get("area")
+        if area is None:
+            area = ''
+        area.strip()
+        if " " in area:
+            item["area"] = area.split(" ")[0]
+            item["city"] = area.split(" ")[-1]
+        item["contenthtml"] = html
+        item["detail"] = substitute(item["contenthtml"])
+        item["href"] = request.url
+        if text_search(item["detail"]).total == 0:
+            # 无正文内容时,该内容直接标记true, 不在被统计
+            item["sendflag"] = "true"
+        # spidersendnew 发送程序是按照时间读取的,采集数据入库时间要求为当前入库时间
+        item["comeintime"] = int2long(int(time.time()))
+        try:
+            item.pop("businessKeyWord")
+        except:
+            print("businessKeyWord")
+        try:
+            item.pop("businessKeyWord")
+        except:
+            print("businessKeyWord")
+        taskid = item.pop("_id")
+        try:
+            self.to_db.add("data_bak", item)
+            log.info(f"_id:{str(item['_id'])}")
+            self.to_db.update(self.db_name, {"timeout": 2}, {"_id": taskid})
+            log.info(
+                f"mongo add _id:{item.get('title')},{item.get('publishtime')}")
+            print("抓取成功")
+        except:
+            item["_id"] = taskid
+            self.to_db.update(self.db_name, {"timeout": 5}, {"_id": taskid})
+            print("更新成功")
+
+
+
+    def end_callback(self):
+        print("爬虫结束")
+
+
+
+if __name__ == "__main__":
+    while True:
+        apider = Details(redis_key="splish:zgzb:detail3")
+        apider.start()
+        apider.join()

+ 259 - 0
zgztb_cookie/detail_normol.py

@@ -0,0 +1,259 @@
+# -*- coding: utf-8 -*-
+"""
+Created on 2021-12-13 13:25:15
+---------
+@summary:
+---------
+@author: 马国鹏
+"""
+import json
+import re
+import sys
+import time
+
+from lxml import etree
+
+from encode_info import encode_info
+
+sys.path.append('/mnt/topic_spider/zgztb_cookie/FworkSpider')
+sys.path.append('C:/Users/topnet/Desktop/crawlab_feader/FworkSpider')
+
+import feapder
+from feapder.db.mongodb import MongoDB
+from feapder.utils.log import log
+from typing import Optional
+from lxml.html import HtmlElement
+from lxml.html.clean import Cleaner
+from untils.tools import int2long, substitute, text_search
+from cookie_pool import WebCookiePool
+from untils.proxy_pool import ProxyPool
+from pathlib import Path
+
+import execjs
+import requests
+
+
+def get_proxy():
+    headers = {
+        "Authorization": "Basic amlhbnl1MDAxOjEyM3F3ZSFB"
+    }
+    proxy = requests.get("http://cc.spdata.jianyu360.com/crawl/proxy/socks5/fetch", headers=headers).json()
+    log.info("切换代理:", proxy.get("data"))
+    return proxy.get("data")
+
+
+class ParseElement:
+
+    def __init__(self, ):
+        self.__element: Optional[HtmlElement] = None
+
+    @property
+    def html(self) -> str:
+        return etree.tostring(self.elem, method="html", encoding="utf-8").decode()
+
+    @property
+    def clean_html(self) -> str:
+        cleaner = Cleaner()
+        cleaner.javascript = False
+        cleaner.remove_unknown_tags = False
+        cleaner.safe_attrs = ['href', 'src']
+        return cleaner.clean_html(self.html)
+
+    @property
+    def elem(self):
+        return self.__element
+
+    @elem.setter
+    def elem(self, element: HtmlElement):
+        self.__element = element
+
+def splicing(response):
+    path = 'splicing.js'
+    with open(path, encoding='utf-8') as rp:
+        js_script = rp.read()
+        ctx = execjs.compile(js_script)
+        html = ctx.call('splicing', response)
+        return html
+
+class Details(feapder.AirSpider):
+    cookie_pool = WebCookiePool(redis_key='zgztbcookie',
+                                page_url="http://www.cebpubservice.com/ctpsp_iiss/SecondaryAction/findDetails.do")
+    _to_db = None
+    db_name = 'zgzb_list'
+    send_list = []
+    proxy = get_proxy()
+
+    @property
+    def to_db(self):
+        if not self._to_db:
+            self._to_db = MongoDB()
+        return self._to_db
+
+    def start_requests(self):
+        base_url = 'http://www.ccgp-jilin.gov.cn/ext/search/gotoHelpFrontList.action'
+        while True:
+            data_lsit = self.to_db.find(self.db_name, {"type": "0","timeout":None}, sort={"publishtime": -1}, limit=300)
+            for item in data_lsit:
+                tenderprojectcode = item.get("href").split("&")[1]
+                businessid = item.get("href").split("&")[0]
+                businesskeyword = item.get("businessKeyWord")
+                businessoObjectname = item.get("title")
+                schemaversion = item.pop("schemaVersion")
+                rowguid = item.pop("rowGuid")
+                data = {
+                    "schemaVersion": schemaversion,
+                    "businessKeyWord": businesskeyword,
+                    "tenderProjectCode": encode_info(tenderprojectcode),
+                    "businessObjectName": businessoObjectname,
+                    "businessId": encode_info(businessid),
+                }
+                detail_url = 'http://www.cebpubservice.com/ctpsp_iiss/SecondaryAction/findDetails.do'
+                yield feapder.Request(url=detail_url, item=item, method="POST", data=data,
+                                      callback=self.detail_get, timeout=5, use_session=True,count=0)
+
+            break
+
+    def get_acw_sc_v2(self, arg1):
+        path = 'acw_sc_v2.js'
+        with open(path, encoding='utf-8') as rp:
+            js_script = rp.read()
+            ctx = execjs.compile(js_script)
+            arg2 = ctx.call('l', arg1)
+            log.info(f'acw_sc_v2 >>> {arg2}')
+            return arg2
+
+    def detail_get(self, request, response):
+        # return
+        if "arg1" in response.text:
+            arg1 = "".join(re.findall("arg1='(\w+)';", response.text)).strip()
+            if arg1 != '':
+                acw_sc_v2 = self.get_acw_sc_v2(arg1)
+                request.session.cookies.update({'acw_sc__v2': acw_sc_v2})
+                time.sleep(1)
+                yield feapder.Request(url=request.url, item=request.item, method="POST", data=request.data,
+                                      callback=self.detail_get, timeout=5, use_session=True, count=0)
+        elif '滑动验证页面' in response.text:
+            log.info('开始过滑块验证')
+            cookies = self.cookie_pool.create_cookies(proxies=self.proxy.get("http"))
+            count = request.count
+            if count > 4:
+                return
+            if cookies is None:
+                self.proxy = get_proxy()
+
+
+            elif len(cookies) <= 1:
+                self.proxy = get_proxy()
+            request.session.cookies.update(cookies)
+            yield feapder.Request(url=request.url, item=request.item, method="POST", data=request.data,
+                                  callback=self.detail_get, timeout=5, use_session=True, count=count + 1)
+        else:
+            try:
+                response.json
+            except Exception as e:
+                log.info(e)
+                self.proxy = get_proxy()
+                cookies = self.cookie_pool.create_cookies(proxies=self.proxy.get("http"))
+                request.session.cookies.update(cookies)
+                yield feapder.Request(url=request.url, item=request.item, method="POST", data=request.data,
+                                      callback=self.detail_get, timeout=5, use_session=True, cookies=cookies, count=0)
+
+            else:
+                item = request.item
+                tenderprojectcode = item.get("href").split("&")[1]
+                businessid = item.get("href").split("&")[0]
+                businesskeyword = "businessKeyWord"
+                if item.__contains__("businessKeyWord"):
+                    businesskeyword = item.pop("businessKeyWord")
+
+                detail_info = response.json.get("object").get(businesskeyword)
+                if not detail_info:
+                    businesskeywords = response.json.get("object").keys()
+                    for businesskeyword in businesskeywords:
+                        businesskeyword = businesskeyword
+                    detail_info = response.json.get("object").get(businesskeyword)
+
+                area = item.get("area")
+                if area is None:
+                    item["area"] = "全国"
+                    item["city"] = ""
+                elif " " in area:
+                    item["area"] = area.split(" ")[0]
+                    item["city"] = area.split(" ")[-1]
+                else:
+                    item["area"] = "全国"
+                    item["city"] = ""
+                if detail_info is None or detail_info == []:
+                    businessKeyWords = response.json.get("object").keys()
+                    for key in businessKeyWords:
+                        businesskeyword = key
+                    detail_info = response.json.get("object").get(businesskeyword)
+                    if detail_info is None or detail_info == []:
+                        item[
+                            "href"] = f"http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/showDetails.do#uuid={businessid + tenderprojectcode}"
+                        item["sendflag"] = "true"
+                        item["comeintime"] = int(time.time())
+                        result = self.to_db.add("data_bak", item)
+                        # self.to_db.delete(self.db_name, {"_id": item["_id"]})
+                        self.to_db.update(self.db_name, {"timeout": 3}, {"_id": item["_id"]})
+                        log.info(f"mongo add _id:{item.get('title')}<空结果")
+                        # log.info(f"mongo add _id:{item.get('title')}")
+
+                    else:
+                        pass
+                if businesskeyword == "tenderProject":
+                    item["contenthtml"] = splicing(detail_info)
+                    pass
+                else:
+                    detail_info = detail_info[0]
+                    item["contenthtml"] = detail_info.get("bulletinContent")
+                if item["contenthtml"] is None:
+                    item["detail"] = None
+                    item["sendflag"] = "true"
+                else:
+                    item["detail"] = substitute(item["contenthtml"])
+                item[
+                    "href"] = f"http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/showDetails.do#uuid={businessid + tenderprojectcode}"
+                if text_search(item["detail"]).total == 0:
+                    item["sendflag"] = "true"
+                item["comeintime"] = int2long(int(time.time()))
+                ss = {"": ""}
+                result = self.to_db.add("data_bak", item)
+                # self.to_db.delete(self.db_name, {"_id": item["_id"]})
+                self.to_db.update(self.db_name, {"timeout": 2}, {"_id": item["_id"]})
+                # print(f"mongo add _id:{item.get('title')}")
+                log.info(f"mongo add _id:{item.get('title')}")
+                time.sleep(0.5)
+
+    def download_midware(self, request):
+        request.proxies = self.proxy
+        log.info(request.item.get("title"))
+        request.headers = {
+            "Host": "www.cebpubservice.com",
+            "Accept": "application/json, text/javascript, */*; q=0.01",
+            "X-Requested-With": "XMLHttpRequest",
+            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36",
+            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
+            "Origin": "http://www.cebpubservice.com",
+            "Referer": "http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/showDetails.do",
+            "Accept-Language": "zh-CN,zh;q=0.9"
+        }
+
+    def exception_request(self, request, response):
+        if response is None:
+            item = request.item
+            self.to_db.update(self.db_name, {"timeout": 1}, {"_id": item["_id"]})
+            self.proxy = get_proxy()
+            log.info("添加到超时标记")
+        else:
+            log.info("error:这是一个一般错误")
+
+
+
+if __name__ == "__main__":
+    spider = Details(thread_count=1)
+    spider.start()
+    spider.join()
+
+
+

+ 710 - 0
zgztb_cookie/encode_info.py

@@ -0,0 +1,710 @@
+import execjs,json
+
+js_str = '''
+function CurentTime() {
+    var now = new Date();
+    var year = now.getFullYear();
+    //年
+    var month = now.getMonth() + 1;
+    //月
+    var day = now.getDate();
+    //日
+    var hh = now.getHours();
+    //时
+    var mm = now.getMinutes();
+    //分
+    var ss = now.getSeconds();
+    if (ss > 30) {
+        if (mm == 59) {
+            hh = hh + 1;
+            mm = 0;
+        } else {
+            mm = mm + 1;
+        }
+    }
+    var clock = year + "-";
+    if (month < 10)
+        clock += "0";
+    clock += month + "-";
+    if (day < 10)
+        clock += "0";
+    clock += day + " ";
+    if (hh < 10)
+        clock += "0";
+    clock += hh;
+    //clock += hh + ":";
+    //if (mm < 10) clock += '0';
+    //clock += mm;
+    return (clock);
+};
+function getKeyBytes(key){
+ var keyBytes = new Array();
+ var leng = key.length;
+ var iterator = parseInt(leng/4);
+ var remainder = leng%4;
+ var i = 0;
+ for(i = 0;i < iterator; i ++){
+   keyBytes[i] = strToBt(key.substring(i*4+0,i*4+4));
+ }
+ if(remainder > 0){
+   keyBytes[i] = strToBt(key.substring(i*4+0,leng));
+ }    
+ return keyBytes;
+};
+function strToBt(str){  
+ var leng = str.length;
+ var bt = new Array(64);
+ if(leng < 4){
+   var i=0,j=0,p=0,q=0;
+   for(i = 0;i<leng;i++){
+     var k = str.charCodeAt(i);
+     for(j=0;j<16;j++){      
+       var pow=1,m=0;
+       for(m=15;m>j;m--){
+         pow *= 2;
+       }        
+       bt[16*i+j]=parseInt(k/pow)%2;
+     }
+   }
+   for(p = leng;p<4;p++){
+     var k = 0;
+     for(q=0;q<16;q++){      
+       var pow=1,m=0;
+       for(m=15;m>q;m--){
+         pow *= 2;
+       }        
+       bt[16*p+q]=parseInt(k/pow)%2;
+     }
+   }  
+ }else{
+   for(i = 0;i<4;i++){
+     var k = str.charCodeAt(i);
+     for(j=0;j<16;j++){      
+       var pow=1;
+       for(m=15;m>j;m--){
+         pow *= 2;
+       }        
+       bt[16*i+j]=parseInt(k/pow)%2;
+     }
+   }  
+ }
+ return bt;
+};
+function enc(dataByte,keyByte){  
+ var keys = generateKeys(keyByte);    
+ var ipByte   = initPermute(dataByte);  
+ var ipLeft   = new Array(32);
+ var ipRight  = new Array(32);
+ var tempLeft = new Array(32);
+ var i = 0,j = 0,k = 0,m = 0, n = 0;
+ for(k = 0;k < 32;k ++){
+   ipLeft[k] = ipByte[k];
+   ipRight[k] = ipByte[32+k];
+ }    
+ for(i = 0;i < 16;i ++){
+   for(j = 0;j < 32;j ++){
+     tempLeft[j] = ipLeft[j];
+     ipLeft[j] = ipRight[j];      
+   }  
+   var key = new Array(48);
+   for(m = 0;m < 48;m ++){
+     key[m] = keys[i][m];
+   }
+   var  tempRight = xor(pPermute(sBoxPermute(xor(expandPermute(ipRight),key))), tempLeft);      
+   for(n = 0;n < 32;n ++){
+     ipRight[n] = tempRight[n];
+   }  
+   
+ }  
+ 
+ 
+ var finalData =new Array(64);
+ for(i = 0;i < 32;i ++){
+   finalData[i] = ipRight[i];
+   finalData[32+i] = ipLeft[i];
+ }
+ return finallyPermute(finalData)} 
+;
+function generateKeys(keyByte){    
+ var key   = new Array(56);
+ var keys = new Array();  
+ 
+ keys[ 0] = new Array();
+ keys[ 1] = new Array();
+ keys[ 2] = new Array();
+ keys[ 3] = new Array();
+ keys[ 4] = new Array();
+ keys[ 5] = new Array();
+ keys[ 6] = new Array();
+ keys[ 7] = new Array();
+ keys[ 8] = new Array();
+ keys[ 9] = new Array();
+ keys[10] = new Array();
+ keys[11] = new Array();
+ keys[12] = new Array();
+ keys[13] = new Array();
+ keys[14] = new Array();
+ keys[15] = new Array();  
+ var loop = [1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];
+
+ for(i=0;i<7;i++){
+   for(j=0,k=7;j<8;j++,k--){
+     key[i*8+j]=keyByte[8*k+i];
+   }
+ }    
+ 
+ var i = 0;
+ for(i = 0;i < 16;i ++){
+   var tempLeft=0;
+   var tempRight=0;
+   for(j = 0; j < loop[i];j ++){          
+     tempLeft = key[0];
+     tempRight = key[28];
+     for(k = 0;k < 27 ;k ++){
+       key[k] = key[k+1];
+       key[28+k] = key[29+k];
+     }  
+     key[27]=tempLeft;
+     key[55]=tempRight;
+   }
+   var tempKey = new Array(48);
+   tempKey[ 0] = key[13];
+   tempKey[ 1] = key[16];
+   tempKey[ 2] = key[10];
+   tempKey[ 3] = key[23];
+   tempKey[ 4] = key[ 0];
+   tempKey[ 5] = key[ 4];
+   tempKey[ 6] = key[ 2];
+   tempKey[ 7] = key[27];
+   tempKey[ 8] = key[14];
+   tempKey[ 9] = key[ 5];
+   tempKey[10] = key[20];
+   tempKey[11] = key[ 9];
+   tempKey[12] = key[22];
+   tempKey[13] = key[18];
+   tempKey[14] = key[11];
+   tempKey[15] = key[ 3];
+   tempKey[16] = key[25];
+   tempKey[17] = key[ 7];
+   tempKey[18] = key[15];
+   tempKey[19] = key[ 6];
+   tempKey[20] = key[26];
+   tempKey[21] = key[19];
+   tempKey[22] = key[12];
+   tempKey[23] = key[ 1];
+   tempKey[24] = key[40];
+   tempKey[25] = key[51];
+   tempKey[26] = key[30];
+   tempKey[27] = key[36];
+   tempKey[28] = key[46];
+   tempKey[29] = key[54];
+   tempKey[30] = key[29];
+   tempKey[31] = key[39];
+   tempKey[32] = key[50];
+   tempKey[33] = key[44];
+   tempKey[34] = key[32];
+   tempKey[35] = key[47];
+   tempKey[36] = key[43];
+   tempKey[37] = key[48];
+   tempKey[38] = key[38];
+   tempKey[39] = key[55];
+   tempKey[40] = key[33];
+   tempKey[41] = key[52];
+   tempKey[42] = key[45];
+   tempKey[43] = key[41];
+   tempKey[44] = key[49];
+   tempKey[45] = key[35];
+   tempKey[46] = key[28];
+   tempKey[47] = key[31];
+   switch(i){
+     case 0: for(m=0;m < 48 ;m++){ keys[ 0][m] = tempKey[m]; } break;
+     case 1: for(m=0;m < 48 ;m++){ keys[ 1][m] = tempKey[m]; } break;
+     case 2: for(m=0;m < 48 ;m++){ keys[ 2][m] = tempKey[m]; } break;
+     case 3: for(m=0;m < 48 ;m++){ keys[ 3][m] = tempKey[m]; } break;
+     case 4: for(m=0;m < 48 ;m++){ keys[ 4][m] = tempKey[m]; } break;
+     case 5: for(m=0;m < 48 ;m++){ keys[ 5][m] = tempKey[m]; } break;
+     case 6: for(m=0;m < 48 ;m++){ keys[ 6][m] = tempKey[m]; } break;
+     case 7: for(m=0;m < 48 ;m++){ keys[ 7][m] = tempKey[m]; } break;
+     case 8: for(m=0;m < 48 ;m++){ keys[ 8][m] = tempKey[m]; } break;
+     case 9: for(m=0;m < 48 ;m++){ keys[ 9][m] = tempKey[m]; } break;
+     case 10: for(m=0;m < 48 ;m++){ keys[10][m] = tempKey[m]; } break;
+     case 11: for(m=0;m < 48 ;m++){ keys[11][m] = tempKey[m]; } break;
+     case 12: for(m=0;m < 48 ;m++){ keys[12][m] = tempKey[m]; } break;
+     case 13: for(m=0;m < 48 ;m++){ keys[13][m] = tempKey[m]; } break;
+     case 14: for(m=0;m < 48 ;m++){ keys[14][m] = tempKey[m]; } break;
+     case 15: for(m=0;m < 48 ;m++){ keys[15][m] = tempKey[m]; } break;
+   }
+ }
+ return keys;  
+};
+function initPermute(originalData){
+ var ipByte = new Array(64);
+ for (i = 0, m = 1, n = 0; i < 4; i++, m += 2, n += 2) {
+   for (j = 7, k = 0; j >= 0; j--, k++) {
+     ipByte[i * 8 + k] = originalData[j * 8 + m];
+     ipByte[i * 8 + k + 32] = originalData[j * 8 + n];
+   }
+ }    
+ return ipByte;
+};
+function xor(byteOne,byteTwo){  
+ var xorByte = new Array(byteOne.length);
+ for(i = 0;i < byteOne.length; i ++){      
+   xorByte[i] = byteOne[i] ^ byteTwo[i];
+ }  
+ return xorByte;
+};
+function pPermute(sBoxByte){
+ var pBoxPermute = new Array(32);
+ pBoxPermute[ 0] = sBoxByte[15]; 
+ pBoxPermute[ 1] = sBoxByte[ 6]; 
+ pBoxPermute[ 2] = sBoxByte[19]; 
+ pBoxPermute[ 3] = sBoxByte[20]; 
+ pBoxPermute[ 4] = sBoxByte[28]; 
+ pBoxPermute[ 5] = sBoxByte[11]; 
+ pBoxPermute[ 6] = sBoxByte[27]; 
+ pBoxPermute[ 7] = sBoxByte[16]; 
+ pBoxPermute[ 8] = sBoxByte[ 0]; 
+ pBoxPermute[ 9] = sBoxByte[14]; 
+ pBoxPermute[10] = sBoxByte[22]; 
+ pBoxPermute[11] = sBoxByte[25]; 
+ pBoxPermute[12] = sBoxByte[ 4]; 
+ pBoxPermute[13] = sBoxByte[17]; 
+ pBoxPermute[14] = sBoxByte[30]; 
+ pBoxPermute[15] = sBoxByte[ 9]; 
+ pBoxPermute[16] = sBoxByte[ 1]; 
+ pBoxPermute[17] = sBoxByte[ 7]; 
+ pBoxPermute[18] = sBoxByte[23]; 
+ pBoxPermute[19] = sBoxByte[13]; 
+ pBoxPermute[20] = sBoxByte[31]; 
+ pBoxPermute[21] = sBoxByte[26]; 
+ pBoxPermute[22] = sBoxByte[ 2]; 
+ pBoxPermute[23] = sBoxByte[ 8]; 
+ pBoxPermute[24] = sBoxByte[18]; 
+ pBoxPermute[25] = sBoxByte[12]; 
+ pBoxPermute[26] = sBoxByte[29]; 
+ pBoxPermute[27] = sBoxByte[ 5]; 
+ pBoxPermute[28] = sBoxByte[21]; 
+ pBoxPermute[29] = sBoxByte[10]; 
+ pBoxPermute[30] = sBoxByte[ 3]; 
+ pBoxPermute[31] = sBoxByte[24];    
+ return pBoxPermute;
+};
+function sBoxPermute(expandByte){
+ 
+   var sBoxByte = new Array(32);
+   var binary = "";
+   var s1 = [
+       [14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7],
+       [0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8],
+       [4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0],
+       [15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 ]];
+
+       /* Table - s2 */
+   var s2 = [
+       [15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10],
+       [3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5],
+       [0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15],
+       [13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 ]];
+
+       /* Table - s3 */
+   var s3= [
+       [10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8],
+       [13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1],
+       [13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7],
+       [1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 ]];
+       /* Table - s4 */
+   var s4 = [
+       [7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15],
+       [13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9],
+       [10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4],
+       [3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 ]];
+
+       /* Table - s5 */
+   var s5 = [
+       [2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9],
+       [14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6],
+       [4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14],
+       [11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 ]];
+
+       /* Table - s6 */
+   var s6 = [
+       [12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11],
+       [10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8],
+       [9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6],
+       [4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 ]];
+
+       /* Table - s7 */
+   var s7 = [
+       [4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1],
+       [13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6],
+       [1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2],
+       [6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12]];
+
+       /* Table - s8 */
+   var s8 = [
+       [13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7],
+       [1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2],
+       [7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8],
+       [2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11]];
+   
+   for(m=0;m<8;m++){
+   var i=0,j=0;
+   i = expandByte[m*6+0]*2+expandByte[m*6+5];
+   j = expandByte[m * 6 + 1] * 2 * 2 * 2 
+     + expandByte[m * 6 + 2] * 2* 2 
+     + expandByte[m * 6 + 3] * 2 
+     + expandByte[m * 6 + 4];
+   switch (m) {
+     case 0 :
+       binary = getBoxBinary(s1[i][j]);
+       break;
+     case 1 :
+       binary = getBoxBinary(s2[i][j]);
+       break;
+     case 2 :
+       binary = getBoxBinary(s3[i][j]);
+       break;
+     case 3 :
+       binary = getBoxBinary(s4[i][j]);
+       break;
+     case 4 :
+       binary = getBoxBinary(s5[i][j]);
+       break;
+     case 5 :
+       binary = getBoxBinary(s6[i][j]);
+       break;
+     case 6 :
+       binary = getBoxBinary(s7[i][j]);
+       break;
+     case 7 :
+       binary = getBoxBinary(s8[i][j]);
+       break;
+   }      
+   sBoxByte[m*4+0] = parseInt(binary.substring(0,1));
+   sBoxByte[m*4+1] = parseInt(binary.substring(1,2));
+   sBoxByte[m*4+2] = parseInt(binary.substring(2,3));
+   sBoxByte[m*4+3] = parseInt(binary.substring(3,4));
+ }
+ return sBoxByte;
+};
+function expandPermute(rightData){  
+ var epByte = new Array(48);
+ for (i = 0; i < 8; i++) {
+   if (i == 0) {
+     epByte[i * 6 + 0] = rightData[31];
+   } else {
+     epByte[i * 6 + 0] = rightData[i * 4 - 1];
+   }
+   epByte[i * 6 + 1] = rightData[i * 4 + 0];
+   epByte[i * 6 + 2] = rightData[i * 4 + 1];
+   epByte[i * 6 + 3] = rightData[i * 4 + 2];
+   epByte[i * 6 + 4] = rightData[i * 4 + 3];
+   if (i == 7) {
+     epByte[i * 6 + 5] = rightData[0];
+   } else {
+     epByte[i * 6 + 5] = rightData[i * 4 + 4];
+   }
+ }      
+ return epByte;
+};
+function getBoxBinary(i) {
+ var binary = "";
+ switch (i) {
+   case 0 :binary = "0000";break;
+   case 1 :binary = "0001";break;
+   case 2 :binary = "0010";break;
+   case 3 :binary = "0011";break;
+   case 4 :binary = "0100";break;
+   case 5 :binary = "0101";break;
+   case 6 :binary = "0110";break;
+   case 7 :binary = "0111";break;
+   case 8 :binary = "1000";break;
+   case 9 :binary = "1001";break;
+   case 10 :binary = "1010";break;
+   case 11 :binary = "1011";break;
+   case 12 :binary = "1100";break;
+   case 13 :binary = "1101";break;
+   case 14 :binary = "1110";break;
+   case 15 :binary = "1111";break;
+ }
+ return binary;
+};
+function finallyPermute(endByte){    
+ var fpByte = new Array(64);  
+ fpByte[ 0] = endByte[39]; 
+ fpByte[ 1] = endByte[ 7]; 
+ fpByte[ 2] = endByte[47]; 
+ fpByte[ 3] = endByte[15]; 
+ fpByte[ 4] = endByte[55]; 
+ fpByte[ 5] = endByte[23]; 
+ fpByte[ 6] = endByte[63]; 
+ fpByte[ 7] = endByte[31]; 
+ fpByte[ 8] = endByte[38]; 
+ fpByte[ 9] = endByte[ 6]; 
+ fpByte[10] = endByte[46]; 
+ fpByte[11] = endByte[14]; 
+ fpByte[12] = endByte[54]; 
+ fpByte[13] = endByte[22]; 
+ fpByte[14] = endByte[62]; 
+ fpByte[15] = endByte[30]; 
+ fpByte[16] = endByte[37]; 
+ fpByte[17] = endByte[ 5]; 
+ fpByte[18] = endByte[45]; 
+ fpByte[19] = endByte[13]; 
+ fpByte[20] = endByte[53]; 
+ fpByte[21] = endByte[21]; 
+ fpByte[22] = endByte[61]; 
+ fpByte[23] = endByte[29]; 
+ fpByte[24] = endByte[36]; 
+ fpByte[25] = endByte[ 4]; 
+ fpByte[26] = endByte[44]; 
+ fpByte[27] = endByte[12]; 
+ fpByte[28] = endByte[52]; 
+ fpByte[29] = endByte[20]; 
+ fpByte[30] = endByte[60]; 
+ fpByte[31] = endByte[28]; 
+ fpByte[32] = endByte[35]; 
+ fpByte[33] = endByte[ 3]; 
+ fpByte[34] = endByte[43]; 
+ fpByte[35] = endByte[11]; 
+ fpByte[36] = endByte[51]; 
+ fpByte[37] = endByte[19]; 
+ fpByte[38] = endByte[59]; 
+ fpByte[39] = endByte[27]; 
+ fpByte[40] = endByte[34]; 
+ fpByte[41] = endByte[ 2]; 
+ fpByte[42] = endByte[42]; 
+ fpByte[43] = endByte[10]; 
+ fpByte[44] = endByte[50]; 
+ fpByte[45] = endByte[18]; 
+ fpByte[46] = endByte[58]; 
+ fpByte[47] = endByte[26]; 
+ fpByte[48] = endByte[33]; 
+ fpByte[49] = endByte[ 1]; 
+ fpByte[50] = endByte[41]; 
+ fpByte[51] = endByte[ 9]; 
+ fpByte[52] = endByte[49]; 
+ fpByte[53] = endByte[17]; 
+ fpByte[54] = endByte[57]; 
+ fpByte[55] = endByte[25]; 
+ fpByte[56] = endByte[32]; 
+ fpByte[57] = endByte[ 0]; 
+ fpByte[58] = endByte[40]; 
+ fpByte[59] = endByte[ 8]; 
+ fpByte[60] = endByte[48]; 
+ fpByte[61] = endByte[16]; 
+ fpByte[62] = endByte[56]; 
+ fpByte[63] = endByte[24];
+ return fpByte;
+};
+function bt64ToHex(byteData){
+ var hex = "";
+ for(i = 0;i<16;i++){
+   var bt = "";
+   for(j=0;j<4;j++){    
+     bt += byteData[i*4+j];
+   }    
+   hex+=bt4ToHex(bt);
+ }
+ return hex;
+};
+function bt4ToHex(binary) {
+ var hex;
+ switch (binary) {
+   case "0000" : hex = "0"; break;
+   case "0001" : hex = "1"; break;
+   case "0010" : hex = "2"; break;
+   case "0011" : hex = "3"; break;
+   case "0100" : hex = "4"; break;
+   case "0101" : hex = "5"; break;
+   case "0110" : hex = "6"; break;
+   case "0111" : hex = "7"; break;
+   case "1000" : hex = "8"; break;
+   case "1001" : hex = "9"; break;
+   case "1010" : hex = "A"; break;
+   case "1011" : hex = "B"; break;
+   case "1100" : hex = "C"; break;
+   case "1101" : hex = "D"; break;
+   case "1110" : hex = "E"; break;
+   case "1111" : hex = "F"; break;
+ }
+ return hex;
+};
+
+
+
+
+
+
+function strEnc(data){
+var firstKey = CurentTime();
+var secondKey = "cebpubservice";
+var thirdKey = "iiss";
+
+ var leng = data.length;
+ var encData = "";
+ var firstKeyBt,secondKeyBt,thirdKeyBt,firstLength,secondLength,thirdLength;
+ if(firstKey != null && firstKey != ""){    
+   firstKeyBt = getKeyBytes(firstKey);
+   firstLength = firstKeyBt.length;
+ }
+ if(secondKey != null && secondKey != ""){
+   secondKeyBt = getKeyBytes(secondKey);
+   secondLength = secondKeyBt.length;
+ }
+ if(thirdKey != null && thirdKey != ""){
+   thirdKeyBt = getKeyBytes(thirdKey);
+   thirdLength = thirdKeyBt.length;
+ }  
+ 
+ if(leng > 0){
+   if(leng < 4){
+     var bt = strToBt(data);      
+     var encByte ;
+     if(firstKey != null && firstKey !="" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != ""){
+       var tempBt;
+       var x,y,z;
+       tempBt = bt;        
+       for(x = 0;x < firstLength ;x ++){
+         tempBt = enc(tempBt,firstKeyBt[x]);
+       }
+       for(y = 0;y < secondLength ;y ++){
+         tempBt = enc(tempBt,secondKeyBt[y]);
+       }
+       for(z = 0;z < thirdLength ;z ++){
+         tempBt = enc(tempBt,thirdKeyBt[z]);
+       }        
+       encByte = tempBt;        
+     }else{
+       if(firstKey != null && firstKey !="" && secondKey != null && secondKey != ""){
+         var tempBt;
+         var x,y;
+         tempBt = bt;
+         for(x = 0;x < firstLength ;x ++){
+           tempBt = enc(tempBt,firstKeyBt[x]);
+         }
+         for(y = 0;y < secondLength ;y ++){
+           tempBt = enc(tempBt,secondKeyBt[y]);
+         }
+         encByte = tempBt;
+       }else{
+         if(firstKey != null && firstKey !=""){            
+           var tempBt;
+           var x = 0;
+           tempBt = bt;            
+           for(x = 0;x < firstLength ;x ++){
+             tempBt = enc(tempBt,firstKeyBt[x]);
+           }
+           encByte = tempBt;
+         }
+       }        
+     }
+     encData = bt64ToHex(encByte);
+   }else{
+     var iterator = parseInt(leng/4);
+     var remainder = leng%4;
+     var i=0;      
+     for(i = 0;i < iterator;i++){
+       var tempData = data.substring(i*4+0,i*4+4);
+       var tempByte = strToBt(tempData);
+       var encByte ;
+       if(firstKey != null && firstKey !="" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != ""){
+         var tempBt;
+         var x,y,z;
+         tempBt = tempByte;
+         for(x = 0;x < firstLength ;x ++){
+           tempBt = enc(tempBt,firstKeyBt[x]);
+         }
+         for(y = 0;y < secondLength ;y ++){
+           tempBt = enc(tempBt,secondKeyBt[y]);
+         }
+         for(z = 0;z < thirdLength ;z ++){
+           tempBt = enc(tempBt,thirdKeyBt[z]);
+         }
+         encByte = tempBt;
+       }else{
+         if(firstKey != null && firstKey !="" && secondKey != null && secondKey != ""){
+           var tempBt;
+           var x,y;
+           tempBt = tempByte;
+           for(x = 0;x < firstLength ;x ++){
+             tempBt = enc(tempBt,firstKeyBt[x]);
+           }
+           for(y = 0;y < secondLength ;y ++){
+             tempBt = enc(tempBt,secondKeyBt[y]);
+           }
+           encByte = tempBt;
+         }else{
+           if(firstKey != null && firstKey !=""){                      
+             var tempBt;
+             var x;
+             tempBt = tempByte;
+             for(x = 0;x < firstLength ;x ++){                
+               tempBt = enc(tempBt,firstKeyBt[x]);
+             }
+             encByte = tempBt;              
+           }
+         }
+       }
+       encData += bt64ToHex(encByte);
+     }      
+     if(remainder > 0){
+       var remainderData = data.substring(iterator*4+0,leng);
+       var tempByte = strToBt(remainderData);
+       var encByte ;
+       if(firstKey != null && firstKey !="" && secondKey != null && secondKey != "" && thirdKey != null && thirdKey != ""){
+         var tempBt;
+         var x,y,z;
+         tempBt = tempByte;
+         for(x = 0;x < firstLength ;x ++){
+           tempBt = enc(tempBt,firstKeyBt[x]);
+         }
+         for(y = 0;y < secondLength ;y ++){
+           tempBt = enc(tempBt,secondKeyBt[y]);
+         }
+         for(z = 0;z < thirdLength ;z ++){
+           tempBt = enc(tempBt,thirdKeyBt[z]);
+         }
+         encByte = tempBt;
+       }else{
+         if(firstKey != null && firstKey !="" && secondKey != null && secondKey != ""){
+           var tempBt;
+           var x,y;
+           tempBt = tempByte;
+           for(x = 0;x < firstLength ;x ++){
+             tempBt = enc(tempBt,firstKeyBt[x]);
+           }
+           for(y = 0;y < secondLength ;y ++){
+             tempBt = enc(tempBt,secondKeyBt[y]);
+           }
+           encByte = tempBt;
+         }else{
+           if(firstKey != null && firstKey !=""){            
+             var tempBt;
+             var x;
+             tempBt = tempByte;
+             for(x = 0;x < firstLength ;x ++){
+               tempBt = enc(tempBt,firstKeyBt[x]);
+             }
+             encByte = tempBt;
+           }
+         }
+       }
+       encData += bt64ToHex(encByte);
+     }                
+   }
+ }
+ return encData;
+}
+'''
+
+
+def encode_info(plaintext):
+    node_model_path = "/usr/lib/node_modules"
+    ctx = execjs.compile(js_str)
+    res = ctx.call('strEnc',plaintext)
+    return res
+if __name__ == '__main__':
+
+    print(encode_info("2447016584bf865cbe60"))

+ 625 - 0
zgztb_cookie/splicing.js

@@ -0,0 +1,625 @@
+function timeZH(time) {
+		var reg = /\d+/g;
+		if(time == null || typeof(time) == undefined) {
+			return "";
+		}
+		var time_array = time.toString().match(reg);
+		var tm = "";
+		if(time_array.length > 1) {
+			for(var i = 0; i < time_array.length; i++) {
+				switch(i) {
+					case 0:
+						tm += time_array[i];
+						tm += "年";
+						break;
+					case 1:
+						tm += time_array[i];
+						tm += "月";
+						break;
+					case 2:
+						tm += time_array[i];
+						tm += "日 ";
+						break;
+					case 3:
+						tm += time_array[i];
+						break;
+					case 4:
+						tm += ":";
+						tm += time_array[i];
+						break;
+					case 5:
+						tm += ":";
+						tm += time_array[i];
+						break;
+					default:
+						break;
+				}
+			}
+			return tm;
+		} else {
+			for(var i = 0; i < time.length; i++) {
+				if(i == 3) {
+					tm += time.substring(0, 4);
+					tm += "年";
+				}
+				if(i == 5) {
+					tm += time.substring(4, 6);
+					tm += "月";
+				}
+				if(i == 7) {
+					tm += time.substring(6, 8);
+					tm += "日";
+				}
+				if(i == 9) {
+					tm += " ";
+					tm += time.substring(8, 10);
+					tm += ":";
+				}
+				if(i == 11) {
+					tm += time.substring(10, 12);
+					tm += ":";
+				}
+				if(i == 13) {
+					tm += time.substring(12, 14);
+				}
+			}
+			return tm;
+		}
+	}
+
+function splicing(response){
+    dataNullName = 'tenderProject'
+    dataNullNameCN = '招标项目'
+    switch (dataNullName) {
+        case "tenderProject": //招标项目
+            var arry = response;
+            var htmlA = "";
+            if (arry != null && arry != undefined) {
+                console.log(arry.length)
+                if (arry.length == 0) {
+                    htmlA += "<div class='wBox '>";
+                    htmlA += "<div class='borderBlue '></div>";
+                    htmlA += "<div class='wrap_box '>";
+                    htmlA += "    <div class='topTit3 fix ' style='height:40px;'>";
+                    htmlA += "        <h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4></div>";
+                    htmlA += "<div class='inner_con '>";
+                    htmlA += "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                    htmlA += "暂无详细数据";
+                    htmlA += "</div>";
+                    htmlA += "<div style='height:20px;'></div>";
+                    htmlA += "</div></div></div>";
+                }
+                htmlA += "<div class='wBox '>" +
+                    "<div class='borderBlue '></div>" +
+                    "<div class='wrap_box '>" +
+                    "<div class='topTit3 fix ' style='height:40px;'>" +
+                    "<h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4>" +
+                    "</div>";
+                for (var i = 0; i < arry.length; i++) {
+                    htmlA += "<div class='inner_con '>" +
+                        "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                    if (i > 0) {
+                        htmlA += "<div class='title fix closed '>" +
+                            "<h4 class ='fleft '>" + arry[i].bulletinName + "</h4>" +
+                            "<div class='ocBtn fright '></div>" +
+                            "</div>" +
+                            "<div class='inner display_none '>";
+                    } else {
+                        htmlA += "<div class='title fix open '>" +
+                            "<h4 class ='fleft '>" + arry[i].bulletinName + "</h4>" +
+                            "<div class='ocBtn fright '></div>" +
+                            "</div>" +
+                            "<div class='inner '>";
+                    }
+                    htmlA += "<div style='margin:0 auto 10px auto;text-align:center;font-size:14px;color:#333;font-family:微软雅黑;'>发布日期:" + timeZH(arry[i].bulletinssueTime) + "" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>" +
+                        "<table class='table_tenderProject ' border='0px ' bordercolor='#999 '>" +
+                        "<tr><td class ='even '><p>所属行业:<span>" + (arry[i].industriesType == undefined ? '' : arry[i].industriesType) + "</span></p></td><td><p>所属地区:<span>" + (arry[i].regionCode == undefined ? '' : arry[i].regionCode) + "</span></p></td></tr>" +
+                        "<tr><td class ='even '><p>招标项目建立时间:<span>" + timeZH(arry[i].bulletinssueTime) + "</span></p></td><td><p><span></span></p></td></tr>" +
+                        "<tr><td class ='even '><p>招标代理机构代码:<span title ='" + (arry[i].tenderAgencyCode == undefined ? '' : arry[i].tenderAgencyCode) + "'>" + (arry[i].tenderAgencyCode == undefined ? '' : arry[i].tenderAgencyCode) + "</span></p></td><td><p>招标代理机构名称:<span title ='" + (arry[i].tenderAgencyName == undefined ? '' : arry[i].tenderAgencyName) + "'>" + (arry[i].tenderAgencyName == undefined ? '' : arry[i].tenderAgencyName) + "</span></p></td></tr>" +
+                        "<tr><td class ='even '><p>招标人名称:<span title ='" + (arry[i].tendererName == undefined ? '' : arry[i].tendererName) + "'>" + (arry[i].tendererName == undefined ? '' : arry[i].tendererName) + "</span></p></td><td><p>招标组织方式:<span>" + (arry[i].tenderOrganizeForm == undefined ? '' : arry[i].tenderOrganizeForm) + "</span></p></td></tr>" +
+                        "<tr><td class ='even '><p>行政监督部门代码:<span>" + (arry[i].superviseDeptCode == undefined ? '' : arry[i].superviseDeptCode) + "</span></p></td><td><p>行政监督部门名称:<span>" + (arry[i].superviseDeptName == undefined ? '' : arry[i].superviseDeptName) + "</span></p></td></tr>" +
+                        "<tr><td class ='even '><p>行政审核部门代码:<span>" + (arry[i].approveDeptCode == undefined ? '' : arry[i].approveDeptCode) + "</span></p></td><td><p>行政审核部门名称:<span>" + (arry[i].approveDeptName == undefined ? '' : arry[i].approveDeptName) + "</span></p></td></tr>" +
+                        /* "<tr><td class ='even '><p>所属行业:<span>医疗器械</span></p></td><td><p>所属行业:<span>医疗器械</span></p></td></tr>"+ */
+                        "</table>" +
+                        "<div class ='div_tenderProject '>" +
+                        "<h5>招标内容与范围及招标方案说明:</h5>";
+                    if (typeof (arry[i].bulletinContent) != "undefined" && arry[i].bulletinContent != null) {
+                        htmlA += "<span>" + arry[i].bulletinContent + "</span>";
+                    } else {
+                        htmlA += "<span>无</span>";
+                    }
+                    htmlA += "</div>" +
+                        "</div>" +
+                        "</div>" +
+                        "<div style='height:20px;'></div>" +
+                        "</div>";
+                }
+                htmlA += "</div>" +
+                    "</div>";
+            }
+            return htmlA
+        case "openBidRecord": //开标记录
+            var htmlA = "";
+            if (mapbFlag) {
+                var mapList = [];
+                mapList = mapb.openBidRecord;
+                var openBidRecord; //开标记录信息列表
+                var goodsOpenBidList = []; //开标记录货物信息列表
+                var serviceOpenBidList = []; //开标记录服务信息列表
+                var projectOpenBidList = []; //开标记录工程信息列表
+                if (mapList.length == 1) {
+                    openBidRecord = mapList[0].openBidRecord;
+                    goodsOpenBidList = mapList[0].goodsOpenBidList0;
+                    serviceOpenBidList = mapList[0].serviceOpenBidList0;
+                    projectOpenBidList = mapList[0].projectOpenBidList0;
+                    if (openBidRecord == null) {
+                        htmlA += "<div class='wBox '>";
+                        htmlA += "<div class='borderBlue '></div>";
+                        htmlA += "<div class='wrap_box '>";
+                        htmlA += "<div class='topTit3 fix ' style='height:40px;'>";
+                        htmlA += "<h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4></div>";
+                        htmlA += "<div class='inner_con '>";
+                        htmlA += "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                        htmlA += "暂无详细数据";
+                        htmlA += "</div>";
+                        htmlA += "<div style='height:20px;'></div>";
+                        htmlA += "</div></div></div>";
+                    } else {
+                        htmlA += "<div class='wBox '>";
+                        htmlA += "<div class='borderBlue '></div>"
+                        htmlA += "<div class='wrap_box '>"
+                        htmlA += "<div class='topTit3 fix ' style='height:40px;'>";
+                        htmlA += "<h4 style='color:#387fcc;'>开标记录</h4>  </div>";
+                        htmlA += "<div class='inner_con '><div class='openCloseWrap '><div class='title fix open '>";
+                        htmlA += "<h4 class='fleft '>" + openBidRecord.openBidRecordName + "</h4>";
+                        htmlA += "<div class='ocBtn fright '></div></div><div class='inner '>";
+                        htmlA += "<div style='margin:0 auto 10px auto;text-align:center;font-size:14px;color:#333;font-family:微软雅黑;'>开标时间:";
+                        if (typeof (openBidRecord.bidOpeningTime) != "undefined" && openBidRecord.bidOpeningTime != null) {
+                            openBidRecord.bidOpeningTime = timeZH(openBidRecord.bidOpeningTime);
+                            htmlA += openBidRecord.bidOpeningTime;
+                        }
+                        htmlA += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a target='_blank ' href='";
+                        if (typeof (openBidRecord.sourceUrl) == "undefined " || openBidRecord.sourceUrl == null || openBidRecord.sourceUrl == "") {
+                            htmlA += "#";
+                        } else {
+
+                            if (openBidRecord.sourceUrl.indexOf("http://") > -1) {
+                                htmlA += openBidRecord.sourceUrl;
+                            } else if (openBidRecord.sourceUrl.indexOf("https://") > -1) {
+                                htmlA += openBidRecord.sourceUrl;
+                            } else {
+                                htmlA += "http://" + openBidRecord.sourceUrl;
+                            }
+                        }
+                        htmlA += "'>原文链接地址</a></div>";
+                        htmlA += "<table class='table_1 ' border='1px ' bordercolor='#999 ' >";
+                        if (goodsOpenBidList != null && goodsOpenBidList.length > 0) {
+                            htmlA += "<tr><td colspan='3 ' style='text-align:left;'>" + goodsOpenBidList[0].bidSectionName + "</td></tr>";
+                            htmlA += "<tr><td>投标人名称</td><td>投标价格</td><td>交货期</td></tr>";
+                            for (var i = 0; i < goodsOpenBidList.length; i++) {
+                                htmlA += "    <tr><td>";
+                                if (typeof (goodsOpenBidList[i].bidderName) != "undefined" && goodsOpenBidList[i].bidderName != null) {
+                                    htmlA += goodsOpenBidList[i].bidderName
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (goodsOpenBidList[i].bidAmount) != "undefined" && goodsOpenBidList[i].bidAmount != null) {
+                                    htmlA += goodsOpenBidList[i].bidAmount;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (goodsOpenBidList[i].verifyTime) != "undefined" && goodsOpenBidList[i].verifyTime != null) {
+                                    htmlA += goodsOpenBidList[i].verifyTime;
+                                }
+                                htmlA += "</td></tr>";
+                            }
+                        }
+                        if (serviceOpenBidList != null && serviceOpenBidList.length > 0) {
+                            htmlA += "<tr><td colspan='3 ' style='text-align:left;'>" + serviceOpenBidList[0].bidSectionName + "</td></tr>";
+                            htmlA += "<tr><td>投标人名称</td><td>投标价格</td><td>交货期</td></tr>";
+                            for (var i = 0; i < serviceOpenBidList.length; i++) {
+                                htmlA += "<tr><td>";
+                                if (typeof (serviceOpenBidList[i].verifyTime) != "undefined" && serviceOpenBidList[i].bidderName != null) {
+                                    htmlA += serviceOpenBidList[i].bidderName;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (serviceOpenBidList[i].verifyTime) != "undefined" && serviceOpenBidList[i].bidAmount != null) {
+                                    htmlA += serviceOpenBidList[i].bidAmount;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (serviceOpenBidList[i].verifyTime) != "undefined" && serviceOpenBidList[i].verifyTime != null) {
+                                    htmlA += serviceOpenBidList[i].verifyTime;
+                                }
+                                htmlA += "</td></tr>";
+                            }
+                        }
+                        if (projectOpenBidList != null && projectOpenBidList.length > 0) {
+                            htmlA += "<tr><td colspan='3 ' style='text-align:left;'>" + projectOpenBidList[0].bidSectionName + "</td></tr>";
+                            htmlA += "<tr><td>投标人名称</td><td>投标报价</td><td>交货期</td></tr>";
+                            for (var i = 0; i < projectOpenBidList.length; i++) {
+                                htmlA += "<tr><td>";
+                                if (typeof (projectOpenBidList[i].bidderName) != "undefined" && projectOpenBidList[i].bidderName != null) {
+                                    htmlA += projectOpenBidList[i].bidderName;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (projectOpenBidList[i].bidAmount) != "undefined" && projectOpenBidList[i].bidAmount != null) {
+                                    htmlA += projectOpenBidList[i].bidAmount;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (projectOpenBidList[i].verifyTime) != "undefined" && projectOpenBidList[i].verifyTime != null) {
+                                    htmlA += projectOpenBidList[i].verifyTime;
+                                }
+                                htmlA += "</td></tr>";
+                            }
+                        }
+                        htmlA += "</table>";
+                        if (typeof (openBidRecord.attachmentCode) != "undefined" && openBidRecord.attachmentCode != null && openBidRecord.attachmentCode != "") {
+                            htmlA += "<div class='downloadbut '><span class='downloadbutton '>附件下载<span class='attachmentCode ' style='display:none '>" + openBidRecord.attachmentCode + "</span><span class='openBidRecordName ' style='display:none '>" + openBidRecord.openBidRecordName + "</span></span></div>";
+                        }
+                        htmlA += "</div></div><div style='height:20px;'></div></div></div></div>";
+                    }
+                } else {
+                    openBidRecord = mapList[0].openBidRecord;
+                    if (openBidRecord == null) {
+                        htmlA += "<div class='wBox '>";
+                        htmlA += "<div class='borderBlue '></div>";
+                        htmlA += "<div class='wrap_box '>";
+                        htmlA += "<div class='topTit3 fix ' style='height:40px;'>";
+                        htmlA += "<h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4></div>";
+                        htmlA += "<div class='inner_con '>";
+                        htmlA += "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                        htmlA += "暂无详细数据";
+                        htmlA += "</div>";
+                        htmlA += "<div style='height:20px;'></div>";
+                        htmlA += "</div></div></div>";
+                    } else {
+                        htmlA += "<div class='wBox '>";
+                        htmlA += "<div class='borderBlue '></div>"
+                        htmlA += "<div class='wrap_box '>"
+                        htmlA += "<div class='topTit3 fix ' style='height:40px;'>";
+                        htmlA += "<h4 style='color:#387fcc;'>开标记录</h4>  </div>";
+                        htmlA += "<div class='inner_con '><div class='openCloseWrap '><div class='title fix open '>";
+                        htmlA += "<h4 class='fleft '>" + openBidRecord.openBidRecordName + "</h4>";
+                        htmlA += "<div class='ocBtn fright '></div></div><div class='inner '>";
+                        htmlA += "<div style='margin:0 auto 10px auto;text-align:center;font-size:14px;color:#333;font-family:微软雅黑;'>开标时间:";
+                        if (typeof (openBidRecord.bidOpeningTime) != "undefined" && openBidRecord.bidOpeningTime != null) {
+                            openBidRecord.bidOpeningTime = timeZH(openBidRecord.bidOpeningTime);
+                            htmlA += openBidRecord.bidOpeningTime;
+                        }
+                        htmlA += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a target='_blank ' href='";
+                        if (typeof (openBidRecord.sourceUrl) == "undefined " || openBidRecord.sourceUrl == null || openBidRecord.sourceUrl == "") {
+                            htmlA += "#";
+                        } else {
+
+                            if (openBidRecord.sourceUrl.indexOf("http://") > -1) {
+                                htmlA += openBidRecord.sourceUrl;
+                            } else if (openBidRecord.sourceUrl.indexOf("https://") > -1) {
+                                htmlA += openBidRecord.sourceUrl;
+                            } else {
+                                htmlA += "http://" + openBidRecord.sourceUrl;
+                            }
+                        }
+                        htmlA += "'>原文链接地址</a></div>";
+                        htmlA += "<table class='table_1 ' border='1px ' bordercolor='#999 ' >";
+                    }
+                    var json = {
+                        arr: []
+                    }
+
+                    function modifyJosnKey(json, oddkey, newkey, key) {
+                        var val = json[oddkey];
+                        delete json[oddkey];
+                        json[newkey] = key;
+                    }
+
+                    for (var j = 0; j < mapList.length; j++) {
+                        modifyJosnKey(json, json.arr, j, mapList[j]);
+                        goodsOpenBidList = json[j]["goodsOpenBidList" + j];
+                        serviceOpenBidList = json[j]["serviceOpenBidList" + j];
+                        projectOpenBidList = json[j]["projectOpenBidList" + j];
+                        /* if(j == 0){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList0;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList0;
+                            projectOpenBidList = mapList[j].projectOpenBidList0;
+                        }else if(j == 1){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList1;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList1;
+                            projectOpenBidList = mapList[j].projectOpenBidList1;
+                        }else if(j == 2){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList2;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList2;
+                            projectOpenBidList = mapList[j].projectOpenBidList2;
+                        }else if(j == 3){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList3;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList3;
+                            projectOpenBidList = mapList[j].projectOpenBidList3;
+                        }else if(j == 4){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList4;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList4;
+                            projectOpenBidList = mapList[j].projectOpenBidList4;
+                        }else if(j == 5){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList5;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList5;
+                            projectOpenBidList = mapList[j].projectOpenBidList5;
+                        }else if(j == 6){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList6;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList6;
+                            projectOpenBidList = mapList[j].projectOpenBidList6;
+                        }else if(j == 7){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList7;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList7;
+                            projectOpenBidList = mapList[j].projectOpenBidList7;
+                        }else if(j == 8){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList8;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList8;
+                            projectOpenBidList = mapList[j].projectOpenBidList8;
+                        }else if(j == 9){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList9;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList9;
+                            projectOpenBidList = mapList[j].projectOpenBidList9;
+                        }else if(j == 10){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList10;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList10;
+                            projectOpenBidList = mapList[j].projectOpenBidList10;
+                        }else if(j == 11){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList11;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList11;
+                            projectOpenBidList = mapList[j].projectOpenBidList11;
+                        }else if(j == 12){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList12;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList12;
+                            projectOpenBidList = mapList[j].projectOpenBidList12;
+                        }else if(j == 13){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList13;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList13;
+                            projectOpenBidList = mapList[j].projectOpenBidList13;
+                        }else if(j == 14){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList14;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList14;
+                            projectOpenBidList = mapList[j].projectOpenBidList14;
+                        }else if(j == 15){
+                            goodsOpenBidList = mapList[j].goodsOpenBidList15;
+                            serviceOpenBidList = mapList[j].serviceOpenBidList15;
+                            projectOpenBidList = mapList[j].projectOpenBidList15;
+                        } */
+                        if (goodsOpenBidList != null && goodsOpenBidList.length > 0) {
+                            htmlA += "<tr><td colspan='3 ' style='text-align:left;'>" + goodsOpenBidList[0].bidSectionName + "</td></tr>";
+                            htmlA += "<tr><td>投标人名称</td><td>投标价格</td><td>交货期</td></tr>";
+                            for (var i = 0; i < goodsOpenBidList.length; i++) {
+                                htmlA += "    <tr><td>";
+                                if (typeof (goodsOpenBidList[i].bidderName) != "undefined" && goodsOpenBidList[i].bidderName != null) {
+                                    htmlA += goodsOpenBidList[i].bidderName
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (goodsOpenBidList[i].bidAmount) != "undefined" && goodsOpenBidList[i].bidAmount != null) {
+                                    htmlA += goodsOpenBidList[i].bidAmount;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (goodsOpenBidList[i].verifyTime) != "undefined" && goodsOpenBidList[i].verifyTime != null) {
+                                    htmlA += goodsOpenBidList[i].verifyTime;
+                                }
+                                htmlA += "</td></tr>";
+                            }
+                        }
+                        if (serviceOpenBidList != null && serviceOpenBidList.length > 0) {
+                            htmlA += "<tr><td colspan='3 ' style='text-align:left;'>" + serviceOpenBidList[0].bidSectionName + "</td></tr>";
+                            htmlA += "<tr><td>投标人名称</td><td>投标价格</td><td>交货期</td></tr>";
+                            for (var i = 0; i < serviceOpenBidList.length; i++) {
+                                htmlA += "<tr><td>";
+                                if (typeof (serviceOpenBidList[i].verifyTime) != "undefined" && serviceOpenBidList[i].bidderName != null) {
+                                    htmlA += serviceOpenBidList[i].bidderName;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (serviceOpenBidList[i].verifyTime) != "undefined" && serviceOpenBidList[i].bidAmount != null) {
+                                    htmlA += serviceOpenBidList[i].bidAmount;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (serviceOpenBidList[i].verifyTime) != "undefined" && serviceOpenBidList[i].verifyTime != null) {
+                                    htmlA += serviceOpenBidList[i].verifyTime;
+                                }
+                                htmlA += "</td></tr>";
+                            }
+                        }
+                        if (projectOpenBidList != null && projectOpenBidList.length > 0) {
+                            htmlA += "<tr><td colspan='3 ' style='text-align:left;'>" + projectOpenBidList[0].bidSectionName + "</td></tr>";
+                            htmlA += "<tr><td>投标人名称</td><td>投标报价</td><td>交货期</td></tr>";
+                            for (var i = 0; i < projectOpenBidList.length; i++) {
+                                htmlA += "<tr><td>";
+                                if (typeof (projectOpenBidList[i].bidderName) != "undefined" && projectOpenBidList[i].bidderName != null) {
+                                    htmlA += projectOpenBidList[i].bidderName;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (projectOpenBidList[i].bidAmount) != "undefined" && projectOpenBidList[i].bidAmount != null) {
+                                    htmlA += projectOpenBidList[i].bidAmount;
+                                }
+                                htmlA += "</td><td>";
+                                if (typeof (projectOpenBidList[i].verifyTime) != "undefined" && projectOpenBidList[i].verifyTime != null) {
+                                    htmlA += projectOpenBidList[i].verifyTime;
+                                }
+                                htmlA += "</td></tr>";
+                            }
+                        }
+                    }
+                    htmlA += "</table>";
+                    if (typeof (openBidRecord.attachmentCode) != "undefined" && openBidRecord.attachmentCode != null && openBidRecord.attachmentCode != "") {
+                        htmlA += "<div class='downloadbut '><span class='downloadbutton '>附件下载<span class='attachmentCode ' style='display:none '>" + openBidRecord.attachmentCode + "</span><span class='openBidRecordName ' style='display:none '>" + openBidRecord.openBidRecordName + "</span></span></div>";
+                    }
+                    htmlA += "</div></div><div style='height:20px;'></div></div></div></div>";
+                }
+            } else {
+                htmlA += "<div class='wBox '>";
+                htmlA += "<div class='borderBlue '></div>";
+                htmlA += "<div class='wrap_box '>";
+                htmlA += "<div class='topTit3 fix ' style='height:60px;'>";
+                htmlA += "<h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4></div>";
+                htmlA += "<div class='inner_con '>";
+                htmlA += "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                htmlA += "暂无详细数据";
+                htmlA += "</div>";
+                htmlA += "<div style='height:20px;'></div>";
+                htmlA += "</div></div></div>";
+            }
+            return HtmlA
+
+        default:
+            var htmlA = "";
+            if (mapbFlag) {
+
+                var mapList = [];
+                var keyCN = [];
+                for (var i = 0; i < keyList.length; i++) {
+                    switch (keyList[i]) {
+                        case "tenderBulletin": {
+                            mapList[i] = mapb.tenderBulletin;
+                            keyCN[i] = "招标公告";
+                            break;
+                        }
+                        case "qualifyBulletin": {
+                            mapList[i] = mapb.qualifyBulletin;
+                            keyCN[i] = "资格预审公告";
+                            break;
+                        }
+                        case "amendBulletin": {
+                            mapList[i] = mapb.amendBulletin;
+                            keyCN[i] = "变更公告";
+                            break;
+                        }
+                        case "openBidRecord": {
+                            mapList[i] = mapb.openBidRecord;
+                            keyCN[i] = "开标记录";
+                            break;
+                        }
+                        case "goodsOpenBidList": {
+                            mapList[i] = mapb.goodsOpenBidList;
+                            keyCN[i] = "开标明细货物";
+                            break;
+                        }
+                        case "serviceOpenBidList": {
+                            mapList[i] = mapb.serviceOpenBidList;
+                            keyCN[i] = "开标明细服务";
+                            break;
+                        }
+                        case "projectOpenBidList": {
+                            mapList[i] = mapb.projectOpenBidList;
+                            keyCN[i] = "开标明细工程";
+                            break;
+                        }
+                        case "winCandidateBulletin": {
+                            mapList[i] = mapb.winCandidateBulletin;
+                            keyCN[i] = "中标候选人公示";
+                            break;
+                        }
+                        case "winBidBulletin": {
+                            mapList[i] = mapb.winBidBulletin;
+                            keyCN[i] = "中标结果公告";
+                            break;
+                        }
+                        case "tenderProject": {
+                            mapList[i] = mapb.tenderProject;
+                            keyCN[i] = "招标项目";
+                            break;
+                        }
+                    }
+                }
+                var htmlNotNullFlag = false; //接收到的所有关键字中list
+                for (var i = 0; i < mapList.length; i++) {
+                    var ArrayA = [];
+                    ArrayA = mapList[i];
+                    if (ArrayA.length != 0) {
+                        htmlNotNullFlag = true;
+                    }
+                }
+                if (htmlNotNullFlag) {
+                    for (var i = 0; i < mapList.length; i++) {
+                        var ArrayA = [];
+                        ArrayA = mapList[i];
+                        if (ArrayA.length > 0) {
+
+                            htmlA += "<div class='wBox '>";
+                            htmlA += "<div class='borderBlue '></div>";
+                            htmlA += "<div class='wrap_box '>";
+                            htmlA += "<div class='topTit3 fix '>";
+                            htmlA += "<h4 style='color:#387fcc;'>" + keyCN[i] + "</h4></div>";
+                            htmlA += "<div class='inner_con '>";
+                            for (var j = 0; j < ArrayA.length; j++) {
+                                htmlA += "<div class='openCloseWrap '>";
+                                if (j == 0) {
+                                    htmlA += "<div class='title fix open '>";
+                                } else {
+                                    htmlA += "<div class='title fix closed '>";
+                                }
+                                htmlA += " <h4 class='fleft '>";
+                                if (typeof (ArrayA[j].bulletinName) != "undefined" && ArrayA[j].bulletinName != null && ArrayA[j].bulletinName != "") {
+                                    htmlA += ArrayA[j].bulletinName;
+                                }
+                                htmlA += "</h4>";
+                                htmlA += "<div class='ocBtn fright '></div>";
+                                htmlA += "</div>";
+                                if (j == 0) {
+                                    htmlA += "<div class='inner ' style='width:668px;overflow-x:auto;font-size:14px;color:#333;font-family:微软雅黑;line-height:2;'>";
+                                } else {
+                                    htmlA += "<div class='inner display_none ' style='width:668px;overflow-x:auto;font-size:14px;color:#333;font-family:微软雅黑;line-height:2;'>";
+                                }
+                                htmlA += "<div style='margin:0 auto 10px auto;text-align:center;font-size:14px;color:#333;font-family:微软雅黑;'>发布日期:";
+                                if (typeof (ArrayA[j].bulletinssueTime) != "undefined" && ArrayA[j].bulletinssueTime != null && ArrayA[j].bulletinssueTime != "") {
+                                    ArrayA[j].bulletinssueTime = timeZH(ArrayA[j].bulletinssueTime);
+                                    htmlA += ArrayA[j].bulletinssueTime;
+                                }
+                                htmlA += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a target='_blank ' href='";
+                                if (typeof (ArrayA[j].sourceUrl) != "undefined " && ArrayA[j].sourceUrl != null && ArrayA[j].sourceUrl != "") {
+                                    //htmlA += ArrayA[j].sourceUrl;
+                                    debugger
+                                    if (ArrayA[j].sourceUrl.indexOf("http://") > -1) {
+                                        htmlA += ArrayA[j].sourceUrl;
+                                    } else if (ArrayA[j].sourceUrl.indexOf("https://") > -1) {
+                                        htmlA += ArrayA[j].sourceUrl;
+                                    } else {
+                                        htmlA += "http://" + ArrayA[j].sourceUrl;
+                                    }
+                                } else {
+                                    htmlA += "#";
+                                }
+                                htmlA += "' >原文链接地址</a></div>";
+                                if (typeof (ArrayA[j].bulletinContent) != "undefined" && ArrayA[j].bulletinContent != null) {
+                                    htmlA += ArrayA[j].bulletinContent.replace("<![CDATA[", "").replace("]]>", "");
+                                }
+                                if (typeof (ArrayA[j].attachmentCode) != "undefined" && ArrayA[j].attachmentCode != null && ArrayA[j].attachmentCode != "") {
+                                    htmlA += "<div class='downloadbut '><span class='downloadbutton '>附件下载<span class='attachmentCode ' style='display:none '>" + ArrayA[j].attachmentCode + "</span><span class='openBidRecordName ' style='display:none '>" + ArrayA[j].bulletinName + "</span></span></div>";
+                                }
+                                htmlA += "</div></div>";
+                                htmlA += "<div style='height:20px;'></div>";
+                            }
+                            htmlA += "</div>";
+                            htmlA += "</div></div></div>";
+                        }
+                    }
+                } else {
+                    htmlA += "<div class='wBox '>";
+                    htmlA += "<div class='borderBlue '></div>";
+                    htmlA += "<div class='wrap_box '>";
+                    htmlA += "<div class='topTit3 fix ' style='height:60px;'>";
+                    htmlA += "<h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4></div>";
+                    htmlA += "<div class='inner_con '>";
+                    htmlA += "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                    htmlA += "暂无详细数据";
+                    htmlA += "</div>";
+                    htmlA += "<div style='height:20px;'></div>";
+                    htmlA += "</div></div></div>";
+                }
+            } else {
+                htmlA += "<div class='wBox '>";
+                htmlA += "<div class='borderBlue '></div>";
+                htmlA += "<div class='wrap_box '>";
+                htmlA += "<div class='topTit3 fix ' style='height:60px;'>";
+                htmlA += "<h4 style='color:#387fcc;'>" + dataNullNameCN + "</h4></div>";
+                htmlA += "<div class='inner_con '>";
+                htmlA += "<div class='openCloseWrap ' style='heigth:40px;font-size:16px;'>";
+                htmlA += "暂无详细数据";
+                htmlA += "</div>";
+                htmlA += "<div style='height:20px;'></div>";
+                htmlA += "</div></div></div>";
+            }
+            return HtmlA
+
+    }
+}
+// ss = splicing([])
+// console.log(ss)

+ 150 - 0
zgztb_cookie/zgzbtb_spider.py

@@ -0,0 +1,150 @@
+# -*- coding: utf-8 -*-
+#  中国招标投标公共服务平台
+#  @CreatDate    : 4/11/2021 上午 10:04
+#  @Author  : 马国鹏
+#  @File    : qgzb_spider.py
+import datetime
+import time
+import requests
+from collections import namedtuple
+from utils.databases import RedisDBS, MongoDBS
+from utils.log import Log
+from utils.socks5proxy import Socks5Proxy
+from utils.tools import get_signature
+
+def get_proxy():
+    headers = {
+        "Authorization": "Basic amlhbnl1MDAxOjEyM3F3ZSFB"
+    }
+    proxy = requests.get("http://cc.spdata.jianyu360.com/crawl/proxy/socks5/fetch", headers=headers).json()
+    return proxy.get("data")
+
+class ZGZBSpider(object):
+    def __init__(self):
+        self.__proxies = Socks5Proxy().proxies
+        Menu = namedtuple('Menu', ['channel', 'code', 'id', 'crawl_page',"businessKeyWord"])
+        self.menus = [
+            Menu('未按数据规范-招标项目', 'a_zgzbtbggfwpt_wasjgf_zbxm', "招标项目", 1, "tenderProject"),
+            Menu('未按数据规范-招标公告', 'a_zgzbtbggfwpt_wasjgf_zbgg', "招标公告", 1,"tenderBulletin"),
+            Menu('未按数据规范-开标记录', 'a_zgzbtbggfwpt_wasjgf_kbjl', "开标记录", 1, "openBidRecord"),
+            Menu('未按数据规范-评标公示', 'a_zgzbtbggfwpt_wasjgf_pbgs', "评标公示", 1, "winCandidateBulletin"),
+            Menu('未按数据规范-中标公告', 'a_zgzbtbggfwpt_wasjgf_zhbgg', "中标公告", 1, "winBidBulletin"),
+            # Menu('未按数据规范-签约履行', 'a_zgzbtbggfwpt_wasjgf_qylx', "签约履行", 1,"tenderBulletin"),
+        ]
+
+        self.logger = Log('zgzb_list').get_logger
+        self.crawl_list = MongoDBS('py_spider', 'zgzb_list').coll
+        self.redis_key = "zgzb_2021"
+        self.err_key = "zgzb_2021:err"
+        self.r = RedisDBS().redis
+        self.url = 'http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/getStringMethod.do'
+
+    def set_proxies(self, enable_proxy=False):
+        time.sleep(3)
+        self.__proxies = Socks5Proxy().proxies
+
+    def parse(self):
+        for menu in self.menus:
+            self.list_page(menu)
+
+    def list_page(self,menu):
+        header = {
+            "Origin": "http: // www.cebpubservice.com",
+            "Host": "www.cebpubservice.com",
+            "Content-Length": "228",
+            "X-Requested-With": "XMLHttpRequest",
+            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
+            "Referer": "http://www.cebpubservice.com/ctpsp_iiss/searchbusinesstypebeforedooraction/getSearch.do?tabledivIds=searchTabLi2",
+            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3877.400 QQBrowser/10.8.4506.400"
+        }
+        data = "searchName=&searchArea=&searchIndustry=&centerPlat=&businessType=%E6%8B%9B%E6%A0%87%E5%85%AC%E5%91%8A&searchTimeStart=&searchTimeStop=&timeTypeParam=&bulletinIssnTime=&bulletinIssnTimeStop="
+        data = {i.split("=")[0]:i.split("=")[-1] for i in data.split("&")}
+        data["businessType"] =menu.id
+
+        for pegenum in range(1,10):
+                try:
+                    today = datetime.date.today()
+                    endday = today - datetime.timedelta(days=-3)
+                    # endday = today
+                    data["pageNo"] = str(pegenum)
+                    data["row"] = '1000'
+                    data["bulletinIssnTime"] = "2天"
+
+                    if menu.id=='招标公告':
+                        # data["bulletinIssnTimeStart"] = str(endday)
+                        # data["bulletinIssnTimeStart"] = str(today)
+                        data["bulletinIssnTimeStart"] = ""
+                        data["bulletinIssnTimeStart"] = ""
+                    else:
+                        # data["searchTimeStop"] = str(endday)
+                        #
+                        # data["searchTimeStart"] = str(today)
+                        data["searchTimeStop"] = ""
+                        data["searchTimeStart"] = ""
+                    print(data)
+                    self.logger.info(f'start_time:{data["searchTimeStart"]}'
+                                     f'end_time:{data["searchTimeStop"]}'
+                                     f'page_num:{data["pageNo"]}')
+                    res = requests.post(self.url, headers=header, data=data,timeout=5,proxies=get_proxy())
+                    res = res.json()
+                    if res.get("object").get("page").get("totalPage") is not None:
+                        max_page= res.get("object").get("page").get("totalPage")
+                        print(max_page)
+                except Exception as e:
+                    print("获取失败")
+                    self.logger.error(e)
+                else:
+                    print(f'{menu.id},页码{pegenum}连接含有',len(res.get("object").get("returnlist")),'条数据')
+                    # print(res.get("object"))
+                    for jtme in res.get("object").get("returnlist"):
+                        businessid = jtme.get("businessId")
+                        tenderprojectcode = jtme.get("tenderProjectCode")
+                        businessobjectname = jtme.get("businessObjectName")
+                        transactionplatfcode = jtme.get("transactionPlatfCode")
+                        transactionplatfname = jtme.get("transactionPlatfName")
+
+                        regionname = jtme.get("regionName")
+                        city = ''
+                        if regionname is not None:
+                            city = "" if "市" in regionname else regionname.split(" ")[-1]
+                        if jtme.get("businessObjectName") is None:
+                            continue
+                        if jtme.get("businessObjectName") == '':
+                            continue
+                        item = {
+                            "schemaVersion":jtme.get("schemaVersion"),
+                            "type":jtme.get("type"),
+                            "businessKeyWord":menu.businessKeyWord,
+                            "rowGuid":jtme.get("rowGuid"),
+                            "site": "中国招标投标公共服务平台",
+                            "channel": menu.channel,
+                            "area": jtme.get("regionName"),
+                            "_d": "comeintime",
+                            "comeintime": int(time.time()),
+                            "T": "bidding",
+                            "sendflag": "false",
+                            "spidercode": menu.code,
+                            "city": city,
+                            "iscompete":"true",
+                            "publishdept": "",
+                            "title": jtme.get("businessObjectName"),
+                            "href":businessid+"&"+tenderprojectcode+"&"+transactionplatfcode,
+                            "publishtime": str(jtme.get("receiveTime")) + " 00:00:00",
+                            "l_np_publishtime": int(time.mktime(time.strptime(jtme.get("receiveTime"), "%Y-%m-%d"))),
+                            "detail": "",
+                            "contenthtml": "",
+                        }
+                        data_signature = get_signature(businessid+"&"+tenderprojectcode+"&"+transactionplatfcode)
+                        # print(businessid,page)
+
+                        if not self.r.hexists(self.redis_key, data_signature):
+                            result = self.crawl_list.insert_one(item)
+                            self.logger.info(f"mongo add {menu.channel} _id: {result.inserted_id} {item['title']}")
+                            self.r.hset(self.redis_key, data_signature, item["href"])
+                        # else:
+                        #     self.logger.info(f"数据重复: {item['title']}")
+                    # break
+
+if __name__ == '__main__':
+    ZGZBSpider().parse()
+