批量关注改价测试
This commit is contained in:
@@ -1020,7 +1020,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
if user := ctx.GetFullUser(); user != nil {
|
if user := ctx.GetFullUser(); user != nil {
|
||||||
isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0
|
isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0
|
||||||
}
|
}
|
||||||
|
fmt.Println("test1")
|
||||||
userName := ctx.GetUserName()
|
userName := ctx.GetUserName()
|
||||||
needSyncIDMap := make(map[int]int)
|
needSyncIDMap := make(map[int]int)
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
@@ -1037,6 +1037,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
dao.Rollback(db)
|
dao.Rollback(db)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
fmt.Println("test2")
|
||||||
scaleFactor := float64(1)
|
scaleFactor := float64(1)
|
||||||
if isScale {
|
if isScale {
|
||||||
scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage))
|
scaleFactor = 100 / float64(jxutils.ConstrainPayPercentage(storeDetail.PayPercentage))
|
||||||
@@ -1083,6 +1084,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
|||||||
sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue)
|
sqlParams = append(sqlParams, skuBindInfo.NameID, utils.DefaultTimeValue)
|
||||||
// globals.SugarLogger.Debug(sql)
|
// globals.SugarLogger.Debug(sql)
|
||||||
if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil {
|
if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil {
|
||||||
|
fmt.Println("test3")
|
||||||
if len(allBinds) > 0 {
|
if len(allBinds) > 0 {
|
||||||
// globals.SugarLogger.Debug(utils.Format4Output(allBinds, false))
|
// globals.SugarLogger.Debug(utils.Format4Output(allBinds, false))
|
||||||
inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds))
|
inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds))
|
||||||
@@ -4585,12 +4587,12 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto
|
|||||||
if len(storeAudits) > 0 {
|
if len(storeAudits) > 0 {
|
||||||
storeAudits[0].DeletedAt = time.Now()
|
storeAudits[0].DeletedAt = time.Now()
|
||||||
dao.UpdateEntity(db, storeAudits[0], "DeletedAt")
|
dao.UpdateEntity(db, storeAudits[0], "DeletedAt")
|
||||||
if globals.IsProductEnv() {
|
// if globals.IsProductEnv() {
|
||||||
skuAndNames, err := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, nil)
|
// skuAndNames, err := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, nil)
|
||||||
if len(skuAndNames) > 0 && err == nil {
|
// if len(skuAndNames) > 0 && err == nil {
|
||||||
weixinmsg.NotifyStoreOpRequestStatus(true, storeID, skuBindInfo.NameID, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, skuBindInfo.UnitPrice, "")
|
// weixinmsg.NotifyStoreOpRequestStatus(true, storeID, skuBindInfo.NameID, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, skuBindInfo.UnitPrice, "")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("doStoreSkuAudit return3 storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
globals.SugarLogger.Debugf("doStoreSkuAudit return3 storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
||||||
return false, err
|
return false, err
|
||||||
|
|||||||
@@ -1668,32 +1668,31 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
|||||||
vendorMap[v.SkuList[0].SkuID] = v
|
vendorMap[v.SkuList[0].SkuID] = v
|
||||||
}
|
}
|
||||||
for _, v := range storeSkuList {
|
for _, v := range storeSkuList {
|
||||||
if vendorMap[v.SkuID] == nil && v.Status == model.StoreSkuBindStatusNormal {
|
if vendorMap[v.SkuID] == nil {
|
||||||
addList = append(addList, v.SkuID)
|
if v.Status == model.StoreSkuBindStatusNormal {
|
||||||
|
addList = append(addList, v.SkuID)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("vendorMap", utils.Format4Output(vendorMap[v.SkuID], false))
|
if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice {
|
||||||
if vendorMap[v.SkuID].SkuList[0] != nil {
|
updateList = append(updateList, &tTmp{
|
||||||
if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice {
|
SkuID: v.SkuID,
|
||||||
|
Reason: "价格不同",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if v.Status != vendorStock2JxStatus(vendorMap[v.SkuID].SkuList[0].Stock) {
|
||||||
|
updateList = append(updateList, &tTmp{
|
||||||
|
SkuID: v.SkuID,
|
||||||
|
Reason: "库存可售不同",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
skus, _ := dao.GetSkus(dao.GetDB(), []int{v.SkuID}, nil, nil, nil, nil)
|
||||||
|
if skus[0].Comment != "" {
|
||||||
|
if skus[0].Comment != vendorMap[v.SkuID].SkuList[0].Comment {
|
||||||
updateList = append(updateList, &tTmp{
|
updateList = append(updateList, &tTmp{
|
||||||
SkuID: v.SkuID,
|
SkuID: v.SkuID,
|
||||||
Reason: "价格不同",
|
Reason: "备注与销售属性不同",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if v.Status != vendorStock2JxStatus(vendorMap[v.SkuID].SkuList[0].Stock) {
|
|
||||||
updateList = append(updateList, &tTmp{
|
|
||||||
SkuID: v.SkuID,
|
|
||||||
Reason: "库存可售不同",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
skus, _ := dao.GetSkus(dao.GetDB(), []int{v.SkuID}, nil, nil, nil, nil)
|
|
||||||
if skus[0].Comment != "" {
|
|
||||||
if skus[0].Comment != vendorMap[v.SkuID].SkuList[0].Comment {
|
|
||||||
updateList = append(updateList, &tTmp{
|
|
||||||
SkuID: v.SkuID,
|
|
||||||
Reason: "备注与销售属性不同",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localMap[v.SkuID] = v
|
localMap[v.SkuID] = v
|
||||||
|
|||||||
Reference in New Issue
Block a user