Commit 51d31399 by huangchengyi

1.0

parent 3a0ddd74
Showing with 6 additions and 1 deletions
......@@ -96,7 +96,12 @@ type SpuAttr struct {
//获取Spu的属性
func (ls *LyService) GetSpuAttr(spuId int64) (attrsResult []interface{}) {
var spuAttr SpuAttr
err := mongo.Conn("default").DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuId}).One(&spuAttr)
mongodb := mongo.Conn("default");
defer func() {
mongodb.Close()
}()
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 {
fmt.Println(err)
}
......
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