|
|
@@ -41,6 +41,8 @@ const (
|
|
|
DELIVER_STATE_2 = int64(2) //进行中
|
|
|
DELIVER_STATE_3 = int64(3) //已结束
|
|
|
|
|
|
+ //Employ Sort
|
|
|
+ ProdutEmploySort = 25
|
|
|
)
|
|
|
|
|
|
func (self *Product) TableName() string {
|
|
|
@@ -127,7 +129,7 @@ type Product struct {
|
|
|
CanBuy bool `orm:"-" json:"can_buy"` // bool
|
|
|
}
|
|
|
|
|
|
-//获取最新推荐商品
|
|
|
+// 获取最新推荐商品
|
|
|
func GetLatest(page, perPage, recommend, priceSort, saleSort, saleZone, depart int64, ptype string, useCache bool) (products []*Product) {
|
|
|
k := fmt.Sprintf("product_model.GetLatest.page(%d).perPage(%d).recommend(%d)", page, perPage, recommend)
|
|
|
if useCache {
|
|
|
@@ -238,7 +240,7 @@ func GetLatestCount(recommend, saleZone int64, ptype string, useCache bool) int6
|
|
|
return count
|
|
|
}
|
|
|
|
|
|
-//根据商品Id,获取商品信息
|
|
|
+// 根据商品Id,获取商品信息
|
|
|
func GetProductById(id int64, useCache bool) *Product {
|
|
|
//k := fmt.Sprintf("product_model.GetProductById[%d]", id)
|
|
|
k := cache.GetKey(cache.GetProductByPId, id)
|
|
|
@@ -257,7 +259,7 @@ func GetProductById(id int64, useCache bool) *Product {
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//判断商品是否在当前省可发货
|
|
|
+// 判断商品是否在当前省可发货
|
|
|
func GetProductByIdAndProvince(id int64, province string, useCache bool) *Product {
|
|
|
//k := fmt.Sprintf("product_model.GetProductById[%d]", id)
|
|
|
k := cache.GetKey(cache.GetProductByPIdAndProvince, id, province)
|
|
|
@@ -281,7 +283,7 @@ func GetProductByIdAndProvince(id int64, province string, useCache bool) *Produc
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//判断商品是否在当前省受限
|
|
|
+// 判断商品是否在当前省受限
|
|
|
func GetNoDeliveryPrd(id int64, province string, useCache bool) *Product {
|
|
|
//k := fmt.Sprintf("product_model.GetProductById[%d]", id)
|
|
|
k := cache.GetKey(cache.GetNoDeliveryPrd, id, province)
|
|
|
@@ -490,7 +492,7 @@ func (self *Product) Save() error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-//根据关联商品Id,sizeId,colorId,获取商品信息
|
|
|
+// 根据关联商品Id,sizeId,colorId,获取商品信息
|
|
|
func GetProductByIdAndSizeAndColor(id, sizeId, colorId int64, useCache bool) *Product {
|
|
|
k := fmt.Sprintf("product_model.GetProductByIdAndSizeAndColor[%d]", id)
|
|
|
if useCache {
|
|
|
@@ -508,7 +510,7 @@ func GetProductByIdAndSizeAndColor(id, sizeId, colorId int64, useCache bool) *Pr
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//根据商品 relate_Id 跟 sizeId,获取商品信息
|
|
|
+// 根据商品 relate_Id 跟 sizeId,获取商品信息
|
|
|
func GetProductByIdAndSizeId(relateId, sizeId int64, useCache bool) *Product {
|
|
|
k := fmt.Sprintf("product_model.GetProductByRelateId[%d]SizeId[%d]", relateId, sizeId)
|
|
|
if useCache {
|
|
|
@@ -527,7 +529,7 @@ func GetProductByIdAndSizeId(relateId, sizeId int64, useCache bool) *Product {
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//根据商品 relate_Id 跟 colorId,获取商品信息
|
|
|
+// 根据商品 relate_Id 跟 colorId,获取商品信息
|
|
|
func GetProductByIdAndColorId(relateId, colorId int64, useCache bool) *Product {
|
|
|
k := fmt.Sprintf("product_model.GetProductByRelateId[%d]ColorId[%d]", relateId, colorId)
|
|
|
if useCache {
|
|
|
@@ -545,7 +547,7 @@ func GetProductByIdAndColorId(relateId, colorId int64, useCache bool) *Product {
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//获取某主商品销售总量
|
|
|
+// 获取某主商品销售总量
|
|
|
func GetProductCountByRelateId(relateId int64, useCache bool) int64 {
|
|
|
type Ret struct {
|
|
|
Count int64
|