当前位置: 首页>>代码示例>>Golang>>正文


Golang info.NewRe函数代码示例

本文整理汇总了Golang中github.com/JacobXie/leanote/app/info.NewRe函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRe函数的具体用法?Golang NewRe怎么用?Golang NewRe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NewRe函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的github.com/JacobXie/leanote/app/info.NewRe函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。