瀏覽代碼

更新

guide_order
huangjiajun 3 月之前
父節點
當前提交
bcddaa3fc8
共有 8 個文件被更改,包括 44 次插入29 次删除
  1. +12
    -6
      app/db/db_newcomers_free_product.go
  2. +6
    -3
      app/db/db_second_newcomers_free.go
  3. +1
    -0
      app/db/model/ord_item_info.go
  4. +1
    -0
      app/db/model/ord_list.go
  5. +1
    -0
      app/md/order.go
  6. +8
    -7
      app/svc/svc_order_track_save_create.go
  7. +11
    -9
      app/svc/svc_order_track_save_create_update.go
  8. +4
    -4
      app/svc/svc_order_track_save_update.go

+ 12
- 6
app/db/db_newcomers_free_product.go 查看文件

@@ -12,7 +12,7 @@ import (
)

// FreeProductByID is 获取新人免单对应的商品id
func FreeProductByID(Db *xorm.Engine, gid, provider string) (*model.NewcomersFreeProduct, error) {
func FreeProductByID(Db *xorm.Engine, gid, skuId, provider string) (*model.NewcomersFreeProduct, error) {
m := new(model.NewcomersFreeProduct)
var has bool
var err error
@@ -23,8 +23,11 @@ func FreeProductByID(Db *xorm.Engine, gid, provider string) (*model.NewcomersFre
}
has, err = Db.Where("good_id LIKE ?", "%-"+gid).Get(m)
} else {
m.GoodId = gid
has, err = Db.Get(m)
sess := Db.Where("good_id=?", gid)
if skuId != "" {
sess.Or("good_id=?", skuId)
}
has, err = sess.Get(m)
}

if err != nil {
@@ -36,7 +39,7 @@ func FreeProductByID(Db *xorm.Engine, gid, provider string) (*model.NewcomersFre

return m, nil
}
func MoreFreeProductByID(Db *xorm.Engine, gid, provider string) (*model.MoreNewcomersFreeProduct, error) {
func MoreFreeProductByID(Db *xorm.Engine, gid, skuId, provider string) (*model.MoreNewcomersFreeProduct, error) {
m := new(model.MoreNewcomersFreeProduct)
var has bool
var err error
@@ -47,8 +50,11 @@ func MoreFreeProductByID(Db *xorm.Engine, gid, provider string) (*model.MoreNewc
}
has, err = Db.Where("good_id LIKE ?", "%-"+gid).Get(m)
} else {
m.GoodId = gid
has, err = Db.Get(m)
sess := Db.Where("good_id=?", gid)
if skuId != "" {
sess.Or("good_id=?", skuId)
}
has, err = sess.Get(m)
}

if err != nil {


+ 6
- 3
app/db/db_second_newcomers_free.go 查看文件

@@ -73,7 +73,7 @@ func SecondGetPriceTypeById(Db *xorm.Engine, id int) *model.SecondNewcomersFreeP
}
return &price
}
func SecondFreeProductByID(Db *xorm.Engine, gid, provider string) (*model.SecondNewcomersFreeProduct, error) {
func SecondFreeProductByID(Db *xorm.Engine, gid, skuId, provider string) (*model.SecondNewcomersFreeProduct, error) {
m := new(model.SecondNewcomersFreeProduct)
var has bool
var err error
@@ -84,8 +84,11 @@ func SecondFreeProductByID(Db *xorm.Engine, gid, provider string) (*model.Second
}
has, err = Db.Where("good_id LIKE ?", "%-"+gid).Get(m)
} else {
m.GoodId = gid
has, err = Db.Get(m)
sess := Db.Where("good_id=?", gid)
if skuId != "" {
sess.Or("good_id=?", skuId)
}
has, err = sess.Get(m)
}

if err != nil {


+ 1
- 0
app/db/model/ord_item_info.go 查看文件

@@ -7,4 +7,5 @@ type OrdItemInfo struct {
Thumbnail string `json:"thumbnail" xorm:"not null default '' comment('缩略图URL') VARCHAR(2000)"`
ItemTitle string `json:"item_title" xorm:"not null default '' comment('标题') VARCHAR(256)"`
ItemLink string `json:"item_link" xorm:"not null default '' comment('商品链接') VARCHAR(2000)"`
NumItemId string `json:"num_item_id" xorm:"not null default '' comment('商品链接') VARCHAR(2000)"`
}

+ 1
- 0
app/db/model/ord_list.go 查看文件

@@ -60,4 +60,5 @@ type OrdList struct {
OrderFormType int `xorm:"not null default 0 INT(1)" json:"order_form_type"`
IsTotal int `xorm:"not null default 0 INT(1)" json:"is_total"`
TaskType string `xorm:"not null default '' VARCHAR(100)" json:"task_type"`
NumItemId string `xorm:"not null default '' VARCHAR(100)" json:"num_item_id"`
}

+ 1
- 0
app/md/order.go 查看文件

@@ -148,6 +148,7 @@ type OrderInfo struct {
ParentOrdId int64
Pvd string
ItemId string
SkuId string
ItemNum int
ItemPrice float64
ItemTitle string


+ 8
- 7
app/svc/svc_order_track_save_create.go 查看文件

@@ -566,6 +566,7 @@ func OrderSaveCreate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, opts
ParentOrdId: v.ParentOrdId,
Pvd: newPvd,
ItemId: v.ItemId,
NumItemId: v.SkuId,
ItemNum: v.ItemNum,
ItemPrice: v.ItemPrice,
PaidPrice: v.PaidPrice,
@@ -619,13 +620,13 @@ func OrderSaveCreate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, opts
if len(v.Thumbnail) > 3 && v.Thumbnail[0:2] == "//" {
thumbnail = "http:" + v.Thumbnail
}

db.DbsOrderItemInfoInsert(eg, &model.OrdItemInfo{
ItemId: v.ItemId,
Pvd: newPvd,
Thumbnail: thumbnail,
ItemTitle: v.ItemTitle,
ItemLink: v.ItemLink,
ItemId: v.ItemId,
Pvd: newPvd,
Thumbnail: thumbnail,
NumGoodsId: v.SkuId,
ItemTitle: v.ItemTitle,
ItemLink: v.ItemLink,
})
mode := ""
if opt != nil {
@@ -756,7 +757,7 @@ func CheckValid(eg *xorm.Engine, dbName string, uid, isOrder int, ch *rabbit.Cha
}

func orderSecondFreeCheck(eg *xorm.Engine, v *md.OrderInfo, oid int64, uid int, isNeedReduct int) *model.SecondNewcomersFreeProduct {
m, err := db.SecondFreeProductByID(eg, v.ItemId, v.Pvd)
m, err := db.SecondFreeProductByID(eg, v.ItemId, v.SkuId, v.Pvd)
if err != nil || m == nil {

logx.Warn(err)


+ 11
- 9
app/svc/svc_order_track_save_create_update.go 查看文件

@@ -229,7 +229,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo,
NotSettleDeduct(eg, &v, dbName)
}
if v.State != 4 && v.PriceType > 0 {
m, _ := db.FreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.FreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
//直接退回账号了 定制
storeOrder := db.GuideStoreOrder(eg, v.OrdId)
if m != nil {
@@ -258,7 +258,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo,
}
}
if v.State != 4 && v.SecondPriceType > 0 {
m, _ := db.SecondFreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.SecondFreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
if m != nil {
m.Stock++
m.Sale--
@@ -269,7 +269,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo,
}
}
if v.State == 4 && v.PriceType > 0 {
m, _ := db.FreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.FreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
//直接退回账号了 定制
storeOrder := db.GuideStoreOrder(eg, v.OrdId)
if m != nil {
@@ -292,7 +292,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo,

}
if v.State == 4 && v.ThirdPriceType > 0 {
m, _ := db.MoreFreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.MoreFreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
//直接退回账号了 定制
storeOrder := db.GuideStoreOrder(eg, v.OrdId)
if m != nil {
@@ -878,6 +878,7 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo,
}
// 插入新订单
newOrd := &model.OrdList{
NumItemId: v.SkuId,
TaskType: v.TaskType,
OrderFormType: orderFormType,
OrdId: oid,
@@ -941,11 +942,12 @@ func OrderSaveCreateUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo,
}

db.DbsOrderItemInfoInsert(eg, &model.OrdItemInfo{
ItemId: v.ItemId,
Pvd: newPvd,
Thumbnail: thumbnail,
ItemTitle: v.ItemTitle,
ItemLink: v.ItemLink,
ItemId: v.ItemId,
Pvd: newPvd,
Thumbnail: thumbnail,
ItemTitle: v.ItemTitle,
ItemLink: v.ItemLink,
NumGoodsId: v.SkuId,
})
mode := ""
if opt != nil {


+ 4
- 4
app/svc/svc_order_track_save_update.go 查看文件

@@ -220,7 +220,7 @@ func OrderSaveUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, opts
NotSettleDeduct(eg, &v, dbName)
}
if v.State != 4 && v.PriceType > 0 {
m, _ := db.FreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.FreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
//直接退回账号了 定制
storeOrder := db.GuideStoreOrder(eg, v.OrdId)
if m != nil {
@@ -249,7 +249,7 @@ func OrderSaveUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, opts
}
}
if v.State != 4 && v.SecondPriceType > 0 {
m, _ := db.SecondFreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.SecondFreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
if m != nil {
m.Stock++
m.Sale--
@@ -260,7 +260,7 @@ func OrderSaveUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, opts
}
}
if v.State == 4 && v.PriceType > 0 {
m, _ := db.FreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.FreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
//直接退回账号了 定制
storeOrder := db.GuideStoreOrder(eg, v.OrdId)
if m != nil {
@@ -283,7 +283,7 @@ func OrderSaveUpdate(eg *xorm.Engine, pvd string, ordData *[]md.OrderInfo, opts

}
if v.State == 4 && v.ThirdPriceType > 0 {
m, _ := db.MoreFreeProductByID(eg, v.ItemId, v.Pvd)
m, _ := db.MoreFreeProductByID(eg, v.ItemId, v.NumItemId, v.Pvd)
//直接退回账号了 定制
storeOrder := db.GuideStoreOrder(eg, v.OrdId)
if m != nil {


Loading…
取消
儲存