Ejemplo n.º 1
0
 def get_create_activity_list(self, info):
     '''
     我创建的活动列表
     第一步: 验证用户身份
     第二步: 判断活动是否存在,是否已经加入,是否已经满员
     第三步: 自动分配活动位置, 创建参加记录
     :param info: {'token_id': '', 'user_id': '', 'activity_id': ''}
     :return: {'data': '', 'status': 'SUCCESS'}
     '''
     start_index = info['start_index']
     page_count = info['page_count']
     user_id = info['user_id']
     query = db.session.query(Activity).filter(Activity.user_id == user_id)
     all_result = query.order_by(desc(
         Activity.createtime)).offset(start_index).limit(page_count).all()
     callback_data = []
     img_request = {}
     img_request['directory'] = 'activity'
     imagemanager = ImageManager()
     for result in all_result:
         (status, activity_info) = Activity.generate(result=result)
         img_request['foreign_id'] = result.activity_id
         (status, image_info) = imagemanager.get_image(info=img_request)
         activity_info.update(image_info)
         callback_data.append(activity_info)
     return (True, callback_data)
Ejemplo n.º 2
0
 def get_create_activity_list(self, info):
     '''
     我创建的活动列表
     第一步: 验证用户身份
     第二步: 判断活动是否存在,是否已经加入,是否已经满员
     第三步: 自动分配活动位置, 创建参加记录
     :param info: {'token_id': '', 'user_id': '', 'activity_id': ''}
     :return: {'data': '', 'status': 'SUCCESS'}
     '''
     start_index = info['start_index']
     page_count = info['page_count']
     user_id = info['user_id']
     query = db.session.query(Activity).filter(Activity.user_id == user_id)
     all_result = query.order_by(desc(Activity.createtime)).offset(start_index).limit(page_count).all()
     callback_data = []
     img_request = {}
     img_request['directory'] = 'activity'
     imagemanager = ImageManager()
     for result in all_result:
         (status, activity_info) = Activity.generate(result=result)
         img_request['foreign_id'] = result.activity_id
         (status, image_info) = imagemanager.get_image(info=img_request)
         activity_info.update(image_info)
         callback_data.append(activity_info)
     return (True, callback_data)
Ejemplo n.º 3
0
 def _get_activity_detail(self, info):
     activity_id = info['activity_id']
     query = db.session.query(Activity).filter(Activity.activity_id == activity_id)
     result = query.first()
     img_request = {}
     img_request['directory'] = 'activity'
     img_request['foreign_id'] = activity_id
     imagemanager = ImageManager()
     (status, activity_info) = Activity.generate(result=result)
     (status, image_info) = imagemanager.get_image(info=img_request)
     activity_info.update(image_info)
     return (True, activity_info)
Ejemplo n.º 4
0
 def _get_activity_detail(self, info):
     activity_id = info['activity_id']
     query = db.session.query(Activity).filter(
         Activity.activity_id == activity_id)
     result = query.first()
     img_request = {}
     img_request['directory'] = 'activity'
     img_request['foreign_id'] = activity_id
     imagemanager = ImageManager()
     (status, activity_info) = Activity.generate(result=result)
     (status, image_info) = imagemanager.get_image(info=img_request)
     activity_info.update(image_info)
     return (True, activity_info)