func (u *ArticleModel) New(userId int64, title string, body []byte) (string, error) { cid := util.Unique() vo := NewArticleVO(userId, title, body) vo.Cid = cid vo.Html = blackfriday.MarkdownCommon(body) reg, _ := regexp.Compile("\\<[\\S\\s]+?\\>") vo.Description = reg.ReplaceAll(vo.Html, []byte("")) _, err := db.NewInsertBuilder(u.Table()).Insert(vo) if err != nil { return cid, err } return cid, err }
func UserToken(nick string, pwd []byte) (string, string) { salt := util.Unique() return salt, gos.UserToken([]interface{}{nick}, pwd, []byte(salt)) }