Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -727,7 +727,7 @@ func CheckHasSensitiveWord(word string) (bool, error) {
|
||||
}
|
||||
|
||||
func IsSensitiveWordInList(str string) (bool, string) {
|
||||
wordList, err := dao.GetSensitiveWordList()
|
||||
wordList, err := dao.GetSensitiveWordList(-1)
|
||||
if err == nil {
|
||||
for _, value := range wordList {
|
||||
keyWord := value.Word
|
||||
|
||||
@@ -455,16 +455,18 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool
|
||||
sql += ")"
|
||||
}
|
||||
}
|
||||
/*前台传入的最大值和最小值设置*/
|
||||
if params["highestPrice"] != "" && params["highestPrice"] != nil {
|
||||
//highestPrice := utils.Interface2Float64WithDefault(params["highestPrice"], 0) * 100
|
||||
sql += " AND t4.unit_price <= ? "
|
||||
sqlParams = append(sqlParams, params["highestPrice"])
|
||||
}
|
||||
if params["minimumPrice"] != "" && params["minimumPrice"] != nil {
|
||||
//minimumPrice := utils.Interface2Float64WithDefault(params["minimumPrice"], 0) * 100
|
||||
sql += " AND t4.unit_price >= ? "
|
||||
sqlParams = append(sqlParams, params["minimumPrice"])
|
||||
if isFocus {
|
||||
/*前台传入的最大值和最小值设置*/
|
||||
if params["highestPrice"] != "" && params["highestPrice"] != nil {
|
||||
//highestPrice := utils.Interface2Float64WithDefault(params["highestPrice"], 0) * 100
|
||||
sql += " AND t4.unit_price <= ? "
|
||||
sqlParams = append(sqlParams, params["highestPrice"])
|
||||
}
|
||||
if params["minimumPrice"] != "" && params["minimumPrice"] != nil {
|
||||
//minimumPrice := utils.Interface2Float64WithDefault(params["minimumPrice"], 0) * 100
|
||||
sql += " AND t4.unit_price >= ? "
|
||||
sqlParams = append(sqlParams, params["minimumPrice"])
|
||||
}
|
||||
}
|
||||
return sql, sqlParams, err
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -1284,26 +1285,85 @@ 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
|
||||
}
|
||||
if StoreInfoList.DataList[0].OuterPoiID != "" {
|
||||
//若存在且名字不为空,就是找到了
|
||||
if StoreInfoList.DataList[0].OpenType != courierStatus {
|
||||
sl := make(map[string]interface{})
|
||||
sl["vendorStoreID"] = StoreInfoList.DataList[0].OuterPoiID
|
||||
sl["status"] = StoreInfoList.DataList[0].OpenType
|
||||
sl["vendorStatus"] = StoreInfoList.DataList[0].OpenType
|
||||
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
||||
StoreInfoList.DataList[0].OuterPoiID, StoreInfoList.DataList[0].PoiName, strconv.Itoa(StoreInfoList.DataList[0].OpenType), strconv.Itoa(StoreLists[0].Status))
|
||||
UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName())
|
||||
ifExist:
|
||||
{
|
||||
if StoreInfoList.DataList[0].OuterPoiID != "" {
|
||||
//若存在且名字不为空,就是找到了
|
||||
if StoreInfoList.DataList[0].OpenType != courierStatus {
|
||||
sl := make(map[string]interface{})
|
||||
sl["vendorStoreID"] = StoreInfoList.DataList[0].OuterPoiID
|
||||
sl["status"] = StoreInfoList.DataList[0].OpenType
|
||||
sl["vendorStatus"] = StoreInfoList.DataList[0].OpenType
|
||||
globals.SugarLogger.Debugf("被修改配送状态的VendorStoreID是:%s,名称是:%s,美团状态是:%s,本地状态是:%s",
|
||||
StoreInfoList.DataList[0].OuterPoiID, StoreInfoList.DataList[0].PoiName, strconv.Itoa(StoreInfoList.DataList[0].OpenType), strconv.Itoa(StoreLists[0].Status))
|
||||
UpdateStoreCourierMap(ctx, nil, storeId, model.VendorIDMTPS, sl, ctx.GetUserName())
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user