Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -1707,3 +1707,35 @@ func SaveAndSendAlarmVendorSnapshot(ctx *jxcontext.Context, vendorIDs, storeIDs
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func SyncStoresQualify(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
if len(storeIDs) > 0 {
|
||||
db := dao.GetDB()
|
||||
task := tasksch.NewParallelTask("上传门店资质", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
vendorID := model.VendorIDJD
|
||||
if handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IStoreSyncQualifyHandler); handler != nil {
|
||||
storeID := batchItemList[0].(int)
|
||||
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
|
||||
if err = err2; err == nil {
|
||||
if err = handler.SyncQualify(ctx, storeDetail); err == nil {
|
||||
retVal = []int{1}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("平台%s不支持此操作", model.VendorChineseNames[vendorID])
|
||||
}
|
||||
return retVal, err
|
||||
}, storeIDs)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
if isAsync {
|
||||
hint = task.GetID()
|
||||
} else {
|
||||
resultList, err2 := task.GetResult(0)
|
||||
if err = err2; err == nil {
|
||||
hint = utils.Int2Str(len(resultList))
|
||||
}
|
||||
}
|
||||
}
|
||||
return hint, err
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ type tGetStoresSkusInfo struct {
|
||||
const (
|
||||
maxStoreNameBind = 3000 // 最大门店SkuName bind个数
|
||||
maxStoreNameBind2 = 10000 // 最大门店乘SkuName个数
|
||||
|
||||
AutoSaleAtStr = "20:25:00"
|
||||
)
|
||||
|
||||
func GetStoreSkus(ctx *jxcontext.Context, storeID int, skuIDs []int, isFocus bool, keyword string, isBySku bool, params map[string]interface{}, offset, pageSize int) (skuNamesInfo *StoreSkuNamesInfo, err error) {
|
||||
@@ -1307,6 +1309,15 @@ func getSkuSaleStatus(inSkuBind *StoreSkuBindSkuInfo, skuBindInfo *StoreSkuBindI
|
||||
return model.StoreSkuBindStatusNA
|
||||
}
|
||||
|
||||
func formatAutoSaleTime(autoSaleTime time.Time) (outAutoSaleTime time.Time) {
|
||||
if utils.IsTimeZero(autoSaleTime) {
|
||||
outAutoSaleTime = utils.DefaultTimeValue
|
||||
} else {
|
||||
outAutoSaleTime = jxutils.GetNextTimeFromList(time.Now(), []string{AutoSaleAtStr})
|
||||
}
|
||||
return outAutoSaleTime
|
||||
}
|
||||
|
||||
// todo 应该用updateStoresSkusWithoutSync实现
|
||||
func updateStoreSkusSaleWithoutSync(ctx *jxcontext.Context, storeID int, skuBindSkuInfos []*StoreSkuBindSkuInfo, autoSaleTime time.Time, userName string) (needSyncSkus []int, err error) {
|
||||
var num int64
|
||||
@@ -1331,6 +1342,7 @@ func updateStoreSkusSaleWithoutSync(ctx *jxcontext.Context, storeID int, skuBind
|
||||
dao.Rollback(db)
|
||||
return nil, err
|
||||
}
|
||||
autoSaleTime = formatAutoSaleTime(autoSaleTime)
|
||||
for _, skuBind := range storeSkuList {
|
||||
if v := skuBindSkuInfosMap[skuBind.SkuID]; v != nil && v.IsSale != 0 {
|
||||
if v.IsSale == 1 {
|
||||
|
||||
Reference in New Issue
Block a user