代码如下:
@cache.memoize(timeout=3600 * 12)
def _get_activites(activity_type, today):
query = Activity.query \
.join(ActivityType,
Activity.id == ActivityType.activity_id) \
.filter(ActivityType.show_type == activity_type,
Activity.is_publish == 1,
Activity.start <= today,
Activity.end > today) \
.order_by(Activity.publish_time)
return query.all()
网友评论