causeFlag
This commit is contained in:
@@ -90,7 +90,7 @@ func changeStoreSkusByOrder(order *weimobapi.OrderDetail) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cms.UpdateStoreSkus(ctx, storeID, skuBindInfos, true, true)
|
cms.UpdateStoreSkus(ctx, 0, storeID, skuBindInfos, true, true)
|
||||||
} else {
|
} else {
|
||||||
globals.SugarLogger.Debugf("changeStoreSkusByOrder orderID:%d, storeID:%d is empty", order.OrderNo, storeID)
|
globals.SugarLogger.Debugf("changeStoreSkusByOrder orderID:%d, storeID:%d is empty", order.OrderNo, storeID)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -779,15 +779,15 @@ func asyncStoreSkuOpFilter(ctx *jxcontext.Context, isAsync bool) bool {
|
|||||||
return isAsync
|
return isAsync
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateStoreSku(ctx *jxcontext.Context, storeID int, skuBindInfo *StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func UpdateStoreSku(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfo *StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
return UpdateStoreSkus(ctx, storeID, []*StoreSkuBindInfo{skuBindInfo}, isAsync, isContinueWhenError)
|
return UpdateStoreSkus(ctx, causeFlag, storeID, []*StoreSkuBindInfo{skuBindInfo}, isAsync, isContinueWhenError)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateStoreSkus(ctx *jxcontext.Context, storeID int, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func UpdateStoreSkus(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
return UpdateStoresSkus(ctx, []int{storeID}, skuBindInfos, false, isAsync, isContinueWhenError)
|
return UpdateStoresSkus(ctx, causeFlag, []int{storeID}, skuBindInfos, false, isAsync, isContinueWhenError)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateStoresSkus(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true))
|
globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true))
|
||||||
|
|
||||||
var num int64
|
var num int64
|
||||||
@@ -799,7 +799,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*St
|
|||||||
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
|
isAsync = asyncStoreSkuOpFilter(ctx, isAsync)
|
||||||
num = int64(len(skuIDs))
|
num = int64(len(skuIDs))
|
||||||
if num > 0 {
|
if num > 0 {
|
||||||
hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError)
|
hint, err = CurVendorSync.SyncStoresSkus(ctx, nil, causeFlag, db, nil, storeIDs, skuIDs, false, isAsync, isContinueWhenError)
|
||||||
}
|
}
|
||||||
if num == 0 || !isAsync || hint == "" {
|
if num == 0 || !isAsync || hint == "" {
|
||||||
hint = utils.Int64ToStr(num)
|
hint = utils.Int64ToStr(num)
|
||||||
@@ -1752,7 +1752,7 @@ func AcceptStoreOpRequests(ctx *jxcontext.Context, reqIDs []int) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err2 == nil {
|
if err2 == nil {
|
||||||
_, err2 := UpdateStoresSkus(ctx, []int{op.StoreID}, []*StoreSkuBindInfo{skuBindInfo}, false, false, false)
|
_, err2 := UpdateStoresSkus(ctx, 0, []int{op.StoreID}, []*StoreSkuBindInfo{skuBindInfo}, false, false, false)
|
||||||
isLocalSucess := true
|
isLocalSucess := true
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
subErrors[reqID] = err2
|
subErrors[reqID] = err2
|
||||||
@@ -2585,7 +2585,7 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
|
|||||||
skuBindInfoList = append(skuBindInfoList, v.(*StoreSkuBindInfo))
|
skuBindInfoList = append(skuBindInfoList, v.(*StoreSkuBindInfo))
|
||||||
}
|
}
|
||||||
if isErr {
|
if isErr {
|
||||||
UpdateStoresSkus(ctx, storeIDs, skuBindInfoList, false, isAsync, isContinueWhenError)
|
UpdateStoresSkus(ctx, 0, storeIDs, skuBindInfoList, false, isAsync, isContinueWhenError)
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
//写Excel
|
//写Excel
|
||||||
@@ -3239,23 +3239,10 @@ func AutoFocusStoreSkusWithoutFocus(ctx *jxcontext.Context, skuIDs []int, isSync
|
|||||||
}
|
}
|
||||||
skuBindInfoList = append(skuBindInfoList, skuBindInfoResult)
|
skuBindInfoList = append(skuBindInfoList, skuBindInfoResult)
|
||||||
if isSync {
|
if isSync {
|
||||||
UpdateStoreSkus(ctx, v.StoreID, skuBindInfoList, true, true)
|
UpdateStoreSkus(ctx, 0, v.StoreID, skuBindInfoList, true, true)
|
||||||
} else {
|
} else {
|
||||||
updateStoresSkusWithoutSync(ctx, db, []int{v.StoreID}, skuBindInfoList, false)
|
updateStoresSkusWithoutSync(ctx, db, []int{v.StoreID}, skuBindInfoList, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
func UpdateStoreSkuNamePrice(ctx *jxcontext.Context, storeID, nameID, unitPrice int, isAsync bool) (hint string, err error) {
|
|
||||||
// db := dao.GetDB()
|
|
||||||
// skuList, err := dao.GetSkus(db, nil, []int{nameID}, nil, nil)
|
|
||||||
// if err != nil || len(skuList) == 0 {
|
|
||||||
// return "", err
|
|
||||||
// }
|
|
||||||
// var skuIDs []int
|
|
||||||
// for _, v := range skuList {
|
|
||||||
// skuIDs = append(skuIDs, v.ID)
|
|
||||||
// }
|
|
||||||
// actStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, model.ActSkuDirectDown, []int{storeID}, skuIDs, time.Now(), time.Now())
|
|
||||||
return hint, err
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -851,7 +851,7 @@ func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isCo
|
|||||||
for _, v := range storeSkuBindInfoList {
|
for _, v := range storeSkuBindInfoList {
|
||||||
skuBindInfos = append(skuBindInfos, v.(*cms.StoreSkuBindInfo))
|
skuBindInfos = append(skuBindInfos, v.(*cms.StoreSkuBindInfo))
|
||||||
}
|
}
|
||||||
cms.UpdateStoresSkus(ctx, storeIDs, skuBindInfos, false, isAsync, isContinueWhenError)
|
cms.UpdateStoresSkus(ctx, 0, storeIDs, skuBindInfos, false, isAsync, isContinueWhenError)
|
||||||
case 2:
|
case 2:
|
||||||
WriteToExcel3(task, dataStoreSkusSuccess.dataStoreSkusSuccessList, dataFailed.dataFailedList)
|
WriteToExcel3(task, dataStoreSkusSuccess.dataStoreSkusSuccessList, dataFailed.dataFailedList)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ func (c *StoreSkuController) GetVendorStoreSkusInfo() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeID formData int true 门店ID"
|
// @Param storeID formData int true 门店ID"
|
||||||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象"
|
// @Param payload formData string true "json数据,StoreSkuBindInfo对象"
|
||||||
|
// @Param causeFlag formData int false "操作类型"
|
||||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||||
// @Param isAsync formData bool false "是否异步操作"
|
// @Param isAsync formData bool false "是否异步操作"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
@@ -151,7 +152,7 @@ func (c *StoreSkuController) UpdateStoreSku() {
|
|||||||
c.callUpdateStoreSku(func(params *tStoreSkuUpdateStoreSkuParams) (retVal interface{}, errCode string, err error) {
|
c.callUpdateStoreSku(func(params *tStoreSkuUpdateStoreSkuParams) (retVal interface{}, errCode string, err error) {
|
||||||
var skuBindInfo cms.StoreSkuBindInfo
|
var skuBindInfo cms.StoreSkuBindInfo
|
||||||
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfo); err == nil {
|
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfo); err == nil {
|
||||||
retVal, err = cms.UpdateStoreSku(params.Ctx, params.StoreID, &skuBindInfo, params.IsAsync, params.IsContinueWhenError)
|
retVal, err = cms.UpdateStoreSku(params.Ctx, params.CauseFlag, params.StoreID, &skuBindInfo, params.IsAsync, params.IsContinueWhenError)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
@@ -162,6 +163,7 @@ func (c *StoreSkuController) UpdateStoreSku() {
|
|||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param storeID formData int true "门店ID"
|
// @Param storeID formData int true "门店ID"
|
||||||
// @Param payload formData string true "json数据,StoreSkuBindInfo对象数组"
|
// @Param payload formData string true "json数据,StoreSkuBindInfo对象数组"
|
||||||
|
// @Param causeFlag formData int false "操作类型"
|
||||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||||
// @Param isAsync formData bool false "是否异步操作"
|
// @Param isAsync formData bool false "是否异步操作"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
@@ -171,7 +173,7 @@ func (c *StoreSkuController) UpdateStoreSkus() {
|
|||||||
c.callUpdateStoreSkus(func(params *tStoreSkuUpdateStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
c.callUpdateStoreSkus(func(params *tStoreSkuUpdateStoreSkusParams) (retVal interface{}, errCode string, err error) {
|
||||||
var skuBindInfos []*cms.StoreSkuBindInfo
|
var skuBindInfos []*cms.StoreSkuBindInfo
|
||||||
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err == nil {
|
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err == nil {
|
||||||
retVal, err = cms.UpdateStoreSkus(params.Ctx, params.StoreID, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
|
retVal, err = cms.UpdateStoreSkus(params.Ctx, params.CauseFlag, params.StoreID, skuBindInfos, params.IsAsync, params.IsContinueWhenError)
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
@@ -220,7 +222,7 @@ func (c *StoreSkuController) UpdateStoresSkus() {
|
|||||||
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Payload, &skuBindInfos); err != nil {
|
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.Payload, &skuBindInfos); err != nil {
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
}
|
}
|
||||||
retVal, err = cms.UpdateStoresSkus(params.Ctx, storeIDs, skuBindInfos, params.IsScale, params.IsAsync, params.IsContinueWhenError)
|
retVal, err = cms.UpdateStoresSkus(params.Ctx, params.CauseFlag, storeIDs, skuBindInfos, params.IsScale, params.IsAsync, params.IsContinueWhenError)
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -245,23 +247,6 @@ func (c *StoreSkuController) UpdateStoresSkusByBind() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Title 修改门店SkuName价格
|
|
||||||
// @Description 修改门店SkuName价格(支持活动中改价)
|
|
||||||
// @Param token header string true "认证token"
|
|
||||||
// @Param storeID formData int true "门店ID"
|
|
||||||
// @Param nameID formData int true "SkuName ID"
|
|
||||||
// @Param unitPrice formData int true "单价"
|
|
||||||
// @Param isAsync formData bool false "是否异步操作"
|
|
||||||
// @Success 200 {object} controllers.CallResult
|
|
||||||
// @Failure 200 {object} controllers.CallResult
|
|
||||||
// @router /UpdateStoreSkuNamePrice [put]
|
|
||||||
func (c *StoreSkuController) UpdateStoreSkuNamePrice() {
|
|
||||||
c.callUpdateStoreSkuNamePrice(func(params *tStoreSkuUpdateStoreSkuNamePriceParams) (retVal interface{}, errCode string, err error) {
|
|
||||||
retVal, err = cms.UpdateStoreSkuNamePrice(params.Ctx, params.StoreID, params.NameID, params.UnitPrice, params.IsAsync)
|
|
||||||
return retVal, "", err
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Title 拷贝门店SKU信息
|
// @Title 拷贝门店SKU信息
|
||||||
// @Description 拷贝门店SKU信息(此函数当前只是本地数据操作,要同步到远端需要调用SyncStoresSkus)
|
// @Description 拷贝门店SKU信息(此函数当前只是本地数据操作,要同步到远端需要调用SyncStoresSkus)
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
|
|||||||
Reference in New Issue
Block a user