From a0d833d4ae39fc1f738726d1bf7a740cc606b007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 7 Jan 2020 11:03:07 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/event/event.go | 6 ++++-- business/model/dao/dao_order.go | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/business/jxstore/event/event.go b/business/jxstore/event/event.go index 4a9713f86..429c57de3 100644 --- a/business/jxstore/event/event.go +++ b/business/jxstore/event/event.go @@ -1,9 +1,11 @@ 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) { } diff --git a/business/model/dao/dao_order.go b/business/model/dao/dao_order.go index 7339adfef..a0885ad7c 100644 --- a/business/model/dao/dao_order.go +++ b/business/model/dao/dao_order.go @@ -1096,6 +1096,7 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs, statuss []int, vendorOrd } else if IsReverse == 1 { sql += " AND link_id <> 0" } + sql += " ORDER BY supplement_time DESC" sql += " LIMIT ? OFFSET ?" sqlParams = append(sqlParams, pageSize, offset) Begin(db) From aa84f7ae317f158002002c48fc8f90cac67d69d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 09:15:20 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=A0=B9=E6=8D=AEskuID=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=85=B3=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 65bd5c91b..772e849a5 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2969,6 +2969,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuIDs []int, isAsync, isContin } } skuBindInfo := &StoreSkuBindInfo{ + StoreID: store.ID, NameID: k, UnitPrice: price, IsFocus: 1, @@ -2989,7 +2990,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuIDs []int, isAsync, isContin case 2: for _, v := range result1 { tUpdate := v.(*tUpdateStoresSkus) - UpdateStoresSkus(ctx, []int{tUpdate.StoreID}, tUpdate.SkuBindInfos, false, isAsync, isContinueWhenError) + UpdateStoresSkusByBind(ctx, tUpdate.SkuBindInfos, isAsync, isContinueWhenError) } } return result, err From f7d89c8fe3c37ffc4ddab31b27ad47354469df20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 09:25:08 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 772e849a5..23b422f2d 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -262,7 +262,7 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool sql += ` JOIN store_sku_bind t4 ON t4.store_id = t3.id AND t4.sku_id = t2.id AND t4.deleted_at = ? LEFT JOIN sku_name_place_bind t5 ON t1.id = t5.name_id AND t3.city_code = t5.place_code - LEFT JOIN price_refer_snapshot t6 ON t6.city_code = 0 AND t6.sku_id = t2.id AND t6.snapshot_at = ? + LEFT JOIN price_refer_snapshot t6 ON t6.city_code = 0 AND t6.name_id = t1.id AND t6.snapshot_at = ? WHERE t1.deleted_at = ? AND (t1.is_global = 1 OR t5.id IS NOT NULL OR 1 = ?)/* AND t1.status = ?*/ ` sqlParams = append(sqlParams, []interface{}{ From 743238b9ec085570d6a6561928ac2cdfe862cf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 09:28:45 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 23b422f2d..772e849a5 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -262,7 +262,7 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool sql += ` JOIN store_sku_bind t4 ON t4.store_id = t3.id AND t4.sku_id = t2.id AND t4.deleted_at = ? LEFT JOIN sku_name_place_bind t5 ON t1.id = t5.name_id AND t3.city_code = t5.place_code - LEFT JOIN price_refer_snapshot t6 ON t6.city_code = 0 AND t6.name_id = t1.id AND t6.snapshot_at = ? + LEFT JOIN price_refer_snapshot t6 ON t6.city_code = 0 AND t6.sku_id = t2.id AND t6.snapshot_at = ? WHERE t1.deleted_at = ? AND (t1.is_global = 1 OR t5.id IS NOT NULL OR 1 = ?)/* AND t1.status = ?*/ ` sqlParams = append(sqlParams, []interface{}{ From f5e8860b0ac185c0d9b2ab86a2f6ce9a303bf6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 09:46:05 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=8B=E5=8A=A1?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/report/report.go | 6 +++--- business/model/store.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index e2b9b8f78..ca0b29060 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -65,6 +65,9 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn var priceReferSnapshotList []*model.PriceReferSnapshot db := dao.GetDB() 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) { switch step { 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) { v := batchItemList[0].(*model.PriceReferSnapshot) dao.WrapAddIDCULDEntity(v, ctx.GetUserName()) diff --git a/business/model/store.go b/business/model/store.go index 26ade2838..604371afc 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -475,7 +475,8 @@ type PriceReferSnapshot struct { func (*PriceReferSnapshot) TableUnique() [][]string { return [][]string{ - []string{"CityCode", "NameID", "SkuID", "SnapshotAt"}, + []string{"CityCode", "SkuID", "SnapshotAt"}, + []string{"CityCode", "NameID", "SnapshotAt"}, } } From 5fed851b8d79fb6cde1b4413910c088fc6f7781b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 09:47:09 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/model/store.go b/business/model/store.go index 604371afc..3ae1ba43f 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -476,7 +476,7 @@ type PriceReferSnapshot struct { func (*PriceReferSnapshot) TableUnique() [][]string { return [][]string{ []string{"CityCode", "SkuID", "SnapshotAt"}, - []string{"CityCode", "NameID", "SnapshotAt"}, + []string{"CityCode", "NameID", "SkuID", "SnapshotAt"}, } } From 296d877d550d767e00a1d22b043accf00133b6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 10:20:50 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=85=B3=E6=B3=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 772e849a5..bbaeb71cf 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2872,6 +2872,7 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync, } for k, v := range skuNameMap { skuBindInfo := &StoreSkuBindInfo{ + StoreID: store.ID, NameID: k, UnitPrice: v, IsFocus: 1, @@ -2893,7 +2894,7 @@ func FocusStoreSkusByExcelBin(ctx *jxcontext.Context, reader io.Reader, isAsync, case 2: for _, v := range result1 { tUpdate := v.(*tUpdateStoresSkus) - UpdateStoresSkus(ctx, []int{tUpdate.StoreID}, tUpdate.SkuBindInfos, false, isAsync, isContinueWhenError) + UpdateStoresSkusByBind(ctx, tUpdate.SkuBindInfos, true, true) } } return result, err @@ -3048,12 +3049,13 @@ func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context) (err error payPercentage = v.PayPercentage } if len(skuNameAndPlaceList) > 0 { - for _, v := range skuNameAndPlaceList { - if skuNameMap[v.ID] != 0 { - priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{v.CityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) + for _, vv := range skuNameAndPlaceList { + if skuNameMap[vv.ID] != 0 { + 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 { storeSkuBindInfo := &StoreSkuBindInfo{ - NameID: v.ID, + StoreID: v.ID, + NameID: vv.ID, UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100, IsFocus: 1, IsSale: 0, @@ -3063,7 +3065,7 @@ func AutoFocusStoreSkusWithoutFocusForTopSkus(ctx *jxcontext.Context) (err error } } } - UpdateStoreSkus(ctx, v.ID, skuBindInfoList, true, true) + UpdateStoresSkusByBind(ctx, skuBindInfoList, true, true) } return err } From d7ae6eb9a277e19216cef837c95288786243a1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 10:30:03 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/cms_store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index dc1c5ae62..916fe9fbf 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -620,7 +620,7 @@ func (c *StoreSkuController) FocusStoreSkusBySku() { var skuIDList []int c.callFocusStoreSkusBySku(func(params *tStoreSkuFocusStoreSkusBySkuParams) (retVal interface{}, errCode string, err error) { 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 })