Пример #1
0
 def get(self, *args, **kwargs):
     # 根据参数,获取产品信息(type:自营(商户ID),type:所有商品)
     # 后台管理用户登陆成功后,Session中保存自营ID
     # 自营ID=1
     ret = {"status": False, "message": "", "total": 0, "rows": []}
     try:
         merchant_id = 6
         page = int(self.get_argument("page", 1))
         rows = int(self.get_argument("rows", 10))
         start = (page - 1) * 10
         service = ProductService(ProductRepository())
         total, data = service.get_page_by_merchant_id(
             merchant_id, start, rows)
         ret["status"] = True
         ret["total"] = total
         ret["rows"] = data
     except Exception as e:
         ret["message"] = str(e)
     self.write(json.dumps(ret))
Пример #2
0
    def get(self, *args, **kwargs):

        # 根据参数,获取产品信息(type:自营(商户ID),type:所有商品)
        # 后台管理用户登陆成功后,Session中保存自营ID
        # 自营ID=1
        ret = {'status': False, 'message': '', 'total': 0, 'rows': []}
        try:
            # 手动获取京东自营ID为14
            merchant_id = 14
            page = int(self.get_argument('page', 1))
            rows = int(self.get_argument('rows', 10))
            start = (page - 1) * rows
            service = ProductService(ProductRepository())
            total, result = service.get_page_by_merchant_id(
                merchant_id, start, rows)
            ret['status'] = True
            ret['total'] = total
            ret['rows'] = result
        except Exception as e:
            ret['message'] = str(e)
        self.write(json.dumps(ret))