示例#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
def appliable_restaurant_activity(restaurant_id):
    """
    可申请参加的餐厅活动,即可以申请一份活动对应的合同去签署.注意不等同于可参加的餐厅活动
    """
    restaurant_id = int(restaurant_id)
    _result = {}
    with thrift_client('ers') as ers:
        for type_name,type_value in RestaurantActivityConstType._n2v.iteritems():
            zeus_result = ers.get_restaurant_appliable_activity_ids(restaurant_id,SubsidyConst.CATEGORY_RESTAURANT_ACTIVITY,type_value)
            zeus_result = [rst_act_base.get(_id) for _id in zeus_result]
            _result[type_value] = zeus_result
    result = []
    for _type,_activity_list in _result.iteritems():
        result.extend(_activity_list)
    return result
示例#3
0
def participatable_restaurant_activity(restaurant_id):
    """
    获取可参加的餐厅活动
    返回值为活动+补贴的组合-.-
    """
    restaurant_id = int(restaurant_id)
    result = {}
    with thrift_client('ers') as ers:
        for type_name,type_value in RestaurantActivityConstType._n2v.iteritems():
            zeus_result = ers.get_participatable_restaurant_activity_ids(restaurant_id,type_value)
            zeus_result = [rst_act_base.get(_id) for _id in zeus_result]
            result[type_value] = zeus_result
        for type_name,type_value in RestaurantActivityConstType._n2v.iteritems():
            for activity in result[type_value]:
                activity_id = activity.id
                amount = rst_act_base.get_amount(restaurant_id,activity_id)
                setattr(activity,'_amount',amount)
    return result
示例#4
0
def appliable_restaurant_activity(restaurant_id):
    """
    可申请参加的餐厅活动,即可以申请一份活动对应的合同去签署.注意不等同于可参加的餐厅活动
    """
    restaurant_id = int(restaurant_id)
    _result = {}
    with thrift_client('ers') as ers:
        for type_name, type_value in RestaurantActivityConstType._n2v.iteritems(
        ):
            zeus_result = ers.get_restaurant_appliable_activity_ids(
                restaurant_id, SubsidyConst.CATEGORY_RESTAURANT_ACTIVITY,
                type_value)
            zeus_result = [rst_act_base.get(_id) for _id in zeus_result]
            _result[type_value] = zeus_result
    result = []
    for _type, _activity_list in _result.iteritems():
        result.extend(_activity_list)
    return result
示例#5
0
def participatable_restaurant_activity(restaurant_id):
    """
    获取可参加的餐厅活动
    返回值为活动+补贴的组合-.-
    """
    restaurant_id = int(restaurant_id)
    result = {}
    with thrift_client('ers') as ers:
        for type_name, type_value in RestaurantActivityConstType._n2v.iteritems(
        ):
            zeus_result = ers.get_participatable_restaurant_activity_ids(
                restaurant_id, type_value)
            zeus_result = [rst_act_base.get(_id) for _id in zeus_result]
            result[type_value] = zeus_result
        for type_name, type_value in RestaurantActivityConstType._n2v.iteritems(
        ):
            for activity in result[type_value]:
                activity_id = activity.id
                amount = rst_act_base.get_amount(restaurant_id, activity_id)
                setattr(activity, '_amount', amount)
    return result
示例#6
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)