Пример #1
0
    def get_effect_data(cls, shop_info_list):

        for shop_info in shop_info_list:
            try:
                if RptAll.is_effect_rpt_correct(shop_info):
                    continue

                report_logger.info("店铺  [%s] 需要重新获取效果报表", shop_info["nick"])
                rpt_effect_db = RptEffectDB(mongoConn, str(shop_info["sid"]))
                rpt_effect_db.clear_one_day_ago_rpt(RptAll.ONE_WEEK_AGO)
                rpt_effect_db.clear_one_day_rpt(RptAll.YESTERDAY)

                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")
Пример #2
0
    def get_effect_data(cls, shop_info_list):

        for shop_info in shop_info_list:
            try:
                if RptAll.is_effect_rpt_correct(shop_info):
                    continue

                report_logger.info("店铺  [%s] 需要重新获取效果报表", shop_info['nick'])
                rpt_effect_db = RptEffectDB(mongoConn, str(shop_info['sid']))
                rpt_effect_db.clear_one_day_ago_rpt(RptAll.ONE_WEEK_AGO)
                rpt_effect_db.clear_one_day_rpt(RptAll.YESTERDAY)

                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')
Пример #3
0
                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("补充基础报表完成")
    RptAll.get_effect_data(shop_info_list)
    report_logger.info("补充效果报表完成")
Пример #4
0
                )

                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("补充基础报表完成")
    RptAll.get_effect_data(shop_info_list)
    report_logger.info("补充效果报表完成")