Commit c6f3f3f1 by mushishixian

spu修改类型

parent e30e7e5c
......@@ -7,7 +7,7 @@ import (
//联营sku结构体
type LySku struct {
LadderPrice []LadderPrice `json:"-"`
SpuId string `json:"spu_id"`
SpuId int64 `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").String()
spuId := gjson.Get(sku, "spu_id").Int()
data.SpuId = spuId
oldGoodsId := gjson.Get(sku, "old_goods_id").Int()
......
......@@ -9,6 +9,7 @@ import (
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"sort"
"strconv"
"sync"
)
......@@ -61,7 +62,8 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//A := orderedmap.New()
sku := model.InitSkuData(skuStr)
sku.GoodsId = goodsId
spu := spuList[sku.SpuId]
spuIdStr:= strconv.Itoa(int(sku.SpuId))
spu := spuList[spuIdStr]
//读取包装字段的缓存
if sku.SupplierId == 7 {
//sku_raw_map哪里写入(成意写的)
......
......@@ -17,7 +17,6 @@ import (
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
_ "gopkg.in/mgo.v2/bson"
"strconv"
"strings"
)
......@@ -96,15 +95,14 @@ type SpuAttr struct {
}
//获取Spu的属性
func (ls *LyService) GetSpuAttr(spuId string) (attrsResult interface{}) {
func (ls *LyService) GetSpuAttr(spuId int64) (attrsResult interface{}) {
var spuAttr SpuAttr
var attrsList []interface{}
mongodb := mongo.Conn("default")
defer func() {
mongodb.Close()
}()
spuIdInt, _ := strconv.Atoi(spuId)
err := mongodb.DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuIdInt}).One(&spuAttr)
err := mongodb.DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuId}).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