1
This commit is contained in:
@@ -155,7 +155,7 @@ func GetCheckVendorCookie(ctx *jxcontext.Context, vendorIDs []int, isAuto bool)
|
|||||||
resultMap, err := api.EbaiAPI.GetStoreOrderInfo(ebaiOrderID)
|
resultMap, err := api.EbaiAPI.GetStoreOrderInfo(ebaiOrderID)
|
||||||
if len(resultMap) < 1 && err != nil {
|
if len(resultMap) < 1 && err != nil {
|
||||||
if strings.Contains(err.Error(), ebaiErr) || strings.Contains(err.Error(), ebaiErr2) {
|
if strings.Contains(err.Error(), ebaiErr) || strings.Contains(err.Error(), ebaiErr2) {
|
||||||
errMsg += fmt.Sprintf(" 饿百账号:[%v]的Cookie无效了!")
|
errMsg += fmt.Sprintf(" 饿百账号:[%v]的Cookie无效了!", v)
|
||||||
flag = true
|
flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ func GetCheckVendorCookie(ctx *jxcontext.Context, vendorIDs []int, isAuto bool)
|
|||||||
_, err := api.MtwmAPI.PackagePriceGet(mtStoreID)
|
_, err := api.MtwmAPI.PackagePriceGet(mtStoreID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), mtErr) {
|
if strings.Contains(err.Error(), mtErr) {
|
||||||
errMsg += fmt.Sprintf(" 美团账号:[%v]的Cookie无效了!")
|
errMsg += fmt.Sprintf(" 美团账号:[%v]的Cookie无效了!", v)
|
||||||
flag = true
|
flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ func GetCheckVendorCookie(ctx *jxcontext.Context, vendorIDs []int, isAuto bool)
|
|||||||
result, err := api.JdAPI.GetJdUpcCodeByName("", jdUpcCode, 1, 5)
|
result, err := api.JdAPI.GetJdUpcCodeByName("", jdUpcCode, 1, 5)
|
||||||
if len(result) < 1 && err != nil {
|
if len(result) < 1 && err != nil {
|
||||||
if strings.Contains(err.Error(), jdErr) {
|
if strings.Contains(err.Error(), jdErr) {
|
||||||
errMsg += fmt.Sprintf(" 京东账号:[%v]的Cookie无效了!")
|
errMsg += fmt.Sprintf(" 京东账号:[%v]的Cookie无效了!", v)
|
||||||
flag = true
|
flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,7 @@ func GetCheckVendorCookie(ctx *jxcontext.Context, vendorIDs []int, isAuto bool)
|
|||||||
_, err := api.JdShopAPI.OrderDetail("124350112427")
|
_, err := api.JdShopAPI.OrderDetail("124350112427")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "登录") {
|
if strings.Contains(err.Error(), "登录") {
|
||||||
errMsg += fmt.Sprintf("京东商城:[%v]的Cookie无效了!")
|
errMsg += fmt.Sprintf("京东商城:[%v]的Cookie无效了!", v)
|
||||||
flag = true
|
flag = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,19 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
storeParams.StationName = utils.LimitUTF8StringLen(storeParams.StationName, jdapi.MaxStoreNameLen)
|
storeParams.StationName = utils.LimitUTF8StringLen(storeParams.StationName, jdapi.MaxStoreNameLen)
|
||||||
}
|
}
|
||||||
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreAddress) != 0 {
|
if store.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreAddress) != 0 {
|
||||||
storeParams.StationAddress = store.Address
|
storeDetail, _ := dao.GetStoreDetail(db, storeID, model.VendorIDJD, "")
|
||||||
|
address := ""
|
||||||
|
if !strings.Contains(store.Address, "省") && model.ZXCityCodeMap[store.CityCode] != "" {
|
||||||
|
address += storeDetail.ProvinceName
|
||||||
|
}
|
||||||
|
if !strings.Contains(storeDetail.Address, "市") {
|
||||||
|
address += storeDetail.CityName
|
||||||
|
}
|
||||||
|
if !strings.Contains(storeDetail.Address, "县") || !strings.Contains(storeDetail.Address, "区") {
|
||||||
|
address += storeDetail.DistrictName
|
||||||
|
}
|
||||||
|
storeParams.StationAddress = address + storeDetail.Address
|
||||||
|
|
||||||
storeParams.CoordinateType = jdapi.CoordinateTypeAutonavi // 一直用高德
|
storeParams.CoordinateType = jdapi.CoordinateTypeAutonavi // 一直用高德
|
||||||
storeParams.Lng = jxutils.IntCoordinate2Standard(store.Lng)
|
storeParams.Lng = jxutils.IntCoordinate2Standard(store.Lng)
|
||||||
storeParams.Lat = jxutils.IntCoordinate2Standard(store.Lat)
|
storeParams.Lat = jxutils.IntCoordinate2Standard(store.Lat)
|
||||||
@@ -576,6 +588,18 @@ func (p *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
|
|||||||
if createParams.County == 310045 {
|
if createParams.County == 310045 {
|
||||||
createParams.City = 49318
|
createParams.City = 49318
|
||||||
}
|
}
|
||||||
|
address := ""
|
||||||
|
if !strings.Contains(storeDetail.Address, "省") && model.ZXCityCodeMap[storeDetail.CityCode] != "" {
|
||||||
|
address += storeDetail.ProvinceName
|
||||||
|
}
|
||||||
|
if !strings.Contains(storeDetail.Address, "市") {
|
||||||
|
address += storeDetail.CityName
|
||||||
|
}
|
||||||
|
if !strings.Contains(storeDetail.Address, "县") || !strings.Contains(storeDetail.Address, "区") {
|
||||||
|
address += storeDetail.DistrictName
|
||||||
|
}
|
||||||
|
createParams.StationAddress = address + storeDetail.Address
|
||||||
|
|
||||||
result, err := getAPI(vendorOrgCode).CreateStore(createParams)
|
result, err := getAPI(vendorOrgCode).CreateStore(createParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
@@ -68,25 +68,29 @@ func (a *APIManager) GetAPI(vendorID int, appOrgCode string) (pfAPI interface{})
|
|||||||
pfAPI = api.Mtwm2API
|
pfAPI = api.Mtwm2API
|
||||||
}
|
}
|
||||||
case model.VendorIDTaoVegetable:
|
case model.VendorIDTaoVegetable:
|
||||||
api := api.TaoVegetableApi
|
api2 := api.TaoVegetableApi
|
||||||
|
if api2 == nil || api2.GetToken() == "" {
|
||||||
codes, _ := dao.GetVendorOrgCode(db, vendorID, appOrgCode, "platform")
|
codes, _ := dao.GetVendorOrgCode(db, vendorID, appOrgCode, "platform")
|
||||||
if len(codes) == 0 {
|
if len(codes) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
code := codes[0]
|
code := codes[0]
|
||||||
api = tao_vegetable.NewTaoVegetable(code.AppKey, code.AppSecret, beego.AppConfig.DefaultString("taoVegetableServerUrl", ""))
|
api2 = tao_vegetable.NewTaoVegetable(code.AppKey, code.AppSecret, beego.AppConfig.DefaultString("taoVegetableServerUrl", ""))
|
||||||
if code.Token != "" {
|
if code.Token != "" {
|
||||||
var tokenInfo *tao_vegetable.StoreTokenInfo
|
var tokenInfo *tao_vegetable.StoreTokenInfo
|
||||||
if err := json.Unmarshal([]byte(code.Token), &tokenInfo); err != nil {
|
if err := json.Unmarshal([]byte(code.Token), &tokenInfo); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if tokenInfo.AccessToken != "" && tokenInfo.ExpireTime > time.Now().UnixNano()/1e6 {
|
if tokenInfo.AccessToken != "" && tokenInfo.ExpireTime > time.Now().UnixNano()/1e6 {
|
||||||
api.SetToken(tokenInfo.AccessToken)
|
api2.SetToken(tokenInfo.AccessToken)
|
||||||
} else {
|
} else {
|
||||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "淘鲜达token过期", ",请重新授权")
|
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "淘鲜达token过期", ",请重新授权")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pfAPI = api
|
api.TaoVegetableApi = api2
|
||||||
|
}
|
||||||
|
|
||||||
|
pfAPI = api2
|
||||||
case model.VendorIDEBAI:
|
case model.VendorIDEBAI:
|
||||||
pfAPI = api.EbaiAPI
|
pfAPI = api.EbaiAPI
|
||||||
case model.VendorIDJDShop:
|
case model.VendorIDJDShop:
|
||||||
|
|||||||
Reference in New Issue
Block a user