瀏覽代碼

prodct get off

abiao 2 年之前
父節點
當前提交
c5e5533aa9
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      go/gopath/src/fohow.com/apps/controllers/product_controller/product_controller.go

+ 10 - 0
go/gopath/src/fohow.com/apps/controllers/product_controller/product_controller.go

@@ -155,6 +155,10 @@ func (self *ProductController) Get() {
 	if pd == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
+	//商品下架
+	if pd.Status == product_model.PRODUCT_STATUS_DOWN {
+		self.ReturnError(403, []string{apps.ProductOffSale[0], fmt.Sprintf("%s产品已经下架", pd.Name)}, "", nil)
+	}
 
 	pd.SoldCount = pd.SaleNums
 	if pd.Count > pd.SoldCount {
@@ -238,6 +242,12 @@ func (self *ProductController) GetPdDetail() {
 	if beginPd == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
+
+	//商品下架
+	if beginPd.Status == product_model.PRODUCT_STATUS_DOWN {
+		self.ReturnError(403, []string{apps.ProductOffSale[0], fmt.Sprintf("%s产品已经下架", beginPd.Name)}, "", nil)
+	}
+
 	pd := product_model.GetProductByIdAndSizeAndColor(beginPd.RelateProductId, sizeId, colorId, cache)
 	type Ret struct {
 		Product *product_model.Product `json:"product"`