コード例 #1
0
def get_name(activity_id, category_id):
    ACTIVITY_CATEGORY = thirdparty_svc.ers.SubsidyConst()
    if category_id == ACTIVITY_CATEGORY.CATEGORY_RESTAURANT_ACTIVITY:
        restaurant_activity = rst_activity.get(activity_id)
        return get_restaurant_activity_name(restaurant_activity)
    elif category_id == ACTIVITY_CATEGORY.CATEGORY_FOOD_ACTIVITY:
        return food_activity.get(activity_id).name
コード例 #2
0
ファイル: restaurant.py プロジェクト: liuzelei/walis
def appliable_food_activity(restaurant_id):
    """
    可申请参加的食物活动,即可以申请一份活动对应的合同去签署.注意不等同于可参加的食物活动
    """
    restaurant_id = int(restaurant_id)
    with thrift_client('ers') as ers:
        activities = ers.get_restaurant_appliable_activity_ids(restaurant_id, SubsidyConst.CATEGORY_FOOD_ACTIVITY, None)
        activities = [food_act_base.get(_id) for _id in activities]
    return activities
コード例 #3
0
def appliable_food_activity(restaurant_id):
    """
    可申请参加的食物活动,即可以申请一份活动对应的合同去签署.注意不等同于可参加的食物活动
    """
    restaurant_id = int(restaurant_id)
    with thrift_client('ers') as ers:
        activities = ers.get_restaurant_appliable_activity_ids(
            restaurant_id, SubsidyConst.CATEGORY_FOOD_ACTIVITY, None)
        activities = [food_act_base.get(_id) for _id in activities]
    return activities
コード例 #4
0
ファイル: restaurant.py プロジェクト: liuzelei/walis
def menu(restaurant_id):
    """
    获取餐厅菜单
    """
    with thrift_client('ers') as ers:
        categories = ers.query_food_category_with_foods(restaurant_id)
        for category in categories:
            _activity_ids = get_activity_ids(category.foods)
            # _activities = _week_activity_ids_to_full(_activity_ids)
            category.food_category._activity = _activity_ids
            category.food_category._activity_objs = [food_act_base.get(_id) if _id else None for _id in _activity_ids]
            for food in category.foods:
                fix_food_b2f(food)
        categories = [category for category in categories
                      if category.food_category.id != GARNISH_CATEGORY_ID]
        return categories
コード例 #5
0
ファイル: restaurant.py プロジェクト: liuzelei/walis
def food_activity(restaurant_id):
    """
    获取食物活动
    包括食物活动状态是已参加,查询对应合同获取补贴金额,否则补贴金额为None
    """
    restaurant_id = int(restaurant_id)
    result = []
    with thrift_client('ers') as ers:
        zeus_result = ers.get_food_activity_status(restaurant_id)
        for activity_id,status in zeus_result.iteritems():
            activity_id = int(activity_id)
            activity = food_act_base.get(activity_id)
            amount = food_act_base.get_amount(restaurant_id,activity_id)
            setattr(activity,'_amount',amount)
            setattr(activity,'_status',status)
            result.append(activity)
    return result
コード例 #6
0
def food_activity(restaurant_id):
    """
    获取食物活动
    包括食物活动状态是已参加,查询对应合同获取补贴金额,否则补贴金额为None
    """
    restaurant_id = int(restaurant_id)
    result = []
    with thrift_client('ers') as ers:
        zeus_result = ers.get_food_activity_status(restaurant_id)
        for activity_id, status in zeus_result.iteritems():
            activity_id = int(activity_id)
            activity = food_act_base.get(activity_id)
            amount = food_act_base.get_amount(restaurant_id, activity_id)
            setattr(activity, '_amount', amount)
            setattr(activity, '_status', status)
            result.append(activity)
    return result
コード例 #7
0
def menu(restaurant_id):
    """
    获取餐厅菜单
    """
    with thrift_client('ers') as ers:
        categories = ers.query_food_category_with_foods(restaurant_id)
        for category in categories:
            _activity_ids = get_activity_ids(category.foods)
            # _activities = _week_activity_ids_to_full(_activity_ids)
            category.food_category._activity = _activity_ids
            category.food_category._activity_objs = [
                food_act_base.get(_id) if _id else None
                for _id in _activity_ids
            ]
            for food in category.foods:
                fix_food_b2f(food)
        categories = [
            category for category in categories
            if category.food_category.id != GARNISH_CATEGORY_ID
        ]
        return categories
コード例 #8
0
def week_activity_ids_to_full(activity_ids):
    activities = []
    for _id in activity_ids:
        activity = food_act_base.get(_id)
        activities.append(activity)
    return activities
コード例 #9
0
def get(act_id):
    return food_activity.get(int(act_id))
コード例 #10
0
def get(activity_id, category_id):
    ACTIVITY_CATEGORY = thirdparty_svc.ers.SubsidyConst()
    if category_id == ACTIVITY_CATEGORY.CATEGORY_RESTAURANT_ACTIVITY:
        return rst_activity.get(activity_id)
    elif category_id == ACTIVITY_CATEGORY.CATEGORY_FOOD_ACTIVITY:
        return food_activity.get(activity_id)