diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index a78294967..b435627a4 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1663,7 +1663,7 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) Remark: "订单转移被取消", } jxutils.CallMsgHandlerAsync(func() { - err = partner.CurOrderManager.OnOrderStatusChanged("", orderStatus) + err = partner.CurOrderManager.OnOrderStatusChanged(order.VendorOrgCode, orderStatus) }, jxutils.ComposeUniversalOrderID(vendorOrderID, model.VendorIDJX)) if err != nil { return "", err diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index c01a7c28b..f16419e17 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3889,13 +3889,25 @@ func UpdateBrand(ctx *jxcontext.Context, payload map[string]interface{}, isDel b } func CreateVendorStore(ctx *jxcontext.Context, storeID, vendorID int, payload map[string]interface{}) (err error) { - // var ( - // db = dao.GetDB() - // ) + var ( + db = dao.GetDB() + storeDetail *dao.StoreDetail + ) + if storeDetail, err = dao.GetStoreDetail(db, storeID, vendorID, ""); err != nil { + return fmt.Errorf("获取门店信息失败,请联系技术部!") + } if payload["vendorOrgCode"] == nil { return fmt.Errorf("请选择平台账号!") } - // storeDetail, _ := dao.GetStoreDetail(db, storeID, vendorID, payload["vendorOrgCode"].(string)) + if vendorID == model.VendorIDMTWM { + if brands, err := dao.GetBrands(db, "", storeDetail.BrandID); err == nil { + if len(brands) > 0 { + if strings.Contains(brands[0].Name, "无品牌") { + return fmt.Errorf("无品牌店铺不允许创建美团门店!") + } + } + } + } // handler := partner.GetPurchasePlatformFromVendorID(vendorID) // vendorStoreID, err := handler.CreateStore2(db, storeID, ctx.GetUserName(), payload) // if err != nil { diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 34732c6f6..6d32d7f0c 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -245,7 +245,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs db2 = dao.GetDB() } if model.IsSyncStatusNew(storeMap.SyncStatus) { - if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil); err == nil { + if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, nil); err == nil { resultList = append(resultList, 1) } else { failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店") @@ -283,7 +283,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs var vendorStoreID string storeMap := loopMapInfo.StoreMapList[0] if model.IsSyncStatusNew(storeMap.SyncStatus) { - if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil); err == nil { + if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName, nil, nil); err == nil { resultList = append(resultList, 1) } else { failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店") diff --git a/business/jxstore/cms/sync_store_sku.go b/business/jxstore/cms/sync_store_sku.go index a0db06929..21de1b2f3 100644 --- a/business/jxstore/cms/sync_store_sku.go +++ b/business/jxstore/cms/sync_store_sku.go @@ -469,6 +469,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag now := jxutils.OperationTime2HourMinuteFormat(time.Now()) var failedList []*partner.StoreSkuInfoWithErr for _, sku := range skus { + globals.SugarLogger.Debugf("syncStoreSkuNew sku sync:%v", sku.SkuSyncStatus) if !useVendorPriceDirectly && !isSkuLockTimeValid(sku) { sku.VendorPrice = 0 diff --git a/business/partner/partner.go b/business/partner/partner.go index 9db1f15a9..e0677d85c 100644 --- a/business/partner/partner.go +++ b/business/partner/partner.go @@ -149,7 +149,7 @@ type IPurchasePlatformHandler interface { // Store ReadStore(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string) (store *dao.StoreDetail, err error) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) - CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}) (vendorStoreID string, err error) + CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) DeleteStore(db *dao.DaoDB, storeID int, userName string) (err error) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgCode, vendorStoreID string, storeID int64) (err error) diff --git a/business/partner/purchase/ebai/store.go b/business/partner/purchase/ebai/store.go index 7f4578fb9..3350f267d 100644 --- a/business/partner/purchase/ebai/store.go +++ b/business/partner/purchase/ebai/store.go @@ -18,6 +18,24 @@ import ( "git.rosy.net.cn/jx-callback/globals/api" ) +type tEbaiSupplierInfo struct { + SupplierID string `json:"supplierID"` + Logo string `json:"logo"` +} + +var ( + ebaiSupplierInfo = map[string]*tEbaiSupplierInfo{ + EbaiSupplierIDsc: &tEbaiSupplierInfo{ + SupplierID: EbaiSupplierIDsc, + Logo: "http://image.jxc4.com/image/4573e7789c647d4961f8955e3733dbd6.tem.jpg", + }, + EbaiSupplierIDc4: &tEbaiSupplierInfo{ + SupplierID: EbaiSupplierIDc4, + Logo: "", + }, + } +) + type tEbaiStoreInfo struct { model.Store VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空 @@ -550,7 +568,39 @@ func (c *PurchaseHandler) GetShopIDsByPage() (vendorStoreIDs []string, err error return vendorStoreIDs, err } -func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}) (vendorStoreID string, err error) { +func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) { + brands, err := dao.GetBrands(db, "", storeDetail.BrandID) + brand := brands[0] + param := make(map[string]interface{}) + param["shop_id"] = storeID + if strings.Contains(brand.Name, "京西到家") { + param["name"] = storeDetail.Name + } else { + param["name"] = brand.Name + "(" + storeDetail.Name + ")" + } + param["supplier_id"] = params["supplier_id"] + //省市区 + placeCity, err := dao.GetPlaceByCode(db, storeDetail.CityCode) + param["city"] = placeCity.EbaiCode + placeProvince, err := dao.GetPlaceByCode(db, placeCity.ParentCode) + param["province"] = placeProvince.EbaiCode + placeCounty, err := dao.GetPlaceByCode(db, storeDetail.DistrictCode) + param["county"] = placeCounty.EbaiCode + + phone := "" + if storeDetail.MarketManPhone != "" { + phone = storeDetail.MarketManPhone + } else { + phone = model.VendorStoreTel + } + param["phone"] = phone + param["ivr_phone"] = phone + param["service_phone"] = storeDetail.Tel1 + param["address"] = params["address"] + param["longitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lng) + param["latitude"] = jxutils.IntCoordinate2Standard(storeDetail.Lat) + + api.EbaiAPI.ShopCreate(params) return vendorStoreID, err } diff --git a/business/partner/purchase/jd/store.go b/business/partner/purchase/jd/store.go index 49456d8a0..a9c162c4a 100644 --- a/business/partner/purchase/jd/store.go +++ b/business/partner/purchase/jd/store.go @@ -522,7 +522,7 @@ func (c *PurchaseHandler) UpdateStoreCustomID(ctx *jxcontext.Context, vendorOrgC return err } -func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}) (vendorStoreID string, err error) { +func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) { return vendorStoreID, err } diff --git a/business/partner/purchase/jdshop/store.go b/business/partner/purchase/jdshop/store.go index d08f1200e..1d7b8be90 100644 --- a/business/partner/purchase/jdshop/store.go +++ b/business/partner/purchase/jdshop/store.go @@ -77,7 +77,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin return err } -func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}) (vendorStoreID string, err error) { +func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) { store, err := dao.GetStoreDetail(db, storeID, model.VendorIDJDShop, "") if err != nil { return vendorStoreID, err diff --git a/business/partner/purchase/mtwm/store.go b/business/partner/purchase/mtwm/store.go index 6fdba6ecd..1a38f8f48 100644 --- a/business/partner/purchase/mtwm/store.go +++ b/business/partner/purchase/mtwm/store.go @@ -96,7 +96,7 @@ func (p *PurchaseHandler) CreateStore(db *dao.DaoDB, storeID int, userName strin return p.UpdateStore(db, storeID, userName) } -func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}) (vendorStoreID string, err error) { +func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) { return vendorStoreID, err } diff --git a/business/partner/purchase/yb/store.go b/business/partner/purchase/yb/store.go index 5c277f14a..68818332c 100644 --- a/business/partner/purchase/yb/store.go +++ b/business/partner/purchase/yb/store.go @@ -15,7 +15,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin return err } -func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}) (vendorStoreID string, err error) { +func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName string, params map[string]interface{}, storeDetail *dao.StoreDetail) (vendorStoreID string, err error) { return vendorStoreID, err }