From 2f465df551ada418f4ec1d0e7c4c023c8cd5e7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 25 May 2020 09:43:59 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=9C=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E7=9B=B4=E8=BE=96=E5=B8=82=E9=97=A8=E5=BA=97=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 89 ++++++++++++++++++++----------- business/model/store.go | 1 + 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index ea12386ea..b050c6a2f 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -18,7 +18,6 @@ import ( "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils/errlist" "git.rosy.net.cn/jx-callback/business/jxstore/cms" - "git.rosy.net.cn/jx-callback/business/jxstore/misc" "git.rosy.net.cn/jx-callback/business/jxutils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" @@ -1523,37 +1522,63 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } // } // } - beginTime := utils.Str2Time("2020-05-18") - endTime := utils.Str2Time("2020-05-24") - result, _ := misc.GetStoreTotalScoreList(nil, 0, "", beginTime, endTime, true, 50, 100, 1, 700) - for _, v := range result.StoreTotalScoreList { - storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJX}, []int{v.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "") - if len(storeMaps) == 0 { - stores, _ := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, "") - store := stores[0] - if store.Status != model.StoreStatusDisabled && !strings.Contains(store.Name, "不做") { - pricePercentagePack := "" - if store.PayPercentage >= 90 { - pricePercentagePack = "京西100" - } else if store.PayPercentage >= 80 { - pricePercentagePack = "京西80" - } else { - pricePercentagePack = "京西70" - } - storeMap := &model.StoreMap{ - Status: 1, - VendorID: model.VendorIDJX, - AutoPickup: 1, - DeliveryCompetition: 1, - PricePercentage: 100, - IsSync: 1, - VendorStoreID: utils.Int2Str(v.StoreID), - PricePercentagePack: pricePercentagePack, - } - _, err = cms.AddStoreVendorMap(ctx, db, model.VendorIDJX, "", v.StoreID, storeMap) - if err != nil { - continue - } + + ///建店 + // beginTime := utils.Str2Time("2020-05-18") + // endTime := utils.Str2Time("2020-05-24") + // result, _ := misc.GetStoreTotalScoreList(nil, 0, "", beginTime, endTime, true, 50, 100, 1, 700) + // for _, v := range result.StoreTotalScoreList { + // storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJX}, []int{v.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "") + // if len(storeMaps) == 0 { + // stores, _ := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, "") + // store := stores[0] + // if store.Status != model.StoreStatusDisabled && !strings.Contains(store.Name, "不做") { + // pricePercentagePack := "" + // if store.PayPercentage >= 90 { + // pricePercentagePack = "京西100" + // } else if store.PayPercentage >= 80 { + // pricePercentagePack = "京西80" + // } else { + // pricePercentagePack = "京西70" + // } + // storeMap := &model.StoreMap{ + // Status: 1, + // VendorID: model.VendorIDJX, + // AutoPickup: 1, + // DeliveryCompetition: 1, + // PricePercentage: 100, + // IsSync: 1, + // VendorStoreID: utils.Int2Str(v.StoreID), + // PricePercentagePack: pricePercentagePack, + // } + // _, err = cms.AddStoreVendorMap(ctx, db, model.VendorIDJX, "", v.StoreID, storeMap) + // if err != nil { + // continue + // } + // } + // } + // } + + //京东商城街道code + var stores []*model.Store + sql := ` + SELECT b.* + FROM store_map a, store b + WHERE a.store_id = b.id + AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ? + AND b.deleted_at = ? + ` + sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue} + err = dao.GetRows(db, &stores, sql, sqlParams) + for _, v := range stores { + result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat)) + if result["regeocode"] != nil { + street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string) + if street != "" { + storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "") + storeMap := storeMaps[0] + storeMap.JdsStreetName = street + dao.UpdateEntity(db, storeMap, "JdsStreetName") } } } diff --git a/business/model/store.go b/business/model/store.go index 7f0bd4c47..647cc86d4 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -428,6 +428,7 @@ type StoreMap struct { FakeOpenStop int16 `orm:"default(0)" json:"fakeOpenStop"` // 假开店结束 JdStoreLevel string `orm:"size(32)" json:"jdStoreLevel"` //京东门店等级 JdsStreetCode int `orm:"default(0)" json:"jdsStreetCode"` //京东商城直辖市街道code + JdsStreetName string `orm:"size(32)" json:"jdsStreetName"` //京东商城直辖市街道 IsOrder int `orm:"default(0)" json:"isOrder"` //是否是下预订单门店