|
@@ -14,13 +14,14 @@ const (
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type OrderDtItem struct {
|
|
type OrderDtItem struct {
|
|
|
- Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
|
|
- OrderId int64 `orm:"column(order_id)" json:"order_id"` // int(11)
|
|
|
|
|
- OrderNo string `orm:"column(order_no);null" json:"order_no"` // varchar(64)
|
|
|
|
|
- OrderDtId int64 `orm:"column(dt_id)" json:"order_dt_id"` // int(11)
|
|
|
|
|
- ProductId int64 `orm:"column(product_id)" json:"product_id"` // int(11)
|
|
|
|
|
- Title string `orm:"column(product_name);null" json:"title"` // varchar(64)
|
|
|
|
|
- Nums int64 `orm:"column(nums);null" json:"nums"` // tinyint(1)
|
|
|
|
|
|
|
+ Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
|
|
+ OrderId int64 `orm:"column(order_id)" json:"order_id"` // int(11)
|
|
|
|
|
+ OrderNo string `orm:"column(order_no);null" json:"order_no"` // varchar(64)
|
|
|
|
|
+ OrderDtId int64 `orm:"column(dt_id)" json:"order_dt_id"` // int(11)
|
|
|
|
|
+ ProductId int64 `orm:"column(product_id)" json:"product_id"` // int(11)
|
|
|
|
|
+ Price int64 `orm:"column(price)" json:"price"` // int(11)
|
|
|
|
|
+ Title string `orm:"column(product_name);null" json:"title"` // varchar(64)
|
|
|
|
|
+ Nums int64 `orm:"column(nums);null" json:"nums"` // tinyint(1)
|
|
|
Send bool `orm:"column(is_zeng)" json:"send"`
|
|
Send bool `orm:"column(is_zeng)" json:"send"`
|
|
|
CreatedAt time.Time `orm:"column(created_at);auto_now_add;type(datetime)" json:"-"` // datetime
|
|
CreatedAt time.Time `orm:"column(created_at);auto_now_add;type(datetime)" json:"-"` // datetime
|
|
|
UpdatedAt time.Time `orm:"column(updated_at);auto_now;type(datetime)" json:"-"` // datetime
|
|
UpdatedAt time.Time `orm:"column(updated_at);auto_now;type(datetime)" json:"-"` // datetime
|
|
@@ -39,12 +40,13 @@ type ProductItem struct {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//创建订单明细项
|
|
//创建订单明细项
|
|
|
-func (self *OrderDtItem) Create(orderNo, title string, pId, pCount, orderId, orderDtId int64, send bool) *OrderDtItem {
|
|
|
|
|
|
|
+func (self *OrderDtItem) Create(orderNo, title string, pId, price, pCount, orderId, orderDtId int64, send bool) *OrderDtItem {
|
|
|
item := &OrderDtItem{
|
|
item := &OrderDtItem{
|
|
|
OrderNo: orderNo,
|
|
OrderNo: orderNo,
|
|
|
OrderId: orderId,
|
|
OrderId: orderId,
|
|
|
OrderDtId: orderDtId,
|
|
OrderDtId: orderDtId,
|
|
|
ProductId: pId,
|
|
ProductId: pId,
|
|
|
|
|
+ Price: price,
|
|
|
Title: title,
|
|
Title: title,
|
|
|
Nums: pCount,
|
|
Nums: pCount,
|
|
|
Send: send,
|
|
Send: send,
|
|
@@ -65,10 +67,10 @@ func GenerateOrderDtItem(detail_item *OrderDetail) error {
|
|
|
product_list := product_model.GetPackageList(product.Id, false)
|
|
product_list := product_model.GetPackageList(product.Id, false)
|
|
|
for _, pd := range product_list {
|
|
for _, pd := range product_list {
|
|
|
count := detail_item.Count * pd.Nums
|
|
count := detail_item.Count * pd.Nums
|
|
|
- new(OrderDtItem).Create(detail_item.OrderNo, pd.ItemTitle, pd.ItemId, count, detail_item.OrderId, detail_item.Id, detail_item.Send)
|
|
|
|
|
|
|
+ new(OrderDtItem).Create(detail_item.OrderNo, pd.ItemTitle, detail_item.Price, pd.ItemId, count, detail_item.OrderId, detail_item.Id, detail_item.Send)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- new(OrderDtItem).Create(detail_item.OrderNo, product.Name, product.Id, detail_item.Count, detail_item.OrderId, detail_item.Id, detail_item.Send)
|
|
|
|
|
|
|
+ new(OrderDtItem).Create(detail_item.OrderNo, product.Name, product.Id, detail_item.Price, detail_item.Count, detail_item.OrderId, detail_item.Id, detail_item.Send)
|
|
|
}
|
|
}
|
|
|
beego.BeeLogger.Warn("orderdtbase GenerateOrderDtItem ")
|
|
beego.BeeLogger.Warn("orderdtbase GenerateOrderDtItem ")
|
|
|
return nil
|
|
return nil
|