From f2044489309d07094ff4ebec6171e16ed6632ac5 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 24 Aug 2022 18:13:17 +0800 Subject: [PATCH 01/27] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=95=86=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 44 +++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index baf8dfc5a..b1e7bcccb 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -8,6 +8,7 @@ import ( "fmt" "git.rosy.net.cn/jx-callback/business/jxstore/common" "git.rosy.net.cn/jx-callback/business/jxstore/event" + "git.rosy.net.cn/jx-callback/business/jxstore/misc" "io" "math" "mime/multipart" @@ -137,6 +138,7 @@ type Info1 struct { BrandLogo string `json:"brandLogo"` //品牌logo DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额 DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额 + WeeklyScore int `json:"weeklyScore"` //店铺每周评分 } //首页展示信息 @@ -155,6 +157,7 @@ type HomePageInfos struct { BrandLogo string `json:"brandLogo"` //品牌logo DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额 DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额 + WeeklyScore int `json:"weeklyScore"` //店铺每周评分 //Info *Info1 `json:"info"` //拼接数据 //热销商品信息 SkuID int `json:"skuID"` //商品ID @@ -5755,22 +5758,32 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis 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, + //获取店铺每周评分 + weeklyScore, err := misc.GetWeeklyStoreScore(v.ID, -1) + if err != nil { + return nil, "获取店铺每周评分失败", err + } + for _, k := range storePolicy { + if k.StoreID == v.ID { + 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, + WeeklyScore: weeklyScore[0].TotalScore, + } + tmp1s = append(tmp1s, tmp1) + } } - tmp1s = append(tmp1s, tmp1) } //获取热销商品 topSkusInfo, err := GetTopSkusByStoreIDs(ctx, storeID) @@ -5794,6 +5807,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis BrandLogo: i.BrandLogo, DeliveryFeeDeductionSill: i.DeliveryFeeDeductionSill, DeliveryFeeDeductionFee: i.DeliveryFeeDeductionFee, + WeeklyScore: i.WeeklyScore, SkuID: j.SkuID, SkuName: j.Name, SkuStatus: j.Status, From 951bad012ec3ca892a11a5ce06346418d5c7c63a Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 24 Aug 2022 18:18:25 +0800 Subject: [PATCH 02/27] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=95=86=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index b1e7bcccb..42714a3c4 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -8,7 +8,6 @@ import ( "fmt" "git.rosy.net.cn/jx-callback/business/jxstore/common" "git.rosy.net.cn/jx-callback/business/jxstore/event" - "git.rosy.net.cn/jx-callback/business/jxstore/misc" "io" "math" "mime/multipart" @@ -5759,10 +5758,10 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis return nil, "获取门店减免策略失败", err } //获取店铺每周评分 - weeklyScore, err := misc.GetWeeklyStoreScore(v.ID, -1) - if err != nil { - return nil, "获取店铺每周评分失败", err - } + //weeklyScore, err := misc.GetWeeklyStoreScore(v.ID, -1) + //if err != nil { + // return nil, "获取店铺每周评分失败", err + //} for _, k := range storePolicy { if k.StoreID == v.ID { tmp1 := Info1{ @@ -5779,7 +5778,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis BrandLogo: brandInfos.Logo, DeliveryFeeDeductionSill: storePolicy[0].DeliveryFeeDeductionSill, DeliveryFeeDeductionFee: storePolicy[0].DeliveryFeeDeductionFee, - WeeklyScore: weeklyScore[0].TotalScore, + //WeeklyScore: weeklyScore[0].TotalScore, } tmp1s = append(tmp1s, tmp1) } @@ -5807,14 +5806,14 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis BrandLogo: i.BrandLogo, DeliveryFeeDeductionSill: i.DeliveryFeeDeductionSill, DeliveryFeeDeductionFee: i.DeliveryFeeDeductionFee, - WeeklyScore: i.WeeklyScore, - SkuID: j.SkuID, - SkuName: j.Name, - SkuStatus: j.Status, - BestSeller: j.BestSeller, - Img: j.Img, - Price: j.Price, - Unit: j.Unit, + //WeeklyScore: i.WeeklyScore, + SkuID: j.SkuID, + SkuName: j.Name, + SkuStatus: j.Status, + BestSeller: j.BestSeller, + Img: j.Img, + Price: j.Price, + Unit: j.Unit, } multipleData = append(multipleData, data) } From 6163f1b0fed8b4fe44fe8ef17dadabb9f2fcd0cd Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 09:38:51 +0800 Subject: [PATCH 03/27] home --- business/jxstore/cms/store.go | 59 ++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 42714a3c4..c6ba6291f 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -142,22 +142,22 @@ type Info1 struct { //首页展示信息 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"` //订单减免金额 - WeeklyScore int `json:"weeklyScore"` //店铺每周评分 - //Info *Info1 `json:"info"` //拼接数据 + //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"` //订单减免金额 + //WeeklyScore int `json:"weeklyScore"` //店铺每周评分 + Info *Info1 `json:"info"` //拼接数据 //热销商品信息 SkuID int `json:"skuID"` //商品ID SkuName string `json:"skuName"` //商品名字 @@ -5793,20 +5793,21 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis 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, + //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, //WeeklyScore: i.WeeklyScore, + Info: i, SkuID: j.SkuID, SkuName: j.Name, SkuStatus: j.Status, From c1573d1796a55d7531199fc54eeb74e28cfff2f2 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 09:40:34 +0800 Subject: [PATCH 04/27] home --- business/jxstore/cms/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index c6ba6291f..75d9ae1d5 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -157,7 +157,7 @@ type HomePageInfos struct { //DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额 //DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额 //WeeklyScore int `json:"weeklyScore"` //店铺每周评分 - Info *Info1 `json:"info"` //拼接数据 + Info Info1 `json:"info"` //拼接数据 //热销商品信息 SkuID int `json:"skuID"` //商品ID SkuName string `json:"skuName"` //商品名字 From 880414e5ce364c75f6cc972244d34c484bb641f5 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 09:59:43 +0800 Subject: [PATCH 05/27] home --- business/jxstore/cms/store.go | 55 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 75d9ae1d5..984fb6e9d 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -139,6 +139,15 @@ type Info1 struct { DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额 WeeklyScore int `json:"weeklyScore"` //店铺每周评分 } +type Info2 struct { + 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 HomePageInfos struct { @@ -157,15 +166,16 @@ type HomePageInfos struct { //DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"` //订单满减金额 //DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"` //订单减免金额 //WeeklyScore int `json:"weeklyScore"` //店铺每周评分 - Info Info1 `json:"info"` //拼接数据 + Info Info1 `json:"info1"` //拼接数据 //热销商品信息 - 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等 + 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等 } @@ -5733,7 +5743,9 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis var ( storeID []int tmp1s []Info1 - multipleData []HomePageInfos + multipleData []Info2 + data Info2 + res []HomePageInfos ) locationList, err := common.GetStoreListByLocation(ctx, lng, lat, 20000, needWalkDistance, false, 0) if err != nil { @@ -5778,7 +5790,6 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis BrandLogo: brandInfos.Logo, DeliveryFeeDeductionSill: storePolicy[0].DeliveryFeeDeductionSill, DeliveryFeeDeductionFee: storePolicy[0].DeliveryFeeDeductionFee, - //WeeklyScore: weeklyScore[0].TotalScore, } tmp1s = append(tmp1s, tmp1) } @@ -5792,22 +5803,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis 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, - //WeeklyScore: i.WeeklyScore, - Info: i, + data = Info2{ SkuID: j.SkuID, SkuName: j.Name, SkuStatus: j.Status, @@ -5818,8 +5814,13 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } multipleData = append(multipleData, data) } + ans := HomePageInfos{ + Info: i, + Info2: data, + } + res = append(res, ans) } } } - return multipleData, "", nil + return res, "", nil } From 2e8a73890a1d70ce5971dc7ddee3a8fd3a1ae1ad Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:03:11 +0800 Subject: [PATCH 06/27] home --- business/jxstore/cms/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 984fb6e9d..28eb463bb 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -168,7 +168,7 @@ type HomePageInfos struct { //WeeklyScore int `json:"weeklyScore"` //店铺每周评分 Info Info1 `json:"info1"` //拼接数据 //热销商品信息 - Info2 Info2 `json:"info2"` + Info2 []Info2 `json:"info2"` //SkuID int `json:"skuID"` //商品ID //SkuName string `json:"skuName"` //商品名字 //SkuStatus int `json:"skuStatus"` //商品是否可售状态 1可售 0不可售 @@ -5816,7 +5816,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } ans := HomePageInfos{ Info: i, - Info2: data, + Info2: multipleData, } res = append(res, ans) } From 9af3536bf1932df3dad37133476f9a145a9dc739 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:06:59 +0800 Subject: [PATCH 07/27] home --- business/jxstore/cms/store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 28eb463bb..1154b3291 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5814,6 +5814,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } multipleData = append(multipleData, data) } + globals.SugarLogger.Debug("multipleData===============", multipleData) ans := HomePageInfos{ Info: i, Info2: multipleData, From 1952e318a23fa79fd58403e668d33cd408244e9e Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:10:06 +0800 Subject: [PATCH 08/27] home --- business/jxstore/cms/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 1154b3291..6c2dc1ca8 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5812,8 +5812,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis Price: j.Price, Unit: j.Unit, } - multipleData = append(multipleData, data) } + multipleData = append(multipleData, data) globals.SugarLogger.Debug("multipleData===============", multipleData) ans := HomePageInfos{ Info: i, From 3f9d49cafe962f059b86c0587d41c8250dcb0659 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:14:46 +0800 Subject: [PATCH 09/27] home --- business/jxstore/cms/store.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 6c2dc1ca8..112d1694e 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5813,14 +5813,14 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis Unit: j.Unit, } } - multipleData = append(multipleData, data) - globals.SugarLogger.Debug("multipleData===============", multipleData) - ans := HomePageInfos{ - Info: i, - Info2: multipleData, - } - res = append(res, ans) } + multipleData = append(multipleData, data) + globals.SugarLogger.Debug("multipleData===============", multipleData) + ans := HomePageInfos{ + Info: i, + Info2: multipleData, + } + res = append(res, ans) } } return res, "", nil From 62c0e1fc59e8063abcbc9edbdfeb9e1633871abf Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:26:11 +0800 Subject: [PATCH 10/27] home --- business/jxstore/cms/store.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 112d1694e..49d07f1af 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5745,6 +5745,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis tmp1s []Info1 multipleData []Info2 data Info2 + ans HomePageInfos res []HomePageInfos ) locationList, err := common.GetStoreListByLocation(ctx, lng, lat, 20000, needWalkDistance, false, 0) @@ -5815,10 +5816,15 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } } multipleData = append(multipleData, data) - globals.SugarLogger.Debug("multipleData===============", multipleData) - ans := HomePageInfos{ - Info: i, - Info2: multipleData, + if len(multipleData) > 0 { + ans = HomePageInfos{ + Info: i, + Info2: multipleData, + } + } else { + ans = HomePageInfos{ + Info: i, + } } res = append(res, ans) } From 1933aa0024f9b0131ebf5897dbf989bcd6144111 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:34:12 +0800 Subject: [PATCH 11/27] home --- business/jxstore/cms/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 49d07f1af..ff46247cd 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5814,8 +5814,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis Unit: j.Unit, } } + multipleData = append(multipleData, data) } - multipleData = append(multipleData, data) if len(multipleData) > 0 { ans = HomePageInfos{ Info: i, From cc889b42b0d2ae36e135159f74d3daa828117026 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:36:49 +0800 Subject: [PATCH 12/27] home --- business/jxstore/cms/store.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index ff46247cd..e870428bb 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5814,8 +5814,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis Unit: j.Unit, } } - multipleData = append(multipleData, data) } + multipleData = append(multipleData, data) if len(multipleData) > 0 { ans = HomePageInfos{ Info: i, @@ -5826,8 +5826,9 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis Info: i, } } - res = append(res, ans) + } + res = append(res, ans) } return res, "", nil } From 0884a0256ffda755b199605b440445bdb1f3c0b4 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:39:28 +0800 Subject: [PATCH 13/27] home --- business/jxstore/cms/store.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index e870428bb..49d07f1af 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5826,9 +5826,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis Info: i, } } - + res = append(res, ans) } - res = append(res, ans) } return res, "", nil } From feae547e4bf8bd759bbf4a9bb246af329760001b Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:45:35 +0800 Subject: [PATCH 14/27] home --- business/jxstore/cms/store.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 49d07f1af..36702c5af 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -140,6 +140,7 @@ type Info1 struct { WeeklyScore int `json:"weeklyScore"` //店铺每周评分 } type Info2 struct { + StoreID int `json:"storeID"` //门店ID SkuID int `json:"skuID"` //商品ID SkuName string `json:"skuName"` //商品名字 SkuStatus int `json:"skuStatus"` //商品是否可售状态 1可售 0不可售 @@ -5805,6 +5806,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis for _, j := range topSkusInfo { if i.StoreID == j.StoreID { data = Info2{ + StoreID: j.StoreID, SkuID: j.SkuID, SkuName: j.Name, SkuStatus: j.Status, @@ -5817,9 +5819,13 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } multipleData = append(multipleData, data) if len(multipleData) > 0 { - ans = HomePageInfos{ - Info: i, - Info2: multipleData, + for _, k := range multipleData { + if i.StoreID == k.StoreID { + ans = HomePageInfos{ + Info: i, + Info2: multipleData, + } + } } } else { ans = HomePageInfos{ From e2361182a0e75a9c86bf5b1a26ee9f323d9e1347 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:47:40 +0800 Subject: [PATCH 15/27] home --- business/jxstore/cms/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 36702c5af..a9b0fc0ec 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5829,7 +5829,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } } else { ans = HomePageInfos{ - Info: i, + Info: i, + Info2: nil, } } res = append(res, ans) From 95cd8433af0a8cb74811c683deaa8b752cfa4b59 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:49:26 +0800 Subject: [PATCH 16/27] home --- business/jxstore/cms/store.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index a9b0fc0ec..5b55fb7e6 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5819,12 +5819,10 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } multipleData = append(multipleData, data) if len(multipleData) > 0 { - for _, k := range multipleData { - if i.StoreID == k.StoreID { - ans = HomePageInfos{ - Info: i, - Info2: multipleData, - } + if i.StoreID == multipleData[0].StoreID { + ans = HomePageInfos{ + Info: i, + Info2: multipleData, } } } else { From 245ceeb28c377ffb73de6b937395e2ffafe44e65 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:52:11 +0800 Subject: [PATCH 17/27] home --- business/jxstore/cms/store.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 5b55fb7e6..49d07f1af 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -140,7 +140,6 @@ type Info1 struct { WeeklyScore int `json:"weeklyScore"` //店铺每周评分 } type Info2 struct { - StoreID int `json:"storeID"` //门店ID SkuID int `json:"skuID"` //商品ID SkuName string `json:"skuName"` //商品名字 SkuStatus int `json:"skuStatus"` //商品是否可售状态 1可售 0不可售 @@ -5806,7 +5805,6 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis for _, j := range topSkusInfo { if i.StoreID == j.StoreID { data = Info2{ - StoreID: j.StoreID, SkuID: j.SkuID, SkuName: j.Name, SkuStatus: j.Status, @@ -5819,16 +5817,13 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } multipleData = append(multipleData, data) if len(multipleData) > 0 { - if i.StoreID == multipleData[0].StoreID { - ans = HomePageInfos{ - Info: i, - Info2: multipleData, - } + ans = HomePageInfos{ + Info: i, + Info2: multipleData, } } else { ans = HomePageInfos{ - Info: i, - Info2: nil, + Info: i, } } res = append(res, ans) From f5119f5ba1e6b3eab97c00b2b174fe5faacd313c Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 10:57:53 +0800 Subject: [PATCH 18/27] home --- business/jxstore/cms/store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 49d07f1af..378022c9d 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5801,6 +5801,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取热销商品失败", err } + globals.SugarLogger.Debug("topSkusInfo===============", topSkusInfo) for _, i := range tmp1s { for _, j := range topSkusInfo { if i.StoreID == j.StoreID { From c812ea1965fb8d73bea91e6d19ac69c78732ad83 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 11:02:10 +0800 Subject: [PATCH 19/27] home --- business/jxstore/cms/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 378022c9d..94711fd52 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5801,7 +5801,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取热销商品失败", err } - globals.SugarLogger.Debug("topSkusInfo===============", topSkusInfo) + globals.SugarLogger.Debug("topSkusInfo===============", topSkusInfo[4]) for _, i := range tmp1s { for _, j := range topSkusInfo { if i.StoreID == j.StoreID { From e01b5aa70f8a382c26b0b96425e0d6ff460a1d88 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 11:06:30 +0800 Subject: [PATCH 20/27] home --- business/jxstore/cms/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 94711fd52..dfaccd896 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5801,7 +5801,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取热销商品失败", err } - globals.SugarLogger.Debug("topSkusInfo===============", topSkusInfo[4]) + globals.SugarLogger.Debug("topSkusInfo===============", topSkusInfo[4], topSkusInfo[4].StoreID) + globals.SugarLogger.Debug("topSkusInfo55555===============", topSkusInfo[5].StoreID, topSkusInfo[5]) for _, i := range tmp1s { for _, j := range topSkusInfo { if i.StoreID == j.StoreID { From b0fb0318bfb2348fbb8069a03f28682d4b799232 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 11:08:58 +0800 Subject: [PATCH 21/27] home --- business/jxstore/cms/store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index dfaccd896..1fadd3201 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5801,8 +5801,8 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取热销商品失败", err } - globals.SugarLogger.Debug("topSkusInfo===============", topSkusInfo[4], topSkusInfo[4].StoreID) - globals.SugarLogger.Debug("topSkusInfo55555===============", topSkusInfo[5].StoreID, topSkusInfo[5]) + globals.SugarLogger.Debug("topSkusInfo===============", &topSkusInfo[4], &topSkusInfo[4].StoreID) + globals.SugarLogger.Debug("topSkusInfo55555===============", &topSkusInfo[5].StoreID, &topSkusInfo[5]) for _, i := range tmp1s { for _, j := range topSkusInfo { if i.StoreID == j.StoreID { From a417611b175211d028b844ea5225318c58f25742 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 11:34:44 +0800 Subject: [PATCH 22/27] home --- business/jxstore/cms/store.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 1fadd3201..49d07f1af 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5801,8 +5801,6 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取热销商品失败", err } - globals.SugarLogger.Debug("topSkusInfo===============", &topSkusInfo[4], &topSkusInfo[4].StoreID) - globals.SugarLogger.Debug("topSkusInfo55555===============", &topSkusInfo[5].StoreID, &topSkusInfo[5]) for _, i := range tmp1s { for _, j := range topSkusInfo { if i.StoreID == j.StoreID { From 934d8f932ec52e9503b6c20988b4b56854137ffe Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 14:05:30 +0800 Subject: [PATCH 23/27] home --- business/jxstore/cms/store.go | 149 ++++++++++++++++------------------ 1 file changed, 70 insertions(+), 79 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 49d07f1af..ced1adeb3 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -121,25 +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"` //订单减免金额 - WeeklyScore int `json:"weeklyScore"` //店铺每周评分 +//门店信息 +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 Info2 struct { + +//门店减免策略 +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不可售 @@ -151,32 +159,9 @@ type Info2 struct { //首页展示信息 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"` //订单减免金额 - //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等 - + StoreInfo StoreInfo `json:"storeInfo"` + StoreDeductionInfo []StoreDeductionInfo `json:"StoreDeductionInfo"` + StoreSkuInfo []StoreSkuInfo `json:"StoreSkuInfo"` } type JdStoreLevelExt struct { @@ -5741,12 +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 []Info2 - data Info2 - ans HomePageInfos - res []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 { @@ -5765,6 +5752,20 @@ 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 { @@ -5777,23 +5778,13 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis //} for _, k := range storePolicy { if k.StoreID == v.ID { - 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, + storeDeductionInfo = StoreDeductionInfo{ + StoreID: k.StoreID, + DeliveryFeeDeductionSill: k.DeliveryFeeDeductionSill, + DeliveryFeeDeductionFee: k.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 { return nil, "获取热销商品失败", err } - for _, i := range tmp1s { + for _, i := range storeID { for _, j := range topSkusInfo { - if i.StoreID == j.StoreID { - data = Info2{ + if i == j.StoreID { + storeSkuInfo = StoreSkuInfo{ + StoreID: j.StoreID, SkuID: j.SkuID, SkuName: j.Name, SkuStatus: j.Status, @@ -5815,19 +5807,18 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } } } - multipleData = append(multipleData, data) - if len(multipleData) > 0 { - ans = HomePageInfos{ - Info: i, - Info2: multipleData, - } - } else { - ans = HomePageInfos{ - Info: i, + StoreSkuInfos = append(StoreSkuInfos, storeSkuInfo) + } + for _, i := range storeInfos { + if i.StoreID == storeDeductionInfos[0].StoreID && i.StoreID == StoreSkuInfos[0].StoreID { + homePage = HomePageInfos{ + StoreInfo: i, + StoreDeductionInfo: storeDeductionInfos, + StoreSkuInfo: StoreSkuInfos, } } - res = append(res, ans) + homePages = append(homePages, homePage) } } - return res, "", nil + return homePages, "", nil } From 9b4e66fd2763fb96d75404ab3a0f02058696287a Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 14:09:12 +0800 Subject: [PATCH 24/27] home --- business/jxstore/cms/store.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index ced1adeb3..0e2379688 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5787,6 +5787,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis storeDeductionInfos = append(storeDeductionInfos, storeDeductionInfo) } } + globals.SugarLogger.Debug("storeDeductionInfos=================", storeDeductionInfos) //获取热销商品 topSkusInfo, err := GetTopSkusByStoreIDs(ctx, storeID) if err != nil { @@ -5809,6 +5810,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } StoreSkuInfos = append(StoreSkuInfos, storeSkuInfo) } + globals.SugarLogger.Debug("StoreSkuInfos=================", StoreSkuInfos) for _, i := range storeInfos { if i.StoreID == storeDeductionInfos[0].StoreID && i.StoreID == StoreSkuInfos[0].StoreID { homePage = HomePageInfos{ From 39c9b7c8e152f73d3a2719e046a6684aca476ce2 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 14:23:17 +0800 Subject: [PATCH 25/27] home --- business/jxstore/cms/store.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 0e2379688..fe64f7c0b 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -5771,11 +5771,6 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取门店减免策略失败", err } - //获取店铺每周评分 - //weeklyScore, err := misc.GetWeeklyStoreScore(v.ID, -1) - //if err != nil { - // return nil, "获取店铺每周评分失败", err - //} for _, k := range storePolicy { if k.StoreID == v.ID { storeDeductionInfo = StoreDeductionInfo{ @@ -5787,6 +5782,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis storeDeductionInfos = append(storeDeductionInfos, storeDeductionInfo) } } + globals.SugarLogger.Debug("storeInfos============", storeInfos) globals.SugarLogger.Debug("storeDeductionInfos=================", storeDeductionInfos) //获取热销商品 topSkusInfo, err := GetTopSkusByStoreIDs(ctx, storeID) From 64f5b99ebede398ba3a0cd12ed9bc1a998946508 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 14:52:37 +0800 Subject: [PATCH 26/27] home --- business/jxstore/cms/store.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index fe64f7c0b..fe0221f68 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -159,9 +159,9 @@ type StoreSkuInfo struct { //首页展示信息 type HomePageInfos struct { - StoreInfo StoreInfo `json:"storeInfo"` - StoreDeductionInfo []StoreDeductionInfo `json:"StoreDeductionInfo"` - StoreSkuInfo []StoreSkuInfo `json:"StoreSkuInfo"` + StoreInfo StoreInfo `json:"storeInfo"` + StoreDeductionInfo StoreDeductionInfo `json:"StoreDeductionInfo"` + StoreSkuInfo StoreSkuInfo `json:"StoreSkuInfo"` } type JdStoreLevelExt struct { @@ -5786,6 +5786,7 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis globals.SugarLogger.Debug("storeDeductionInfos=================", storeDeductionInfos) //获取热销商品 topSkusInfo, err := GetTopSkusByStoreIDs(ctx, storeID) + globals.SugarLogger.Debug("topSkusInfo==============", topSkusInfo) if err != nil { return nil, "获取热销商品失败", err } @@ -5808,11 +5809,15 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis } globals.SugarLogger.Debug("StoreSkuInfos=================", StoreSkuInfos) for _, i := range storeInfos { - if i.StoreID == storeDeductionInfos[0].StoreID && i.StoreID == StoreSkuInfos[0].StoreID { - homePage = HomePageInfos{ - StoreInfo: i, - StoreDeductionInfo: storeDeductionInfos, - StoreSkuInfo: StoreSkuInfos, + 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, + } + } } } homePages = append(homePages, homePage) From c8129d9547aaa87f1a22ee3759a1e62ab1ff32d1 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Thu, 25 Aug 2022 15:01:37 +0800 Subject: [PATCH 27/27] home --- business/jxstore/cms/store.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index fe0221f68..7ce408830 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -159,9 +159,9 @@ type StoreSkuInfo struct { //首页展示信息 type HomePageInfos struct { - StoreInfo StoreInfo `json:"storeInfo"` - StoreDeductionInfo StoreDeductionInfo `json:"StoreDeductionInfo"` - StoreSkuInfo StoreSkuInfo `json:"StoreSkuInfo"` + StoreInfo StoreInfo `json:"storeInfo"` + StoreDeductionInfo []StoreDeductionInfo `json:"StoreDeductionInfo"` + StoreSkuInfo []StoreSkuInfo `json:"StoreSkuInfo"` } type JdStoreLevelExt struct { @@ -5790,21 +5790,21 @@ func GetHomePageByLocation(ctx *jxcontext.Context, lng, lat float64, needWalkDis if err != nil { return nil, "获取热销商品失败", err } - for _, i := range storeID { - for _, j := range topSkusInfo { - 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, - } - } + 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)