Пример #1
0
    def __generate_c3_201(self):

        # 负面新闻
        # for tpm in dbutil.get_topic_messages(self.db, 37, self.last_check_time):
        #     for cid in dbutil.get_topic_message_companies(self.db, tpm.id):
        #         if self.__valid_company(cid):
        #             siid = dbutil.get_saoanzi_item(self.db, cid, self.today)
        #             dbutil.update_saoanzi_item_source(self.db, siid, 201, 90, tpm.id)
        #             dbutil.update_saoanzi_item_cate(self.db, siid, cateid=3)
        for news in self.mongo.article.news.find({
                'date': {
                    '$gte': self.today,
                    '$lte': self.today + timedelta(days=1)
                },
                'processStatus': 1,
                'features': 578362
        }):
            for cid in news.get('companyIds', []):
                if self.__valid_company(cid):
                    cm = dbutil.get_news_company_message(
                        self.db, cid, str(news['_id']))
                    print 'bad', cm
                    if cm:
                        siid = dbutil.get_saoanzi_item(self.db, cid,
                                                       self.today)
                        dbutil.update_saoanzi_item_source(
                            self.db, siid, 201, 91, cm.id)
                        dbutil.update_saoanzi_item_cate(self.db,
                                                        siid,
                                                        cateid=3)
Пример #2
0
    def __general_c2_105(self):

        for cm in dbutil.get_all_company_messages(self.db, 3107,
                                                  self.last_check_time):
            if self.__valid_company(cm.companyId):
                # source 105 今日入榜的公司
                siid = dbutil.get_saoanzi_item(self.db, cm.companyId,
                                               self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 105, 91,
                                                  cm.id)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=2)
                # source 4 第一次入榜的公司
                domain = dbutil.get_artifact_info(self.db, cm.relateId,
                                                  'domain')
                genre, atype = int(
                    cm.detailId.split(',')[0]), cm.detailId.split(',')[1]
                previous = self.mongo.trend.appstore_rank.find({
                    'trackId': domain,
                    'genre': genre,
                    'type': atype,
                    'rank': {
                        '$lt': 100
                    }
                }).count()
                if previous == 1:
                    dbutil.update_saoanzi_item_source(self.db, siid, 4, 91,
                                                      cm.id)
                    dbutil.update_saoanzi_item_cate(self.db, siid, cateid=1)
Пример #3
0
    def __generate_c1_3(self):

        # 发布新的应用
        for cm in dbutil.get_all_company_messages(self.db, 2001,
                                                  self.last_check_time):
            if self.__valid_company(cm.companyId):
                siid = dbutil.get_saoanzi_item(self.db, cm.companyId,
                                               self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 3, 91, cm.id)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=1)
Пример #4
0
    def __generate_c2_104(self):

        # 下载激增
        for tpm in dbutil.get_topic_messages(self.db, 8, self.last_check_time):
            for cid in dbutil.get_topic_message_companies(self.db, tpm.id):
                if self.__valid_company(cid):
                    siid = dbutil.get_saoanzi_item(self.db, cid, self.today)
                    dbutil.update_saoanzi_item_source(self.db, siid, 104, 90,
                                                      tpm.id)
                    dbutil.update_saoanzi_item_cate(self.db, siid, cateid=2)
Пример #5
0
    def __generate_c2_103(self):

        # 每日退出
        for tpm in dbutil.get_topic_messages(self.db, 27,
                                             self.last_check_time):
            cid = dbutil.get_funding(self.db, tpm.relateId).companyId
            if self.__valid_company(cid):
                siid = dbutil.get_saoanzi_item(self.db, cid, self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 103, 90,
                                                  tpm.id)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=2)
Пример #6
0
    def __generate_c3_202(self):

        # 热议
        tpms = []
        for tpid in [16, 20, 21, 22, 38]:
            tpms.extend(
                dbutil.get_topic_messages(self.db, tpid, self.last_check_time))
        for tpm in tpms:
            for cid in dbutil.get_topic_message_companies(self.db, tpm.id):
                if self.__valid_company(cid):
                    siid = dbutil.get_saoanzi_item(self.db, cid, self.today)
                    dbutil.update_saoanzi_item_source(self.db, siid, 202, 90,
                                                      tpm.id)
                    dbutil.update_saoanzi_item_cate(self.db, siid, cateid=3)
