def get(self, *args, **kwargs): ret = {"status": False, "summary": "", "total": 0, "row": []} try: product_id = self.get_argument("product_id", None) if not product_id: raise Exception("商品id不能为空") merchant_id = 6 service = ProductService(ProductRepository()) total, result = service.get_price_by_product_id( merchant_id=merchant_id, product_id=product_id) ret["total"] = total ret['rows'] = result ret["status"] = True except Exception as e: ret["summary"] = str(e) self.write(json.dumps(ret, cls=JsonCustomEncoder))
def get(self, *args, **kwargs): ret = {'status': False, 'summary': '', 'total': 0, 'rows': []} try: product_id = self.get_argument('productid', None) if not product_id: raise Exception('商品ID不能为空') merchant_id = 14 service = ProductService(ProductRepository()) total, result = service.get_price_by_product_id( merchant_id=merchant_id, product_id=product_id) ret['total'] = total ret['rows'] = result ret['status'] = True except Exception as e: ret['summary'] = str(e) self.write(json.dumps(ret, cls=JsonCustomEncoder))