home
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,11 +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"` //订单减免金额
|
||||||
WeeklyScore int `json:"weeklyScore"` //店铺每周评分
|
|
||||||
}
|
}
|
||||||
type Info2 struct {
|
|
||||||
|
//门店热销商品
|
||||||
|
type StoreSkuInfo struct {
|
||||||
|
StoreID int `json:"storeID"` //门店ID
|
||||||
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不可售
|
||||||
@@ -151,32 +159,9 @@ type Info2 struct {
|
|||||||
|
|
||||||
//首页展示信息
|
//首页展示信息
|
||||||
type HomePageInfos struct {
|
type HomePageInfos struct {
|
||||||
//StoreID int `json:"storeID"` //门店ID
|
StoreInfo StoreInfo `json:"storeInfo"`
|
||||||
//StoreName string `json:"storeName"` //门店名字
|
StoreDeductionInfo []StoreDeductionInfo `json:"StoreDeductionInfo"`
|
||||||
//OpenTime1 int16 `json:"openTime1"` // 930就表示9点半,用两个的原因是为了支持中午休息,1与2的时间段不能交叉,为0表示没有
|
StoreSkuInfo []StoreSkuInfo `json:"StoreSkuInfo"`
|
||||||
//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"` //订单减免金额
|
|
||||||
//WeeklyScore int `json:"weeklyScore"` //店铺每周评分
|
|
||||||
Info Info1 `json:"info1"` //拼接数据
|
|
||||||
//热销商品信息
|
|
||||||
Info2 []Info2 `json:"info2"`
|
|
||||||
//SkuID int `json:"skuID"` //商品ID
|
|
||||||
//SkuName string `json:"skuName"` //商品名字
|
|
||||||
//SkuStatus int `json:"skuStatus"` //商品是否可售状态 1可售 0不可售
|
|
||||||
//BestSeller int `json:"bestSeller"` //畅销品 0不是 1是
|
|
||||||
//Img string `json:"img"` //商品第一张图片
|
|
||||||
//Price int `json:"price"` // 单位为分,标准价,不为份的就为实际标准价,为份的为每市斤价,实际还要乘质量
|
|
||||||
//Unit string `json:"unit"` //商品售卖单位 份/kg等
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type JdStoreLevelExt struct {
|
type JdStoreLevelExt struct {
|
||||||
@@ -5742,11 +5727,13 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
|||||||
//获取门店信息
|
//获取门店信息
|
||||||
var (
|
var (
|
||||||
storeID []int
|
storeID []int
|
||||||
tmp1s []Info1
|
storeInfos []StoreInfo
|
||||||
multipleData []Info2
|
storeDeductionInfo StoreDeductionInfo
|
||||||
data Info2
|
storeDeductionInfos []StoreDeductionInfo
|
||||||
ans HomePageInfos
|
storeSkuInfo StoreSkuInfo
|
||||||
res []HomePageInfos
|
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 {
|
||||||
@@ -5765,6 +5752,20 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "获取门店品牌信息失败", err
|
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)
|
storePolicy, err := GetStoreVendorMaps(ctx, dao.GetDB(), v.ID, 9)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -5777,23 +5778,13 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
|||||||
//}
|
//}
|
||||||
for _, k := range storePolicy {
|
for _, k := range storePolicy {
|
||||||
if k.StoreID == v.ID {
|
if k.StoreID == v.ID {
|
||||||
tmp1 := Info1{
|
storeDeductionInfo = StoreDeductionInfo{
|
||||||
StoreID: v.ID,
|
StoreID: k.StoreID,
|
||||||
StoreName: v.Name,
|
DeliveryFeeDeductionSill: k.DeliveryFeeDeductionSill,
|
||||||
OpenTime1: v.OpenTime1,
|
DeliveryFeeDeductionFee: k.DeliveryFeeDeductionFee,
|
||||||
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,
|
|
||||||
}
|
}
|
||||||
tmp1s = append(tmp1s, tmp1)
|
|
||||||
}
|
}
|
||||||
|
storeDeductionInfos = append(storeDeductionInfos, storeDeductionInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//获取热销商品
|
//获取热销商品
|
||||||
@@ -5801,10 +5792,11 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "获取热销商品失败", err
|
return nil, "获取热销商品失败", err
|
||||||
}
|
}
|
||||||
for _, i := range tmp1s {
|
for _, i := range storeID {
|
||||||
for _, j := range topSkusInfo {
|
for _, j := range topSkusInfo {
|
||||||
if i.StoreID == j.StoreID {
|
if i == j.StoreID {
|
||||||
data = Info2{
|
storeSkuInfo = StoreSkuInfo{
|
||||||
|
StoreID: j.StoreID,
|
||||||
SkuID: j.SkuID,
|
SkuID: j.SkuID,
|
||||||
SkuName: j.Name,
|
SkuName: j.Name,
|
||||||
SkuStatus: j.Status,
|
SkuStatus: j.Status,
|
||||||
@@ -5815,19 +5807,18 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
multipleData = append(multipleData, data)
|
StoreSkuInfos = append(StoreSkuInfos, storeSkuInfo)
|
||||||
if len(multipleData) > 0 {
|
|
||||||
ans = HomePageInfos{
|
|
||||||
Info: i,
|
|
||||||
Info2: multipleData,
|
|
||||||
}
|
}
|
||||||
} else {
|
for _, i := range storeInfos {
|
||||||
ans = HomePageInfos{
|
if i.StoreID == storeDeductionInfos[0].StoreID && i.StoreID == StoreSkuInfos[0].StoreID {
|
||||||
Info: i,
|
homePage = HomePageInfos{
|
||||||
|
StoreInfo: i,
|
||||||
|
StoreDeductionInfo: storeDeductionInfos,
|
||||||
|
StoreSkuInfo: StoreSkuInfos,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = append(res, ans)
|
homePages = append(homePages, homePage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res, "", nil
|
return homePages, "", nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user