Browse Source

更新

master
huangjiajun 4 months ago
parent
commit
61f303631b
3 changed files with 13 additions and 6 deletions
  1. +10
    -4
      app/db/db_newcomers_free_product.go
  2. +1
    -0
      consume/md/md_zhios_capital_pool_order_total.go
  3. +2
    -2
      consume/zhios_order_free.go

+ 10
- 4
app/db/db_newcomers_free_product.go View File

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

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

@@ -35,7 +38,7 @@ func FreeProductByID(sess *xorm.Session, gid, provider string) (*model.Newcomers

return m, nil
}
func MoreFreeProductByID(sess *xorm.Session, gid, provider string) (*model.MoreNewcomersFreeProduct, error) {
func MoreFreeProductByID(sess *xorm.Session, gid, skuId, provider string) (*model.MoreNewcomersFreeProduct, error) {
m := new(model.MoreNewcomersFreeProduct)
var has bool
var err error
@@ -46,7 +49,10 @@ func MoreFreeProductByID(sess *xorm.Session, gid, provider string) (*model.MoreN
}
has, err = sess.Where("good_id LIKE ?", "%-"+gid).Get(m)
} else {
m.GoodId = gid
sess.Where("good_id=?", gid)
if skuId != "" {
sess.Or("good_id=?", skuId)
}
has, err = sess.Get(m)
}



+ 1
- 0
consume/md/md_zhios_capital_pool_order_total.go View File

@@ -38,6 +38,7 @@ type ZhiosMallConsume struct {

type ZhiosOrderFree struct {
ItemId string `json:"item_id"`
SkuId string `json:"sku_id"`
OptPvd string `json:"opt_pvd"`
OrderType string `json:"order_type"`
Pid string `json:"pid"`


+ 2
- 2
consume/zhios_order_free.go View File

@@ -343,7 +343,7 @@ func handleZhiosOrderFree(msg []byte) error {
}
func orderFreeCheck(eg *xorm.Engine, sess *xorm.Session, canalMsg *md.ZhiosOrderFree) *model.NewcomersFreeProduct {

m, err := db.FreeProductByID(sess, canalMsg.ItemId, canalMsg.OptPvd)
m, err := db.FreeProductByID(sess, canalMsg.ItemId, canalMsg.SkuId, canalMsg.OptPvd)
stock := 0
if m != nil && m.StoreId > 0 { //小于多少份就不能出售了
guideStoreStock := db.SysCfgGetWithDb(eg, canalMsg.Mid, "guide_store_stock")
@@ -483,7 +483,7 @@ func orderFreeCheck(eg *xorm.Engine, sess *xorm.Session, canalMsg *md.ZhiosOrder
}
func moreOrderFreeCheck(eg *xorm.Engine, sess *xorm.Session, canalMsg *md.ZhiosOrderFree) *model.MoreNewcomersFreeProduct {

m, err := db.MoreFreeProductByID(sess, canalMsg.ItemId, canalMsg.OptPvd)
m, err := db.MoreFreeProductByID(sess, canalMsg.ItemId, canalMsg.SkuId, canalMsg.OptPvd)
stock := 0
if m != nil && m.StoreId > 0 { //小于多少份就不能出售了
guideStoreStock := db.SysCfgGetWithDb(eg, canalMsg.Mid, "guide_store_stock")


Loading…
Cancel
Save