Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/baidunavi"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"math"
|
||||
"reflect"
|
||||
"regexp"
|
||||
@@ -681,6 +682,7 @@ func GetSToURidingDistance2(sLng, sLat, uLng, uLat float64, orderId string) (way
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("=======================1")
|
||||
|
||||
// 当这个运单为假物流/门店真实自送/获取运单骑手信息为空的时候使用假的骑手信息
|
||||
if (v.WaybillVendorID == model.VendorJXFakeWL || v.WaybillVendorID == model.VendorIDUnknown || v.CourierCoordinate == "") && v.OriginalData != "" {
|
||||
@@ -750,26 +752,5 @@ func GetCyclingLine(sLng, sLat, uLng, uLat float64) (polyLineList []string, dist
|
||||
polyLineList = append(polyLineList, strings.Split(v.Path, ";")...)
|
||||
}
|
||||
|
||||
// 高德()免费次数太少暂时不用
|
||||
//for {
|
||||
// polyLineList, distance, duration, errCode = api.AutonaviAPI.GetCyclingPlan(origin, destination)
|
||||
// if errCode != nil {
|
||||
// ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "2452A93EEB9111EC9B06525400E86DC0", "获取骑行路线:", utils.Format4Output(errCode, false))
|
||||
// }
|
||||
// if errCode != nil && (errCode.Error() == autonavi.DAILYQUERYOVERLIMIT || errCode.Error() == autonavi.USERDAILYQUERYOVERLIMIT) {
|
||||
// AutonaviKeyIndex += model.YES
|
||||
// if AutonaviKeyIndex >= len(AutonaviKeyList) {
|
||||
// AutonaviKeyIndex = model.NO
|
||||
// }
|
||||
// api.AutonaviAPI.SetKey(AutonaviKeyList[AutonaviKeyIndex])
|
||||
// } else if errCode != nil {
|
||||
// return nil, 0, 0, errCode
|
||||
// }
|
||||
//
|
||||
// if len(polyLineList) > model.NO {
|
||||
// return polyLineList, distance, duration, errCode
|
||||
// }
|
||||
//}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
@@ -12,7 +13,6 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
)
|
||||
|
||||
// CopyOnStoreSkuToOther 将一个美团门店分类和商品复制到另一个门店
|
||||
@@ -26,15 +26,18 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
toApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, toStore.VendorOrgCode).(*mtwmapi.API)
|
||||
//firstApi := api.Mtwm2API
|
||||
toApi := mtwmapi.New(beego.AppConfig.DefaultString("mtwmAppID2", ""), beego.AppConfig.DefaultString("mtwmSecret2", ""), beego.AppConfig.DefaultString("mtwmCallbackURL2", ""), "")
|
||||
toApi.SetToken(toStore.MtwmToken)
|
||||
|
||||
fromStore, err := dao.GetStoreDetailByVendorStoreID(db, utils.Int2Str(fromVendorStoreId), model.VendorIDMTWM, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, fromStore.VendorOrgCode).(*mtwmapi.API)
|
||||
fromApi := mtwmapi.New(beego.AppConfig.DefaultString("mtwmAppID2", ""), beego.AppConfig.DefaultString("mtwmSecret2", ""), beego.AppConfig.DefaultString("mtwmCallbackURL2", ""), "")
|
||||
fromApi.SetToken(fromStore.MtwmToken)
|
||||
//fromApi := partner.CurAPIManager.GetAPI(model.VendorIDMTWM, fromStore.VendorOrgCode).(*mtwmapi.API)
|
||||
//fromApi.SetToken(fromStore.MtwmToken)
|
||||
|
||||
taskName := fmt.Sprintf("将平台门店[%d],分类和商品复制到[%d]", fromVendorStoreId, toStoreId)
|
||||
config := tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(false)
|
||||
@@ -49,8 +52,9 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
|
||||
//}
|
||||
case 2:
|
||||
// 同步分类
|
||||
//fromCategoryList, _ := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
|
||||
//
|
||||
//fromCategoryList, err := fromApi.RetailCatList(utils.Int2Str(fromVendorStoreId))
|
||||
//globals.SugarLogger.Debugf("fromCategoryList ============ %d", len(fromCategoryList))
|
||||
//globals.SugarLogger.Debugf("err ============ %v", err)
|
||||
//for _, v := range fromCategoryList {
|
||||
// categoryErr := toApi.RetailCatUpdate(toStore.VendorStoreID, v.Name, &mtwmapi.Param4UpdateCat{
|
||||
// CategoryCode: v.Code,
|
||||
@@ -84,7 +88,7 @@ func CopyOnStoreSkuToOther(ctx *jxcontext.Context, fromVendorStoreId, toStoreId
|
||||
return nil, fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i)
|
||||
}
|
||||
|
||||
if err := BatchInitData(ctx, fromFoodList, toApi, toStore.VendorStoreID); err != nil {
|
||||
if err := BatchInitData(ctx, fromFoodList, toApi, toStore.VendorStoreID, i); err != nil {
|
||||
globals.SugarLogger.Debugf("BatchInitData : %s", utils.Format4Output(err, false))
|
||||
}
|
||||
if len(fromFoodList) < 100 {
|
||||
@@ -158,7 +162,7 @@ type Skus struct {
|
||||
}
|
||||
|
||||
// BatchInitData 批量创建商品
|
||||
func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mtwmapi.API, vendorStoreID string) error {
|
||||
func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mtwmapi.API, vendorStoreID string, i int) error {
|
||||
foodDataList := make([]map[string]interface{}, len(fromSku))
|
||||
for i, storeSku := range fromSku {
|
||||
foodData := make(map[string]interface{})
|
||||
@@ -238,7 +242,7 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
||||
if i == count-1 {
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:])
|
||||
if err2 != nil {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%s", utils.Format4Output(err2, false))
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%v", err2)
|
||||
}
|
||||
if len(failedFoodList) != 0 {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err4 :%s", utils.Format4Output(failedFoodList, false))
|
||||
@@ -246,7 +250,7 @@ func BatchInitData(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, toApi *mt
|
||||
} else {
|
||||
failedFoodList, err2 := toApi.RetailBatchInitData(ctx.GetTrackInfo(), vendorStoreID, foodDataList[i*10:(i+1)*10])
|
||||
if err2 != nil {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%s", utils.Format4Output(err2, false))
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err3 :%v", err2)
|
||||
}
|
||||
if len(failedFoodList) != 0 {
|
||||
globals.SugarLogger.Debugf("RetailBatchInitData err4 :%s", utils.Format4Output(failedFoodList, false))
|
||||
|
||||
Reference in New Issue
Block a user