Commit f0f76118 by mushishixian

修复类型

parent c6f3f3f1
......@@ -7,7 +7,7 @@ import (
//联营sku结构体
type LySku struct {
LadderPrice []LadderPrice `json:"-"`
SpuId int64 `json:"spu_id"`
SpuId string `json:"spu_id"`
OldGoodsId int64 `json:"old_goods_id"`
UpdateTime int64 `json:"update_time"`
CpTime int64 `json:"cp_time"`
......@@ -71,7 +71,7 @@ func InitSkuData(sku string) (data LySku) {
goodsSn := gjson.Get(sku, "goods_sn").String()
data.GoodsSn = goodsSn
spuId := gjson.Get(sku, "spu_id").Int()
spuId := gjson.Get(sku, "spu_id").String()
data.SpuId = spuId
oldGoodsId := gjson.Get(sku, "old_goods_id").Int()
......
......@@ -9,7 +9,6 @@ import (
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"sort"
"strconv"
"sync"
)
......@@ -62,8 +61,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//A := orderedmap.New()
sku := model.InitSkuData(skuStr)
sku.GoodsId = goodsId
spuIdStr:= strconv.Itoa(int(sku.SpuId))
spu := spuList[spuIdStr]
spu := spuList[sku.SpuId]
//读取包装字段的缓存
if sku.SupplierId == 7 {
//sku_raw_map哪里写入(成意写的)
......
......@@ -17,6 +17,7 @@ import (
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
_ "gopkg.in/mgo.v2/bson"
"strconv"
"strings"
)
......@@ -95,14 +96,15 @@ type SpuAttr struct {
}
//获取Spu的属性
func (ls *LyService) GetSpuAttr(spuId int64) (attrsResult interface{}) {
func (ls *LyService) GetSpuAttr(spuId string) (attrsResult interface{}) {
var spuAttr SpuAttr
var attrsList []interface{}
mongodb := mongo.Conn("default")
defer func() {
mongodb.Close()
}()
err := mongodb.DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuId}).One(&spuAttr)
spuIdInt, _ := strconv.Atoi(spuId)
err := mongodb.DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuIdInt}).One(&spuAttr)
//err := mongo.Conn("default").DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuId}).One(&spuAttr)
if err != nil && err != mgo.ErrNotFound {
fmt.Println("mongodb连接错误:")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment