价格统计
This commit is contained in:
@@ -81,5 +81,26 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int) (err e
|
||||
_, err = task.GetResult(0)
|
||||
dao.Commit(db)
|
||||
}
|
||||
priceReferSnapshotList, err := dao.GetPriceReferSnapshotNoPage(db, nil, nil, nil, snapshotAt)
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db)
|
||||
if r != nil {
|
||||
panic(r)
|
||||
}
|
||||
}
|
||||
}()
|
||||
if len(priceReferSnapshotList) > 0 {
|
||||
for _, v := range priceReferSnapshotList {
|
||||
result, _ := dao.GetPriceReferPrice(db, v.CityCode, v.SkuID, snapshotAt)
|
||||
v.MaxPrice = result.MaxPrice
|
||||
v.MinPrice = result.MinPrice
|
||||
v.AvgPrice = result.AvgPrice
|
||||
v.MidPrice = result.MidPrice
|
||||
dao.UpdateEntity(db, v, "MidPrice", "MaxPrice", "MinPrice", "AvgPrice")
|
||||
}
|
||||
}
|
||||
dao.Commit(db)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user