Browse Source

get product commend list

abiao 4 years ago
parent
commit
04bcda972a

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

@@ -702,7 +702,7 @@ func (self *OrderController) OrderCommend() {
 		od.Commend = true
 		od.Save()
 		//创建商品评论
-		new(product_model.ProductCommend).Create(o.WxUserId, od.ProductId, score, detail)
+		new(product_model.ProductCommend).Create(o.WxUserId, od.ProductId, score, detail, o.OrderId)
 	} else {
 		self.ReturnError(403, apps.ParamsError, "", nil)
 	}

+ 3 - 1
go/gopath/src/fohow.com/apps/models/product_model/product_commend.go

@@ -20,6 +20,7 @@ type ProductCommend struct {
 	Head      string    `orm:"-"                      json:"head"`                           // varchar(20)
 	WxUserId  int64     `orm:"column(wx_user_id);null" json:"-"`                             // int(11)
 	ProductId int64     `orm:"column(product_id);null" json:"-"`                             // int(11)
+	OrderId   string    `orm:"column(order_id);"       json:"-"`                             // varchar(20)
 	Detail    string    `orm:"column(detail);"         json:"detail"`                        // varchar(20)
 	IsEnable  bool      `orm:"column(is_enable);null"  json:"-"`                             // tinyint(1)
 	IsTop     bool      `orm:"column(is_top);null"     json:"-"`                             // tinyint(1)
@@ -33,12 +34,13 @@ func (self *ProductCommend) TableName() string {
 	return product_commends_tablename
 }
 
-func (self *ProductCommend) Create(wxUId, pId, score int64, detail string) (item *ProductCommend) {
+func (self *ProductCommend) Create(wxUId, pId, score int64, detail, orderId string) (item *ProductCommend) {
 	item = &ProductCommend{
 		ProductId: pId,
 		WxUserId:  wxUId,
 		Detail:    detail,
 		Score:     score,
+		OrderId:   orderId,
 		IsEnable:  true,
 	}
 	id, err := orm.NewOrm().Insert(item)