Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -121,42 +121,33 @@ type VendorStoreExcel struct {
|
||||
OperatorName3 string `json:"运营负责人3"`
|
||||
}
|
||||
|
||||
//门店信息+减免策略
|
||||
type Info1 struct {
|
||||
StoreID int `json:"storeID"` //门店ID
|
||||
StoreName string `json:"storeName"` //门店名字
|
||||
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半,用两个的原因是为了支持中午休息,1与2的时间段不能交叉,为0表示没有
|
||||
CloseTime1 int16 `json:"closeTime1"` // 营业时间 1
|
||||
OpenTime2 int16 `json:"openTime2"` // 营业时间2
|
||||
CloseTime2 int16 `json:"closeTime2"`
|
||||
Status int `json:"status"` //门店是否营业
|
||||
Distance int `json:"distance"` //店铺与定位 直线距离
|
||||
Address string `json:"address"` //门店地址
|
||||
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
|
||||
BrandName string `json:"brandName"` //品牌名字
|
||||
BrandLogo string `json:"brandLogo"` //品牌logo
|
||||
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额
|
||||
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额
|
||||
//门店信息
|
||||
type StoreInfo struct {
|
||||
StoreID int `json:"storeID"` //门店ID
|
||||
StoreName string `json:"storeName"` //门店名字
|
||||
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半,用两个的原因是为了支持中午休息,1与2的时间段不能交叉,为0表示没有
|
||||
CloseTime1 int16 `json:"closeTime1"` // 营业时间 1
|
||||
OpenTime2 int16 `json:"openTime2"` // 营业时间2
|
||||
CloseTime2 int16 `json:"closeTime2"`
|
||||
Status int `json:"status"` //门店是否营业
|
||||
Distance int `json:"distance"` //店铺与定位 直线距离
|
||||
Address string `json:"address"` //门店地址
|
||||
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
|
||||
BrandName string `json:"brandName"` //品牌名字
|
||||
BrandLogo string `json:"brandLogo"` //品牌logo
|
||||
//WeeklyScore int `json:"weeklyScore"` //店铺每周评分
|
||||
}
|
||||
|
||||
//首页展示信息
|
||||
type HomePageInfos struct {
|
||||
StoreID int `json:"storeID"` //门店ID
|
||||
StoreName string `json:"storeName"` //门店名字
|
||||
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半,用两个的原因是为了支持中午休息,1与2的时间段不能交叉,为0表示没有
|
||||
CloseTime1 int16 `json:"closeTime1"` // 营业时间 1
|
||||
OpenTime2 int16 `json:"openTime2"` // 营业时间2
|
||||
CloseTime2 int16 `json:"closeTime2"`
|
||||
Status int `json:"status"` //门店是否营业
|
||||
Distance int `json:"distance"` //店铺与定位 直线距离
|
||||
Address string `json:"address"` //门店地址
|
||||
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
|
||||
BrandName string `json:"brandName"` //品牌名字
|
||||
BrandLogo string `json:"brandLogo"` //品牌logo
|
||||
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额
|
||||
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额
|
||||
//Info *Info1 `json:"info"` //拼接数据
|
||||
//热销商品信息
|
||||
//门店减免策略
|
||||
type StoreDeductionInfo struct {
|
||||
StoreID int `json:"storeID"` //门店ID
|
||||
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额
|
||||
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额
|
||||
}
|
||||
|
||||
//门店热销商品
|
||||
type StoreSkuInfo struct {
|
||||
StoreID int `json:"storeID"` //门店ID
|
||||
SkuID int `json:"skuID"` //商品ID
|
||||
SkuName string `json:"skuName"` //商品名字
|
||||
SkuStatus int `json:"skuStatus"` //商品是否可售状态 1可售 0不可售
|
||||
@@ -164,7 +155,13 @@ type HomePageInfos struct {
|
||||
Img string `json:"img"` //商品第一张图片
|
||||
Price int `json:"price"` // 单位为分,标准价,不为份的就为实际标准价,为份的为每市斤价,实际还要乘质量
|
||||
Unit string `json:"unit"` //商品售卖单位 份/kg等
|
||||
}
|
||||
|
||||
//首页展示信息
|
||||
type HomePageInfos struct {
|
||||
StoreInfo StoreInfo `json:"storeInfo"`
|
||||
StoreDeductionInfo []StoreDeductionInfo `json:"StoreDeductionInfo"`
|
||||
StoreSkuInfo []StoreSkuInfo `json:"StoreSkuInfo"`
|
||||
}
|
||||
|
||||
type JdStoreLevelExt struct {
|
||||
@@ -5729,9 +5726,14 @@ func FilterByB2B(locationList []*common.Store4User, token string) (retVal []*com
|
||||
func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDistance bool, token string) (interface{}, string, error) {
|
||||
//获取门店信息
|
||||
var (
|
||||
storeID []int
|
||||
tmp1s []Info1
|
||||
multipleData []HomePageInfos
|
||||
storeID []int
|
||||
storeInfos []StoreInfo
|
||||
storeDeductionInfo StoreDeductionInfo
|
||||
storeDeductionInfos []StoreDeductionInfo
|
||||
storeSkuInfo StoreSkuInfo
|
||||
StoreSkuInfos []StoreSkuInfo
|
||||
homePage HomePageInfos
|
||||
homePages []HomePageInfos
|
||||
)
|
||||
locationList, err := common.GetStoreListByLocation(ctx, lng, lat, 20000, needWalkDistance, false, 0)
|
||||
if err != nil {
|
||||
@@ -5750,62 +5752,76 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
||||
if err != nil {
|
||||
return nil, "获取门店品牌信息失败", err
|
||||
}
|
||||
storeInfo := StoreInfo{
|
||||
StoreID: v.ID,
|
||||
StoreName: v.Name,
|
||||
OpenTime1: v.OpenTime1,
|
||||
CloseTime1: v.CloseTime1,
|
||||
OpenTime2: v.OpenTime2,
|
||||
CloseTime2: v.CloseTime2,
|
||||
Status: v.Status,
|
||||
Distance: v.Distance,
|
||||
Address: v.Address,
|
||||
BrandName: brandInfos.Name,
|
||||
BrandLogo: brandInfos.Logo,
|
||||
}
|
||||
storeInfos = append(storeInfos, storeInfo)
|
||||
//获取门店减免策略
|
||||
storePolicy, err := GetStoreVendorMaps(ctx, dao.GetDB(), v.ID, 9)
|
||||
if err != nil {
|
||||
return nil, "获取门店减免策略失败", err
|
||||
}
|
||||
tmp1 := Info1{
|
||||
StoreID: v.ID,
|
||||
StoreName: v.Name,
|
||||
OpenTime1: v.OpenTime1,
|
||||
CloseTime1: v.CloseTime1,
|
||||
OpenTime2: v.OpenTime2,
|
||||
CloseTime2: v.CloseTime2,
|
||||
Status: v.Status,
|
||||
Distance: v.Distance,
|
||||
Address: v.Address,
|
||||
BrandName: brandInfos.Name,
|
||||
BrandLogo: brandInfos.Logo,
|
||||
DeliveryFeeDeductionSill: storePolicy[0].DeliveryFeeDeductionSill,
|
||||
DeliveryFeeDeductionFee: storePolicy[0].DeliveryFeeDeductionFee,
|
||||
for _, k := range storePolicy {
|
||||
if k.StoreID == v.ID {
|
||||
storeDeductionInfo = StoreDeductionInfo{
|
||||
StoreID: k.StoreID,
|
||||
DeliveryFeeDeductionSill: k.DeliveryFeeDeductionSill,
|
||||
DeliveryFeeDeductionFee: k.DeliveryFeeDeductionFee,
|
||||
}
|
||||
}
|
||||
storeDeductionInfos = append(storeDeductionInfos, storeDeductionInfo)
|
||||
}
|
||||
tmp1s = append(tmp1s, tmp1)
|
||||
}
|
||||
globals.SugarLogger.Debug("storeInfos============", storeInfos)
|
||||
globals.SugarLogger.Debug("storeDeductionInfos=================", storeDeductionInfos)
|
||||
//获取热销商品
|
||||
topSkusInfo, err := GetTopSkusByStoreIDs(ctx, storeID)
|
||||
globals.SugarLogger.Debug("topSkusInfo==============", topSkusInfo)
|
||||
if err != nil {
|
||||
return nil, "获取热销商品失败", err
|
||||
}
|
||||
for _, i := range tmp1s {
|
||||
for _, j := range topSkusInfo {
|
||||
if i.StoreID == j.StoreID {
|
||||
data := HomePageInfos{
|
||||
StoreID: i.StoreID,
|
||||
StoreName: i.StoreName,
|
||||
OpenTime1: i.OpenTime1,
|
||||
CloseTime1: i.CloseTime1,
|
||||
OpenTime2: i.OpenTime2,
|
||||
CloseTime2: i.CloseTime2,
|
||||
Status: i.Status,
|
||||
Distance: i.Distance,
|
||||
Address: i.Address,
|
||||
BrandName: i.BrandName,
|
||||
BrandLogo: i.BrandLogo,
|
||||
DeliveryFeeDeductionSill: i.DeliveryFeeDeductionSill,
|
||||
DeliveryFeeDeductionFee: i.DeliveryFeeDeductionFee,
|
||||
SkuID: j.SkuID,
|
||||
SkuName: j.Name,
|
||||
SkuStatus: j.Status,
|
||||
BestSeller: j.BestSeller,
|
||||
Img: j.Img,
|
||||
Price: j.Price,
|
||||
Unit: j.Unit,
|
||||
for _, j := range topSkusInfo {
|
||||
//for _, i := range storeID {
|
||||
//if i == j.StoreID {
|
||||
storeSkuInfo = StoreSkuInfo{
|
||||
StoreID: j.StoreID,
|
||||
SkuID: j.SkuID,
|
||||
SkuName: j.Name,
|
||||
SkuStatus: j.Status,
|
||||
BestSeller: j.BestSeller,
|
||||
Img: j.Img,
|
||||
Price: j.Price,
|
||||
Unit: j.Unit,
|
||||
}
|
||||
//}
|
||||
//}
|
||||
StoreSkuInfos = append(StoreSkuInfos, storeSkuInfo)
|
||||
}
|
||||
globals.SugarLogger.Debug("StoreSkuInfos=================", StoreSkuInfos)
|
||||
for _, i := range storeInfos {
|
||||
for _, j := range storeDeductionInfos {
|
||||
for _, k := range StoreSkuInfos {
|
||||
if i.StoreID == j.StoreID && i.StoreID == k.StoreID {
|
||||
homePage = HomePageInfos{
|
||||
StoreInfo: i,
|
||||
StoreDeductionInfo: j,
|
||||
StoreSkuInfo: k,
|
||||
}
|
||||
}
|
||||
multipleData = append(multipleData, data)
|
||||
}
|
||||
}
|
||||
homePages = append(homePages, homePage)
|
||||
}
|
||||
}
|
||||
return multipleData, "", nil
|
||||
return homePages, "", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user