Exemplo n.º 1
0
def getui_login(*args):
    logger = Logger("getui_login")
    logger.write("Start")

    try:
        count = GeTui.job_of_login_notification()
        logger.write("Done. count: {0}".format(count))
    except:
        logger.error(traceback.format_exc())
    finally:
        logger.close()
Exemplo n.º 2
0
def clean_mail_history(*args):
    logger = Logger("clean_mail_history")
    logger.write("Start")

    try:
        MailHistoryRecord.cronjob()
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 3
0
def clean_statistics(*args):
    logger = Logger("clean_statistics")
    logger.write("Start")

    try:
        num = Statistics.cronjob()
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done. Delete {0}".format(num))
    finally:
        logger.close()
Exemplo n.º 4
0
def clean_account_log(*args):
    logger = Logger('clean_account_log')
    logger.write("Start")

    try:
        AccountLoginLog.cronjob()
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 5
0
def union_explore_reset(*args):
    logger = Logger("union_explore_reset")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            cronjob_of_union_explore(sid)
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 6
0
def getui_energy(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.hour not in [11,12,13,17,18,19,20]:
        return

    logger = Logger("getui_energy")
    logger.write("Start")

    try:
        count = GeTui.job_of_energy_notification()
        logger.write("Done. count: {0}".format(count))
    except:
        logger.error(traceback.format_exc())
    finally:
        logger.close()
Exemplo n.º 7
0
def union_explore_reset(*args):
    logger = Logger("union_explore_reset")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            cronjob_of_union_explore(sid)
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 8
0
def clean_operation_log(*args):
    logger = Logger('clean_operation_log')
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            OperationLog.clean(sid)
            logger.write("Server {0} Done.".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 9
0
def reset_task_daily(*args):
    logger = Logger("reset_task_daily")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MongoTaskDaily.db(sid).drop()

            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 10
0
def plunder_reset_station(*args):
    logger = Logger("plunder_reset_station")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.make_product(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 11
0
def send_rank_reward(*args):
    logger = Logger("arena_send_rank_reward")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MongoArena.db(sid).update_many({}, {'$set': {'continue_win': 0}})

            Arena.send_rank_reward(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 12
0
def party_clean_talent_id(*args):
    logger = Logger("party_clean_talent_id")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Party.clean_talent_id(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 13
0
def plunder_reset_station(*args):
    logger = Logger("plunder_reset_station")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.make_product(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 14
0
def champion_before_apply(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.weekday() not in APPLY_WEEKDAY:
        return

    logger = Logger("champion_before_apply")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            before_apply(sid)
            logger.write("Server {0} Finish.".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 15
0
def generate_club_leaderboard(*args):
    logger = Logger('generate_club_leaderboard')
    logger.write('Start')

    try:
        for sid in Server.duty_server_ids():
            ClubLeaderBoard.generate(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 16
0
def winning_reset(*args):
    logger = Logger("winning_reset")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            WinningArena.cronjob(sid)
            WinningPlunder.cronjob(sid)

            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 17
0
def champion_level_match(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.weekday() not in APPLY_WEEKDAY:
        return

    logger = Logger("champion_level_match")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            lv = ChampionshipLevel(sid).start_match()
            logger.write("Server {0} Finish Level Math {1}".format(sid, lv))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 18
0
def union_reset(*args):
    logger = Logger("union_reset")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MongoUnionMember.db(sid).update_many({}, {
                '$set': {
                    'today_contribution': 0,
                    'quit_flag': False,
                    'kick_flag': False,
                }
            })

            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 19
0
def clean_mail(*args):
    logger = Logger("clean_mail")
    logger.write("Start")

    try:
        server_ids = Server.duty_server_ids()
        for s in server_ids:
            cleaned_amount = MailManager.cronjob(s)
            logger.write("server {0} cleaned amount {1}".format(s, cleaned_amount))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 20
0
def send_gm_mail(*args):
    logger = Logger("send_gm_mail")
    logger.write("Start")

    gm = AdminMailManager()
    gm.fetch()

    logger.write("Send ids: {0}".format(gm.send_ids))

    try:
        gm.start_send()
    except:
        logger.write("Done ids: {0}".format(gm.done_ids))
        logger.error(traceback.format_exc())
    else:
        logger.write("Done ids: {0}".format(gm.done_ids))
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 21
0
def tower_send_reward_and_reset_star(*args):
    logger = Logger("tower_send_reward_and_reset_star")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Tower.send_rank_reward_and_reset_star(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 22
0
def champion_make_group(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.weekday() not in APPLY_WEEKDAY:
        return

    logger = Logger("champion_make_group")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            club_ids = ChampionshipGroupManager.find_applied_clubs(sid)
            ChampionshipGroupManager.assign_to_groups(sid, club_ids)
            logger.write("Server {0} Finish. Real Club Amount: {0}".format(len(club_ids)))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 23
0
def winning_reset(*args):
    logger = Logger("winning_reset")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            WinningArena.cronjob(sid)
            WinningPlunder.cronjob(sid)

            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 24
0
def champion_group_match(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.weekday() not in APPLY_WEEKDAY:
        return

    logger = Logger("champion_group_match")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            match_times = ChampionshipGroupManager.start_match(sid)
            logger.write("Server {0} Finish Match {1}".format(sid, match_times))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 25
0
def territory_auto_increase_product(*args):
    logger = Logger("territory_auto_increase_product")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Territory.auto_increase_product(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 26
0
def union_reset(*args):
    logger = Logger("union_reset")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MongoUnionMember.db(sid).update_many(
                {},
                {'$set': {
                    'today_contribution': 0,
                    'quit_flag': False,
                    'kick_flag': False,
                }}
            )

            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 27
0
def send_yueka_reward(*args):
    logger = Logger("send_yueka_reward")
    logger.write("Start")

    try:
        server_ids = Server.duty_server_ids()
        for s in server_ids:
            amount = Purchase.send_yueka_reward(s)
            logger.write("server {0} done. send amount {1}".format(s, amount))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 28
0
def generate_club_leaderboard(*args):
    logger = Logger('generate_club_leaderboard')
    logger.write('Start')

    try:
        for sid in Server.duty_server_ids():
            ClubLeaderBoard.generate(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 29
0
def plunder_auto_add_times(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.hour not in AUTO_CRON_HOUR:
        return

    logger = Logger("plunder_auto_add_times")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.auto_add_plunder_times(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 30
0
def union_auto_transfer(*args):
    logger = Logger("union_auto_transfer")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            result = UnionOwner.try_auto_transfer(sid)
            logger.write("Server {0} Finish".format(sid))
            logger.write(json.dumps(result))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 31
0
def plunder_auto_add_times(*args):
    now = arrow.utcnow().to(settings.TIME_ZONE)
    if now.hour not in AUTO_CRON_HOUR:
        return

    logger = Logger("plunder_auto_add_times")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            Plunder.auto_add_plunder_times(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 32
0
def send_yueka_reward(*args):
    logger = Logger("send_yueka_reward")
    logger.write("Start")

    try:
        server_ids = Server.duty_server_ids()
        for s in server_ids:
            amount = Purchase.send_yueka_reward(s)
            logger.write("server {0} done. send amount {1}".format(s, amount))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 33
0
def reset_online_time_activity(*args):
    logger = Logger("reset_online_time_activity")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MongoActivityOnlineTime.db(sid).drop()

            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 34
0
def send_rank_reward(*args):
    logger = Logger("arena_send_rank_reward")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MongoArena.db(sid).update_many(
                {},
                {'$set': {
                    'continue_win': 0
                }}
            )

            Arena.send_rank_reward(sid)
            logger.write("Server {0} Finish".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 35
0
def clean_match_record(*args):
    logger = Logger("clean_match_record")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            MatchRecord.clean(sid)
            logger.write("Server {0} Done.".format(sid))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()
Exemplo n.º 36
0
def union_auto_transfer(*args):
    logger = Logger("union_auto_transfer")
    logger.write("Start")

    try:
        for sid in Server.duty_server_ids():
            result = UnionOwner.try_auto_transfer(sid)
            logger.write("Server {0} Finish".format(sid))
            logger.write(json.dumps(result))
    except:
        logger.error(traceback.format_exc())
    else:
        logger.write("Done")
    finally:
        logger.close()