本文整理汇总了Golang中github.com/JacobXie/leanote/app/info.NewRe函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRe函数的具体用法?Golang NewRe怎么用?Golang NewRe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewRe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Template
func (c AdminEmail) Template() revel.Result {
re := info.NewRe()
keys := []string{"emailTemplateHeader", "emailTemplateFooter",
"emailTemplateRegisterSubject",
"emailTemplateRegister",
"emailTemplateFindPasswordSubject",
"emailTemplateFindPassword",
"emailTemplateUpdateEmailSubject",
"emailTemplateUpdateEmail",
"emailTemplateInviteSubject",
"emailTemplateInvite",
"emailTemplateCommentSubject",
"emailTemplateComment",
}
userId := c.GetUserId()
for _, key := range keys {
v := c.Params.Values.Get(key)
if v != "" {
ok, msg := emailService.ValidTpl(v)
if !ok {
re.Ok = false
re.Msg = "Error key: " + key + "<br />" + msg
return c.RenderJson(re)
} else {
configService.UpdateGlobalStringConfig(userId, key, v)
}
}
}
re.Ok = true
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:34,代码来源:AdminEmailController.go
示例2: SendToUsers
func (c AdminEmail) SendToUsers(userFilterEmail, userFilterWhiteList, userFilterBlackList, latestEmailSubject, latestEmailBody string, verified, saveAsOldEmail bool) revel.Result {
re := info.NewRe()
c.updateConfig([]string{"userFilterEmail", "userFilterWhiteList", "userFilterBlackList", "latestEmailSubject", "latestEmailBody"})
if latestEmailSubject == "" || latestEmailBody == "" {
re.Msg = "subject or body is blank"
return c.RenderJson(re)
}
if saveAsOldEmail {
oldEmails := configService.GetGlobalMapConfig("oldEmails")
oldEmails[latestEmailSubject] = latestEmailBody
configService.UpdateGlobalMapConfig(c.GetUserId(), "oldEmails", oldEmails)
}
users := userService.GetAllUserByFilter(userFilterEmail, userFilterWhiteList, userFilterBlackList, verified)
if users == nil || len(users) == 0 {
re.Ok = false
re.Msg = "no users"
return c.RenderJson(re)
}
re.Ok, re.Msg = emailService.SendEmailToUsers(users, latestEmailSubject, latestEmailBody)
if !re.Ok {
return c.RenderJson(re)
}
re.Ok = true
re.Msg = "users:" + strconv.Itoa(len(users))
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:34,代码来源:AdminEmailController.go
示例3: Mongodb
func (c AdminSetting) Mongodb(mongodumpPath, mongorestorePath string) revel.Result {
re := info.NewRe()
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "mongodumpPath", mongodumpPath)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "mongorestorePath", mongorestorePath)
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:7,代码来源:AdminSettingController.go
示例4: SendToUsers2
// 发送Email
func (c AdminEmail) SendToUsers2(emails, latestEmailSubject, latestEmailBody string, verified, saveAsOldEmail bool) revel.Result {
re := info.NewRe()
c.updateConfig([]string{"sendEmails", "latestEmailSubject", "latestEmailBody"})
if latestEmailSubject == "" || latestEmailBody == "" {
re.Msg = "subject or body is blank"
return c.RenderJson(re)
}
if saveAsOldEmail {
oldEmails := configService.GetGlobalMapConfig("oldEmails")
oldEmails[latestEmailSubject] = latestEmailBody
configService.UpdateGlobalMapConfig(c.GetUserId(), "oldEmails", oldEmails)
}
emails = strings.Replace(emails, "\r", "", -1)
emailsArr := strings.Split(emails, "\n")
users := userService.ListUserInfosByEmails(emailsArr)
LogJ(emailsArr)
re.Ok, re.Msg = emailService.SendEmailToUsers(users, latestEmailSubject, latestEmailBody)
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:27,代码来源:AdminEmailController.go
示例5: GetTplContent
// 得到文件内容
func (c MemberBlog) GetTplContent(themeId string, filename string) revel.Result {
re := info.NewRe()
re.Ok = true
re.Item = themeService.GetTplContent(c.GetUserId(), themeId, filename)
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:8,代码来源:MemberBlogController.go
示例6: AuthInterceptor
func AuthInterceptor(c *revel.Controller) revel.Result {
// 全部变成首字大写
/*
var controller = strings.Title(c.Name)
var method = strings.Title(c.MethodName)
// 是否需要验证?
if !needValidate(controller, method) {
return nil
}
*/
// 验证是否已登录
// 必须是管理员
if _, ok := c.Session["Username"]; ok {
return nil // 已登录
}
// 没有登录, 判断是否是ajax操作
if c.Request.Header.Get("X-Requested-With") == "XMLHttpRequest" {
re := info.NewRe()
re.Msg = "NOTLOGIN"
return c.RenderJson(re)
}
return c.Redirect("/login")
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:26,代码来源:init.go
示例7: HomePage
func (c AdminSetting) HomePage(homePage string) revel.Result {
re := info.NewRe()
if homePage == "0" {
homePage = ""
}
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "homePage", homePage)
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:8,代码来源:AdminSettingController.go
示例8: DoBlogTag
func (c AdminEmail) DoBlogTag(recommendTags, newTags string) revel.Result {
re := info.NewRe()
re.Ok = configService.UpdateGlobalArrayConfig(c.GetUserId(), "recommendTags", strings.Split(recommendTags, ","))
re.Ok = configService.UpdateGlobalArrayConfig(c.GetUserId(), "newTags", strings.Split(newTags, ","))
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:8,代码来源:AdminEmailController.go
示例9: DoResetPwd
func (c AdminUser) DoResetPwd(userId, pwd string) revel.Result {
re := info.NewRe()
if re.Ok, re.Msg = Vd("password", pwd); !re.Ok {
return c.RenderRe(re)
}
re.Ok, re.Msg = userService.ResetPwd(c.GetUserId(), userId, pwd)
return c.RenderRe(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:8,代码来源:AdminUserController.go
示例10: ShareNote
// 共享设置
func (c AdminSetting) ShareNote(registerSharedUserId string,
registerSharedNotebookPerms, registerSharedNotePerms []int,
registerSharedNotebookIds, registerSharedNoteIds, registerCopyNoteIds []string) revel.Result {
re := info.NewRe()
re.Ok, re.Msg = configService.UpdateShareNoteConfig(registerSharedUserId, registerSharedNotebookPerms, registerSharedNotePerms, registerSharedNotebookIds, registerSharedNoteIds, registerCopyNoteIds)
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:9,代码来源:AdminSettingController.go
示例11: UploadSize
func (c AdminSetting) UploadSize(uploadImageSize, uploadAvatarSize, uploadBlogLogoSize, uploadAttachSize float64) revel.Result {
re := info.NewRe()
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "uploadImageSize", fmt.Sprintf("%v", uploadImageSize))
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "uploadAvatarSize", fmt.Sprintf("%v", uploadAvatarSize))
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "uploadBlogLogoSize", fmt.Sprintf("%v", uploadBlogLogoSize))
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "uploadAttachSize", fmt.Sprintf("%v", uploadAttachSize))
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:8,代码来源:AdminSettingController.go
示例12: Set
func (c AdminEmail) Set(emailHost, emailPort, emailUsername, emailPassword string) revel.Result {
re := info.NewRe()
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "emailHost", emailHost)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "emailPort", emailPort)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "emailUsername", emailUsername)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "emailPassword", emailPassword)
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:9,代码来源:AdminEmailController.go
示例13: ListThemeImages
func (c MemberBlog) ListThemeImages(themeId string) revel.Result {
re := info.NewRe()
userId := c.GetUserId()
path := themeService.GetThemeAbsolutePath(userId, themeId) + "/images"
os.MkdirAll(path, 0755)
images := ListDir(path)
re.List = images
re.Ok = true
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:10,代码来源:MemberBlogController.go
示例14: CopySharedNote
// 复制别人共享的笔记给我
func (c Note) CopySharedNote(noteIds []string, notebookId, fromUserId string) revel.Result {
copyNotes := make([]info.Note, len(noteIds))
userId := c.GetUserId()
for i, noteId := range noteIds {
copyNotes[i] = noteService.CopySharedNote(noteId, notebookId, fromUserId, userId)
}
re := info.NewRe()
re.Ok = true
re.Item = copyNotes
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:12,代码来源:NoteController.go
示例15: FindPasswordUpdate
// 找回密码修改密码
func (c Auth) FindPasswordUpdate(token, pwd string) revel.Result {
re := info.NewRe()
if re.Ok, re.Msg = Vd("password", pwd); !re.Ok {
return c.RenderRe(re)
}
// 修改之
re.Ok, re.Msg = pwdService.UpdatePwd(token, pwd)
return c.RenderRe(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:12,代码来源:AuthController.go
示例16: Suggestion
// 建议
func (c Index) Suggestion(addr, suggestion string) revel.Result {
re := info.NewRe()
re.Ok = suggestionService.AddSuggestion(info.Suggestion{Addr: addr, UserId: c.GetObjectUserId(), Suggestion: suggestion})
// 发给我
go func() {
emailService.SendEmail("[email protected]", "建议", "UserId: "+c.GetUserId()+" <br /> Suggestions: "+suggestion)
}()
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:12,代码来源:IndexController.go
示例17: AddUser
// 添加用户
func (c MemberGroup) AddUser(groupId, email string) revel.Result {
re := info.NewRe()
userInfo := userService.GetUserInfoByAny(email)
if userInfo.UserId == "" {
re.Msg = "userNotExists"
} else {
re.Ok, re.Msg = groupService.AddUser(c.GetUserId(), groupId, userInfo.UserId.Hex())
re.Item = userInfo
}
return c.RenderRe(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:12,代码来源:MemberGroupController.go
示例18: DoSubDomain
func (c AdminSetting) DoSubDomain(noteSubDomain, blogSubDomain, leaSubDomain, blackSubDomains, allowCustomDomain, blackCustomDomains string) revel.Result {
re := info.NewRe()
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "noteSubDomain", noteSubDomain)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "blogSubDomain", blogSubDomain)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "leaSubDomain", leaSubDomain)
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "allowCustomDomain", allowCustomDomain)
re.Ok = configService.UpdateGlobalArrayConfig(c.GetUserId(), "blackSubDomains", strings.Split(blackSubDomains, ","))
re.Ok = configService.UpdateGlobalArrayConfig(c.GetUserId(), "blackCustomDomains", strings.Split(blackCustomDomains, ","))
return c.RenderJson(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:12,代码来源:AdminSettingController.go
示例19: ExportTheme
// 导出
func (c MemberBlog) ExportTheme(themeId string) revel.Result {
re := info.NewRe()
var path string
re.Ok, path = themeService.ExportTheme(c.GetUserId(), themeId)
if !re.Ok {
return c.RenderText("error...")
}
fw, err := os.Open(path)
if err != nil {
return c.RenderText("error")
}
return c.RenderBinary(fw, GetFilename(path), revel.Attachment, time.Now()) // revel.Attachment
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:14,代码来源:MemberBlogController.go
示例20: ImportTheme
// 导入主题
func (c MemberBlog) ImportTheme() revel.Result {
re := info.NewRe()
file, handel, err := c.Request.FormFile("file")
if err != nil {
re.Msg = fmt.Sprintf("%v", err)
return c.RenderJson(re)
}
defer file.Close()
// 生成上传路径
userId := c.GetUserId()
dir := revel.BasePath + "/public/upload/" + userId + "/tmp"
err = os.MkdirAll(dir, 0755)
if err != nil {
re.Msg = fmt.Sprintf("%v", err)
return c.RenderJson(re)
}
// 生成新的文件名
filename := handel.Filename
var ext string
_, ext = SplitFilename(filename)
if ext != ".zip" {
re.Msg = "Please upload zip file"
return c.RenderJson(re)
}
filename = filename
data, err := ioutil.ReadAll(file)
if err != nil {
return c.RenderJson(re)
}
// > 10M?
if len(data) > 10*1024*1024 {
re.Msg = "File is big than 10M"
return c.RenderJson(re)
}
toPath := dir + "/" + filename
err = ioutil.WriteFile(toPath, data, 0777)
if err != nil {
re.Msg = fmt.Sprintf("%v", err)
return c.RenderJson(re)
}
// 上传好后, 增加之
re.Ok, re.Msg = themeService.ImportTheme(c.GetUserId(), toPath)
return c.RenderRe(re)
}
开发者ID:JacobXie,项目名称:leanote-daocloud,代码行数:52,代码来源:MemberBlogController.go
注:本文中的github.com/JacobXie/leanote/app/info.NewRe函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论