Commit 2ee198aa by mushishixian

mongo

parent 299cbfd6
Showing with 4 additions and 1 deletions
...@@ -93,7 +93,10 @@ type SpuAttr struct { ...@@ -93,7 +93,10 @@ type SpuAttr struct {
//获取Spu的属性 //获取Spu的属性
func (ls *LyService) GetSpuAttr(spuId int64) (attrsResult []interface{}) { func (ls *LyService) GetSpuAttr(spuId int64) (attrsResult []interface{}) {
var spuAttr SpuAttr var spuAttr SpuAttr
mongo.Conn("default").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 {
fmt.Println(err)
}
if spuAttr.Attrs != "" { if spuAttr.Attrs != "" {
o := orderedmap.New() o := orderedmap.New()
err := json.Unmarshal([]byte(spuAttr.Attrs), &o) err := json.Unmarshal([]byte(spuAttr.Attrs), &o)
......
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