소스 검색

order details add depart

abiao 4 년 전
부모
커밋
d0bea9ffa0

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

@@ -122,7 +122,7 @@ func (self *OrderController) Create() {
 	order.Save()
 	//创建订单明细
 	go new(order_model.OrderDetail).Create(order.OrderId, order.Id, product.Id, product.Price, product.RoboBalancePrice, product.Name,
-		sizeName, colorName, count)
+		sizeName, colorName, count, wxUser.Depart)
 	//未支付订单加入取消队列
 	cancelKey := lib_redis.GetOrderCancelList()
 	lib_redis.ThrowInRedisList(cancelKey, order.OrderId)
@@ -235,7 +235,7 @@ func (self *OrderController) MultipleCreate() {
 		}
 		//创建订单明细
 		totalPrice += product.Price * cNums
-		CreateOrderDetails(product, order, cNums)
+		CreateOrderDetails(product, order, cNums, wxUser.Depart)
 	}
 	freight := base_config.GetFreight()
 	if totalPrice >= base_config.GetOrderLimit() {
@@ -315,7 +315,7 @@ func (self *OrderController) MultShopCreate() {
 		}
 		//创建订单明细
 		totalPrice += product.Price * cNums
-		CreateOrderDetails(product, order, cNums)
+		CreateOrderDetails(product, order, cNums, wxUser.Depart)
 	}
 	freight := base_config.GetFreight()
 	if totalPrice >= base_config.GetOrderLimit() {
@@ -419,7 +419,7 @@ func (self *OrderController) MultCentCreate() {
 		if product == nil {
 			self.ReturnError(403, apps.NoExist, "", nil)
 		}
-		CreateOrderDetails(product, order, cNums)
+		CreateOrderDetails(product, order, cNums, wxUser.Depart)
 	}
 	order.TotalPrice = totalPrice
 	order.Freight = freight
@@ -653,7 +653,7 @@ func (self *OrderController) MerchantListCount() {
 	self.ServeJSON()
 }
 
-func CreateOrderDetails(product *product_model.Product, order *order_model.Order, cNums int64) {
+func CreateOrderDetails(product *product_model.Product, order *order_model.Order, cNums, depart int64) {
 	//获取商品属性详情
 	sizeName := ""
 	colorName := ""
@@ -669,5 +669,5 @@ func CreateOrderDetails(product *product_model.Product, order *order_model.Order
 			colorName = productColor.Name
 		}
 	}
-	new(order_model.OrderDetail).Create(order.OrderId, order.Id, product.Id, product.Price, product.RoboBalancePrice, product.Name, sizeName, colorName, cNums)
+	new(order_model.OrderDetail).Create(order.OrderId, order.Id, product.Id, product.Price, product.RoboBalancePrice, product.Name, sizeName, colorName, cNums, depart)
 }

+ 3 - 3
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/live_award_controller.go

@@ -54,7 +54,7 @@ func (self *RailsadminController) LiveAward() {
 			product := product_model.GetProductById(LiveAward.Prod1, true)
 			if product != nil {
 				totalPrice += LiveAward.Nums1 * product.Price
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums1)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums1, order.Depart)
 			}
 
 		}
@@ -64,7 +64,7 @@ func (self *RailsadminController) LiveAward() {
 			product := product_model.GetProductById(LiveAward.Prod2, true)
 			if product != nil {
 				totalPrice += LiveAward.Nums2 * product.Price
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums2)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums2, order.Depart)
 			}
 		}
 
@@ -75,7 +75,7 @@ func (self *RailsadminController) LiveAward() {
 			//赠送赠品1
 			if product != nil {
 				totalPrice += LiveAward.Nums3 * product.Price
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3, order.Depart)
 			}
 		}
 		order.Address = LiveAward.Address

+ 5 - 5
go/gopath/src/fohow.com/apps/helpers/promotion_helper.go

