From 2b53dbb7084afb799f184eb6f2f073bd810e0063 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, 17 Mar 2021 09:21:57 +0800 Subject: [PATCH] aa --- business/jxstore/cms/store_sku.go | 22 ++++++++++++++-------- business/jxstore/misc/misc.go | 6 +++--- business/jxstore/report/report.go | 16 ++++++++-------- controllers/cms_store_sku.go | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 88a86a9b1..c84e38fe6 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -5278,11 +5278,11 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act func GetVendorStoreSkus(ctx *jxcontext.Context, storeID, vendorID int) (err error) { type SpecialtyStoreSkus struct { - Upc int `json:"商品upc码"` - SkuName string `json:"商品名"` - Unit int `json:"单位"` - Weight float64 `json:"重量(g)"` - Price float64 `json:"售价"` + Upc string `json:"商品upc码"` + SkuName string `json:"商品名"` + Unit string `json:"单位"` + Weight int `json:"重量(g)"` + Price int64 `json:"售价"` } var ( db = dao.GetDB() @@ -5309,9 +5309,15 @@ func GetVendorStoreSkus(ctx *jxcontext.Context, storeID, vendorID int) (err erro handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler) skuList, _ := handler.GetStoreSkusFullInfo(ctx, nil, storeID, storeDetail.VendorStoreID, nil) for _, sku := range skuList { - if sku.SkuList[0].IsSpecialty == model.YES { - specialtyStoreSku := &SpecialtyStoreSkus{} - specialtyStoreSkus = append(specialtyStoreSkus, specialtyStoreSku) + if sku.UPC != "" { + skus := &SpecialtyStoreSkus{ + Upc: sku.UPC, + SkuName: sku.Name, + Unit: sku.Unit, + Weight: sku.SkuList[0].Weight, + Price: sku.SkuList[0].VendorPrice, + } + specialtyStoreSkus = append(specialtyStoreSkus, skus) } } } diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index d5af69df3..f65ef16c2 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -193,9 +193,9 @@ func Init() { // cms.OpenRemoteStoreByJxStatus(jxcontext.AdminCtx, nil, nil, false, false, true) }, openRemoteStoreTimeList) - ScheduleTimerFunc("SaveAndSendAlarmVendorSnapshot", func() { - cms.SaveAndSendAlarmVendorSnapshot(jxcontext.AdminCtx, nil, nil, false) - }, cms.WatchVendorStoreTimeList) + // ScheduleTimerFunc("SaveAndSendAlarmVendorSnapshot", func() { + // cms.SaveAndSendAlarmVendorSnapshot(jxcontext.AdminCtx, nil, nil, false) + // }, cms.WatchVendorStoreTimeList) ScheduleTimerFunc("RefreshPageActs", func() { act.RefreshPageActs(jxcontext.AdminCtx, []int{model.VendorIDEBAI}, time.Now().Add(-30*24*time.Hour), false) diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index 50af9334a..3ef174c96 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -397,7 +397,7 @@ func RefreshStoreManageState(ctx *jxcontext.Context) { db = dao.GetDB() vendorIDs = []int{model.VendorIDJD, model.VendorIDMTWM, model.VendorIDEBAI} dayTimeBegin, dayTimeEnd = utils.Str2Time(utils.Time2Str(utils.Time2Date(time.Now())) + "00:00:00"), utils.Str2Time(utils.Time2Str(utils.Time2Date(time.Now())) + "23:59:59") - coverAreaFlag = time.Now().Hour() == 9 && time.Now().Minute() > 50 && time.Now().Minute() < 59 + // coverAreaFlag = time.Now().Hour() == 9 && time.Now().Minute() > 50 && time.Now().Minute() < 59 ) task := tasksch.NewParallelTask("RefreshStoreManageState", tasksch.NewParallelConfig().SetParallelCount(3).SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { @@ -417,14 +417,14 @@ func RefreshStoreManageState(ctx *jxcontext.Context) { dao.WrapAddIDCULEntity(storeManage, ctx.GetUserName()) handler := partner.GetPurchasePlatformFromVendorID(vendorID) store, err := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID) - if coverAreaFlag { - if vendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon { - storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", math.Pi*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000))) - } else { - storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), vendorID))) - } + // if coverAreaFlag { + if vendorID == model.VendorIDJD && store.DeliveryRangeType != model.DeliveryRangeTypePolygon { + storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", math.Pi*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000)*utils.Str2Float64WithDefault(store.DeliveryRange, 0)/float64(1000))) + } else { + storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), vendorID))) } - // storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", storeManage.CoverArea)) + // } + storeManage.CoverArea = utils.Str2Float64(fmt.Sprintf("%.2f", storeManage.CoverArea)) //营业状态 storeManage.VendorStatus = store.Status //营业时长 diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 2d96c4ebe..110c651f7 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -923,3 +923,18 @@ func (c *StoreSkuController) GetSpecialtyStoreSkus() { return retVal, "", err }) } + +// @Title 拉取平台标品 +// @Description 拉取平台标品 +// @Param token header string true "认证token" +// @Param vendorID formData int true "平台id" +// @Param storeID formData int true "门店ID" +// @Success 200 {object} controllers.CallResult +// @Failure 200 {object} controllers.CallResult +// @router /GetVendorStoreSkus [post] +func (c *StoreSkuController) GetVendorStoreSkus() { + c.callGetVendorStoreSkus(func(params *tStoreSkuGetVendorStoreSkusParams) (retVal interface{}, errCode string, err error) { + err = cms.GetVendorStoreSkus(params.Ctx, params.StoreID, params.VendorID) + return retVal, "", err + }) +}