Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -6349,7 +6349,6 @@ func SingleBindTaoVegetable(ctx *jxcontext.Context, bind []TaoBindInfo) (error,
|
||||
for _, v := range bind {
|
||||
if len(v.VendorStoreID) == 0 || len(v.VendorStoreName) == 0 {
|
||||
errIDName = append(errIDName, v.VendorStoreID)
|
||||
//errList.AddErr(fmt.Errorf("门店%s Id/名字不合法", v.VendorStoreID))
|
||||
} else {
|
||||
if strings.Contains(v.VendorStoreID, "X") {
|
||||
temp := strings.Split(v.VendorStoreID, "X")
|
||||
@@ -6370,6 +6369,13 @@ func SingleBindTaoVegetable(ctx *jxcontext.Context, bind []TaoBindInfo) (error,
|
||||
MtwmRefreshToken: "",
|
||||
VendorStoreID: v.VendorStoreID,
|
||||
}
|
||||
//跟美团同步 平台调价、调价套餐
|
||||
if localStore, err := dao.GetStoreDetail(dao.GetDB(), utils.Str2Int(storeID), model.VendorIDMTWM, ""); err == nil {
|
||||
if localStore.PricePercentage != 0 {
|
||||
storeMap.PricePercentage = localStore.PricePercentage
|
||||
}
|
||||
//else if localStore.priceper
|
||||
}
|
||||
storeMaps = append(storeMaps, storeMap)
|
||||
}
|
||||
userName := ctx.GetUserName()
|
||||
|
||||
@@ -60,75 +60,67 @@ func act2TxdActivity(act *model.Act2) (activity *domain.AlibabaRetailMarketingIt
|
||||
|
||||
func storeSku2ActData(act *model.Act2, actStoreSku []*model.ActStoreSku2, handler func(int8) bool) (actData *domain.AlibabaRetailMarketingItemdiscountActivitySkuAddItemDiscountActivityElementOperateRequest) {
|
||||
var (
|
||||
limitCount = int64(1)
|
||||
userLimitCount = int64(1)
|
||||
fixPriceMoney = int64(0)
|
||||
discountRate = int64(0)
|
||||
decreaseMoney = int64(0)
|
||||
limitDaily = int64(1)
|
||||
limitCount = int64(1)
|
||||
//userLimitCount = int64(1)
|
||||
fixPriceMoney = int64(0)
|
||||
discountRate = int64(0)
|
||||
decreaseMoney = int64(0)
|
||||
//limitDaily = int64(1)
|
||||
skuElements []domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto
|
||||
skuElement domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto
|
||||
)
|
||||
if act.LimitCount > 0 {
|
||||
limitCount = int64(act.LimitCount)
|
||||
if act.LimitUser > 0 {
|
||||
userLimitCount = int64(act.LimitCount)
|
||||
}
|
||||
} else if act.LimitDaily > 0 {
|
||||
limitDaily = int64(act.LimitDaily)
|
||||
//if act.LimitCount > 0 {
|
||||
// limitCount = int64(act.LimitCount)
|
||||
// if act.LimitUser > 0 {
|
||||
// userLimitCount = int64(act.LimitCount)
|
||||
// }
|
||||
//} else if act.LimitDaily > 0 {
|
||||
// limitDaily = int64(act.LimitDaily)
|
||||
//}
|
||||
actData = &domain.AlibabaRetailMarketingItemdiscountActivitySkuAddItemDiscountActivityElementOperateRequest{
|
||||
CreatorId: utils.String2Pointer(utils.Int2Str(rand.Int())),
|
||||
CreatorName: &act.LastOperator,
|
||||
OutActId: utils.String2Pointer(utils.Int2Str(act.Act.ID)),
|
||||
}
|
||||
|
||||
for _, v := range actStoreSku {
|
||||
if handler == nil || handler(v.SyncStatus) {
|
||||
stock := int64(0)
|
||||
if v.Stock > 0 {
|
||||
stock = int64(v.Stock)
|
||||
}
|
||||
|
||||
actData = &domain.AlibabaRetailMarketingItemdiscountActivitySkuAddItemDiscountActivityElementOperateRequest{
|
||||
SkuElements: &[]domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{{
|
||||
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
||||
Limit: &domain.AlibabaRetailMarketingItemdiscountActivitySkuAddLimitDto{
|
||||
TotalLimitCnt: &stock,
|
||||
DailyTotalLimitCnt: &limitDaily,
|
||||
UserTotalLimitCnt: &userLimitCount,
|
||||
UserDailyLimitCnt: &userLimitCount,
|
||||
OrderLimitCnt: &limitCount,
|
||||
},
|
||||
}},
|
||||
CreatorId: utils.String2Pointer(utils.Int2Str(rand.Int())),
|
||||
CreatorName: &v.LastOperator,
|
||||
OutActId: utils.String2Pointer(utils.Int2Str(v.ActID)),
|
||||
}
|
||||
//stock := int64(0)
|
||||
//if v.Stock > 0 {
|
||||
// stock = int64(v.Stock)
|
||||
//}
|
||||
|
||||
sType := actType2Txd(act.Type)
|
||||
switch sType {
|
||||
case tao_vegetable.DiscountTypeDeductMoney:
|
||||
decreaseMoney = v.VendorPrice - v.ActualActPrice
|
||||
actData.SkuElements = &[]domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{{
|
||||
skuElement = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{
|
||||
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
||||
DecreaseMoney: &decreaseMoney,
|
||||
Limit: &domain.AlibabaRetailMarketingItemdiscountActivitySkuAddLimitDto{
|
||||
OrderLimitCnt: &limitCount,
|
||||
},
|
||||
}}
|
||||
}
|
||||
case tao_vegetable.DiscountTypeOnePrice:
|
||||
fixPriceMoney = v.ActualActPrice
|
||||
actData.SkuElements = &[]domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{{
|
||||
skuElement = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{
|
||||
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
||||
FixPriceMoney: &fixPriceMoney,
|
||||
Limit: &domain.AlibabaRetailMarketingItemdiscountActivitySkuAddLimitDto{
|
||||
OrderLimitCnt: &limitCount,
|
||||
},
|
||||
}}
|
||||
}
|
||||
case tao_vegetable.DiscountTypeDiscounts:
|
||||
discountRate = int64(v.PricePercentage * 10)
|
||||
actData.SkuElements = &[]domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{{
|
||||
skuElement = domain.AlibabaRetailMarketingItemdiscountActivitySkuAddSkuActivityElementDto{
|
||||
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
||||
DiscountRate: &discountRate,
|
||||
Limit: &domain.AlibabaRetailMarketingItemdiscountActivitySkuAddLimitDto{
|
||||
OrderLimitCnt: &limitCount,
|
||||
},
|
||||
}}
|
||||
}
|
||||
}
|
||||
skuElements = append(skuElements, skuElement)
|
||||
actData.SkuElements = &skuElements
|
||||
}
|
||||
}
|
||||
return actData
|
||||
@@ -186,7 +178,7 @@ func createOneShopAct(act *model.Act2, vendorStoreID string, actStoreSku []*mode
|
||||
actData := act2TxdActivity(act)
|
||||
//2 活动商品详情
|
||||
actSkuData := storeSku2ActData(act, actStoreSku, isCreateOrUpdate)
|
||||
|
||||
globals.SugarLogger.Debugf("createOneShopAct actData=%s,actSkuData=%s", utils.Format4Output(actData, false), utils.Format4Output(actSkuData, false))
|
||||
if actData != nil && actSkuData != nil {
|
||||
if globals.EnableMtwmStoreWrite {
|
||||
//创建活动
|
||||
|
||||
Reference in New Issue
Block a user