@@ -123,34 +123,34 @@ func SetOrderPromotion(orderId string, wxUid int64) {
 				sendNums1 := nums * item.SendNums1
 				//赠送赠品1
 				product := product_model.GetProductById(item.SendProd1, true)
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums1)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums1, order.Depart)
 			}
 			if item.SendProd2 > 0 && item.SendNums2 > 0 {
 				sendNums2 := nums * item.SendNums2
 				//赠送赠品1
 				product := product_model.GetProductById(item.SendProd2, true)
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums2)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums2, order.Depart)
 			}
 
 			if item.SendProd3 > 0 && item.SendNums3 > 0 {
 				sendNums3 := nums * item.SendNums3
 				//赠送赠品1
 				product := product_model.GetProductById(item.SendProd3, true)
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums3, order.Depart)
 			}
 
 			if item.SendProd4 > 0 && item.SendNums4 > 0 {
 				sendNums4 := nums * item.SendNums4
 				//赠送赠品1
 				product := product_model.GetProductById(item.SendProd4, true)
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums4)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums4, order.Depart)
 			}
 
 			if item.SendProd5 > 0 && item.SendNums5 > 0 {
 				sendNums5 := nums * item.SendNums5
 				//赠送赠品1
 				product := product_model.GetProductById(item.SendProd5, true)
-				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums5)
+				go order_model.SendCreate(order.OrderId, order.Id, product.Id, product.Price, product.Price, product.Name, sendNums5, order.Depart)
 			}
 			//赠送积分 or 代办费
 			if item.Cash > 0 {

+ 6 - 3
go/gopath/src/fohow.com/apps/models/order_model/order_detail.go

@@ -36,7 +36,8 @@ type OrderDetail struct {
 	Cover                string    `orm:"-"     json:"cover"`                                                      // decimal(10,2)
 	OriginalPrice        float64   `orm:"-"     json:"original_price"`                                             // decimal(10,2)
 	UnitRoboBalancePrice int64     `orm:"column(unit_robo_balance_price)"                     json:"unit_robo_balance_price"`
-	Attrs                string    `orm:"-"     json:"attrs"` // decimal(10,2)
+	Attrs                string    `orm:"-"     json:"attrs"`      // decimal(10,2)
+	Depart               int64     `orm:"column(depart)" json:"-"` // datetime
 }
 
 func (self *OrderDetail) TableName() string {
@@ -45,7 +46,7 @@ func (self *OrderDetail) TableName() string {
 
 //创建订单项
 func (self *OrderDetail) Create(oId string, orderId, pId, pPrice, unitRoboBalancePrice int64, pName, sizeName, colorName string,
-	pCount int64) *OrderDetail {
+	pCount, depart int64) *OrderDetail {
 	item := &OrderDetail{
 		OrderNo:              oId,
 		OrderId:              orderId,
@@ -57,6 +58,7 @@ func (self *OrderDetail) Create(oId string, orderId, pId, pPrice, unitRoboBalanc
 		SizeName:             sizeName,
 		ColorName:            colorName,
 		Send:                 false,
+		Depart:               depart,
 	}
 	id, err := orm.NewOrm().Insert(item)
 	if err != nil {
@@ -69,7 +71,7 @@ func (self *OrderDetail) Create(oId string, orderId, pId, pPrice, unitRoboBalanc
 
 //创建订单项
 func SendCreate(oId string, orderId, pId, pPrice, unitRoboBalancePrice int64, pName string,
-	pCount int64) *OrderDetail {
+	pCount, depart int64) *OrderDetail {
 	item := &OrderDetail{
 		OrderNo:              oId,
 		OrderId:              orderId,
@@ -79,6 +81,7 @@ func SendCreate(oId string, orderId, pId, pPrice, unitRoboBalancePrice int64, pN
 		UnitRoboBalancePrice: unitRoboBalancePrice,
 		ProductName:          pName,
 		Send:                 true,
+		Depart:               depart,
 	}
 	id, err := orm.NewOrm().Insert(item)
 	if err != nil {