修改SetMTPSStatus方法的名字判断
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -1285,16 +1286,73 @@ func SetMTPSStatus(ctx *jxcontext.Context, storeId, courierStatus int) {
|
||||
/*获取美团门店信息*/
|
||||
//&& CourierStatus != 0
|
||||
if storeId != 0 {
|
||||
var ShopName string
|
||||
StoreLists, _ := dao.GetStoreList(nil, []int{storeId}, nil, nil, nil, "")
|
||||
StoreInfoList, _ := api.MtpsAPI.GetStoreStatus(StoreLists[0].Name)
|
||||
globals.SugarLogger.Debug("美团查询结果", StoreInfoList)
|
||||
if StoreInfoList == nil || StoreInfoList.DataList == nil {
|
||||
ShopName = StoreLists[0].Name
|
||||
StoreInfoList := new(mtpsapi.GetStoreStatusResultAll)
|
||||
StoreInfoList, _ = api.MtpsAPI.GetStoreStatus(ShopName)
|
||||
/*通过名字找到了,正常情况*/
|
||||
if StoreInfoList != nil && StoreInfoList.DataList != nil {
|
||||
goto ifExist
|
||||
} else {
|
||||
/*如果通过名字找不到,那就先通过ID去找名字*/
|
||||
ShopInfo, _ := api.MtpsAPI.ShopQuery(strconv.Itoa(storeId))
|
||||
if ShopInfo != nil {
|
||||
ShopName = ShopInfo.ShopName
|
||||
StoreInfoList, _ = api.MtpsAPI.GetStoreStatus(ShopName)
|
||||
if StoreInfoList != nil && StoreInfoList.DataList != nil {
|
||||
goto ifExist
|
||||
} else {
|
||||
/*如果通过API返回的名字也找不到*/
|
||||
goto ifNotExist
|
||||
}
|
||||
} else {
|
||||
/*如果通过ID找不到,那就直接去判断名字*/
|
||||
goto NameProblem
|
||||
}
|
||||
NameProblem:
|
||||
{
|
||||
var NotOpen int
|
||||
if strings.Contains(StoreLists[0].Name, "不做") || strings.Contains(StoreLists[0].Name, "不想做") {
|
||||
NotOpen = strings.Index(StoreLists[0].Name, "-")
|
||||
if strings.Index(StoreLists[0].Name, "-") > 0 {
|
||||
StoreLists[0].Name = StoreLists[0].Name[:NotOpen-1]
|
||||
}
|
||||
NotOpen = strings.Index(StoreLists[0].Name, "不")
|
||||
if strings.Index(StoreLists[0].Name, "不") > 0 {
|
||||
StoreLists[0].Name = StoreLists[0].Name[:NotOpen-1]
|
||||
}
|
||||
NotOpen = strings.Index(StoreLists[0].Name, "(")
|
||||
if strings.Index(StoreLists[0].Name, "(") > 0 {
|
||||
StoreLists[0].Name = StoreLists[0].Name[:NotOpen-1]
|
||||
}
|
||||
NotOpen = strings.Index(StoreLists[0].Name, "(")
|
||||
if strings.Index(StoreLists[0].Name, "(") > 0 {
|
||||
StoreLists[0].Name = StoreLists[0].Name[:NotOpen-1]
|
||||
}
|
||||
NotOpen = strings.Index(StoreLists[0].Name, " ")
|
||||
if NotOpen > 0 {
|
||||
StoreLists[0].Name = StoreLists[0].Name[:NotOpen-1]
|
||||
}
|
||||
ShopName = StoreLists[0].Name
|
||||
StoreInfoList, _ = api.MtpsAPI.GetStoreStatus(ShopName)
|
||||
if StoreInfoList != nil && StoreInfoList.DataList != nil {
|
||||
goto ifExist
|
||||
} else {
|
||||
goto ifNotExist
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ifNotExist:
|
||||
{
|
||||
sl := make(map[string]interface{})
|
||||
sl["vendorStatus"] = 0
|
||||
globals.SugarLogger.Debug("因为没找到被修改配送状态的VendorStoreID是", StoreLists[0].Name, storeId)
|
||||
UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName())
|
||||
return
|
||||
}
|
||||
ifExist:
|
||||
if StoreInfoList.DataList[0].OuterPoiID != "" {
|
||||
//若存在且名字不为空,就是找到了
|
||||
if StoreInfoList.DataList[0].OpenType != courierStatus {
|
||||
|
||||
Reference in New Issue
Block a user