Пример #1
0
 def get_shop_infos_by_shop_ids(cls, in_shop_id_list):
     """
     根据店铺id获得店铺相应信息包括access_token,subway_token,nick
     """
     shop_info_list = []
     shop_info_db = ShopInfoDB(mongoConn)
     for shop_id in in_shop_id_list:
         shop_info = shop_info_db.get_shop_info_by_shop_id(shop_id)
         try:
             shop_info.update({"campaign_ids": RptAll.get_campaigns_by_shop_info(shop_info)})
         except InvalidAccessTokenException, data:
             report_logger.error("nick [%s] access_token expired", shop_info["nick"])
             continue
         except Exception, data:
             report_logger.exception("get campaign_ids failed")
             continue
Пример #2
0
 def get_shop_infos_by_shop_ids(cls, in_shop_id_list):
     """
     根据店铺id获得店铺相应信息包括access_token,subway_token,nick
     """
     shop_info_list = []
     shop_info_db = ShopInfoDB(mongoConn)
     for shop_id in in_shop_id_list:
         shop_info = shop_info_db.get_shop_info_by_shop_id(shop_id)
         try:
             shop_info.update({
                 'campaign_ids':
                 RptAll.get_campaigns_by_shop_info(shop_info)
             })
         except InvalidAccessTokenException, data:
             report_logger.error("nick [%s] access_token expired",
                                 shop_info['nick'])
             continue
         except Exception, data:
             report_logger.exception('get campaign_ids failed')
             continue
Пример #3
0
                                              shop_info['access_token'],
                                              shop_info['subway_token'],
                                              shop_info['campaign_ids'])

                effect_rpt_list = effect_rpt_get.yesterday_rpt_get()
                rpt_effect_db.save_records(effect_rpt_list)
                report_logger.info("店铺  [%s] 重新获取效果报表完成,条数 %d",
                                   shop_info['nick'], len(effect_rpt_list))
            except Exception, data:
                report_logger.exception('get effect data exception')

        return True


if __name__ == '__main__':
    shop_info_db = ShopInfoDB(mongoConn)
    shop_id_list = shop_info_db.get_all_shop_id_list()
    #shop_id_list = shop_id_list[0:5]
    #shop_id_list = ['58735843']

    RptAll.get_day_info()
    shop_info_list = RptAll.get_shop_infos_by_shop_ids(shop_id_list)
    report_logger.info('获得店铺信息完成, 店铺总数 %d', len(shop_info_list))
    base_fail_list = RptAll.get_base_data_topats(shop_info_list)
    report_logger.info('异步基础报表抓取完成, 已知失败店铺数 %d', len(base_fail_list))
    effect_fail_list = RptAll.get_effect_data_topats(shop_info_list)
    report_logger.info('异步效果报表抓取完成, 已知失败店铺数 %d', len(effect_fail_list))

    #通过同步报表,修正异步报表错误,或者补充异步报表
    RptAll.get_base_data(shop_info_list)
    report_logger.info("补充基础报表完成")
Пример #4
0
                effect_rpt_get = EffectRptGet(
                    shop_info["nick"], shop_info["access_token"], shop_info["subway_token"], shop_info["campaign_ids"]
                )

                effect_rpt_list = effect_rpt_get.yesterday_rpt_get()
                rpt_effect_db.save_records(effect_rpt_list)
                report_logger.info("店铺  [%s] 重新获取效果报表完成,条数 %d", shop_info["nick"], len(effect_rpt_list))
            except Exception, data:
                report_logger.exception("get effect data exception")

        return True


if __name__ == "__main__":
    shop_info_db = ShopInfoDB(mongoConn)
    shop_id_list = shop_info_db.get_all_shop_id_list()
    # shop_id_list = shop_id_list[0:5]
    # shop_id_list = ['58735843']

    RptAll.get_day_info()
    shop_info_list = RptAll.get_shop_infos_by_shop_ids(shop_id_list)
    report_logger.info("获得店铺信息完成, 店铺总数 %d", len(shop_info_list))
    base_fail_list = RptAll.get_base_data_topats(shop_info_list)
    report_logger.info("异步基础报表抓取完成, 已知失败店铺数 %d", len(base_fail_list))
    effect_fail_list = RptAll.get_effect_data_topats(shop_info_list)
    report_logger.info("异步效果报表抓取完成, 已知失败店铺数 %d", len(effect_fail_list))

    # 通过同步报表,修正异步报表错误,或者补充异步报表
    RptAll.get_base_data(shop_info_list)
    report_logger.info("补充基础报表完成")