|
|
@@ -17,7 +17,7 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
-//精选推介-首页
|
|
|
+// 精选推介-首页
|
|
|
func (self *ProductController) Latest() {
|
|
|
recommend, _ := self.GetInt64("rd", 0)
|
|
|
page, _ := self.GetInt64("page")
|
|
|
@@ -44,15 +44,15 @@ func (self *ProductController) Latest() {
|
|
|
List []*product_model.Product `json:"list"`
|
|
|
ListCount int64 `json:"list_count"`
|
|
|
}
|
|
|
-
|
|
|
+ depart := int64(0)
|
|
|
wxUId := self.GetCurrentWxUserIdByToken()
|
|
|
- wxUser := user_model.GetWxUserById(wxUId, true)
|
|
|
+ wxUser := user_model.GetWxUserById(wxUId, false)
|
|
|
if wxUser == nil {
|
|
|
- self.ReturnError(403, apps.NoExist, "", nil)
|
|
|
+ depart = wxUser.Depart
|
|
|
}
|
|
|
|
|
|
- pds := product_model.GetLatest(page, perPage, recommend, price_sort, sale_sort, sale_zone, wxUser.Depart, ptype, cache)
|
|
|
- count := product_model.GetNewLatestCount(recommend, sale_zone, wxUser.Depart, ptype, cache)
|
|
|
+ pds := product_model.GetLatest(page, perPage, recommend, price_sort, sale_sort, sale_zone, depart, ptype, cache)
|
|
|
+ count := product_model.GetNewLatestCount(recommend, sale_zone, depart, ptype, cache)
|
|
|
for _, pd := range pds {
|
|
|
pd.SoldCount = pd.SaleNums
|
|
|
if pd.Count > pd.SoldCount {
|
|
|
@@ -145,7 +145,7 @@ func (self *ProductController) Latest() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//商品详情
|
|
|
+// 商品详情
|
|
|
func (self *ProductController) Get() {
|
|
|
_id := self.Ctx.Input.Param(":id")
|
|
|
cache, _ := self.GetBool("cache", true)
|
|
|
@@ -229,7 +229,7 @@ func (self *ProductController) Get() {
|
|
|
//self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//商品详情
|
|
|
+// 商品详情
|
|
|
func (self *ProductController) GetPdDetail() {
|
|
|
_id := self.Ctx.Input.Param(":id")
|
|
|
pId, _ := strconv.ParseInt(_id, 10, 64)
|
|
|
@@ -326,7 +326,7 @@ func (self *ProductController) GetPdDetail() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//商品分类
|
|
|
+// 商品分类
|
|
|
func (self *ProductController) Categories() {
|
|
|
ancestry := self.GetString("ancestry")
|
|
|
var catRet []*product_model.ProductCat
|
|
|
@@ -342,7 +342,7 @@ func (self *ProductController) Categories() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//某个类别下的商品列表
|
|
|
+// 某个类别下的商品列表
|
|
|
func (self *ProductController) GetProductsByCat() {
|
|
|
_id := self.Ctx.Input.Param(":cat_id")
|
|
|
catId, _ := strconv.ParseInt(_id, 10, 64)
|
|
|
@@ -424,7 +424,7 @@ func (self *ProductController) GetProductsByCat() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//商品是否需要转发
|
|
|
+// 商品是否需要转发
|
|
|
func (self *ProductController) GetNeedShare() {
|
|
|
_id := self.Ctx.Input.Param(":id")
|
|
|
cache, _ := self.GetBool("cache", false)
|
|
|
@@ -476,7 +476,7 @@ func (self *ProductController) GetNeedShare() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//获取某个商品关联规格列表
|
|
|
+// 获取某个商品关联规格列表
|
|
|
func (self *ProductController) GetProductSizesByPid() {
|
|
|
_id := self.Ctx.Input.Param(":id")
|
|
|
pId, _ := strconv.ParseInt(_id, 10, 64)
|
|
|
@@ -538,7 +538,7 @@ func (self *ProductController) GetProductSizesByPid() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//获取某商品评论列表
|
|
|
+// 获取某商品评论列表
|
|
|
func (self *ProductController) GetProductsCommends() {
|
|
|
_id := self.Ctx.Input.Param(":product_id")
|
|
|
prdId, _ := strconv.ParseInt(_id, 10, 64)
|
|
|
@@ -587,7 +587,7 @@ func (self *ProductController) GetCommendWords() {
|
|
|
self.ServeJSON()
|
|
|
}
|
|
|
|
|
|
-//专区商品
|
|
|
+// 专区商品
|
|
|
func (self *ProductController) SaleTypes() {
|
|
|
saleTypes := product_model.GetProductSaleZones()
|
|
|
self.Data["json"] = saleTypes
|