Пример #1
0
 def update_word(self):
     """ 更新热词数据 """
     try:
         if self.select_word(self.data_source['title']) == 0:
             db_util.insert(ImsPlusHotWord, [self.data_source])
         else:
             word = db_util.ImsPlusHotWord
             word.update(hot_rank=self.data_source['hot_rank']).where(
                 word.title == self.data_source['title']).execute()
     except Exception as e:
         print 'VdImsPlusHotWord 更新热词数据异常', e
Пример #2
0
 def insert_word(self):
     """ 插入热词数据 """
     try:
         if self.select_word(self.data_source['title']) == 0:
             db_util.insert(ImsPlusHotWord, [self.data_source])
         else:
             word = db_util.ImsPlusHotWord
             word.update(gzh_class=self.data_source['gzh_class'],
                         gzh_article_read=self.data_source['gzh_article_read']) \
                 .where(word.title == self.data_source['title']).execute()
     except Exception as e:
         print 'VdImsPlusHotWord 插入热词数据异常', e
Пример #3
0
 def insert_gzh(self):
     """ 插入公众号数据 """
     try:
         gzh_info = self.data_source
         if self.select_gzh(gzh_info['biz'], None) == 0:
             db_util.insert(ImsPlusHotGzh, [gzh_info])
         else:
             gzh = db_util.ImsPlusHotGzh
             gzh.update(uin_hao=gzh_info['uin_hao'], logo=gzh_info['logo'], title=gzh_info['title'],
                        auth=gzh_info['auth'], qr_code_url=gzh_info['qr_code_url'],
                        new_send_time=gzh_info['new_send_time']) \
                 .where(gzh.biz == gzh_info['biz']).execute()
     except Exception as e:
         print 'VdImsPlusHotGzh 插入公众号数据异常', e
Пример #4
0
 def update_gzh_info(self):
     """ 更新公众号信息 """
     try:
         data_source = self.data_source
         gzh_biz = data_source['gzh_biz']
         create_time = data_source['create_time']
         if self.select_gzh(gzh_biz, create_time) == 0:
             db_util.insert(ImsPlusHotGzhInfo, [data_source])
         else:
             info = db_util.ImsPlusHotGzhInfo
             info.update(ranking=data_source['ranking']) \
                 .where(info.gzh_biz == gzh_biz, info.create_time == create_time).execute()
     except Exception as e:
         print 'VdImsPlusHotGzhInfo 更新公众号信息异常', e
Пример #5
0
 def update_gzh(self):
     """ 更新公众号数据 """
     try:
         gzh_info = self.data_source
         if self.select_gzh(None, gzh_info['uin_hao']) == 0:
             db_util.insert(ImsPlusHotGzh, [gzh_info])
         else:
             gzh = db_util.ImsPlusHotGzh
             gzh.update(remark=gzh_info['remark'], send_article_sum=gzh_info['send_article_sum'],
                        average_send_article=gzh_info['average_send_article'],
                        average_top_read=gzh_info['average_top_read'],
                        average_nottop_read=gzh_info['average_nottop_read'],
                        average_top_agree=gzh_info['average_top_agree'], max_read_sum=gzh_info['max_read_sum']) \
                 .where(gzh.uin_hao == gzh_info['uin_hao']).execute()
     except Exception as e:
         print 'VdImsPlusHotGzh 更新公众号数据异常', e
Пример #6
0
 def insert_gzh_info(self):
     """ 插入公众号信息 """
     try:
         data = self.data_source
         gzh_biz = data['gzh_biz']
         create_time = data['create_time']
         if self.select_gzh(gzh_biz, create_time) == 0:
             db_util.insert(ImsPlusHotGzhInfo, [data])
         else:
             info = db_util.ImsPlusHotGzhInfo
             info.update(gzh_title=data['gzh_title'], read_sum=data['read_sum'], top_read_sum=data['top_read_sum'],
                         agree_sum=data['agree_sum'], top_agree_sum=data['top_agree_sum'],
                         send_read_sum=data['send_read_sum']) \
                 .where(info.gzh_biz == gzh_biz, info.create_time == create_time).execute()
     except Exception as e:
         print 'VdImsPlusHotGzhInfo 插入公众号信息异常', e
Пример #7
0
 def insert_word_info(self):
     """ 插入热词信息 """
     try:
         db_util.insert(ImsPlusHotWordInfo, [self.data_source])
     except Exception as e:
         print 'VdImsPlusHotWordInfo 插入热词信息异常', e
Пример #8
0
 def insert_article(self):
     """ 插入文章信息 """
     try:
         db_util.insert(ImsPlusHotArticle, [self.data_source])
     except Exception as e:
         print 'VdImsPlusHotArticle 插入文章信息异常', e