Пример #7
0
    def __generate_c2_101(self):

        for tpm in dbutil.get_topic_messages(self.db, 26,
                                             self.last_check_time):
            # source 101 获得新一轮融资
            cid = dbutil.get_funding(self.db, tpm.relateId).companyId
            if self.__valid_company(cid):
                siid = dbutil.get_saoanzi_item(self.db, cid, self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 101, 90,
                                                  tpm.id)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=2)
                # source 1, 第一次获得融资
                if len(dbutil.get_company_funding(self.db, cid)) == 1:
                    dbutil.update_saoanzi_item_source(self.db, siid, 1, 90,
                                                      tpm.id)
                    dbutil.update_saoanzi_item_cate(self.db, siid, cateid=1)
Пример #8
0
    def __generate_c1_6(self):

        for tpm in dbutil.get_topic_messages(self.db, 30,
                                             self.last_check_time):
            # source 6 第一次媒体播报
            news = self.mongo.article.news.find_one(
                {'_id': ObjectId(tpm.relateId)})
            if news:
                for cid in news.get('companyIds', []):
                    if self.__valid_company(cid):
                        siid = dbutil.get_saoanzi_item(self.db, cid,
                                                       self.today)
                        dbutil.update_saoanzi_item_source(
                            self.db, siid, 6, 90, tpm.id)
                        dbutil.update_saoanzi_item_cate(self.db,
                                                        siid,
                                                        cateid=1)
Пример #9
0
    def __generate_c1_5(self):

        # 新招聘
        for tc in self.mongo.task.company.find({
                'processStatus': {
                    '$gte': 1
                },
                'types': 'company_job',
                'finishTime': {
                    '$gte': self.utc_last_check_time
                }
        }):
            if self.__valid_company(tc.get('companyId')):
                cmid = dbutil.get_new_company_message(self.db,
                                                      tc.get('companyId'),
                                                      u'今日招聘网站上出现的新公司', 10002)
                siid = dbutil.get_saoanzi_item(self.db, tc.get('companyId'),
                                               self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 5, 91, cmid)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=1)
Пример #10
0
    def __generate_c2_102(self):

        for cm in dbutil.get_all_company_messages(self.db, 8001,
                                                  self.last_check_time):
            # source 102 开启新一轮融资
            if self.__valid_company(cm.companyId):
                siid = dbutil.get_saoanzi_item(self.db, cm.companyId,
                                               self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 102, 91,
                                                  cm.id)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=2)
                # source 2 第一次开启融资
                if len([
                        ccm.id for ccm in dbutil.get_company_messages(
                            self.db, cm.companyId, 'Y')
                        if ccm.trackDimension == 8001
                ]) == 1:
                    dbutil.update_saoanzi_item_source(self.db, siid, 2, 91,
                                                      cm.id)
                    dbutil.update_saoanzi_item_cate(self.db, siid, cateid=1)
Пример #11
0
    def __generate_c1_7(self):

        # 新收录
        for tc in self.mongo.task.company.find({
                'processStatus': {
                    '$gte': 1
                },
                'finishTime': {
                    '$gte': self.utc_last_check_time
                },
                'types': {
                    '$in': ['company_create', 'company_newcover']
                }
        }):
            if self.__valid_company(tc.get('companyId')):
                cmid = dbutil.get_new_company_message(self.db,
                                                      tc.get('companyId'),
                                                      u'今日新收录公司', 10001)
                siid = dbutil.get_saoanzi_item(self.db, tc.get('companyId'),
                                               self.today)
                dbutil.update_saoanzi_item_source(self.db, siid, 7, 91, cmid)
                dbutil.update_saoanzi_item_cate(self.db, siid, cateid=1)