Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -148,6 +148,7 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
|
|||||||
"operateType": model.OperateTypeName,
|
"operateType": model.OperateTypeName,
|
||||||
"thingType": model.ThingTypeName,
|
"thingType": model.ThingTypeName,
|
||||||
"apiFunctionName": model.ApiFunctionName,
|
"apiFunctionName": model.ApiFunctionName,
|
||||||
|
"vendorStatus": model.VendorStatus,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1519,6 +1519,7 @@ func AddStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID
|
|||||||
func addStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeCourierMap *model.StoreCourierMap, isNeedUpdateRemote bool) (outStoreCourierMap *model.StoreCourierMap, err error) {
|
func addStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, storeCourierMap *model.StoreCourierMap, isNeedUpdateRemote bool) (outStoreCourierMap *model.StoreCourierMap, err error) {
|
||||||
storeCourierMap.StoreID = storeID
|
storeCourierMap.StoreID = storeID
|
||||||
storeCourierMap.VendorID = vendorID
|
storeCourierMap.VendorID = vendorID
|
||||||
|
storeCourierMap.VendorStatus = storeCourierMap.Status
|
||||||
globals.SugarLogger.Debugf("addStoreCourierMap %s, storeCourierMap:%s, isNeedUpdateRemote:%t", model.VendorChineseNames[vendorID], utils.Format4Output(storeCourierMap, true), isNeedUpdateRemote)
|
globals.SugarLogger.Debugf("addStoreCourierMap %s, storeCourierMap:%s, isNeedUpdateRemote:%t", model.VendorChineseNames[vendorID], utils.Format4Output(storeCourierMap, true), isNeedUpdateRemote)
|
||||||
|
|
||||||
if handler := partner.GetDeliveryPlatformFromVendorID(vendorID); handler != nil {
|
if handler := partner.GetDeliveryPlatformFromVendorID(vendorID); handler != nil {
|
||||||
@@ -1565,6 +1566,7 @@ func DeleteStoreCourierMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendo
|
|||||||
storeCourierMap := &model.StoreCourierMap{}
|
storeCourierMap := &model.StoreCourierMap{}
|
||||||
num, err = dao.DeleteEntityLogically(db, storeCourierMap, map[string]interface{}{
|
num, err = dao.DeleteEntityLogically(db, storeCourierMap, map[string]interface{}{
|
||||||
model.FieldStatus: model.StoreStatusDisabled,
|
model.FieldStatus: model.StoreStatusDisabled,
|
||||||
|
model.FieldVendorStatus: model.StoreStatusDisabled,
|
||||||
}, userName, map[string]interface{}{
|
}, userName, map[string]interface{}{
|
||||||
model.FieldStoreID: storeID,
|
model.FieldStoreID: storeID,
|
||||||
model.FieldVendorID: vendorID,
|
model.FieldVendorID: vendorID,
|
||||||
|
|||||||
@@ -2471,7 +2471,12 @@ func GetTopSkusByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (storeSkuNameE
|
|||||||
func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNameAndPlaceList []*dao.SkuNameAndPlace, err error) {
|
func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNameAndPlaceList []*dao.SkuNameAndPlace, err error) {
|
||||||
db := dao.GetDB()
|
db := dao.GetDB()
|
||||||
orderCreate := time.Now().AddDate(0, -1, 0)
|
orderCreate := time.Now().AddDate(0, -1, 0)
|
||||||
skuNameAndPlace, err := dao.GetTopSkusByCityCode(db, cityCode, orderCreate)
|
var skuNameAndPlace []*dao.SkuNameAndPlace
|
||||||
|
if cityCode > 0 {
|
||||||
|
skuNameAndPlace, err = dao.GetTopSkusByCityCode(db, cityCode, orderCreate)
|
||||||
|
} else {
|
||||||
|
skuNameAndPlace, err = dao.GetTopSkusByNoCityCode(db)
|
||||||
|
}
|
||||||
if storeID > 0 {
|
if storeID > 0 {
|
||||||
var skuNameList []*model.SkuName
|
var skuNameList []*model.SkuName
|
||||||
//不可售的商品nameID列表
|
//不可售的商品nameID列表
|
||||||
@@ -3350,7 +3355,8 @@ func AutoFocusStoreSkusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhe
|
|||||||
for _, name := range skuName {
|
for _, name := range skuName {
|
||||||
skuNameMap[name.ID] = name.ID
|
skuNameMap[name.ID] = name.ID
|
||||||
}
|
}
|
||||||
skuNameAndPlaceList, err2 := GetTopSkusByCityCode(ctx, v.CityCode, 0)
|
skuNameAndPlaceList, err2 := GetTopSkusByCityCode(ctx, 0, 0)
|
||||||
|
//skuNameAndPlaceList, err2 := GetTopSkusByCityCode(ctx, v.CityCode, 0)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
return retVal, err2
|
return retVal, err2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -200,6 +200,10 @@ var (
|
|||||||
AfsAppealTypeReturnAndRefund: "退款", // 这个其实是退货退款,强制显示成退款
|
AfsAppealTypeReturnAndRefund: "退款", // 这个其实是退货退款,强制显示成退款
|
||||||
AfsAppealTypeNewGoods: "退款.", // 这个其实是重发商品,强制显示成退款
|
AfsAppealTypeNewGoods: "退款.", // 这个其实是重发商品,强制显示成退款
|
||||||
}
|
}
|
||||||
|
VendorStatus = map[int]string{
|
||||||
|
0: "休息",
|
||||||
|
1: "营业",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -1672,6 +1672,18 @@ func GetStoreSkuAuditLight(db *DaoDB, storeIDs, nameIDs []int, status int) (stor
|
|||||||
return storeSkuAudit, err
|
return storeSkuAudit, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetTopSkusByNoCityCode(db *DaoDB) (skuNameAndPlace []*SkuNameAndPlace, err error) {
|
||||||
|
var skuName1 []model.SkuName
|
||||||
|
_, err = db.Db.QueryTable("sku_name").Filter("best_seller", "1").All(&skuName1)
|
||||||
|
for k, _ := range skuName1 {
|
||||||
|
skuNameAndPlace1 := &SkuNameAndPlace{
|
||||||
|
SkuName: skuName1[k],
|
||||||
|
}
|
||||||
|
skuNameAndPlace = append(skuNameAndPlace, skuNameAndPlace1)
|
||||||
|
}
|
||||||
|
return skuNameAndPlace, err
|
||||||
|
}
|
||||||
|
|
||||||
func GetStoreSkuHistory(db *DaoDB, storeIDs, skuIDs []int, status int, snapShot time.Time) (storeSkuHistory []*model.StoreSkuBindHistory, err error) {
|
func GetStoreSkuHistory(db *DaoDB, storeIDs, skuIDs []int, status int, snapShot time.Time) (storeSkuHistory []*model.StoreSkuBindHistory, err error) {
|
||||||
sql := `
|
sql := `
|
||||||
SELECT a.*
|
SELECT a.*
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ const (
|
|||||||
FieldVendorActID = "VendorActID"
|
FieldVendorActID = "VendorActID"
|
||||||
|
|
||||||
FieldSkuSeq = "Seq"
|
FieldSkuSeq = "Seq"
|
||||||
|
FieldVendorStatus = "VendorStatus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelIDCUL struct {
|
type ModelIDCUL struct {
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ type SkuName struct {
|
|||||||
YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀
|
YbNameSuffix string `json:"ybNameSuffix"` //银豹商品后缀
|
||||||
JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` //京东商城总库存
|
JdsStockSwitch int8 `orm:"default(1)" json:"jdsStockSwitch"` //京东商城总库存
|
||||||
PreparationTime int `orm:"default(1)" json:"preparationTime"` //商品准备时长
|
PreparationTime int `orm:"default(1)" json:"preparationTime"` //商品准备时长
|
||||||
|
BestSeller int `json:"bestSeller"` //畅销品 0不是 1是
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*SkuName) TableUnique() [][]string {
|
func (*SkuName) TableUnique() [][]string {
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ func (c *StoreSkuController) GetTopSkusByStoreIDs() {
|
|||||||
// @Title 根据城市信息查找推荐商品(按销量)
|
// @Title 根据城市信息查找推荐商品(按销量)
|
||||||
// @Description 根据城市信息查找推荐商品(按销量)
|
// @Description 根据城市信息查找推荐商品(按销量)
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param cityCode query int true "城市id"
|
// @Param cityCode query int false "城市id"
|
||||||
// @Param storeID query int false "门店id"
|
// @Param storeID query int false "门店id"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
|||||||
Reference in New Issue
Block a user