Pārlūkot izejas kodu

order list product change orderdt

abiao 4 gadi atpakaļ
vecāks
revīzija
f553c57bdc

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

@@ -458,37 +458,11 @@ func (self *OrderController) Detail() {
 	}
 	orderList := order_model.GetAllDetailsOrderId(o.OrderId, false)
 	for _, item := range orderList {
-		product := product_model.GetProductById(item.ProductId, cache)
-		if product == nil {
-			self.ReturnError(403, apps.ProductNotExist, "", nil)
-		}
-		//获取商品属性详情
-		product.Commend = true
-		product.SizeName = item.SizeName
-		product.ColorName = item.ColorName
-		product.OrderCount = item.Count
-		product.IsZeng = item.Send
+		item.Commend = true
 		if !item.Commend && o.Status == order_model.STATUS_COMPLETE {
-			product.Commend = item.Commend
+			item.Commend = item.Commend
 		}
-		o.Count += item.Count
-		if product.SeckilShowPrice > 0 {
-			now := time.Now()
-			product.SeckillStartAt = product.SeckillStart.Unix()
-			product.SeckillEndAt = product.SeckillEnd.Unix()
-			if product.SeckillStart.Unix() > now.Unix() {
-				product.SeckillState = product_model.SECKILL_PREPARING_STATE
-				product.SeckillStateCn = product_model.SECKILL_PREPARING_STATE_CN
-			} else if product.SeckillStart.Unix() <= now.Unix() && now.Unix() < product.SeckillEnd.Unix() {
-				product.IsUnderSeckill = true
-				product.SeckillState = product_model.SECKILL_UNDER_STATE
-				product.SeckillStateCn = product_model.SECKILL_UNDER_STATE_CN
-			} else {
-				product.SeckillState = product_model.SECKILL_END_STATE
-				product.SeckillStateCn = product_model.SECKILL_END_STATE_CN
-			}
-		}
-		o.ProductList = append(o.ProductList, product)
+		o.ProductList = append(o.ProductList, item)
 	}
 	wxUser := self.GetCurrentWxUser(cache)
 	if wxUser == nil {
@@ -537,34 +511,12 @@ func (self *OrderController) List() {
 			if product == nil {
 				continue
 			}
-			product.SizeName = orderItem.SizeName
-			product.ColorName = orderItem.ColorName
-			product.OrderCount = orderItem.Count
-			item.Count += orderItem.Count
-			product.OrderCount = orderItem.Count
-			product.IsZeng = orderItem.Send
-			product.Commend = true
+			orderItem.Commend = true
 			if !orderItem.Commend && item.Status == order_model.STATUS_COMPLETE {
-				product.Commend = orderItem.Commend
+				orderItem.Commend = orderItem.Commend
 			}
 
-			if product.SeckilShowPrice > 0 {
-				now := time.Now()
-				product.SeckillStartAt = product.SeckillStart.Unix()
-				product.SeckillEndAt = product.SeckillEnd.Unix()
-				if product.SeckillStart.Unix() > now.Unix() {
-					product.SeckillState = product_model.SECKILL_PREPARING_STATE
-					product.SeckillStateCn = product_model.SECKILL_PREPARING_STATE_CN
-				} else if product.SeckillStart.Unix() <= now.Unix() && now.Unix() < product.SeckillEnd.Unix() {
-					product.IsUnderSeckill = true
-					product.SeckillState = product_model.SECKILL_UNDER_STATE
-					product.SeckillStateCn = product_model.SECKILL_UNDER_STATE_CN
-				} else {
-					product.SeckillState = product_model.SECKILL_END_STATE
-					product.SeckillStateCn = product_model.SECKILL_END_STATE_CN
-				}
-			}
-			item.ProductList = append(item.ProductList, product)
+			item.ProductList = append(item.ProductList, orderItem)
 		}
 	}
 	type Ret struct {

+ 37 - 37
go/gopath/src/fohow.com/apps/models/order_model/order.go

@@ -75,43 +75,43 @@ var ORDER_TYPE_CN_TEXT = map[int64]string{
 }
 
 type Order struct {
-	Id             int64                    `orm:"column(id);pk"                                       json:"id"`       // int(11)
-	OrderId        string                   `orm:"column(order_id)"                                    json:"order_id"` // varchar(255)
-	OrderType      int64                    `orm:"column(order_type)"                                  json:"order_type"`
-	WxUserId       int64                    `orm:"column(wx_user_id)"                                  json:"wx_user_id"`
-	UserId         int64                    `orm:"column(user_id)"                                     json:"user_id"`          // int(11)
-	TotalPrice     int64                    `orm:"column(total_price)"                                 json:"total_price"`      // int(11)
-	PaiedPrice     int64                    `orm:"column(paied_price);null"                            json:"paied_price"`      // int(11)
-	CouponPrice    int64                    `orm:"column(coupon_price);null"                           json:"coupon_price"`     // int(11)
-	CentPrice      int64                    `orm:"column(cent_price);null"                             json:"cent_price"`       // int(11)
-	BuyPrice       int64                    `orm:"column(buy_price);null"                              json:"-"`                // int(11)
-	Count          int64                    `orm:"column(count);null"                                  json:"count"`            // int(11)
-	PaiedAt        int64                    `orm:"column(paied_at);null"                               json:"paied_at"`         // int(11)
-	TradeNo        string                   `orm:"column(trade_no);null"                               json:"trade_no"`         // varchar(255)
-	Status         string                   `orm:"column(status);null"                                 json:"status"`           // varchar(255)
-	StatusCn       string                   `orm:"-"                                                   json:"status_cn"`        // varchar(255)
-	PayWay         string                   `orm:"column(pay_way);null"                                json:"pay_way"`          // varchar(255)
-	Source         string                   `orm:"column(source);null"                                 json:"source"`           // varchar(255)
-	Tel            string                   `orm:"column(tel);null"                                    json:"tel"`              // varchar(255)
-	Address        string                   `orm:"column(address);null"                                json:"address"`          // varchar(255)
-	Contact        string                   `orm:"column(contact);null"                                json:"contact"`          // varchar(255)
-	ExpressCompany string                   `orm:"column(express_company);null"                        json:"express_company"`  // varchar(255)
-	ExpressOrderNo string                   `orm:"column(express_order_no);null"                       json:"express_order_no"` // varchar(255)
-	Remark         string                   `orm:"column(remark);null"                                 json:"remark"`           // varchar(255)
-	OrderRemark    string                   `orm:"column(order_remark);null"                           json:"-"`                // varchar(255)
-	ExpressCode    string                   `orm:"column(express_code);null"                           json:"express_code"`     // varchar(255)
-	Sign           string                   `orm:"-"                                                   json:"sign"`             // varchar(255)
-	CTime          int64                    `orm:"-"                                 json:"ctime"`                              // int(11)
-	DTime          int64                    `orm:"-"                                 json:"dtime"`                              // int(11)
-	Freight        int64                    `orm:"column(freight);null"                            json:"freight"`              // int(11)
-	Depart         int64                    `orm:"column(depart)" json:"-"`                                                     // datetime
-	DispatchTime   time.Time                `orm:"column(dispatch_time);null;type(datetime)"           json:"dispatch_time"`
-	ReceiveTime    time.Time                `orm:"column(receive_time);null;type(datetime)"            json:"receive_time"`
-	PaiedTime      time.Time                `orm:"column(paied_time);null;type(datetime)"              json:"paied_time"` // int(11)
-	CreatedAt      time.Time                `orm:"column(created_at);null;auto_now_add;type(datetime)" json:"-"`          // datetime
-	UpdatedAt      time.Time                `orm:"column(updated_at);null;auto_now;type(datetime)"     json:"-"`          // datetime
-	WxUser         *user_model.WxUser       `orm:"-"                                 json:"wx_user"`
-	ProductList    []*product_model.Product `orm:"-"                                 json:"product_list"` // varchar(255)
+	Id             int64              `orm:"column(id);pk"                                       json:"id"`       // int(11)
+	OrderId        string             `orm:"column(order_id)"                                    json:"order_id"` // varchar(255)
+	OrderType      int64              `orm:"column(order_type)"                                  json:"order_type"`
+	WxUserId       int64              `orm:"column(wx_user_id)"                                  json:"wx_user_id"`
+	UserId         int64              `orm:"column(user_id)"                                     json:"user_id"`          // int(11)
+	TotalPrice     int64              `orm:"column(total_price)"                                 json:"total_price"`      // int(11)
+	PaiedPrice     int64              `orm:"column(paied_price);null"                            json:"paied_price"`      // int(11)
+	CouponPrice    int64              `orm:"column(coupon_price);null"                           json:"coupon_price"`     // int(11)
+	CentPrice      int64              `orm:"column(cent_price);null"                             json:"cent_price"`       // int(11)
+	BuyPrice       int64              `orm:"column(buy_price);null"                              json:"-"`                // int(11)
+	Count          int64              `orm:"column(count);null"                                  json:"count"`            // int(11)
+	PaiedAt        int64              `orm:"column(paied_at);null"                               json:"paied_at"`         // int(11)
+	TradeNo        string             `orm:"column(trade_no);null"                               json:"trade_no"`         // varchar(255)
+	Status         string             `orm:"column(status);null"                                 json:"status"`           // varchar(255)
+	StatusCn       string             `orm:"-"                                                   json:"status_cn"`        // varchar(255)
+	PayWay         string             `orm:"column(pay_way);null"                                json:"pay_way"`          // varchar(255)
+	Source         string             `orm:"column(source);null"                                 json:"source"`           // varchar(255)
+	Tel            string             `orm:"column(tel);null"                                    json:"tel"`              // varchar(255)
+	Address        string             `orm:"column(address);null"                                json:"address"`          // varchar(255)
+	Contact        string             `orm:"column(contact);null"                                json:"contact"`          // varchar(255)
+	ExpressCompany string             `orm:"column(express_company);null"                        json:"express_company"`  // varchar(255)
+	ExpressOrderNo string             `orm:"column(express_order_no);null"                       json:"express_order_no"` // varchar(255)
+	Remark         string             `orm:"column(remark);null"                                 json:"remark"`           // varchar(255)
+	OrderRemark    string             `orm:"column(order_remark);null"                           json:"-"`                // varchar(255)
+	ExpressCode    string             `orm:"column(express_code);null"                           json:"express_code"`     // varchar(255)
+	Sign           string             `orm:"-"                                                   json:"sign"`             // varchar(255)
+	CTime          int64              `orm:"-"                                 json:"ctime"`                              // int(11)
+	DTime          int64              `orm:"-"                                 json:"dtime"`                              // int(11)
+	Freight        int64              `orm:"column(freight);null"                            json:"freight"`              // int(11)
+	Depart         int64              `orm:"column(depart)" json:"-"`                                                     // datetime
+	DispatchTime   time.Time          `orm:"column(dispatch_time);null;type(datetime)"           json:"dispatch_time"`
+	ReceiveTime    time.Time          `orm:"column(receive_time);null;type(datetime)"            json:"receive_time"`
+	PaiedTime      time.Time          `orm:"column(paied_time);null;type(datetime)"              json:"paied_time"` // int(11)
+	CreatedAt      time.Time          `orm:"column(created_at);null;auto_now_add;type(datetime)" json:"-"`          // datetime
+	UpdatedAt      time.Time          `orm:"column(updated_at);null;auto_now;type(datetime)"     json:"-"`          // datetime
+	WxUser         *user_model.WxUser `orm:"-"                                 json:"wx_user"`
+	ProductList    []*OrderDetail     `orm:"-"                                 json:"product_list"` // varchar(255)
 }
 
 func (self *Order) TableName() string {

+ 9 - 10
go/gopath/src/fohow.com/apps/models/product_model/product.go

@@ -95,16 +95,15 @@ type Product struct {
 	VideoUrl   string `orm:"column(video_url)"                       json:"video_url"` // varchar(255)
 	VideoImg   string `orm:"-"                       json:"video_img"`                 // varchar(255)
 	//规格相关
-	RelateProductId  int64  `orm:"column(relate_product_id)"                          json:"relate_product_id"` // varchar(255)
-	ShowFlag         bool   `orm:"column(show_flag)"                          json:"-"`                         // varchar(255)
-	SizeId           int64  `orm:"column(size_id)"                          json:"size_id"`                     // varchar(255)
-	ColorId          int64  `orm:"column(color_id)"                          json:"color_id"`                   // varchar(255)
-	HaveSize         bool   `orm:"-"                                     json:"have_size"`                      // bool
-	IsZeng           bool   `orm:"-"                                     json:"is_zeng"`                        // bool
-	SizeName         string `orm:"-"                                     json:"size_name"`                      // varchar(255)
-	ColorName        string `orm:"-"                                     json:"color_name"`                     // varchar(255)
-	SinglePurchLimit int64  `orm:"column(single_purch_limit)"            json:"-"`                              // varchar(255)
-	Commend          bool   `orm:"-"                                     json:"commend"`                        // bool
+	RelateProductId int64 `orm:"column(relate_product_id)"                          json:"relate_product_id"` // varchar(255)
+	ShowFlag        bool  `orm:"column(show_flag)"                          json:"-"`                         // varchar(255)
+	SizeId          int64 `orm:"column(size_id)"                       json:"size_id"`                        // varchar(255)
+	ColorId         int64 `orm:"column(color_id)"                      json:"color_id"`                       // varchar(255)
+
+	HaveSize         bool   `orm:"-"                                     json:"have_size"` // bool
+	SizeName         string `orm:"-"                                     json:"-"`         // varchar(255)
+	ColorName        string `orm:"-"                                     json:"-"`         // varchar(255)
+	SinglePurchLimit int64  `orm:"column(single_purch_limit)"            json:"-"`         // varchar(255)
 }
 
 //获取最新推荐商品