From 9508ce332718f1d282bc78262c797df16d386588 Mon Sep 17 00:00:00 2001 From: howell <2827207845@qq.com> Date: Tue, 28 Dec 2021 15:53:22 +0800 Subject: [PATCH] fix: brand fill --- internal/api/manage/promotion/update.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/api/manage/promotion/update.go b/internal/api/manage/promotion/update.go index 3d802ba..01f1885 100755 --- a/internal/api/manage/promotion/update.go +++ b/internal/api/manage/promotion/update.go @@ -2,9 +2,6 @@ package promotion import ( "fmt" - mysql2 "git.oa00.com/go/mysql" - "github.com/gin-gonic/gin" - "github.com/shopspring/decimal" "math/rand" "recook/internal/back" "recook/internal/dbc" @@ -13,6 +10,10 @@ import ( goods3 "recook/internal/v2/model/recook/goods" "recook/tools" "unicode/utf8" + + mysql2 "git.oa00.com/go/mysql" + "github.com/gin-gonic/gin" + "github.com/shopspring/decimal" ) type subtitleParam struct { @@ -260,9 +261,9 @@ func JDGoods(c *gin.Context) { var list []jdRes q := mysql2.Db.Table((&promotion.Goods{}).TableName()).Select("goods_id").Where("promotion_id=?", p.PromotionId) var gl []int64 - mysql2.Db.Table((&goods3.RecookGoodsInfoModel{}).TableName()).Where("vendor_id in (1800,2000)").Where("publish_status=1").Where("id not in (?)", q).Where("id not in (?)", p.GoodsIds).Pluck("id", &gl) + mysql2.Db.Table((&goods3.RecookGoodsInfoModel{}).TableName()).Where("brand_id=?", 7846).Where("vendor_id in (1800,2000)").Where("publish_status=1").Where("id not in (?)", q).Where("id not in (?)", p.GoodsIds).Pluck("id", &gl) sortI := rand.Perm(len(gl)) - newsort := sortI[0:50] + newsort := sortI[0:20] var ngl []int64 for _, v := range newsort { ngl = append(ngl, gl[v])