|
|
@@ -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) |
|
|
|
} |
|
|
|
|
|
|
|