master
howell 4 years ago
parent 0d50a9d4a7
commit 2b9cdee001

@ -2,12 +2,6 @@ package goods
import ( import (
"fmt" "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/back"
"recook/internal/cache" "recook/internal/cache"
"recook/internal/dbc" "recook/internal/dbc"
@ -20,7 +14,15 @@ import (
"recook/internal/v2/model/recook/user" "recook/internal/v2/model/recook/user"
"recook/tools" "recook/tools"
"strconv" "strconv"
"strings"
"time" "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 { type queryOrderGoodsListParam struct {
@ -190,12 +192,6 @@ func QueryGoodsListByComprehension(c *gin.Context) {
} }
findByKeyWord(q3, p.Keyword, &goodsList) 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)) back.Suc(c, "", GetGoodsRespByInfoList(goodsList, p.UserId))
} }
@ -380,15 +376,7 @@ func QueryGoodsListByDiscountPrice(c *gin.Context) {
// GetGoodsRespByInfoList ============================================================== // GetGoodsRespByInfoList ==============================================================
func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryCategoryGoodsListResp { func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryCategoryGoodsListResp {
list := make([]QueryCategoryGoodsListResp, 0, 0) list := make([]QueryCategoryGoodsListResp, 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
}
var u user.RecookUserInfoModel var u user.RecookUserInfoModel
mysql2.Db.First(&u, "id = ?", userID) mysql2.Db.First(&u, "id = ?", userID)
//国家图标放入map结束 //国家图标放入map结束
@ -398,7 +386,9 @@ func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryC
gb := goods.Brand{} gb := goods.Brand{}
dbc.DB.First(&gb, "id = ?", v.BrandID) dbc.DB.First(&gb, "id = ?", v.BrandID)
var sku goods.Sku 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, "+ "SUM(sales_volume) AS sales_volume, "+
"MIN(purchase_price) AS purchase_price,"+ "MIN(purchase_price) AS purchase_price,"+
"MIN(original_price) AS original_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) commission = sku.DiscountPrice.Sub(sku.PurchasePrice).Mul(rate)
recookGoodsInfoModel := &goods2.RecookGoodsInfoModel{} recookGoodsInfoModel := &goods2.RecookGoodsInfoModel{}
space := " "
list = append(list, QueryCategoryGoodsListResp{ list = append(list, QueryCategoryGoodsListResp{
ID: v.ID, ID: v.ID,
GoodsName: v.GoodsName, GoodsName: strings.Join([]string{v.GoodsName, strings.Replace(sku.Name, "+", space, -1)},space),
BrandName: gb.Name + "品牌馆", BrandName: gb.Name + "品牌馆",
BrandImg: gb.LogoURL, BrandImg: gb.LogoURL,
BrandId: gb.ID, BrandId: gb.ID,
@ -489,7 +480,7 @@ func GetGoodsRespByInfoList(goodsList []goods.Information, userID uint) []QueryC
HasCoin: recookGoodsInfoModel.HasCoin(v.Storehouse), HasCoin: recookGoodsInfoModel.HasCoin(v.Storehouse),
HasBalance: recookGoodsInfoModel.HasBalance(v.Storehouse), HasBalance: recookGoodsInfoModel.HasBalance(v.Storehouse),
GysId: v.VendorID, GysId: v.VendorID,
CountryIcon: countryMap[v.Country], CountryIcon: ,
}) })
} }

@ -1,8 +1,6 @@
package live package live
import ( import (
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
goods2 "recook/internal/api/mobile/goods" goods2 "recook/internal/api/mobile/goods"
"recook/internal/back" "recook/internal/back"
"recook/internal/dbc" "recook/internal/dbc"
@ -11,6 +9,9 @@ import (
"recook/internal/model/user" "recook/internal/model/user"
"recook/tools" "recook/tools"
"strconv" "strconv"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
) )
type argsList struct { type argsList struct {

@ -31,9 +31,9 @@ var client *sdk.Client
const ( const (
regionId = "cn-hangzhou" regionId = "cn-hangzhou"
accessKey = "LTAI4Fe9j26vbarEGVZ7Nany" accessKey = "LTAI5t8N2GVy5Q8hKLJCvtmd"
accessKeySecret = "ysEYgqgpKtPbEJmHwdZ5psKsT15nel" accessKeySecret = "Lo5rlllMFuvtrI9voeQaeOk227kkB6"
loginTemplateCode = "SMS_193514959" loginTemplateCode = "SMS_231305089"
) )
func init() { func init() {

@ -1,12 +1,13 @@
package app package app
import ( import (
"github.com/gin-gonic/gin"
"recook/internal/api/mobile/bill" "recook/internal/api/mobile/bill"
"recook/internal/api/mobile/live" "recook/internal/api/mobile/live"
_ "recook/internal/secure" _ "recook/internal/secure"
"recook/internal/v2/router/middleware" "recook/internal/v2/router/middleware"
"github.com/gin-gonic/gin"
"recook/internal/api/mobile/activity" "recook/internal/api/mobile/activity"
"recook/internal/api/mobile/addr" "recook/internal/api/mobile/addr"
"recook/internal/api/mobile/aftersales" "recook/internal/api/mobile/aftersales"

Loading…
Cancel
Save