Ejemplo n.º 1
0
func UserLogin(uid string) (err error) {
	s := mongo.GetSession()
	defer s.Close()
	c := collection(s, util.MONGO_COLLECTION_USER_EXPAND)
	err = c.Update(bson.M{"uid": uid}, bson.M{"$set": bson.M{"lltime": util.UnixMillSeconds()}, "$inc": bson.M{"logincnt": 1}})
	return
}
Ejemplo n.º 2
0
func InsertFollow(follow model.Follow) (ret model.Follow, err error) {
	s := mongo.GetSession()
	defer s.Close()
	c := collection(s, util.MONGO_COLLECTION_FOLLOW)

	follow.Ctime = util.UnixMillSeconds()
	return follow, c.Insert(follow)
}
Ejemplo n.º 3
0
func InsertFeed(feed model.Feed) (ret model.Feed, err error) {
	s := mongo.GetSession()
	defer s.Close()
	c := collection(s, util.MONGO_COLLECTION_FEED)

	feed.Fid = bson.NewObjectId()
	feed.Ctime = util.UnixMillSeconds()

	return feed, c.Insert(feed)
}
Ejemplo n.º 4
0
func InsertComment(comment model.Comment) (ret model.Comment, err error) {
	s := mongo.GetSession()
	defer s.Close()
	c := collection(s, util.MONGO_COLLECTION_COMMENT)

	comment.Cid = bson.NewObjectId()
	comment.Ctime = util.UnixMillSeconds()

	return comment, c.Insert(comment)
}
Ejemplo n.º 5
0
func InsertUser(user model.User) (ret model.User, err error) {
	s := mongo.GetSession()
	defer s.Close()
	c := collection(s, util.MONGO_COLLECTION_USER)

	user.Uid = bson.NewObjectId()
	user.Ctime = util.UnixMillSeconds()

	return user, c.Insert(user)
}