Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-08-04 09:28:46 +08:00
15 changed files with 51 additions and 28 deletions

View File

@@ -120,7 +120,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
if storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]; storeSkuInfo != nil {
validVendorMap[vendorID] = 1
validSkuMap[v.SkuID] = 1
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSkuInfo.UnitPrice, int(storeDetail.PricePercentage))
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSkuInfo.Price, int(storeDetail.PricePercentage))
actSkuMap := &model.ActStoreSkuMap{
ActID: act.ID,
StoreID: storeID,

View File

@@ -495,7 +495,9 @@ func updateActPrice4StoreSkuNameNew(db *dao.DaoDB, storeIDs, skuIDs []int, skuNa
// globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err)
// return err
// }
if len(skuIDs) == 0 {
return nil
}
actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, storeIDs, skuIDs, time.Now(), time.Now())
if err != nil {
globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err)
@@ -2055,7 +2057,7 @@ func RefreshStoresSkuByVendor(ctx *jxcontext.Context, storeIDs []int, vendorID i
}
}
for _, v := range storeSkuList {
pricePercentage := jxutils.GetPricePercentageByVendorPrice(storeMap[v.StoreID].PricePercentagePackObj, v.UnitPrice, int(storeMap[v.StoreID].PricePercentage))
pricePercentage := jxutils.GetPricePercentageByVendorPrice(storeMap[v.StoreID].PricePercentagePackObj, v.Price, int(storeMap[v.StoreID].PricePercentage))
skuName := skuNameMap[skuMap[v.SkuID].NameID]
v.Price = jxutils.CaculateSkuPriceFromVendor(v.Price, pricePercentage, 0)
v.UnitPrice = jxutils.CaculateSkuPriceFromVendor(skuName.Price, pricePercentage, 0)

View File

@@ -438,6 +438,7 @@ func (v *VendorSync) SyncStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, vendo
}
func isUseOldSyncLogic(storeMap *model.StoreMap) bool {
return false
return globals.IsProductEnv() && storeMap.StoreID != 102652 // 绿城四季鲜店
}

View File

@@ -190,7 +190,7 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
}
func calVendorPrice4StoreSku(inSku *dao.StoreSkuSyncInfo, pricePercentagePack model.PricePercentagePack, pricePercentage int) (outSku *dao.StoreSkuSyncInfo) {
pricePercentage = jxutils.GetPricePercentage(pricePercentagePack, int(inSku.UnitPrice), pricePercentage)
pricePercentage = jxutils.GetPricePercentage(pricePercentagePack, int(inSku.Price), pricePercentage)
inSku.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(int(inSku.Price), pricePercentage, 0))
if inSku.VendorPrice <= 0 {
inSku.VendorPrice = 1 // 最少1分钱

View File

@@ -97,9 +97,10 @@ func Init() {
func doDailyWork() {
globals.SugarLogger.Debug("doDailyWork")
// cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true)
cms.CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, false, true, true)
netprinter.RebindAllPrinters(jxcontext.AdminCtx, false, true)
// cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD}, nil, true, true)
cms.CurVendorSync.SyncStoresSkus(jxcontext.AdminCtx, dao.GetDB(), []int{model.VendorIDJD, model.VendorIDEBAI, model.VendorIDMTWM}, nil, nil, false, false, true)
InitEx()
}
func RefreshRealMobile(ctx *jxcontext.Context, vendorID int, fromTime, toTime time.Time, isAsync, isContinueWhenError bool) (hint string, err error) {

View File

@@ -6,6 +6,7 @@ import (
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
"git.rosy.net.cn/jx-callback/business/model"
@@ -159,19 +160,38 @@ func StartOrEndOpStore(isStart bool, startTime, endTime int16, isAsync, isContin
}
func InitEx() {
// if globals.IsMainProductEnv() {
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(true, 0, 0, false, true)
// }, startOpStoreTimeListJXCS)
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(false, 0, 0, false, true)
// }, endOpStoreTimeListJXCS)
// } else {
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(true, 0, 0, false, true)
// }, startOpStoreTimeListJXGY)
// ScheduleTimerFunc(func() {
// StartOrEndOpStore(false, 0, 0, false, true)
// }, endOpStoreTimeListJXGY)
// }
var (
time1, time2 time.Time
)
now := time.Now()
if globals.IsMainProductEnv() {
ScheduleTimerFunc(func() {
StartOrEndOpStore(true, 0, 0, false, true)
}, startOpStoreTimeListJXCS)
ScheduleTimerFunc(func() {
StartOrEndOpStore(false, 0, 0, false, true)
}, endOpStoreTimeListJXCS)
time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXCS)
time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXCS)
} else {
ScheduleTimerFunc(func() {
time1 = jxutils.GetNextTimeFromList(now, startOpStoreTimeListJXGY)
time2 = jxutils.GetNextTimeFromList(now, endOpStoreTimeListJXGY)
}
if time1.Sub(now) < 2*time.Hour {
utils.AfterFuncWithRecover(time1.Sub(now), func() {
StartOrEndOpStore(true, 0, 0, false, true)
}, startOpStoreTimeListJXGY)
ScheduleTimerFunc(func() {
})
utils.AfterFuncWithRecover(time2.Sub(now), func() {
StartOrEndOpStore(false, 0, 0, false, true)
}, endOpStoreTimeListJXGY)
})
}
}