Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark

This commit is contained in:
gazebo
2020-01-08 10:39:19 +08:00
6 changed files with 20 additions and 13 deletions

View File

@@ -2872,6 +2872,7 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync,
} }
for k, v := range skuNameMap { for k, v := range skuNameMap {
skuBindInfo := &StoreSkuBindInfo{ skuBindInfo := &StoreSkuBindInfo{
StoreID: store.ID,
NameID: k, NameID: k,
UnitPrice: v, UnitPrice: v,
IsFocus: 1, IsFocus: 1,
@@ -2893,7 +2894,7 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync,
case 2: case 2:
for _, v := range result1 { for _, v := range result1 {
tUpdate := v.(*tUpdateStoresSkus) tUpdate := v.(*tUpdateStoresSkus)
UpdateStoresSkus(ctx, []int{tUpdate.StoreID}, tUpdate.SkuBindInfos, false, isAsync, isContinueWhenError) UpdateStoresSkusByBind(ctx, tUpdate.SkuBindInfos, true, true)
} }
} }
return result, err return result, err
@@ -2969,6 +2970,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuIDs []int, isAsync, isContin
} }
} }
skuBindInfo := &StoreSkuBindInfo{ skuBindInfo := &StoreSkuBindInfo{
StoreID: store.ID,
NameID: k, NameID: k,
UnitPrice: price, UnitPrice: price,
IsFocus: 1, IsFocus: 1,
@@ -2989,7 +2991,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuIDs []int, isAsync, isContin
case 2: case 2:
for _, v := range result1 { for _, v := range result1 {
tUpdate := v.(*tUpdateStoresSkus) tUpdate := v.(*tUpdateStoresSkus)
UpdateStoresSkus(ctx, []int{tUpdate.StoreID}, tUpdate.SkuBindInfos, false, isAsync, isContinueWhenError) UpdateStoresSkusByBind(ctx, tUpdate.SkuBindInfos, isAsync, isContinueWhenError)
} }
} }
return result, err return result, err
@@ -3047,12 +3049,13 @@ func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context) (err error
payPercentage = v.PayPercentage payPercentage = v.PayPercentage
} }
if len(skuNameAndPlaceList) > 0 { if len(skuNameAndPlaceList) > 0 {
for _, v := range skuNameAndPlaceList { for _, vv := range skuNameAndPlaceList {
if skuNameMap[v.ID] != 0 { if skuNameMap[vv.ID] != 0 {
priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{v.CityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{vv.CityCode}, nil, []int{vv.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
if err == nil && len(priceReferList) > 0 { if err == nil && len(priceReferList) > 0 {
storeSkuBindInfo := &StoreSkuBindInfo{ storeSkuBindInfo := &StoreSkuBindInfo{
NameID: v.ID, StoreID: v.ID,
NameID: vv.ID,
UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100, UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100,
IsFocus: 1, IsFocus: 1,
IsSale: 0, IsSale: 0,
@@ -3062,7 +3065,7 @@ func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context) (err error
} }
} }
} }
UpdateStoreSkus(ctx, v.ID, skuBindInfoList, true, true) UpdateStoresSkusByBind(ctx, skuBindInfoList, true, true)
} }
return err return err
} }

View File

@@ -1,9 +1,11 @@
package event package event
func AddOperateEvent() { import "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
func AddOperateEvent(ctx *jxcontext.Context) {
} }
func AddOperateEventDetail() { func AddOperateEventDetail(ctx *jxcontext.Context) {
} }

View File

@@ -65,6 +65,9 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
var priceReferSnapshotList []*model.PriceReferSnapshot var priceReferSnapshotList []*model.PriceReferSnapshot
db := dao.GetDB() db := dao.GetDB()
snapshotAt := utils.Time2Date(time.Now().AddDate(0, 0, -1)) snapshotAt := utils.Time2Date(time.Now().AddDate(0, 0, -1))
dao.DeletePriceReferHistory(db, utils.Time2Date(snapshotAt.AddDate(0, 0, -7)))
priceReferSnapshotDelete := &model.PriceReferSnapshot{SnapshotAt: snapshotAt}
dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt")
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:
@@ -79,9 +82,6 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
} }
} }
}() }()
dao.DeletePriceReferHistory(db, utils.Time2Date(snapshotAt.AddDate(0, 0, -7)))
priceReferSnapshotDelete := &model.PriceReferSnapshot{SnapshotAt: snapshotAt}
dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt")
taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
v := batchItemList[0].(*model.PriceReferSnapshot) v := batchItemList[0].(*model.PriceReferSnapshot)
dao.WrapAddIDCULDEntity(v, ctx.GetUserName()) dao.WrapAddIDCULDEntity(v, ctx.GetUserName())

View File

@@ -1101,6 +1101,7 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs, statuss []int, vendorOrd
} else if IsReverse == 1 { } else if IsReverse == 1 {
sql += " AND link_id <> 0" sql += " AND link_id <> 0"
} }
sql += " ORDER BY supplement_time DESC"
sql += " LIMIT ? OFFSET ?" sql += " LIMIT ? OFFSET ?"
sqlParams = append(sqlParams, pageSize, offset) sqlParams = append(sqlParams, pageSize, offset)
Begin(db) Begin(db)

View File

@@ -475,6 +475,7 @@ type PriceReferSnapshot struct {
func (*PriceReferSnapshot) TableUnique() [][]string { func (*PriceReferSnapshot) TableUnique() [][]string {
return [][]string{ return [][]string{
[]string{"CityCode", "SkuID", "SnapshotAt"},
[]string{"CityCode", "NameID", "SkuID", "SnapshotAt"}, []string{"CityCode", "NameID", "SkuID", "SnapshotAt"},
} }
} }

View File

@@ -620,7 +620,7 @@ func (c *StoreSkuController) FocusStoreSkusBySku() {
var skuIDList []int var skuIDList []int
c.callFocusStoreSkusBySku(func(params *tStoreSkuFocusStoreSkusBySkuParams) (retVal interface{}, errCode string, err error) { c.callFocusStoreSkusBySku(func(params *tStoreSkuFocusStoreSkusBySkuParams) (retVal interface{}, errCode string, err error) {
if jxutils.Strings2Objs(params.SkuIDs, &skuIDList); err == nil { if jxutils.Strings2Objs(params.SkuIDs, &skuIDList); err == nil {
retVal, err = cms.FocusStoreSkusBySku(params.Ctx, skuIDList, params.IsAsync, params.IsContinueWhenError) // retVal, err = cms.FocusStoreSkusBySku(params.Ctx, skuIDList, params.IsAsync, params.IsContinueWhenError)
} }
return retVal, "", err return retVal, "", err
}) })