测试
This commit is contained in:
@@ -2,9 +2,6 @@ package cms
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.rosy.net.cn/baseapi/platformapi/mtpsapi"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -562,91 +559,92 @@ func CompareJxAndMultiVenderDepot(ctx *jxcontext.Context, vendorMap map[int]bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func StoreOpenAll(ctx *jxcontext.Context) {
|
func StoreOpenAll(ctx *jxcontext.Context) {
|
||||||
globals.SugarLogger.Debug("StoreOpenAll skuID is start")
|
AutoFocusStoreSkusForTopSkus(ctx, true, true)
|
||||||
/*获取美团门店信息*/
|
//globals.SugarLogger.Debug("StoreOpenAll skuID is start")
|
||||||
StoreInfoList, _ := api.MtpsAPI.GetStoreStatusAll()
|
///*获取美团门店信息*/
|
||||||
StoreInfoList2 := make(map[string]string)
|
//StoreInfoList, _ := api.MtpsAPI.GetStoreStatusAll()
|
||||||
for _, store := range StoreInfoList {
|
//StoreInfoList2 := make(map[string]string)
|
||||||
for _, data := range store.DataList {
|
//for _, store := range StoreInfoList {
|
||||||
StoreInfoList2[data.OuterPoiID] = data.PoiName
|
// for _, data := range store.DataList {
|
||||||
}
|
// StoreInfoList2[data.OuterPoiID] = data.PoiName
|
||||||
}
|
// }
|
||||||
db := dao.GetDB()
|
//}
|
||||||
/*比较营业状态*/
|
//db := dao.GetDB()
|
||||||
/*把获取的京西状态和名称存一下*/
|
///*比较营业状态*/
|
||||||
StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll)
|
///*把获取的京西状态和名称存一下*/
|
||||||
/*循环美团*/
|
//StoreCourierList, _ := dao.GetStoreCourierList(db, []int{}, model.StoreStatusAll, model.StoreStatusAll)
|
||||||
for _, StoreInfoList1 := range StoreInfoList {
|
///*循环美团*/
|
||||||
for _, StoreInfoList11 := range StoreInfoList1.DataList {
|
//for _, StoreInfoList1 := range StoreInfoList {
|
||||||
/*循环京西*/
|
// for _, StoreInfoList11 := range StoreInfoList1.DataList {
|
||||||
for _, StoreCourierList1 := range StoreCourierList {
|
// /*循环京西*/
|
||||||
/*只比较美团*/
|
// for _, StoreCourierList1 := range StoreCourierList {
|
||||||
if StoreCourierList1.VendorID != model.VendorIDMTPS {
|
// /*只比较美团*/
|
||||||
continue
|
// if StoreCourierList1.VendorID != model.VendorIDMTPS {
|
||||||
}
|
// continue
|
||||||
/*如果门店ID相同的时候进入判断,一个门店只用判断一次就行*/
|
// }
|
||||||
if StoreCourierList1.VendorStoreID == StoreInfoList11.OuterPoiID {
|
// /*如果门店ID相同的时候进入判断,一个门店只用判断一次就行*/
|
||||||
if StoreCourierList1.Status != StoreInfoList11.OpenType {
|
// if StoreCourierList1.VendorStoreID == StoreInfoList11.OuterPoiID {
|
||||||
sl := make(map[string]interface{})
|
// if StoreCourierList1.Status != StoreInfoList11.OpenType {
|
||||||
sl["vendorStoreID"] = StoreInfoList11.OuterPoiID
|
// sl := make(map[string]interface{})
|
||||||
sl["status"] = StoreInfoList11.OpenType
|
// sl["vendorStoreID"] = StoreInfoList11.OuterPoiID
|
||||||
sl["vendorStatus"] = StoreInfoList11.OpenType
|
// sl["status"] = StoreInfoList11.OpenType
|
||||||
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
// sl["vendorStatus"] = StoreInfoList11.OpenType
|
||||||
StoreInfoList11.OuterPoiID, StoreInfoList11.PoiName, strconv.Itoa(StoreInfoList11.OpenType), strconv.Itoa(StoreCourierList1.Status))
|
// globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
||||||
UpdateStoreCourierMap(ctx, nil, StoreCourierList1.StoreID, StoreCourierList1.VendorID, sl, ctx.GetUserName())
|
// StoreInfoList11.OuterPoiID, StoreInfoList11.PoiName, strconv.Itoa(StoreInfoList11.OpenType), strconv.Itoa(StoreCourierList1.Status))
|
||||||
break
|
// UpdateStoreCourierMap(ctx, nil, StoreCourierList1.StoreID, StoreCourierList1.VendorID, sl, ctx.GetUserName())
|
||||||
}
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
/* 美团配送的门店是否存在,调用美团配送的api(有可能接了),查询京西门店对应的美团配送门店是否存在,若不存在则要在京西这边解绑美团配送门店
|
//}
|
||||||
怎么解绑可以在网页上门店管理那点一下看看调的什么接口,传的什么参数*/
|
///* 美团配送的门店是否存在,调用美团配送的api(有可能接了),查询京西门店对应的美团配送门店是否存在,若不存在则要在京西这边解绑美团配送门店
|
||||||
/*获取所有门店信息*/
|
// 怎么解绑可以在网页上门店管理那点一下看看调的什么接口,传的什么参数*/
|
||||||
//test:
|
///*获取所有门店信息*/
|
||||||
for _, StoreCourierList1 := range StoreCourierList {
|
////test:
|
||||||
diff := false
|
//for _, StoreCourierList1 := range StoreCourierList {
|
||||||
StoreLists, _ := dao.GetStoreList(db, []int{StoreCourierList1.StoreID}, nil, nil, nil, "")
|
// diff := false
|
||||||
if StoreLists == nil {
|
// StoreLists, _ := dao.GetStoreList(db, []int{StoreCourierList1.StoreID}, nil, nil, nil, "")
|
||||||
globals.SugarLogger.Debugf("StoreID为:%s,在store表未找到", StoreCourierList1.StoreID)
|
// if StoreLists == nil {
|
||||||
continue
|
// globals.SugarLogger.Debugf("StoreID为:%s,在store表未找到", StoreCourierList1.StoreID)
|
||||||
}
|
// continue
|
||||||
if StoreCourierList1.VendorID != model.VendorIDMTPS || StoreCourierList1.VendorStoreID == "" {
|
// }
|
||||||
continue
|
// if StoreCourierList1.VendorID != model.VendorIDMTPS || StoreCourierList1.VendorStoreID == "" {
|
||||||
}
|
// continue
|
||||||
if StoreCourierList1.Status == model.StoreStatusDisabled || StoreCourierList1.Status == model.StoreStatusClosed {
|
// }
|
||||||
continue
|
// if StoreCourierList1.Status == model.StoreStatusDisabled || StoreCourierList1.Status == model.StoreStatusClosed {
|
||||||
}
|
// continue
|
||||||
/*京西不为空,容错*/
|
// }
|
||||||
//if {
|
// /*京西不为空,容错*/
|
||||||
/*调用API获取美团的商店信息*/
|
// //if {
|
||||||
MTPSInfo := new(mtpsapi.ShopInfo)
|
// /*调用API获取美团的商店信息*/
|
||||||
MTPSInfo, _ = api.MtpsAPI.ShopQuery(StoreCourierList1.VendorStoreID)
|
// MTPSInfo := new(mtpsapi.ShopInfo)
|
||||||
if MTPSInfo == nil {
|
// MTPSInfo, _ = api.MtpsAPI.ShopQuery(StoreCourierList1.VendorStoreID)
|
||||||
globals.SugarLogger.Debug("美团未找到该门店," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
// if MTPSInfo == nil {
|
||||||
diff = true
|
// globals.SugarLogger.Debug("美团未找到该门店," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
||||||
}
|
// diff = true
|
||||||
if MTPSInfo != nil && MTPSInfo.ShopName == "" {
|
// }
|
||||||
MTPSInfo.ShopName = StoreInfoList2[MTPSInfo.ShopID]
|
// if MTPSInfo != nil && MTPSInfo.ShopName == "" {
|
||||||
}
|
// MTPSInfo.ShopName = StoreInfoList2[MTPSInfo.ShopID]
|
||||||
if MTPSInfo != nil && MTPSInfo.ShopLng != StoreCourierList1.Lng && MTPSInfo.ShopLat == StoreCourierList1.Lat {
|
// }
|
||||||
/*平台上但是坐标不同,解绑*/
|
// if MTPSInfo != nil && MTPSInfo.ShopLng != StoreCourierList1.Lng && MTPSInfo.ShopLat == StoreCourierList1.Lat {
|
||||||
globals.SugarLogger.Debug("商店与美团配送上的坐标不同," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
// /*平台上但是坐标不同,解绑*/
|
||||||
if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
// globals.SugarLogger.Debug("商店与美团配送上的坐标不同," + StoreLists[0].Name + strconv.Itoa(StoreCourierList1.StoreID) + " 被解绑,关联的ID为:" + StoreCourierList1.VendorStoreID)
|
||||||
globals.SugarLogger.Debug(err.Error())
|
// if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
||||||
return
|
// globals.SugarLogger.Debug(err.Error())
|
||||||
}
|
// return
|
||||||
diff = true
|
// }
|
||||||
}
|
// diff = true
|
||||||
if diff {
|
// }
|
||||||
if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
// if diff {
|
||||||
globals.SugarLogger.Debug(err.Error())
|
// if _, err := DeleteStoreCourierMap(ctx, db, StoreCourierList1.StoreID, StoreCourierList1.VendorID, ctx.GetUserName()); err != nil {
|
||||||
return
|
// globals.SugarLogger.Debug(err.Error())
|
||||||
}
|
// return
|
||||||
//break test
|
// }
|
||||||
}
|
// //break test
|
||||||
}
|
// }
|
||||||
globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
//}
|
||||||
|
//globals.SugarLogger.Debug("StoreOpenAll skuID is Complete")
|
||||||
}
|
}
|
||||||
|
|
||||||
//func StoreOpenAll(ctx *jxcontext.Context) {
|
//func StoreOpenAll(ctx *jxcontext.Context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user