Selaa lähdekoodia

get product by id usecache

abiao 4 vuotta sitten
vanhempi
commit
bc0291dd90

+ 3 - 3
go/gopath/src/fohow.com/apps/controllers/order_controller/cart_controller.go

@@ -21,7 +21,7 @@ func (self *OrderController) CreateCart() {
 	if count <= 0 {
 		self.ReturnError(403, apps.ParamsError, "", nil)
 	}
-	product := product_model.GetProductById(pId, false)
+	product := product_model.GetProductById(pId, true)
 	if product == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
@@ -213,7 +213,7 @@ func (self *OrderController) ChangeAllState() {
 
 //获取会员购物车信息
 func (self *OrderController) GetCartList() {
-	cache, _ := self.GetBool("cache", false)
+	cache, _ := self.GetBool("cache", true)
 	wxUserId := self.GetCurrentWxUserId()
 	list := order_model.GetCartItemsByWxUserId(wxUserId)
 
@@ -283,7 +283,7 @@ func ClearProductCart(userId, productId int64) {
 
 //获取会员已选购购物车信息
 func (self *OrderController) GetCartBuyList() {
-	cache, _ := self.GetBool("cache", false)
+	cache, _ := self.GetBool("cache", true)
 	uId := self.GetCurrentUserId()
 	isBuy := true
 	list := order_model.GetCartItemsByUserIdAndBuy(uId, isBuy)

+ 4 - 4
go/gopath/src/fohow.com/apps/controllers/order_controller/order_controller.go

@@ -41,7 +41,7 @@ func (self *OrderController) Create() {
 	if count <= 0 {
 		self.ReturnError(403, apps.ParamsError, "", nil)
 	}
-	product := product_model.GetProductById(pId, false)
+	product := product_model.GetProductById(pId, true)
 	if product == nil {
 		self.ReturnError(403, apps.NoExist, "", nil)
 	}
@@ -185,7 +185,7 @@ func (self *OrderController) MultipleCreate() {
 		if cartItem.WxUserId != wxUId {
 			//self.ReturnError(403, apps.AccountError, "", nil)
 		}
-		product := product_model.GetProductById(cartItem.ProductId, false)
+		product := product_model.GetProductById(cartItem.ProductId, true)
 		if product == nil {
 			self.ReturnError(403, apps.NoExist, "", nil)
 		}
@@ -230,7 +230,7 @@ func (self *OrderController) MultipleCreate() {
 		if cartItem.WxUserId != wxUId {
 			//self.ReturnError(403, apps.AccountError, "", nil)
 		}
-		product := product_model.GetProductById(cartItem.ProductId, false)
+		product := product_model.GetProductById(cartItem.ProductId, true)
 		if product == nil {
 			self.ReturnError(403, apps.NoExist, "", nil)
 		}
@@ -285,7 +285,7 @@ func (self *OrderController) MultShopCreate() {
 		pId, _ := strconv.ParseInt(s_item, 10, 64)
 		cNums := int64(1)
 		cNums, _ = strconv.ParseInt(c_nums[key], 10, 64)
-		product := product_model.GetProductById(pId, false)
+		product := product_model.GetProductById(pId, true)
 		if product == nil {
 			self.ReturnError(403, apps.NoExist, "", nil)
 		}

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

@@ -81,7 +81,7 @@ func (self *ProductController) Latest() {
 //商品详情
 func (self *ProductController) Get() {
 	_id := self.Ctx.Input.Param(":id")
-	cache, _ := self.GetBool("cache", false)
+	cache, _ := self.GetBool("cache", true)
 
 	pId, _ := strconv.ParseInt(_id, 10, 64)
 	pd := product_model.GetProductById(pId, cache)
@@ -319,7 +319,7 @@ func (self *ProductController) GetProductSizesByPid() {
 		Size    *product_model.ProductAttrKey `json:"size_list"`
 		Color   *product_model.ProductAttrKey `json:"color_list"`
 	}
-	product := product_model.GetProductById(pId, false)
+	product := product_model.GetProductById(pId, true)
 
 	ret := &Ret{}
 	if product != nil {