Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark
This commit is contained in:
@@ -1379,6 +1379,12 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fro
|
|||||||
payload["exPrefixBegin"] = nil
|
payload["exPrefixBegin"] = nil
|
||||||
payload["exPrefixEnd"] = nil
|
payload["exPrefixEnd"] = nil
|
||||||
_, err = UpdateSkuName(ctx, nameID, payload)
|
_, err = UpdateSkuName(ctx, nameID, payload)
|
||||||
|
} else {
|
||||||
|
skuList, err := dao.GetSkus(db, nil, []int{nameID}, nil, nil)
|
||||||
|
if err == nil && len(skuList) > 0 {
|
||||||
|
if skuList[0].ExPrefixBegin != nil {
|
||||||
|
_, err = UpdateSkuName(ctx, nameID, payload)
|
||||||
|
CurVendorSync.SyncStoresSkus2(ctx, db, partner.GetSingleStoreVendorIDs(), nil, false, []int{skuList[0].ID}, nil, model.SyncFlagModifiedMask, true, true)
|
||||||
} else {
|
} else {
|
||||||
skuName := &model.SkuName{
|
skuName := &model.SkuName{
|
||||||
ExPrefix: exPrefix,
|
ExPrefix: exPrefix,
|
||||||
@@ -1398,6 +1404,8 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fro
|
|||||||
_, err = dao.UpdateEntity(db, skuName, "ExPrefix", "ExPrefixBegin", "ExPrefixEnd", "LastOperator", "UpdatedAt")
|
_, err = dao.UpdateEntity(db, skuName, "ExPrefix", "ExPrefixBegin", "ExPrefixEnd", "LastOperator", "UpdatedAt")
|
||||||
dao.Commit(db)
|
dao.Commit(db)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}, nameIDs)
|
}, nameIDs)
|
||||||
tasksch.HandleTask(task, nil, true).Run()
|
tasksch.HandleTask(task, nil, true).Run()
|
||||||
@@ -1411,7 +1419,7 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, exPrefix, fro
|
|||||||
for _, v := range skuList {
|
for _, v := range skuList {
|
||||||
skuIDs = append(skuIDs, v.ID)
|
skuIDs = append(skuIDs, v.ID)
|
||||||
}
|
}
|
||||||
CurVendorSync.SyncStoresSkus2(ctx, db, partner.GetSingleStoreVendorIDs(), nil, false, skuIDs, nil, 0, true, true)
|
CurVendorSync.SyncStoresSkus2(ctx, db, partner.GetSingleStoreVendorIDs(), nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2759,13 +2759,13 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync,
|
|||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
storeIDs []int
|
storeIDs []int
|
||||||
skuIDs []int
|
skuIDs []int
|
||||||
price int
|
|
||||||
)
|
)
|
||||||
sheetParam := &SheetParam{
|
sheetParam := &SheetParam{
|
||||||
OutSkuIDCol: 1,
|
OutSkuIDCol: 1,
|
||||||
SkuPriceCol: 3,
|
SkuPriceCol: 3,
|
||||||
SkuRow: 1,
|
SkuRow: 1,
|
||||||
}
|
}
|
||||||
|
// xlsx, err := excelize.OpenFile("111.xlsx")
|
||||||
xlsx, err := excelize.OpenReader(reader)
|
xlsx, err := excelize.OpenReader(reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@@ -2785,8 +2785,19 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, v := range skuList {
|
for _, v := range skuList {
|
||||||
|
var (
|
||||||
|
price int
|
||||||
|
specQuality float64
|
||||||
|
)
|
||||||
if v.Unit == model.SpecialUnit {
|
if v.Unit == model.SpecialUnit {
|
||||||
price = model.SpecialSpecQuality / int(utils.Float64TwoInt64(float64(v.SpecQuality))) * skuMap[v.ID]
|
if v.SpecUnit == model.SpecUnitNames[1] || v.SpecUnit == model.SpecUnitNames[2] {
|
||||||
|
specQuality = float64(v.SpecQuality) * 1000
|
||||||
|
} else {
|
||||||
|
specQuality = float64(v.SpecQuality)
|
||||||
|
}
|
||||||
|
price = int(utils.Float64TwoInt64(utils.Int2Float64(model.SpecialSpecQuality) / specQuality * utils.Int2Float64(skuMap[v.ID])))
|
||||||
|
} else {
|
||||||
|
price = skuMap[v.ID]
|
||||||
}
|
}
|
||||||
if skuNameMap[v.NameID] < price {
|
if skuNameMap[v.NameID] < price {
|
||||||
skuNameMap[v.NameID] = price
|
skuNameMap[v.NameID] = price
|
||||||
|
|||||||
@@ -360,10 +360,10 @@ func ComposeSkuName(prefix, name, comment, unit string, spec_quality float32, sp
|
|||||||
|
|
||||||
func ComposeSkuNameSync(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd *time.Time) (skuName string) {
|
func ComposeSkuNameSync(prefix, name, comment, unit string, spec_quality float32, spec_unit string, maxLen int, exPrefix string, exPrefixBegin, exPrefixEnd *time.Time) (skuName string) {
|
||||||
if exPrefix != "" && exPrefixBegin != nil && exPrefixEnd != nil {
|
if exPrefix != "" && exPrefixBegin != nil && exPrefixEnd != nil {
|
||||||
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) < 0 {
|
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixBegin) >= 0 && utils.Time2Date(time.Now()).Sub(*exPrefixEnd) <= 0 {
|
||||||
skuName = exPrefix
|
skuName = exPrefix
|
||||||
}
|
}
|
||||||
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixEnd) >= 0 {
|
if utils.Time2Date(time.Now().Add(6*time.Hour)).Sub(*exPrefixEnd) > 0 {
|
||||||
skuName = ""
|
skuName = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user