From 5ce66681853b9f6efe0f4ae454021e08d1b69468 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 26 Feb 2021 21:08:48 +0800 Subject: [PATCH 01/32] aa --- business/jxstore/cms/store.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index b656cdfa3..1feb65f08 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1190,14 +1190,16 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend return nil, fmt.Errorf("必须指定平台分账号信息") } if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil { - store, err2 := handler.ReadStore(ctx, vendorOrgCode, storeMap.VendorStoreID) - if err = err2; err == nil || storeMap.IsSync == 0 { - if store != nil { - storeMap.DeliveryType = store.DeliveryType - storeMap.Status = store.Status + if vendorOrgCode != "5873" { + store, err2 := handler.ReadStore(ctx, vendorOrgCode, storeMap.VendorStoreID) + if err = err2; err == nil || storeMap.IsSync == 0 { + if store != nil { + storeMap.DeliveryType = store.DeliveryType + storeMap.Status = store.Status + } + err = nil + storeMap.SyncStatus = model.SyncFlagModifiedMask | model.SyncFlagStoreName | model.SyncFlagStoreAddress // 新增绑定门店是修改的概念 } - err = nil - storeMap.SyncStatus = model.SyncFlagModifiedMask | model.SyncFlagStoreName | model.SyncFlagStoreAddress // 新增绑定门店是修改的概念 } } else { err = ErrCanNotFindVendor From 2060998750dc9bbc832cebcae9c7690fb0ebca44 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Fri, 26 Feb 2021 21:26:28 +0800 Subject: [PATCH 02/32] aa --- business/jxstore/cms/store.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 1feb65f08..8be7abc60 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -18,8 +18,10 @@ import ( "git.rosy.net.cn/jx-callback/business/authz" + "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/platformapi/yinbaoapi" + "git.rosy.net.cn/jx-callback/globals/api/apimanager" "git.rosy.net.cn/jx-callback/globals/refutil" "github.com/360EntSecGroup-Skylar/excelize" @@ -1278,13 +1280,13 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend } else if vendorID == model.VendorIDMTWM { //如果是绑的美团超市,要去更新token if outStoreMap.VendorOrgCode == globals.Mtwm2Code { - // mtapi := apimanager.CurAPIManager.GetAPI(model.VendorIDMTWM, outStoreMap.VendorOrgCode).(*mtwmapi.API) - // if result, err := mtapi.GetOAuthCode(outStoreMap.VendorStoreID); result != nil && err == nil { - // if token, err := mtapi.GetAccessToken(result.(string)); err == nil && token != nil { - // outStoreMap.MtwmToken = token.(string) - // dao.UpdateEntity(db, outStoreMap, "MtwmToken") - // } - // } + mtapi := apimanager.CurAPIManager.GetAPI(model.VendorIDMTWM, outStoreMap.VendorOrgCode).(*mtwmapi.API) + if result, err := mtapi.GetOAuthCode(outStoreMap.VendorStoreID); result != nil && err == nil { + if token, err := mtapi.GetAccessToken(result.(string)); err == nil && token != nil { + outStoreMap.MtwmToken = token.(string) + dao.UpdateEntity(db, outStoreMap, "MtwmToken") + } + } } } if globals.IsAddEvent { From 7d2c15935bdb991aaecf4e72525e8f3ee32e0f1d 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, 1 Mar 2021 09:12:05 +0800 Subject: [PATCH 03/32] aa --- .../scheduler/basesch/basesch_ext.go | 2 +- business/model/dao/store.go | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/scheduler/basesch/basesch_ext.go b/business/jxcallback/scheduler/basesch/basesch_ext.go index efa2e3287..98d8ed087 100644 --- a/business/jxcallback/scheduler/basesch/basesch_ext.go +++ b/business/jxcallback/scheduler/basesch/basesch_ext.go @@ -29,7 +29,7 @@ const ( func (c *BaseScheduler) CreateWaybillOnProviders(ctx *jxcontext.Context, order *model.GoodsOrder, courierVendorIDs, excludeCourierVendorIDs []int, maxDeliveryFee int64, createOnlyOne bool) (bills []*model.Waybill, err error) { userName := ctx.GetUserName() globals.SugarLogger.Infof("CreateWaybillOnProviders orderID:%s userName:%s, courierVendorIDs:%v, excludeCourierVendorIDs:%v", order.VendorOrderID, userName, courierVendorIDs, excludeCourierVendorIDs) - storeCourierList, err := dao.GetStoreCourierList(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, model.StoreAuditStatusOnline) + storeCourierList, err := dao.GetStoreCourierList2(dao.GetDB(), []int{jxutils.GetSaleStoreIDFromOrder(order)}, nil, model.StoreStatusOpened, []int{model.StoreAuditStatusOnline, model.StoreAuditStatusUpdated}) if err != nil { return nil, err } diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 97789b6ea..d339b7bfb 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -261,6 +261,37 @@ func GetStoreCourierList(db *DaoDB, storeIDs, vendorIDs []int, status, auditStat return nil, err } +func GetStoreCourierList2(db *DaoDB, storeIDs, vendorIDs []int, status int, auditStatuss []int) (courierStoreList []*model.StoreCourierMap, err error) { + sql := ` + SELECT t1.* + FROM store_courier_map t1 + WHERE t1.deleted_at = ? + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, + } + if len(storeIDs) > 0 { + sql += " AND t1.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")" + sqlParams = append(sqlParams, storeIDs) + } + if len(vendorIDs) > 0 { + sql += " AND t1.vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")" + sqlParams = append(sqlParams, vendorIDs) + } + if status != model.StoreStatusAll { + sql += " AND t1.status = ?" + sqlParams = append(sqlParams, status) + } + if len(auditStatuss) > 0 { + sql += " AND t1.audit_status IN (" + GenQuestionMarks(len(auditStatuss)) + ")" + sqlParams = append(sqlParams, auditStatuss) + } + if err = GetRows(db, &courierStoreList, sql, sqlParams...); err == nil { + return courierStoreList, nil + } + return nil, err +} + func GetStoresMapList2(db *DaoDB, vendorIDs, storeIDs, storeStatuss []int, status, isSync int, pricePack, name, vendorOrgCode string, mustDirty bool) (storeMapList []*model.StoreMap, err error) { sql := ` SELECT t1.* From 46278ea30f988220f205781da7c71226a8cbade5 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, 1 Mar 2021 09:22:34 +0800 Subject: [PATCH 04/32] aa --- business/model/store.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/business/model/store.go b/business/model/store.go index 5ec4124d3..e6aa597f6 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -456,8 +456,9 @@ type StoreMap struct { YbAppKey string `orm:"size(255)" json:"ybAppKey"` YbStorePrefix string `orm:"size(255)" json:"ybStorePrefix"` - MtwmToken string `orm:"size(255)" json:"mtwmToken"` //美团外卖商超token,有效期30天,每20天刷一次 - EbaiSupplierID string `orm:"column(ebai_supplier_id)" json:"ebaiSupplierID"` //饿百供应商ID + MtwmToken string `orm:"size(255)" json:"mtwmToken"` //美团外卖商超token,有效期30天,每20天刷一次 + MtwmRefreshToken string `orm:"size(255)" json:"mtwmRefreshToken"` //美团外卖商超refreshToken + EbaiSupplierID string `orm:"column(ebai_supplier_id)" json:"ebaiSupplierID"` //饿百供应商ID } func (*StoreMap) TableUnique() [][]string { From 7996e34d5db0bf8e7bf0c7c91fa7ffc29cd9ea4e 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, 1 Mar 2021 11:32:36 +0800 Subject: [PATCH 05/32] aa --- business/jxstore/cms/store.go | 24 ++++++++++-------------- business/jxstore/tempop/tempop.go | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 8be7abc60..9770a67aa 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -1192,7 +1192,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend return nil, fmt.Errorf("必须指定平台分账号信息") } if handler := CurVendorSync.GetStoreHandler(vendorID); handler != nil { - if vendorOrgCode != "5873" { + if vendorOrgCode != globals.Mtwm2Code { store, err2 := handler.ReadStore(ctx, vendorOrgCode, storeMap.VendorStoreID) if err = err2; err == nil || storeMap.IsSync == 0 { if store != nil { @@ -1200,9 +1200,16 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend storeMap.Status = store.Status } err = nil - storeMap.SyncStatus = model.SyncFlagModifiedMask | model.SyncFlagStoreName | model.SyncFlagStoreAddress // 新增绑定门店是修改的概念 + } + } else { + //美团商超获取token + mtapi := apimanager.CurAPIManager.GetAPI(model.VendorIDMTWM, outStoreMap.VendorOrgCode).(*mtwmapi.API) + if token, err := mtapi.GetAccessToken2(outStoreMap.VendorStoreID); err == nil && token != nil { + storeMap.MtwmToken = token.AccessToken + storeMap.MtwmToken = token.RefreshToken } } + storeMap.SyncStatus = model.SyncFlagModifiedMask | model.SyncFlagStoreName | model.SyncFlagStoreAddress // 新增绑定门店是修改的概念 } else { err = ErrCanNotFindVendor } @@ -1262,7 +1269,6 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend } dao.Commit(db) outStoreMap = storeMap - _, err = CurVendorSync.SyncStore(ctx, db, storeMap.VendorID, storeID, false, userName) } else { dao.Rollback(db) } @@ -1277,21 +1283,11 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend if _, err = SetStoreSkuSyncStatus2(db, []int{storeID}, []int{model.VendorIDJDShop}, findSkusBetweenJdsMainStore(db, storeID), model.SyncFlagSaleMask); err == nil { // CurVendorSync.SyncStoresSkus(ctx, nil, 0, db, nil, []int{storeID}, nil, false, true, true) } - } else if vendorID == model.VendorIDMTWM { - //如果是绑的美团超市,要去更新token - if outStoreMap.VendorOrgCode == globals.Mtwm2Code { - mtapi := apimanager.CurAPIManager.GetAPI(model.VendorIDMTWM, outStoreMap.VendorOrgCode).(*mtwmapi.API) - if result, err := mtapi.GetOAuthCode(outStoreMap.VendorStoreID); result != nil && err == nil { - if token, err := mtapi.GetAccessToken(result.(string)); err == nil && token != nil { - outStoreMap.MtwmToken = token.(string) - dao.UpdateEntity(db, outStoreMap, "MtwmToken") - } - } - } } if globals.IsAddEvent { err = AddEventDetail(db, ctx, model.OperateAdd, vendorID, model.ThingTypeStore, storeID, "", `{"VendorID":`+utils.Int2Str(vendorID)+`}`) } + _, err = CurVendorSync.SyncStore(ctx, db, storeMap.VendorID, storeID, false, userName) _, err = CurVendorSync.FullSyncStoresSkus(ctx, db, []int{vendorID}, []int{storeID}, true, nil, true, true) return outStoreMap, err } diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 214b4c5d0..4a85c09f2 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1865,6 +1865,20 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // }, storeMaps) // tasksch.HandleTask(task, nil, true).Run() // _, err = task.GetResult(0) + for i := 1; i < 26; i++ { + result, _ := api.JdShop2API.ShopList(i) + for _, v := range result.List { + storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int2Str(v.StoreID), model.VendorIDJDShop, "2") + err = api.JdShop2API.CreateGisFence(v.StoreID) + start, end := jxutils.JxOperationTime2StrTime(storeDetail.OpenTime1), jxutils.JxOperationTime2StrTime(storeDetail.CloseTime1) + if storeDetail.CloseTime2 != 0 { + end = jxutils.JxOperationTime2StrTime(storeDetail.CloseTime2) + } + err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.StoreID) + break + } + break + } return err } From 9a9edbd1171da099cb0433cd12415706878412a3 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, 1 Mar 2021 11:47:57 +0800 Subject: [PATCH 06/32] aa --- business/jxstore/tempop/tempop.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 4a85c09f2..878d8d6f4 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1875,9 +1875,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { end = jxutils.JxOperationTime2StrTime(storeDetail.CloseTime2) } err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.StoreID) - break } - break } return err } From 161238482b5bd76b8064c0497e326d257c153b62 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, 1 Mar 2021 13:36:20 +0800 Subject: [PATCH 07/32] aa --- business/jxstore/tempop/tempop.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 878d8d6f4..1d1e611e9 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1869,7 +1869,9 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { result, _ := api.JdShop2API.ShopList(i) for _, v := range result.List { storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int2Str(v.StoreID), model.VendorIDJDShop, "2") - err = api.JdShop2API.CreateGisFence(v.StoreID) + if v.Kilometres == "" { + err = api.JdShop2API.CreateGisFence(v.StoreID) + } start, end := jxutils.JxOperationTime2StrTime(storeDetail.OpenTime1), jxutils.JxOperationTime2StrTime(storeDetail.CloseTime1) if storeDetail.CloseTime2 != 0 { end = jxutils.JxOperationTime2StrTime(storeDetail.CloseTime2) From 6c004f8c87b466e2f291b422c8c26d68786e8899 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, 1 Mar 2021 13:53:02 +0800 Subject: [PATCH 08/32] aa --- business/jxstore/tempop/tempop.go | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 1d1e611e9..ebfd78523 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1865,19 +1865,29 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // }, storeMaps) // tasksch.HandleTask(task, nil, true).Run() // _, err = task.GetResult(0) - for i := 1; i < 26; i++ { - result, _ := api.JdShop2API.ShopList(i) - for _, v := range result.List { - storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), utils.Int2Str(v.StoreID), model.VendorIDJDShop, "2") - if v.Kilometres == "" { - err = api.JdShop2API.CreateGisFence(v.StoreID) - } - start, end := jxutils.JxOperationTime2StrTime(storeDetail.OpenTime1), jxutils.JxOperationTime2StrTime(storeDetail.CloseTime1) - if storeDetail.CloseTime2 != 0 { - end = jxutils.JxOperationTime2StrTime(storeDetail.CloseTime2) - } - err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.StoreID) + var ( + storeMaps []*model.StoreMap + db = dao.GetDB() + ) + sql := ` + SELECT * FROM store_map WHERE deleted_at = ? AND vendor_org_code = ? AND vendor_id = ? + ` + sqlParams := []interface{}{ + utils.DefaultTimeValue, "2", model.VendorIDJDShop, + } + dao.GetRows(db, &storeMaps, sql, sqlParams) + for _, v := range storeMaps { + stores, _ := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, nil, "") + store := stores[0] + // if v.Kilometres == "" { + // err = api.JdShop2API.CreateGisFence(v.StoreID) + // } + start, end := jxutils.JxOperationTime2StrTime(store.OpenTime1), jxutils.JxOperationTime2StrTime(store.CloseTime1) + if store.CloseTime2 != 0 { + end = jxutils.JxOperationTime2StrTime(store.CloseTime2) } + err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.StoreID) + } return err } From fab9303d60533066a73b49db13e2479974768c25 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, 1 Mar 2021 13:55:59 +0800 Subject: [PATCH 09/32] aa --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index ebfd78523..040f53dd4 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1886,7 +1886,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { if store.CloseTime2 != 0 { end = jxutils.JxOperationTime2StrTime(store.CloseTime2) } - err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.StoreID) + err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.VendorStoreID) } return err From 92d2509b3c1e150403ced9d41f1337853a40fbd6 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, 1 Mar 2021 13:57:00 +0800 Subject: [PATCH 10/32] aa --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 040f53dd4..04cd2dc01 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1886,7 +1886,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { if store.CloseTime2 != 0 { end = jxutils.JxOperationTime2StrTime(store.CloseTime2) } - err = api.JdShop2API.UpdateDeliveryPromise(start, end, v.VendorStoreID) + err = api.JdShop2API.UpdateDeliveryPromise(start, end, utils.Str2Int(v.VendorStoreID)) } return err From 774a265c69add533e84f26fa9bbe502aabd0b659 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, 1 Mar 2021 14:07:50 +0800 Subject: [PATCH 11/32] aa --- business/jxstore/tempop/tempop.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 04cd2dc01..fcff77ec9 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1868,6 +1868,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { var ( storeMaps []*model.StoreMap db = dao.GetDB() + stores []int ) sql := ` SELECT * FROM store_map WHERE deleted_at = ? AND vendor_org_code = ? AND vendor_id = ? @@ -1877,18 +1878,15 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } dao.GetRows(db, &storeMaps, sql, sqlParams) for _, v := range storeMaps { - stores, _ := dao.GetStoreList(db, []int{v.StoreID}, nil, nil, nil, nil, "") - store := stores[0] - // if v.Kilometres == "" { - // err = api.JdShop2API.CreateGisFence(v.StoreID) - // } - start, end := jxutils.JxOperationTime2StrTime(store.OpenTime1), jxutils.JxOperationTime2StrTime(store.CloseTime1) - if store.CloseTime2 != 0 { - end = jxutils.JxOperationTime2StrTime(store.CloseTime2) + err = api.JdShop2API.CreateGisFence(v.StoreID, 3) + if err != nil { + err2 := api.JdShop2API.CreateGisFence(v.StoreID, 2) + if err2 != nil { + stores = append(stores, v.StoreID) + } } - err = api.JdShop2API.UpdateDeliveryPromise(start, end, utils.Str2Int(v.VendorStoreID)) - } + fmt.Println("resultstore", stores) return err } From 5ff8a1b7c371331f78bb23474c614d1fe0e98d96 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, 1 Mar 2021 14:11:11 +0800 Subject: [PATCH 12/32] aa --- business/jxstore/tempop/tempop.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index fcff77ec9..568bb3553 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1878,9 +1878,9 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } dao.GetRows(db, &storeMaps, sql, sqlParams) for _, v := range storeMaps { - err = api.JdShop2API.CreateGisFence(v.StoreID, 3) + err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), 3) if err != nil { - err2 := api.JdShop2API.CreateGisFence(v.StoreID, 2) + err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), 2) if err2 != nil { stores = append(stores, v.StoreID) } From 30c5645eef69f2a8206a09eb1670c6d2dcbb5c1e 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, 1 Mar 2021 14:31:53 +0800 Subject: [PATCH 13/32] aa --- business/jxstore/tempop/tempop.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 568bb3553..8fab8315c 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1872,21 +1872,24 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { ) sql := ` SELECT * FROM store_map WHERE deleted_at = ? AND vendor_org_code = ? AND vendor_id = ? + AND store_id IN ( + 103075, 100129, 100117, 102726, 666677, 666997, 100156, 666987, 100118, 103113, 100144, 101039, 100153, 100881, 667142, 102630, 101897, 102613, 666799, 103177, 100766, 103035, 103090, 102167, 100326, 100454, 102416, 102789, 103037, 101176, 102713, 667057, 102482, 102938, 100920, 102614, 102624, 102675, 102902, 102956, 666748, 666876, 100115, 100141, 100524, 100670, 102671, 102987, 103022, 100206, 100274, 101780, 102138, 102206, 102255, 102785, 102951, 102996, 103111, 667058, 100610, 101099, 102293, 102819, 102824, 102857, 102865, 666751, 100654, 101111, 101945, 101960, 102795, 667093, 100121, 100193, 100230, 102481, 102772, 102969, 103063, 103094, 100126, 100175, 100210, 100270, 102706, 102930, 103116, 666672, 666712, 101840, 102241, 102595, 102686, 102736, 102973, 666735, 666790, 666792, 100205, 100453, 100905, 102147, 102320, 102767, 102925, 102937, 102962, 102994, 103002, 100409, 101956, 102353, 102475, 102794, 102852, 102921, 102928, 102980, 103183, 666669, 666733, 666861, 100204, 100225, 100476, 100699, 102354, 102915, 102923, 102929, 102952, 103069, 100215, 100279, 100458, 100517, 100664, 101013, 101666, 103093, 103191, 103425, 666996, 100132, 100278, 100328, 101032, 102022, 102355, 102364, 102436, 102763, 102776, 102893, 102924, 102966, 666779, 666906, 667110, 100290, 100455, 100471, 101875, 102126, 102479, 103103, 103199, 666767, 666992, 103003, 103088, 666667, 666711, 666930, 101979, 102046, 103201, 666819, 666879, 100116, 100157, 100712, 101061, 101736, 101755, 102561, 102960, 103193, 666905, 666993, 100299, 100334, 100987, 101112, 102264, 102278, 102704, 102752, 102771, 102997, 666828, 666863, 100501, 100681, 101012, 102002, 666746, 666853, 666898, 666985, 667109, 100336, 100543, 102426, 102933, 103194, 100366, 101942, 102186, 102533, 103151, 103200, 666729, 666820, 666854, 666954, 667033, 667064, 100361, 101750, 102374, 102977, 102991, 103015, 103170, 666864, 666890, 666933, 100840, 101983, 102648, 102932, 103018, 103050, 103065, 103171, 666932, 667091, 100002, 100140, 100150, 100828, 100853, 100867, 101000, 102488, 102782, 102807, 102995, 103029, 100124, 102172, 102637, 102705, 102934, 103098, 666855, 667014, 667076, 100714, 102480, 102519, 102594, 102600, 103089, 103189, 667113, 667136, 100134, 100451, 101078, 102047, 103033, 103085, 103127, 666739, 666784, 666891, 666975, 100167, 100782, 101042, 102424, 102723, 102741, 102793, 102883, 102888, 666852, 667003, 100433, 102742, 102836, 103112, 666740, 666835, 666887, 667007, 100130, 100487, 100546, 100982, 102181, 666782, 666961, 666973, 667005, 667038, 667075, 100145, 100369, 100444, 100720, 100741, 101028, 102853, 102953, 103057, 103082, 100032, 100041, 100396, 100837, 102371, 102473, 102718, 102998, 103361, 103408, 666788, 666800, 666948, 666980, 667001, 667006, 100650, 102498, 102676, 666812, 666826, 666929, 666955, 667028, 667094, 667125, 100529, 102720, 102749, 102882, 103032, 666775, 666803, 666927, 666944, 100065, 100162, 100296, 103036, 103055, 103184, 666707, 666839, 666964, 667067, 100470, 102068, 102358, 102733, 103181, 100015, 100549, 100849, 101732, 101763, 102074, 102780, 102821, 102859, 103083, 103118, 103416, 666771, 666802, 102562, 102856, 103160, 666811, 666818, 666850, 666984, 666988, 667071, 100267, 100309, 101916, 103051, 103165, 666783, 666889, 666900, 101008, 102300, 102750, 102958, 103161, 666756, 666786, 666836, 666840, 666880, 666977, 666983, 100123, 100165, 100351, 100548, 100767, 102670, 102711, 102876, 103009, 666823, 666834, 666917, 667051, 100217, 100883, 100971, 102483, 102981, 666793, 666858, 666940, 666945, 667112, 667133, 100935, 101031, 103179, 100024, 100190, 102955, 103143, 103176, 103198, 666825, 666869, 667135, 103074, 100221, 100325, 100463, 100477, 100600, 100661, 100827, 100945, 100946, 101712, 101722, 101815, 101834, 101887, 101896, 101935, 101948, 101997, 102012, 102016, 102023, 102063, 102092, 102180, 102245, 102267, 102275, 102280, 102383, 102405, 102411, 102443, 102444, 102531, 102557, 102652, 102661, 102691, 102721, 102735, 102740, 102759, 102808, 102815, 102858, 102896, 102901, 102906, 102911, 102926, 102946, 102954, 102971, 102974, 102976, 103001, 103008, 103028, 103095, 103106, 103115, 103119, 103145, 103168, 103178, 103188, 103414, 103433, 666705, 666738, 666745, 666747, 666772, 666776, 666785, 666791, 666821, 666822, 666873, 666885, 666888, 666919, 666942, 667010, 667055, 667059, 667117, 667157, 667158, 667176, 667145, 100022, 667234, 667206, 667273, 102788, 102150, 101097, 102379, 100943, 666916, 100273, 666884, 667114, 667205, 667202, 667370, 667366, 667365, 667359, 667356, 667352, 667351, 667349, 667339, 667338, 667336, 667335, 667334, 667332, 667331, 667329, 667324, 667321, 667315, 667312, 667310, 667309, 667308, 667307, 667305, 667304, 667303, 667302, 667296, 667297, 667294, 667292, 667291, 667288, 667284, 667280, 667278, 667277, 667266, 667264, 667263, 667257, 667245, 667242, 667240, 667236, 667223, 667220, 667211, 667208, 667204, 667201, 667200, 667177, 667166, 667159, 667155, 667154, 667147, 667139, 667134, 667129, 667128, 667080, 667029, 667016, 666907, 666862, 666842, 666838, 666770, 666765, 666715, 103136, 100601, 667333, 667381, 667363, 667340, 667386, 667423, 667040, 667419, 667395, 667388, 667443, 667355, 667394, 667390, 667420, 667364, 667389, 667383, 667361, 103182, 667414, 667476, 667465, 667481, 667510, 102377, 101088, 102642, 667469, 666921 + ) ` sqlParams := []interface{}{ utils.DefaultTimeValue, "2", model.VendorIDJDShop, } dao.GetRows(db, &storeMaps, sql, sqlParams) for _, v := range storeMaps { - err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), 3) + err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1.5") if err != nil { - err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), 2) + err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") if err2 != nil { stores = append(stores, v.StoreID) } } } - fmt.Println("resultstore", stores) + fmt.Println("resultstore2", stores) return err } From 423e0de993277fa590d5f8def480ce6f10b6fa80 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, 1 Mar 2021 14:44:48 +0800 Subject: [PATCH 14/32] aa --- business/jxstore/tempop/tempop.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 8fab8315c..a11147237 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1881,15 +1881,23 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } dao.GetRows(db, &storeMaps, sql, sqlParams) for _, v := range storeMaps { - err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1.5") + err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") if err != nil { - err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") + api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "2") + err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") if err2 != nil { - stores = append(stores, v.StoreID) + api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "1") + err3 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") + if err3 != nil { + err4 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") + if err4 != nil { + stores = append(stores, v.StoreID) + } + } } } } - fmt.Println("resultstore2", stores) + fmt.Println("resultstore3", stores) return err } From 96dfa7ad5a98edacfb247bade5b61843041fe79e 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, 1 Mar 2021 15:10:18 +0800 Subject: [PATCH 15/32] aa --- business/jxstore/tempop/tempop.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index a11147237..b2f67dea0 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1872,9 +1872,6 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { ) sql := ` SELECT * FROM store_map WHERE deleted_at = ? AND vendor_org_code = ? AND vendor_id = ? - AND store_id IN ( - 103075, 100129, 100117, 102726, 666677, 666997, 100156, 666987, 100118, 103113, 100144, 101039, 100153, 100881, 667142, 102630, 101897, 102613, 666799, 103177, 100766, 103035, 103090, 102167, 100326, 100454, 102416, 102789, 103037, 101176, 102713, 667057, 102482, 102938, 100920, 102614, 102624, 102675, 102902, 102956, 666748, 666876, 100115, 100141, 100524, 100670, 102671, 102987, 103022, 100206, 100274, 101780, 102138, 102206, 102255, 102785, 102951, 102996, 103111, 667058, 100610, 101099, 102293, 102819, 102824, 102857, 102865, 666751, 100654, 101111, 101945, 101960, 102795, 667093, 100121, 100193, 100230, 102481, 102772, 102969, 103063, 103094, 100126, 100175, 100210, 100270, 102706, 102930, 103116, 666672, 666712, 101840, 102241, 102595, 102686, 102736, 102973, 666735, 666790, 666792, 100205, 100453, 100905, 102147, 102320, 102767, 102925, 102937, 102962, 102994, 103002, 100409, 101956, 102353, 102475, 102794, 102852, 102921, 102928, 102980, 103183, 666669, 666733, 666861, 100204, 100225, 100476, 100699, 102354, 102915, 102923, 102929, 102952, 103069, 100215, 100279, 100458, 100517, 100664, 101013, 101666, 103093, 103191, 103425, 666996, 100132, 100278, 100328, 101032, 102022, 102355, 102364, 102436, 102763, 102776, 102893, 102924, 102966, 666779, 666906, 667110, 100290, 100455, 100471, 101875, 102126, 102479, 103103, 103199, 666767, 666992, 103003, 103088, 666667, 666711, 666930, 101979, 102046, 103201, 666819, 666879, 100116, 100157, 100712, 101061, 101736, 101755, 102561, 102960, 103193, 666905, 666993, 100299, 100334, 100987, 101112, 102264, 102278, 102704, 102752, 102771, 102997, 666828, 666863, 100501, 100681, 101012, 102002, 666746, 666853, 666898, 666985, 667109, 100336, 100543, 102426, 102933, 103194, 100366, 101942, 102186, 102533, 103151, 103200, 666729, 666820, 666854, 666954, 667033, 667064, 100361, 101750, 102374, 102977, 102991, 103015, 103170, 666864, 666890, 666933, 100840, 101983, 102648, 102932, 103018, 103050, 103065, 103171, 666932, 667091, 100002, 100140, 100150, 100828, 100853, 100867, 101000, 102488, 102782, 102807, 102995, 103029, 100124, 102172, 102637, 102705, 102934, 103098, 666855, 667014, 667076, 100714, 102480, 102519, 102594, 102600, 103089, 103189, 667113, 667136, 100134, 100451, 101078, 102047, 103033, 103085, 103127, 666739, 666784, 666891, 666975, 100167, 100782, 101042, 102424, 102723, 102741, 102793, 102883, 102888, 666852, 667003, 100433, 102742, 102836, 103112, 666740, 666835, 666887, 667007, 100130, 100487, 100546, 100982, 102181, 666782, 666961, 666973, 667005, 667038, 667075, 100145, 100369, 100444, 100720, 100741, 101028, 102853, 102953, 103057, 103082, 100032, 100041, 100396, 100837, 102371, 102473, 102718, 102998, 103361, 103408, 666788, 666800, 666948, 666980, 667001, 667006, 100650, 102498, 102676, 666812, 666826, 666929, 666955, 667028, 667094, 667125, 100529, 102720, 102749, 102882, 103032, 666775, 666803, 666927, 666944, 100065, 100162, 100296, 103036, 103055, 103184, 666707, 666839, 666964, 667067, 100470, 102068, 102358, 102733, 103181, 100015, 100549, 100849, 101732, 101763, 102074, 102780, 102821, 102859, 103083, 103118, 103416, 666771, 666802, 102562, 102856, 103160, 666811, 666818, 666850, 666984, 666988, 667071, 100267, 100309, 101916, 103051, 103165, 666783, 666889, 666900, 101008, 102300, 102750, 102958, 103161, 666756, 666786, 666836, 666840, 666880, 666977, 666983, 100123, 100165, 100351, 100548, 100767, 102670, 102711, 102876, 103009, 666823, 666834, 666917, 667051, 100217, 100883, 100971, 102483, 102981, 666793, 666858, 666940, 666945, 667112, 667133, 100935, 101031, 103179, 100024, 100190, 102955, 103143, 103176, 103198, 666825, 666869, 667135, 103074, 100221, 100325, 100463, 100477, 100600, 100661, 100827, 100945, 100946, 101712, 101722, 101815, 101834, 101887, 101896, 101935, 101948, 101997, 102012, 102016, 102023, 102063, 102092, 102180, 102245, 102267, 102275, 102280, 102383, 102405, 102411, 102443, 102444, 102531, 102557, 102652, 102661, 102691, 102721, 102735, 102740, 102759, 102808, 102815, 102858, 102896, 102901, 102906, 102911, 102926, 102946, 102954, 102971, 102974, 102976, 103001, 103008, 103028, 103095, 103106, 103115, 103119, 103145, 103168, 103178, 103188, 103414, 103433, 666705, 666738, 666745, 666747, 666772, 666776, 666785, 666791, 666821, 666822, 666873, 666885, 666888, 666919, 666942, 667010, 667055, 667059, 667117, 667157, 667158, 667176, 667145, 100022, 667234, 667206, 667273, 102788, 102150, 101097, 102379, 100943, 666916, 100273, 666884, 667114, 667205, 667202, 667370, 667366, 667365, 667359, 667356, 667352, 667351, 667349, 667339, 667338, 667336, 667335, 667334, 667332, 667331, 667329, 667324, 667321, 667315, 667312, 667310, 667309, 667308, 667307, 667305, 667304, 667303, 667302, 667296, 667297, 667294, 667292, 667291, 667288, 667284, 667280, 667278, 667277, 667266, 667264, 667263, 667257, 667245, 667242, 667240, 667236, 667223, 667220, 667211, 667208, 667204, 667201, 667200, 667177, 667166, 667159, 667155, 667154, 667147, 667139, 667134, 667129, 667128, 667080, 667029, 667016, 666907, 666862, 666842, 666838, 666770, 666765, 666715, 103136, 100601, 667333, 667381, 667363, 667340, 667386, 667423, 667040, 667419, 667395, 667388, 667443, 667355, 667394, 667390, 667420, 667364, 667389, 667383, 667361, 103182, 667414, 667476, 667465, 667481, 667510, 102377, 101088, 102642, 667469, 666921 - ) ` sqlParams := []interface{}{ utils.DefaultTimeValue, "2", model.VendorIDJDShop, From fb342d813b6967bbea3c9ba6c33a34497692ec17 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, 1 Mar 2021 15:27:45 +0800 Subject: [PATCH 16/32] aa --- business/jxstore/tempop/tempop.go | 35 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index b2f67dea0..cf3d40476 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1877,24 +1877,31 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { utils.DefaultTimeValue, "2", model.VendorIDJDShop, } dao.GetRows(db, &storeMaps, sql, sqlParams) - for _, v := range storeMaps { - err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") - if err != nil { - api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "2") - err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") - if err2 != nil { - api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "1") - err3 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") - if err3 != nil { - err4 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") - if err4 != nil { - stores = append(stores, v.StoreID) + task := tasksch.NewParallelTask2("yuuuuu", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(true), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, successCount int, err error) { + v := batchItemList[0].(*model.StoreMap) + err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") + if err != nil { + api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "2") + err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") + if err2 != nil { + api.JdShop2API.CreateGisFence(utils.Str2Int(err2.Error()), "1") + err3 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") + if err3 != nil { + err4 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") + if err4 != nil { + retVal = []int{v.StoreID} + } } } } - } + return retVal, successCount, err + }, storeMaps) + tasksch.HandleTask(task, nil, false).Run() + result, err := task.GetResult(0) + for _, v := range result { + stores = append(stores, v.(int)) } - fmt.Println("resultstore3", stores) return err } From b4141f448e9bf8bf46395f8d3421fe55d2312589 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, 1 Mar 2021 15:32:01 +0800 Subject: [PATCH 17/32] aa --- business/jxstore/tempop/tempop.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index cf3d40476..b14e969e8 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1877,8 +1877,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { utils.DefaultTimeValue, "2", model.VendorIDJDShop, } dao.GetRows(db, &storeMaps, sql, sqlParams) - task := tasksch.NewParallelTask2("yuuuuu", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, successCount int, err error) { + task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(true), ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { v := batchItemList[0].(*model.StoreMap) err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") if err != nil { @@ -1895,13 +1895,14 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } } } - return retVal, successCount, err + return retVal, err }, storeMaps) - tasksch.HandleTask(task, nil, false).Run() + tasksch.HandleTask(task, nil, true).Run() result, err := task.GetResult(0) for _, v := range result { stores = append(stores, v.(int)) } + fmt.Println("resultstores55", stores) return err } From c55e09e2088e4efe88c42449231ad906ddd6e90a 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, 1 Mar 2021 15:51:44 +0800 Subject: [PATCH 18/32] aa --- business/jxstore/tempop/tempop.go | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index b14e969e8..bf291f42a 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1877,30 +1877,11 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { utils.DefaultTimeValue, "2", model.VendorIDJDShop, } dao.GetRows(db, &storeMaps, sql, sqlParams) - task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(true), ctx, - func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - v := batchItemList[0].(*model.StoreMap) - err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") - if err != nil { - api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "2") - err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") - if err2 != nil { - api.JdShop2API.CreateGisFence(utils.Str2Int(err2.Error()), "1") - err3 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "2") - if err3 != nil { - err4 := api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") - if err4 != nil { - retVal = []int{v.StoreID} - } - } - } - } - return retVal, err - }, storeMaps) - tasksch.HandleTask(task, nil, true).Run() - result, err := task.GetResult(0) - for _, v := range result { - stores = append(stores, v.(int)) + for _, v := range storeMaps { + err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") + if err != nil { + stores = append(stores, v.StoreID) + } } fmt.Println("resultstores55", stores) return err From 0409aed13892bd72e1aff2eb9b5a7142a6d804f3 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, 1 Mar 2021 15:53:53 +0800 Subject: [PATCH 19/32] aa --- business/partner/purchase/jx/localjx/order.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 24c5d3e16..0f562df14 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -2443,16 +2443,16 @@ func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int) dao.CreateEntity(db, storeAcct) } - order := &model.GoodsOrder{ + order := &model.StoreAcctOrder{ VendorOrderID: utils.Int64ToStr(jxutils.GenOrderNo()), UserID: ctx.GetUserID(), StoreID: storeID, OrderType: orderType, Status: model.OrderStatusWait4Pay, - ActualPayPrice: int64(price), - OrderCreatedAt: time.Now(), + ActualPayPrice: price, VendorID: model.VendorIDJX, } + dao.WrapAddIDCULEntity(order, ctx.GetUserName()) dao.Begin(db) defer func() { if r := recover(); r != nil { From b9c6eced384817be05f4d102656235987393e861 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, 1 Mar 2021 15:54:42 +0800 Subject: [PATCH 20/32] aa --- business/partner/purchase/jx/localjx/order.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 0f562df14..05d430e87 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -388,6 +388,21 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType dao.UpdateEntity(db, userMemberOrigin, "EndAt") } } + case model.PayTypeTL_StoreAcctPay: + storeOrder := &model.StoreAcctOrder{ + VendorOrderID: vendorOrderID, + } + if err = dao.GetEntity(db, storeOrder, "VendorOrderID"); err == nil && storeOrder.ID != 0 { + order = &model.GoodsOrder{ + VendorOrderID: vendorOrderID, + ActualPayPrice: int64(storeOrder.ActualPayPrice), + VendorID: model.VendorIDJX, + } + if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil { + dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) + err = dao.CreateEntity(dao.GetDB(), orderPay) + } + } default: err = fmt.Errorf("支付方式:%d当前不支持", payType) } From c6ad936d08bc9d08f04892a142937cd634e4a1cb 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, 1 Mar 2021 15:55:53 +0800 Subject: [PATCH 21/32] aa --- business/model/order.go | 19 +++++++++++++++++++ globals/beegodb/beegodb.go | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/business/model/order.go b/business/model/order.go index c667aa4ee..091b5bbd5 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -485,6 +485,25 @@ func (v *StoreCoupons) TableIndex() [][]string { } } +type StoreAcctOrder struct { + ModelIDCUL + + VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` + VendorID int `orm:"column(vendor_id)" json:"vendorID"` + StoreID int `orm:"column(store_id)" json:"storeID"` // 外部系统里记录的 jxstoreid + ActualPayPrice int `json:"actualPayPrice"` // 单位为分 顾客实际支付 + UserID string `orm:"column(user_id);size(48);index" json:"userID"` + OrderType int `json:"orderType"` + Status int `json:"status"` // 参见OrderStatus*相关的常量定义 // 重复新订单消息数,这个一般不是由于消息重发造成的(消息重发由OrderStatus过滤),一般是业务逻辑造成的 + OrderFinishedAt time.Time `orm:"type(datetime)" json:"orderFinishedAt"` +} + +func (v *StoreAcctOrder) TableUnique() [][]string { + return [][]string{ + []string{"VendorOrderID", "VendorID"}, + } +} + // 判断是否是购买平台自有物流 // 对于京东,饿百来说,就是其自有的物流,对于微商城来说,是达达 func IsWaybillPlatformOwn(bill *Waybill) bool { diff --git a/globals/beegodb/beegodb.go b/globals/beegodb/beegodb.go index 6a7568054..0603dd35b 100644 --- a/globals/beegodb/beegodb.go +++ b/globals/beegodb/beegodb.go @@ -104,7 +104,7 @@ func Init() { orm.RegisterModel(&model.StoreAcct{}) orm.RegisterModel(&model.StoreAcctExpend{}) orm.RegisterModel(&model.StoreAcctIncome{}) - + orm.RegisterModel(&model.StoreAcctOrder{}) // create table orm.RunSyncdb("default", false, true) } From 5c856aaf12d73bd47a5561743f3ce172dec2311d 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, 1 Mar 2021 15:59:26 +0800 Subject: [PATCH 22/32] aa --- business/model/order.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/model/order.go b/business/model/order.go index 091b5bbd5..96f0638b1 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -14,6 +14,7 @@ const ( PayTypeWX = 1 // 微信支付 PayTypeTL = 2 // 通联宝支付 PayTypeTL_DiscountCard = 3 // 通联宝支付(会员折扣卡) + PayTypeTL_StoreAcctPay = 4 PayStatusNo = 0 PayStatusYes = 1 From 78898fb39ff711d765648d2b814c0df5accde924 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, 1 Mar 2021 16:09:44 +0800 Subject: [PATCH 23/32] aa --- business/jxstore/tempop/tempop.go | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index bf291f42a..77f0caba1 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1865,25 +1865,22 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // }, storeMaps) // tasksch.HandleTask(task, nil, true).Run() // _, err = task.GetResult(0) - var ( - storeMaps []*model.StoreMap - db = dao.GetDB() - stores []int - ) - sql := ` - SELECT * FROM store_map WHERE deleted_at = ? AND vendor_org_code = ? AND vendor_id = ? - ` - sqlParams := []interface{}{ - utils.DefaultTimeValue, "2", model.VendorIDJDShop, - } - dao.GetRows(db, &storeMaps, sql, sqlParams) - for _, v := range storeMaps { - err = api.JdShop2API.CreateGisFence(utils.Str2Int(v.VendorStoreID), "1") - if err != nil { - stores = append(stores, v.StoreID) + stores := []int{} + for i := 1; i < 26; i++ { + result, _ := api.JdShop2API.ShopList(i) + for _, v := range result.List { + if v.Kilometres == "" { + if err = api.JdShop2API.CreateGisFence(v.StoreID, "1"); err != nil { + if err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "1"); err2 == nil { + if err3 := api.JdShop2API.CreateGisFence(v.StoreID, "1"); err3 != nil { + stores = append(stores, v.StoreID) + } + } + } + } } } - fmt.Println("resultstores55", stores) + fmt.Println("resultstores112", stores) return err } From ada5d570b81dd3cf4b22ca9ac100ec1b59197ebd 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, 1 Mar 2021 16:16:40 +0800 Subject: [PATCH 24/32] aa --- business/jxstore/tempop/tempop.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 77f0caba1..a629969db 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1871,11 +1871,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { for _, v := range result.List { if v.Kilometres == "" { if err = api.JdShop2API.CreateGisFence(v.StoreID, "1"); err != nil { - if err2 := api.JdShop2API.CreateGisFence(utils.Str2Int(err.Error()), "1"); err2 == nil { - if err3 := api.JdShop2API.CreateGisFence(v.StoreID, "1"); err3 != nil { - stores = append(stores, v.StoreID) - } - } + stores = append(stores, v.StoreID) } } } From af45ed3350da14942484f82f7409b1ca081e7b63 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, 1 Mar 2021 17:10:38 +0800 Subject: [PATCH 25/32] aa --- business/jxstore/cms/sync2.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index dde1eea01..906193066 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -352,6 +352,7 @@ func onUpdateThing(ctx *jxcontext.Context, db *dao.DaoDB, vendorInfoList []*mode updateThingMapEntity(db, thingMap) } else { if dao.IsNoRowsError(err2) { + OnCreateThing(ctx, db, vendorInfoList, thingID, thingType, model.SyncFlagNewMask, true) err2 = nil } else { errList.AddErr(err2) From 38f5f58644289d90f8fcd7d62c0c66f3804f08f8 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, 1 Mar 2021 17:15:45 +0800 Subject: [PATCH 26/32] aa --- business/jxstore/cms/sku.go | 7 ++++++- business/jxstore/cms/sync2.go | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index db69910f0..f165ed05c 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2969,8 +2969,13 @@ func LoadStoreVendorCategories(ctx *jxcontext.Context, vendorOrgCode string, ven return err } dao.Commit(db) + catList, _ := dao.GetSkuCategoryWithVendor(db, []int{vendorID}, []string{vendorOrgCode}, -1, nil, false) for _, v := range storeCats { - OnUpdateThing(ctx, db, vendorOrgCodes, int64(v.CategoryID), model.ThingTypeCategory) + if len(catList) > 0 { + OnUpdateThing(ctx, db, vendorOrgCodes, int64(v.CategoryID), model.ThingTypeCategory) + } else { + OnCreateThing(ctx, db, vendorOrgCodes, int64(v.CategoryID), model.ThingTypeCategory, model.SyncFlagNewMask, false) + } } return err } diff --git a/business/jxstore/cms/sync2.go b/business/jxstore/cms/sync2.go index 906193066..dde1eea01 100644 --- a/business/jxstore/cms/sync2.go +++ b/business/jxstore/cms/sync2.go @@ -352,7 +352,6 @@ func onUpdateThing(ctx *jxcontext.Context, db *dao.DaoDB, vendorInfoList []*mode updateThingMapEntity(db, thingMap) } else { if dao.IsNoRowsError(err2) { - OnCreateThing(ctx, db, vendorInfoList, thingID, thingType, model.SyncFlagNewMask, true) err2 = nil } else { errList.AddErr(err2) From 32430444383a81544e2e8d4f4492f1d0c8fc5645 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, 1 Mar 2021 17:18:45 +0800 Subject: [PATCH 27/32] aa --- business/jxstore/cms/sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index f165ed05c..b3ee2f130 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -2974,7 +2974,7 @@ func LoadStoreVendorCategories(ctx *jxcontext.Context, vendorOrgCode string, ven if len(catList) > 0 { OnUpdateThing(ctx, db, vendorOrgCodes, int64(v.CategoryID), model.ThingTypeCategory) } else { - OnCreateThing(ctx, db, vendorOrgCodes, int64(v.CategoryID), model.ThingTypeCategory, model.SyncFlagNewMask, false) + OnCreateThing(ctx, db, vendorOrgCodes, int64(v.CategoryID), model.ThingTypeCategory, model.SyncFlagNewMask, true) } } return err From 603b27eb386e89201863fa7ec5e4a4c97a6f60f4 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, 2 Mar 2021 09:12:04 +0800 Subject: [PATCH 28/32] aa --- business/partner/purchase/jd/sku2.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/business/partner/purchase/jd/sku2.go b/business/partner/purchase/jd/sku2.go index 316d8644b..29ec7b706 100644 --- a/business/partner/purchase/jd/sku2.go +++ b/business/partner/purchase/jd/sku2.go @@ -2,6 +2,7 @@ package jd import ( "fmt" + "strings" "git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/baseapi/utils" @@ -194,6 +195,21 @@ func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy param := skuInfo2Param(ctx, sku) if globals.EnableJdStoreWrite { sku.VendorSkuID, err = getAPI(sku.VendorOrgCode).AddSku2(param) + if err != nil && strings.Contains(err.Error(), jdapi.ErrMustUPC) { + result, err2 := getAPI(sku.VendorOrgCode).BatchAddSkuByUPC([]*jdapi.CreateByUpcParam2{ + &jdapi.CreateByUpcParam2{ + OutSkuId: utils.Int2Str(sku.SkuID), + Upc: sku.Upc, + JdPrice: utils.Int64ToStr(sku.Price), + ShopCategoryID: utils.Str2Int64(sku.VendorCatID), + }, + }) + if err2 == nil { + sku.VendorSkuID = result.SkuID + } else { + err = err2 + } + } } else { sku.VendorSkuID = utils.Int64ToStr(jxutils.GenFakeID()) } From dd1e4d9c2337565545a7712e57cc1b8e507993e1 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, 2 Mar 2021 09:24:40 +0800 Subject: [PATCH 29/32] aa --- business/partner/purchase/jd/sku2.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/business/partner/purchase/jd/sku2.go b/business/partner/purchase/jd/sku2.go index 29ec7b706..8cd8043cb 100644 --- a/business/partner/purchase/jd/sku2.go +++ b/business/partner/purchase/jd/sku2.go @@ -156,7 +156,7 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd param = &jdapi.OpSkuParam{ TraceID: ctx.GetTrackInfo(), OutSkuID: utils.Int2Str(sku.SkuID), - ShopCategories: []int64{utils.Str2Int64(sku.VendorCatID)}, + ShopCategories: []int64{}, CategoryID: sku.VendorVendorCatID, BrandID: DefBrandID, SkuName: utils.LimitUTF8StringLen(sku.SkuName, jdapi.MaxSkuNameCharCount), @@ -168,6 +168,9 @@ func skuInfo2Param(ctx *jxcontext.Context, sku *dao.StoreSkuSyncInfo) (param *jd Upc: sku.Upc, // Images: jxutils.BatchString2Slice(sku.Img, sku.Img2), } + if sku.VendorCatID != "" { + param.ShopCategories = append(param.ShopCategories, utils.Str2Int64(sku.VendorCatID)) + } if sku.ImgMix != "" { param.Images = jxutils.BatchString2Slice(sku.ImgMix, sku.Img2, sku.Img3) } else { @@ -201,7 +204,7 @@ func (p *PurchaseHandler) CreateSku2(ctx *jxcontext.Context, sku *dao.StoreSkuSy OutSkuId: utils.Int2Str(sku.SkuID), Upc: sku.Upc, JdPrice: utils.Int64ToStr(sku.Price), - ShopCategoryID: utils.Str2Int64(sku.VendorCatID), + ShopCategoryID: utils.Str2Int64WithDefault((sku.VendorCatID), 0), }, }) if err2 == nil { From 29ab696bfd7ddfd15b7098d3c7f6b65a759abf3f 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, 2 Mar 2021 10:38:09 +0800 Subject: [PATCH 30/32] aa --- business/partner/purchase/jx/localjx/order.go | 12 ++++++------ business/partner/purchase/jx/localjx/tonglianpay.go | 3 ++- controllers/jx_order2.go | 6 ++++-- globals/api/api.go | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 05d430e87..327c9bb70 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -306,7 +306,7 @@ func BuyerCancelOrder(ctx *jxcontext.Context, orderID int64, reason string) (can return canceled, err } -func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) { +func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) { var ( db = dao.GetDB() ) @@ -319,7 +319,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType err = dao.CreateEntity(dao.GetDB(), orderPay) } case model.PayTypeTL: - if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil { + if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil { dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) err = dao.CreateEntity(dao.GetDB(), orderPay) } @@ -336,7 +336,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType ActualPayPrice: priceDefendOrders[0].ActualPayPrice, VendorID: model.VendorIDJX, } - if orderPay, err = pay4OrderByTL(ctx, order2, payType, vendorPayType); err == nil && orderPay != nil { + if orderPay, err = pay4OrderByTL(ctx, order2, payType, vendorPayType, subAppID); err == nil && orderPay != nil { dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) err = dao.CreateEntity(dao.GetDB(), orderPay) } @@ -344,7 +344,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType return orderPay, err } -func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) { +func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) { var ( db = dao.GetDB() order *model.GoodsOrder @@ -368,7 +368,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType ActualPayPrice: int64(discountCard.Price), VendorID: model.VendorIDJX, } - if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil { + if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil { dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) err = dao.CreateEntity(dao.GetDB(), orderPay) } @@ -398,7 +398,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType ActualPayPrice: int64(storeOrder.ActualPayPrice), VendorID: model.VendorIDJX, } - if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil { + if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil { dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) err = dao.CreateEntity(dao.GetDB(), orderPay) } diff --git a/business/partner/purchase/jx/localjx/tonglianpay.go b/business/partner/purchase/jx/localjx/tonglianpay.go index 933b368af..5e06b0314 100644 --- a/business/partner/purchase/jx/localjx/tonglianpay.go +++ b/business/partner/purchase/jx/localjx/tonglianpay.go @@ -18,7 +18,7 @@ import ( "git.rosy.net.cn/jx-callback/globals/api" ) -func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) { +func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) { // if order.FromStoreID != 0 { // result, _ := orderman.GetMatterStoreOrderCount(nil, order.FromStoreID) // if !result.Flag { @@ -31,6 +31,7 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, NotifyUrl: globals.TLPayNotifyURL, Reqsn: order.VendorOrderID, PayType: vendorPayType, + SubAppID: subAppID, } //暂时做兼容处理 if vendorPayType == "JSAPI" { diff --git a/controllers/jx_order2.go b/controllers/jx_order2.go index 7143f5894..be591f7a2 100644 --- a/controllers/jx_order2.go +++ b/controllers/jx_order2.go @@ -40,6 +40,7 @@ func (c *JxOrderController) CreateOrder() { // @Title 请求支付京西商城订单 // @Description 请求支付京西商城订单 // @Param token header string true "认证token" +// @Param subAppID formData string true "appID" // @Param vendorOrderID formData string true "订单ID" // @Param payType formData int true "支付类型" // @Param vendorPayType formData string true "平台支付类型" @@ -48,7 +49,7 @@ func (c *JxOrderController) CreateOrder() { // @router /Pay4Order [post] func (c *JxOrderController) Pay4Order() { c.callPay4Order(func(params *tJxorderPay4OrderParams) (retVal interface{}, errCode string, err error) { - retVal, err = localjx.Pay4Order(params.Ctx, utils.Str2Int64(params.VendorOrderID), params.PayType, params.VendorPayType) + retVal, err = localjx.Pay4Order(params.Ctx, utils.Str2Int64(params.VendorOrderID), params.PayType, params.VendorPayType, params.SubAppID) return retVal, "", err }) } @@ -57,6 +58,7 @@ func (c *JxOrderController) Pay4Order() { // @Description 请求支付京西商城相关用户支付项目 // @Param token header string true "认证token" // @Param thingID formData int fasle "项目ID" +// @Param subAppID formData string true "appID" // @Param vendorOrderID formData string fasle "订单ID" // @Param payType formData int true "支付类型" // @Param vendorPayType formData string true "平台支付类型" @@ -65,7 +67,7 @@ func (c *JxOrderController) Pay4Order() { // @router /Pay4User [post] func (c *JxOrderController) Pay4User() { c.callPay4User(func(params *tJxorderPay4UserParams) (retVal interface{}, errCode string, err error) { - retVal, err = localjx.Pay4User(params.Ctx, params.ThingID, params.VendorOrderID, params.PayType, params.VendorPayType) + retVal, err = localjx.Pay4User(params.Ctx, params.ThingID, params.VendorOrderID, params.PayType, params.VendorPayType, params.SubAppID) return retVal, "", err }) } diff --git a/globals/api/api.go b/globals/api/api.go index 85e1235dc..843a0ce2b 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -250,7 +250,7 @@ func Init() { } if globals.TLPayNotifyURL != "" { - TLpayAPI = tonglianpayapi.New(beego.AppConfig.String("tonglianPayAppID"), beego.AppConfig.String("tonglianPayKey"), beego.AppConfig.String("tonglianPayCusID"), beego.AppConfig.String("wxpayAppID")) + TLpayAPI = tonglianpayapi.New(beego.AppConfig.String("tonglianPayAppID"), beego.AppConfig.String("tonglianPayKey"), beego.AppConfig.String("tonglianPayCusID")) } AutonaviAPI = autonavi.New(beego.AppConfig.String("autonaviKey")) BaiDuNaviAPI = baidunavi.New(beego.AppConfig.String("baidunaviAK"), beego.AppConfig.String("baidunaviSK")) From 9ed0b9e3b316a07aefe4e075310e1ac072583bf1 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, 2 Mar 2021 10:43:47 +0800 Subject: [PATCH 31/32] aa --- business/partner/purchase/jx/localjx/tonglianpay.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/partner/purchase/jx/localjx/tonglianpay.go b/business/partner/purchase/jx/localjx/tonglianpay.go index 5e06b0314..f2344ce9e 100644 --- a/business/partner/purchase/jx/localjx/tonglianpay.go +++ b/business/partner/purchase/jx/localjx/tonglianpay.go @@ -38,7 +38,7 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, param.PayType = tonglianpayapi.PayTypeWxXcx } if vendorPayType == tonglianpayapi.PayTypeWxXcx { - if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini { + if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID { param.Acct = authInfo.GetAuthID() } } From dba862d6cddde390155c068dfa4d18606341717f 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, 2 Mar 2021 10:54:01 +0800 Subject: [PATCH 32/32] =?UTF-8?q?mtwm=20=E5=AE=9A=E6=9C=9F=E5=88=B7token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 9770a67aa..43af24d0c 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3999,14 +3999,23 @@ func GetBrandStore(ctx *jxcontext.Context, name string) (brands []*model.BrandSt } func RefreshMTWMToken(ctx *jxcontext.Context) (err error) { - // var ( - // db = dao.GetDB() - // ) - // if time.Now().Weekday() != time.Sunday { - // return - // } - // //token是1个月过期,每周刷一次吧 - // dao.GetStoresMapList(db, []int{model.VendorIDMTWM}, nil, nil, status, isSync, "", "", globals.Mtwm2Code) + var ( + db = dao.GetDB() + ) + if time.Now().YearDay()%20 != 0 { + return + } + //token是1个月过期,每20天刷一次吧 + storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDMTWM}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", globals.Mtwm2Code) + for _, v := range storeMaps { + if v.MtwmRefreshToken != "" { + if result, err := api.Mtwm2API.RefreshAccessToken(v.MtwmRefreshToken); err == nil { + v.MtwmToken = result.AccessToken + v.MtwmRefreshToken = result.RefreshToken + dao.UpdateEntity(db, v, "MtwmToken", "MtwmRefreshToken") + } + } + } return err }