class ProductDetailHandler(BaseHandler):
async def get(self):
_id = self.get_argument('id')
product = await mgo.product.find_one({'_id': ObjectId(_id)})
sku = await mgo.sku.find({'pid': _id}).to_list(None)
seller = await mgo.user.find_one({'_id': product['seller_id']})
product['seller'] = seller['name']
product['sku'] = sku
self.write({'err_code': 0, 'data': product})
像网上找的这个例子, 有一点小疑问, 这里本身 get() 就是一个协程函数了吧? 里面再开三个的话, 它自身不就是等于没事做了吗? 这算不算一种资源浪费?