- 活动平台实际测试通过
This commit is contained in:
@@ -15,6 +15,10 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
)
|
||||
|
||||
const (
|
||||
DefActSkuStock = 200 // 缺省活动库存
|
||||
)
|
||||
|
||||
type ActOrderRuleParam struct {
|
||||
SalePrice int64 `orm:"" json:"salePrice"` // 满的价格
|
||||
DeductPrice int64 `orm:"" json:"deductPrice"` // 减的价格
|
||||
@@ -127,6 +131,9 @@ func addActStoreBind(ctx *jxcontext.Context, db *dao.DaoDB, actStoreSkuList []*m
|
||||
|
||||
storeSkuMap := make(map[int64]int)
|
||||
for _, v := range actStoreSkuList {
|
||||
if v.Stock == 0 {
|
||||
v.Stock = DefActSkuStock
|
||||
}
|
||||
err = dao.CreateEntity(db, v)
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
@@ -151,14 +158,12 @@ func addActStoreBind(ctx *jxcontext.Context, db *dao.DaoDB, actStoreSkuList []*m
|
||||
|
||||
func AddActStoreBind(ctx *jxcontext.Context, actID int, actStoreSku []*ActStoreSkuParam) (err error) {
|
||||
db := dao.GetDB()
|
||||
var vendorIDs []int
|
||||
actMap, err := dao.GetActVendorInfo(db, actID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for vendorID := range actMap {
|
||||
vendorIDs = append(vendorIDs, vendorID)
|
||||
}
|
||||
vendorIDs := partner.GetVendorIDsFromActMap(actMap)
|
||||
|
||||
var act *model.Act
|
||||
if len(vendorIDs) > 0 {
|
||||
act = &actMap[vendorIDs[0]].Act
|
||||
@@ -310,16 +315,25 @@ func DeleteActStoreBind(ctx *jxcontext.Context, actID int, actStoreSku []*ActSto
|
||||
return deleteActStoreBind(ctx, dao.GetDB(), actID, actStoreSku)
|
||||
}
|
||||
|
||||
// actStoreSkuParam为空,不会删除act_store_sku,但会删除act_store_sku_map
|
||||
func deleteActStoreBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, actStoreSkuParam []*ActStoreSkuParam) (err error) {
|
||||
actMap, err := dao.GetActVendorInfo(db, actID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(actMap) == 0 {
|
||||
return fmt.Errorf("找不到活动:%d,或已被全部取消", actID)
|
||||
}
|
||||
|
||||
actStoreSkuMap, err := dao.GetActStoreSkuVendorInfo(db, actID, nil, nil, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
act := actMap[partner.GetVendorIDsFromActMap(actMap)[0]]
|
||||
if act.Status != model.ActStatusCreated {
|
||||
return fmt.Errorf("当前活动状态:%s不能进行此操作", model.ActStatusName[act.Status])
|
||||
}
|
||||
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
|
||||
@@ -62,6 +62,7 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
|
||||
"purchaseVendorInfo": model.PurchaseVendorInfo,
|
||||
"afsReasonTypeName": model.AfsReasonTypeName,
|
||||
"afsAppealTypeName": model.AfsAppealTypeName,
|
||||
"actStatusName": model.ActStatusName,
|
||||
},
|
||||
}
|
||||
Init()
|
||||
|
||||
Reference in New Issue
Block a user