批量关注改价测试
This commit is contained in:
@@ -1020,7 +1020,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
if user := ctx.GetFullUser(); user != nil {
|
||||
isUserCanDirectChangePrice = user.Type&model.UserTypeOperator != 0
|
||||
}
|
||||
|
||||
fmt.Println("test1")
|
||||
userName := ctx.GetUserName()
|
||||
needSyncIDMap := make(map[int]int)
|
||||
dao.Begin(db)
|
||||
@@ -1037,6 +1037,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
dao.Rollback(db)
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println("test2")
|
||||
scaleFactor := float64(1)
|
||||
if isScale {
|
||||
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)
|
||||
// globals.SugarLogger.Debug(sql)
|
||||
if err = dao.GetRows(db, &allBinds, sql, sqlParams...); err == nil {
|
||||
fmt.Println("test3")
|
||||
if len(allBinds) > 0 {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(allBinds, false))
|
||||
inSkuBinsMap := make(map[int]*StoreSkuBindSkuInfo, len(inSkuBinds))
|
||||
@@ -4585,12 +4587,12 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto
|
||||
if len(storeAudits) > 0 {
|
||||
storeAudits[0].DeletedAt = time.Now()
|
||||
dao.UpdateEntity(db, storeAudits[0], "DeletedAt")
|
||||
if globals.IsProductEnv() {
|
||||
skuAndNames, err := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, 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, "")
|
||||
}
|
||||
}
|
||||
// if globals.IsProductEnv() {
|
||||
// skuAndNames, err := dao.GetSkus(db, nil, []int{skuBindInfo.NameID}, nil, nil, 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, "")
|
||||
// }
|
||||
// }
|
||||
}
|
||||
globals.SugarLogger.Debugf("doStoreSkuAudit return3 storeID : %v nameID: %v", storeID, skuBindInfo.NameID)
|
||||
return false, err
|
||||
|
||||
@@ -1668,32 +1668,31 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
vendorMap[v.SkuList[0].SkuID] = v
|
||||
}
|
||||
for _, v := range storeSkuList {
|
||||
if vendorMap[v.SkuID] == nil && v.Status == model.StoreSkuBindStatusNormal {
|
||||
addList = append(addList, v.SkuID)
|
||||
if vendorMap[v.SkuID] == nil {
|
||||
if v.Status == model.StoreSkuBindStatusNormal {
|
||||
addList = append(addList, v.SkuID)
|
||||
}
|
||||
} else {
|
||||
fmt.Println("vendorMap", utils.Format4Output(vendorMap[v.SkuID], false))
|
||||
if vendorMap[v.SkuID].SkuList[0] != nil {
|
||||
if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice {
|
||||
if int64(v.JdsPrice) != vendorMap[v.SkuID].SkuList[0].VendorPrice {
|
||||
updateList = append(updateList, &tTmp{
|
||||
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{
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user