def detail_job(job_id): """""" job = api_job.get(job_id) return jsonres(rv=dict(id=job.id, title=job.title, readCount=job.read_count, status=job.status, content=job.content, userId=job.user_id, type=job.job_type, create_at=mkmillseconds(job.create_at)))
def _garage_json(garage): """把对象格式化一下。 """ return dict(id=garage.id, price=garage.price, position=garage.position, contact=garage.contact, phone=garage.phone, colse=garage.close, desc=garage.desc, publishTime=mkmillseconds(garage.create_at))
def list_dongtan(blogs_matrix=dict()): page = int(request.args.get('page', 1)); if page == None or page <= 0: page = 1 blogs = api_blog.get_latest_page_filterby(page=page, per_page=10, category_id=int(blogs_matrix.get('category', 0))) pageInfo = paginationInfo(blogs) #这个用在动弹里的 if blogs_matrix.get('showcontent'): blogdatas = [dict(id=blog.id, title=blog.title, content=blog.content, userid = blog.user_id, useravatar = blog.user.avatar or url_for('static', filename='/image/'), username = blog.user.validname(), create_at=mkmillseconds(blog.create_at)) for blog in blogs.items] else: blogdatas = [dict(id=blog.id, title=blog.title, create_at=mkmillseconds(blog.create_at)) for blog in blogs.items] return jsonres(rv=dict(pageInfo=pageInfo, datas=blogdatas))
def list_job(page=None): """""" page = int(request.args.get('page', 1)) if page == None or page <= 0: page = 1 jobs = api_job.get_lastest_page(page) pageInfo = paginationInfo(jobs) jobs = [dict(id=job.id, title=job.title, type=job.job_type, create_at=mkmillseconds(job.create_at)) for job in jobs.items] return jsonres(rv=dict(datas=jobs, pageInfo=pageInfo))
def detail_carpool(carpool_id): """""" carpool = api_carpool.get(carpool_id) return jsonres( rv=dict( id=carpool.id, price=carpool.price, start=carpool.start, target=carpool.target, route=carpool.route, start_time=mkmillseconds(carpool.start_time), publish_time=carpool.create_at, ) )
def list_carpool(page=None): """""" page = int(request.args.get("page", 1)) if page == None or page <= 0: page = 1 carpools = api_carpool.get_lastest_page(page) pageInfo = paginationInfo(carpools) carpools = [ dict( id=carpool.id, price=carpool.price, start=carpool.start, target=carpool.target, route=carpool.route, publish_time=mkmillseconds(carpool.create_at), ) for carpool in carpools.items ] return jsonres(rv=dict(datas=carpools, pageInfo=pageInfo))
def detail_blog(blog_id): blog = api_blog.get_or_404(blog_id) return jsonres(rv=dict(id=blog.id, title=blog.title, content=blog.content, create_at=mkmillseconds(blog.create_at)))