根据excel更新京西价

This commit is contained in:
苏尹岚
2019-12-12 14:40:20 +08:00
parent dd58517099
commit 99da2e9824

View File

@@ -2193,8 +2193,8 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) { taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
switch step { switch step {
case 0: case 0:
// xlsx, err := excelize.OpenFile("111.xlsx")
xlsx, err := excelize.OpenReader(reader) xlsx, err := excelize.OpenReader(reader)
// xlsx, err := excelize.OpenFile("111.xlsx")
if err != nil { if err != nil {
return "", err return "", err
} }
@@ -2229,9 +2229,15 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
skuList, err2 := dao.GetStoreSkusByNameIDs(db, []int{vv}, nameID) skuList, err2 := dao.GetStoreSkusByNameIDs(db, []int{vv}, nameID)
err = err2 err = err2
if len(skuList) > 0 { if len(skuList) > 0 {
unitPrice := 0
if storeSkuNamePrice.Unit == "KG" {
unitPrice = storeSkuNamePrice.Price / 2
} else {
unitPrice = storeSkuNamePrice.Price
}
storeSkuBindInfo := &StoreSkuBindInfo{ storeSkuBindInfo := &StoreSkuBindInfo{
NameID: nameID, NameID: nameID,
UnitPrice: storeSkuNamePrice.Price, UnitPrice: unitPrice,
} }
skuBindInfos = append(skuBindInfos, storeSkuBindInfo) skuBindInfos = append(skuBindInfos, storeSkuBindInfo)
outSuccess := DataSuccess{ outSuccess := DataSuccess{
@@ -2239,8 +2245,8 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
Name: skuList[0].Name, Name: skuList[0].Name,
Unit: storeSkuNamePrice.Unit, Unit: storeSkuNamePrice.Unit,
OrgPrice: utils.Str2Float64(utils.Int64ToStr(skuList[0].UnitPrice / 100)), OrgPrice: utils.Str2Float64(utils.Int64ToStr(skuList[0].UnitPrice / 100)),
NowPrice: utils.Str2Float64(utils.Int64ToStr(int64(storeSkuNamePrice.Price / 100))), NowPrice: utils.Str2Float64(utils.Int64ToStr(int64(unitPrice / 100))),
MixPrice: utils.Str2Float64(utils.Int64ToStr(int64(storeSkuNamePrice.Price) - skuList[0].UnitPrice)), MixPrice: utils.Str2Float64(utils.Int64ToStr(int64(unitPrice) - skuList[0].UnitPrice)),
} }
dataLock.AppendDataSuccess(outSuccess) dataLock.AppendDataSuccess(outSuccess)
} else { } else {