From 2b9cdee0011e2648bd66ea79e5ab4e677acd18a8 Mon Sep 17 00:00:00 2001 From: howell <2827207845@qq.com> Date: Mon, 27 Dec 2021 13:17:19 +0800 Subject: [PATCH] fix: goods --- internal/api/mobile/goods/common_list.go | 39 +++++++++--------------- internal/api/mobile/live/order.go | 5 +-- internal/api/mobile/messages/message.go | 6 ++-- internal/gateway/app/v1.go | 3 +- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/internal/api/mobile/goods/common_list.go b/internal/api/mobile/goods/common_list.go index 5446cff..2aa1f7a 100755 --- a/internal/api/mobile/goods/common_list.go +++ b/internal/api/mobile/goods/common_list.go @@ -2,12 +2,6 @@ package goods import ( "fmt" - mysql2 "git.oa00.com/go/mysql" - "github.com/gin-gonic/gin" - "github.com/golangkit/formatime" - "github.com/shopspring/decimal" - gorm2 "gorm.io/gorm" - "gorm.io/gorm/clause" "recook/internal/back" "recook/internal/cache" "recook/internal/dbc" @@ -20,7 +14,15 @@ import ( "recook/internal/v2/model/recook/user" "recook/tools" "strconv" + "strings" "time" + + mysql2 "git.oa00.com/go/mysql" + "github.com/gin-gonic/gin" + "github.com/golangkit/formatime" + "github.com/shopspring/decimal" + gorm2 "gorm.io/gorm" + "gorm.io/gorm/clause" ) type queryOrderGoodsListParam struct { @@ -190,12 +192,6 @@ func QueryGoodsListByComprehension(c *gin.Context) { } findByKeyWord(q3, p.Keyword, &goodsList) - //if p.Kind == 0 { - // if len(goodsList) < 20 && p.Page == 0 && p.Keyword != "" { - // goodsList = getFillList(c, goodsList, "") - // } - //} - back.Suc(c, "", GetGoodsRespByInfoList(goodsList, p.UserId)) } @@ -380,15 +376,7 @@ func QueryGoodsListByDiscountPrice(c *gin.Context) { // GetGoodsRespByInfoList ============================================================== func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryCategoryGoodsListResp { - list := make([]QueryCategoryGoodsListResp, 0, 0) - //新增进口专区国家图标 - var iconList []goods2.RecookAbroadCountryModel - dbc.DB.Table((&goods2.RecookAbroadCountryModel{}).TableName()).Find(&iconList) - var countryMap = make(map[uint]string) - countryMap[0] = "" - for _, v := range iconList { - countryMap[v.ID] = v.Icon - } + list := make([]QueryCategoryGoodsListResp, 0) var u user.RecookUserInfoModel mysql2.Db.First(&u, "id = ?", userID) //国家图标放入map结束 @@ -398,7 +386,9 @@ func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryC gb := goods.Brand{} dbc.DB.First(&gb, "id = ?", v.BrandID) var sku goods.Sku - mysql2.Db.Select("SUM(inventory) AS inventory, "+ + mysql2.Db.Select( + "MIN(name), "+ + "SUM(inventory) AS inventory, "+ "SUM(sales_volume) AS sales_volume, "+ "MIN(purchase_price) AS purchase_price,"+ "MIN(original_price) AS original_price, "+ @@ -464,9 +454,10 @@ func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryC commission = sku.DiscountPrice.Sub(sku.PurchasePrice).Mul(rate) recookGoodsInfoModel := &goods2.RecookGoodsInfoModel{} + space := " " list = append(list, QueryCategoryGoodsListResp{ ID: v.ID, - GoodsName: v.GoodsName, + GoodsName: strings.Join([]string{v.GoodsName, strings.Replace(sku.Name, "+", space, -1)},space), BrandName: gb.Name + "品牌馆", BrandImg: gb.LogoURL, BrandId: gb.ID, @@ -489,7 +480,7 @@ func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryC HasCoin: recookGoodsInfoModel.HasCoin(v.Storehouse), HasBalance: recookGoodsInfoModel.HasBalance(v.Storehouse), GysId: v.VendorID, - CountryIcon: countryMap[v.Country], + CountryIcon: , }) } diff --git a/internal/api/mobile/live/order.go b/internal/api/mobile/live/order.go index 5930da3..04e42c0 100644 --- a/internal/api/mobile/live/order.go +++ b/internal/api/mobile/live/order.go @@ -1,8 +1,6 @@ package live import ( - "github.com/gin-gonic/gin" - "github.com/shopspring/decimal" goods2 "recook/internal/api/mobile/goods" "recook/internal/back" "recook/internal/dbc" @@ -11,6 +9,9 @@ import ( "recook/internal/model/user" "recook/tools" "strconv" + + "github.com/gin-gonic/gin" + "github.com/shopspring/decimal" ) type argsList struct { diff --git a/internal/api/mobile/messages/message.go b/internal/api/mobile/messages/message.go index 498f8c6..f5ef567 100755 --- a/internal/api/mobile/messages/message.go +++ b/internal/api/mobile/messages/message.go @@ -31,9 +31,9 @@ var client *sdk.Client const ( regionId = "cn-hangzhou" - accessKey = "LTAI4Fe9j26vbarEGVZ7Nany" - accessKeySecret = "ysEYgqgpKtPbEJmHwdZ5psKsT15nel" - loginTemplateCode = "SMS_193514959" + accessKey = "LTAI5t8N2GVy5Q8hKLJCvtmd" + accessKeySecret = "Lo5rlllMFuvtrI9voeQaeOk227kkB6" + loginTemplateCode = "SMS_231305089" ) func init() { diff --git a/internal/gateway/app/v1.go b/internal/gateway/app/v1.go index db735bb..6fad8f1 100755 --- a/internal/gateway/app/v1.go +++ b/internal/gateway/app/v1.go @@ -1,12 +1,13 @@ package app import ( - "github.com/gin-gonic/gin" "recook/internal/api/mobile/bill" "recook/internal/api/mobile/live" _ "recook/internal/secure" "recook/internal/v2/router/middleware" + "github.com/gin-gonic/gin" + "recook/internal/api/mobile/activity" "recook/internal/api/mobile/addr" "recook/internal/api/mobile/aftersales"