Ejemplo n.º 1
0
def get_gold_config(**kwargs):
    gold_configs = GoldConfig.objects.all(**kwargs)
    keys = ["id", "ad_source", "ad_type", "gold_count"]
    result = []
    for gold_config in gold_configs:
        result.append(get_obj_dict(gold_config, keys))
    return result
Ejemplo n.º 2
0
def build_ad_policy(ad_policy):
    """
    :type ad_policy AdPolicy
    """
    keys = ["group_id", "ad_position", "edit_by", "has_gold", "last_modify"]
    ad_policy_dict = get_obj_dict(ad_policy, keys)
    return ad_policy_dict
Ejemplo n.º 3
0
def build_user_info(user):
    keys = [
        "username",
    ]
    user_info = get_obj_dict(user, keys)
    try:
        user_profile = user.userprofile
        if user_profile:
            user_profile = build_user_profile(user_profile)
            user_info.update(user_profile)
    except ObjectDoesNotExist:
        user_profile = UserProfile.objects.create(user=user)
        user_profile.save()
        user_info.update(build_user_profile(user_profile))
    return user_info
Ejemplo n.º 4
0
def build_user_profile(user_profile):
    keys = ["gold", "balance", "cashed_balance", "total_get"]
    return get_obj_dict(user_profile, keys)
Ejemplo n.º 5
0
def build_version_update(version, update_config):
    version_keys = ["version_num", "version_name"]
    update_config_keys = ["md5", "url", "release_note", "is_force", "apk_size"]
    result = get_obj_dict(version, version_keys)
    result.update(get_obj_dict(update_config, update_config_keys))
    return result
Ejemplo n.º 6
0
def build_cash_category(cash):
    keys = (
        "channel",
        "money_type_value",
    )
    return get_obj_dict(cash, keys)
Ejemplo n.º 7
0
def build_exchange_rate(exchange):
    keys = ["gold_count", "money", "first_created"]
    return get_obj_dict(exchange, keys)
Ejemplo n.º 8
0
def build_channel_shield_config(config):
    keys = ["channel", "start_time", "end_time"]
    return get_obj_dict(config, keys)
Ejemplo n.º 9
0
def build_global_shield_config(config):
    keys = ["shield_type", "shield_area"]
    result = get_obj_dict(config, keys)
    result["shield_area"] = json.loads(result["shield_area"])
    return result
Ejemplo n.º 10
0
def build_exchange(exchange):
    keys = ["id", "gold_count", "money", "first_created", "last_modify"]
    return get_obj_dict(exchange, keys)
Ejemplo n.º 11
0
def build_reward_condition(condition):
    keys = ["last", "first_created"]
    return get_obj_dict(condition, keys)
Ejemplo n.º 12
0
def build_reward_cycle_count(cycle_count):
    keys = ["id", "count", "first_created"]
    return get_obj_dict(cycle_count, keys)
Ejemplo n.º 13
0
def build_reward_cycle(reward_cycle):
    keys = ["id", "cycle", "first_created"]
    return get_obj_dict(reward_cycle, keys)