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