Exemple #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
}
Exemple #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)
}
Exemple #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)
}
Exemple #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)
}
Exemple #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)
}