Exemplo n.º 1
0
 def get(self, *args, **kwargs):
     ret = {"status": False, "summary": "", "data": {}}
     try:
         product_id = self.get_argument('product_id', None)
         if not product_id:
             raise Exception("请输入产品Id")
         else:
             merchant_id = 6
             service = ProductService(ProductRepository())
             data = service.get_product_by_id(merchant_id=merchant_id,
                                              product_id=product_id)
             if not data:
                 raise Exception("未获取到商品信息")
             ret["status"] = True
             ret["data"] = data
     except Exception as e:
         ret["summary"] = str(e)
     self.render("Product/JdProductPriceManager.html", **ret)
Exemplo n.º 2
0
    def get(self, *args, **kwargs):
        ret = {'status': False, 'summary': '', 'data': {}}
        try:
            product_id = self.get_argument('productid', None)
            if not product_id:
                raise Exception('请输入商品ID')
            merchant_id = 14
            service = ProductService(ProductRepository())
            result = service.get_product_by_id(merchant_id=merchant_id,
                                               product_id=product_id)
            if not result:
                raise Exception('未获取商品信息')
            ret['status'] = True
            ret['data'] = result
        except Exception as e:
            ret['summary'] = str(e)

        self.render('Product/JdProductPriceManager.html', **ret)
Exemplo n.º 3
0
    def get(self, *args, **kwargs):
        error_summary = ""
        product_id = self.get_argument("product_id", None)
        if not product_id:
            crumbs = "添加产品"
            method = "post"
        else:
            crumbs = "编辑产品"
            method = "put"
            #根据产品id获取产品信息
            merchant_id = 6
            service = ProductService(ProductRepository())
            data = service.get_product_by_id(merchant_id, product_id)
            print(data)

        self.render("Product/JdProductEdit.html",
                    crumbs=crumbs,
                    method=method,
                    data=data)