- save order_sku.sku_type and promotion_type
This commit is contained in:
@@ -80,11 +80,13 @@ func (c *OrderController) saveOrder(order *model.GoodsOrder, isAdjust bool, db o
|
||||
created, _, err2 := db.ReadOrCreate(order, "VendorOrderID", "VendorID")
|
||||
if err = err2; err == nil {
|
||||
if created {
|
||||
sql := "INSERT INTO order_sku(vendor_order_id, vendor_id, count, vendor_sku_id, sku_id, jx_sku_id, sku_name, shop_price, sale_price, weight, order_created_at) VALUES"
|
||||
sql := `INSERT INTO order_sku(vendor_order_id, vendor_id, count, vendor_sku_id, sku_id, jx_sku_id, sku_name,
|
||||
shop_price, sale_price, weight, sku_type, promotion_type, order_created_at) VALUES`
|
||||
params := []interface{}{}
|
||||
for _, sku := range order.Skus {
|
||||
sql += "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?),"
|
||||
params = append(params, sku.VendorOrderID, sku.VendorID, sku.Count, sku.VendorSkuID, sku.SkuID, sku.JxSkuID, sku.SkuName, sku.ShopPrice, sku.SalePrice, sku.Weight, order.OrderCreatedAt)
|
||||
sql += "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?),"
|
||||
params = append(params, sku.VendorOrderID, sku.VendorID, sku.Count, sku.VendorSkuID, sku.SkuID, sku.JxSkuID, sku.SkuName,
|
||||
sku.ShopPrice, sku.SalePrice, sku.Weight, sku.SkuType, sku.PromotionType, order.OrderCreatedAt)
|
||||
}
|
||||
sql = sql[:len(sql)-1] + ";"
|
||||
if _, err = db.Raw(sql, params...).Exec(); err != nil {
|
||||
|
||||
@@ -61,8 +61,8 @@ type OrderSku struct {
|
||||
SkuName string `orm:"size(255)"`
|
||||
ShopPrice int64
|
||||
SalePrice int64
|
||||
Weight int // 单位为克
|
||||
SkuType int
|
||||
Weight int // 单位为克
|
||||
SkuType int // 当前如果为gift就为1,否则缺省为0
|
||||
PromotionType int // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换
|
||||
OrderCreatedAt time.Time `orm:"type(datetime);index"` // 分区考虑
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user