本文整理汇总了Golang中github.com/beego/wetalk/modules/utils.ToStr函数的典型用法代码示例。如果您正苦于以下问题:Golang ToStr函数的具体用法?Golang ToStr怎么用?Golang ToStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToStr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: AvatarTypeSelectData
func (form *UserAvatarForm) AvatarTypeSelectData() [][]string {
var data = make([][]string, 0, 2)
data = append(data, []string{"auth.user_avatar_use_gravatar", utils.ToStr(setting.AvatarTypeGravatar)})
data = append(data, []string{"auth.user_avatar_use_personal", utils.ToStr(setting.AvatarTypePersonalized)})
return data
}
开发者ID:netxfly,项目名称:wetalk,代码行数:7,代码来源:form.go
示例2: NewSubmit
func (this *PostRouter) NewSubmit() {
this.TplName = "post/new.html"
if this.CheckActiveRedirect() {
return
}
form := post.PostForm{Locale: this.Locale}
slug := this.GetString("topic")
if len(slug) > 0 {
topic := models.Topic{Slug: slug}
topic.Read("Slug")
form.Topic = topic.Id
this.Data["Topic"] = &topic
}
post.ListCategories(&form.Categories)
post.ListTopics(&form.Topics)
if !this.ValidFormSets(&form) {
return
}
var post models.Post
if err := form.SavePost(&post, &this.User); err == nil {
this.Ctx.SetCookie("post_topic", utils.ToStr(form.Topic), 1<<31-1, "/")
this.Ctx.SetCookie("post_cat", utils.ToStr(form.Category), 1<<31-1, "/")
this.Ctx.SetCookie("post_lang", utils.ToStr(form.Lang), 1<<31-1, "/")
this.JsStorage("deleteKey", "post/new")
this.Redirect(post.Link(), 302)
}
}
开发者ID:wildex,项目名称:wetalk,代码行数:33,代码来源:post.go
示例3: TypeSelectData
func (form *BulletinAdminForm) TypeSelectData() [][]string {
data := [][]string{
[]string{"model.bulletin_friend_link", utils.ToStr(setting.BULLETIN_FRIEND_LINK)},
[]string{"model.bulletin_new_comer", utils.ToStr(setting.BULLETIN_NEW_COMER)},
[]string{"model.bulletin_mobile_app", utils.ToStr(setting.BULLETIN_MOBILE_APP)},
[]string{"model.bulletin_open_source", utils.ToStr(setting.BULLETIN_OPEN_SOURCE)},
}
return data
}
开发者ID:netxfly,项目名称:wetalk,代码行数:9,代码来源:form.go
示例4: postsFilter
func (this *PostListRouter) postsFilter(qs orm.QuerySeter) orm.QuerySeter {
if !this.IsLogin {
return qs
}
args := []string{utils.ToStr(this.Locale.Index())}
args = append(args, this.User.LangAdds...)
args = append(args, utils.ToStr(this.User.Lang))
qs = qs.Filter("Lang__in", args)
return qs
}
开发者ID:wildex,项目名称:wetalk,代码行数:10,代码来源:post.go
示例5: TopicSelectData
func (form *PostForm) TopicSelectData() [][]string {
data := make([][]string, 0, len(form.Topics))
for _, topic := range form.Topics {
data = append(data, []string{topic.GetName(form.Locale.Lang), utils.ToStr(topic.Id)})
}
return data
}
开发者ID:oyoy8629,项目名称:XWetalk,代码行数:7,代码来源:form.go
示例6: CategorySelectData
func (form *PostForm) CategorySelectData() [][]string {
data := make([][]string, 0, len(form.Categories))
for _, cat := range form.Categories {
data = append(data, []string{"category." + cat.Name, utils.ToStr(cat.Id)})
}
return data
}
开发者ID:oyoy8629,项目名称:XWetalk,代码行数:7,代码来源:form.go
示例7: LangAddsSelectData
func (form *UserAdminForm) LangAddsSelectData() [][]string {
langs := setting.Langs
data := make([][]string, 0, len(langs))
for i, lang := range langs {
data = append(data, []string{lang, utils.ToStr(i)})
}
return data
}
开发者ID:JessonChan,项目名称:wetalk,代码行数:8,代码来源:form.go
示例8: CreateUserResetPwdCode
// create a time limit code for user reset password
func CreateUserResetPwdCode(user *models.User, startInf interface{}) string {
minutes := setting.ResetPwdCodeLives
data := utils.ToStr(user.Id) + user.Email + user.UserName + user.Password + user.Rands + user.Updated.String()
code := utils.CreateTimeLimitCode(data, minutes, startInf)
// add tail hex username
code += hex.EncodeToString([]byte(user.UserName))
return code
}
开发者ID:wildex,项目名称:wetalk,代码行数:10,代码来源:auth.go
示例9: GenImageFilePath
func GenImageFilePath(img *models.Image, width int) string {
var size string
if width == 0 {
size = "full"
} else {
size = utils.ToStr(width)
}
return GenImagePath(img) + size + img.GetExt()
}
开发者ID:netxfly,项目名称:wetalk,代码行数:9,代码来源:storage.go
示例10: CategorySelectData
func (form *TopicAdminForm) CategorySelectData() [][]string {
var cats []models.Category
ListCategories(&cats)
data := make([][]string, 0, len(cats))
for _, cat := range cats {
data = append(data, []string{cat.Name, utils.ToStr(cat.Id)})
}
return data
}
开发者ID:netxfly,项目名称:wetalk,代码行数:9,代码来源:topic_form.go
示例11: avatarLink
func (m *User) avatarLink(size int) string {
if m.AvatarType == setting.AvatarTypePersonalized {
if m.AvatarKey != "" {
return fmt.Sprintf("%s", utils.GetQiniuZoomViewUrl(utils.GetQiniuPublicDownloadUrl(setting.QiniuAvatarDomain, m.AvatarKey), size, size))
} else {
return fmt.Sprintf("http://golanghome-public.qiniudn.com/golang_avatar.png?imageView/0/w/%s/h/%s/q/100", utils.ToStr(size), utils.ToStr(size))
}
} else {
return fmt.Sprintf("%s%s?size=%s", setting.AvatarURL, m.GrEmail, utils.ToStr(size))
}
}
开发者ID:netxfly,项目名称:wetalk,代码行数:11,代码来源:auth.go
示例12: CheckFlashRedirect
// check flash redirect, ensure browser redirect to uri and display flash message.
func (this *BaseRouter) CheckFlashRedirect(value string) (match bool, redirect bool) {
v := this.GetSession("on_redirect")
if params, ok := v.([]interface{}); ok {
if len(params) != 5 {
this.EndFlashRedirect()
goto end
}
uri := utils.ToStr(params[0])
code := 302
if c, ok := params[1].(int); ok {
if c/100 == 3 {
code = c
}
}
flag := utils.ToStr(params[2])
flagVal := utils.ToStr(params[3])
times := 0
if v, ok := params[4].(int); ok {
times = v
}
times += 1
if times > 3 {
// if max retry times reached then end
this.EndFlashRedirect()
goto end
}
// match uri or flash flag
if uri == value || flag == value {
match = true
} else {
// if no match then continue redirect
this.FlashRedirect(uri, code, flag, flagVal, times)
redirect = true
}
}
end:
return match, redirect
}
开发者ID:wildex,项目名称:wetalk,代码行数:41,代码来源:base.go
示例13: VerifyUserResetPwdCode
// verify code when reset password
func VerifyUserResetPwdCode(user *models.User, code string) bool {
minutes := setting.ResetPwdCodeLives
if getVerifyUser(user, code) {
// time limit code
prefix := code[:utils.TimeLimitCodeLength]
data := utils.ToStr(user.Id) + user.Email + user.UserName + user.Password + user.Rands + user.Updated.String()
return utils.VerifyTimeLimitCode(data, minutes, prefix)
}
return false
}
开发者ID:wildex,项目名称:wetalk,代码行数:14,代码来源:auth.go
示例14: LinkSize
func (m *Image) LinkSize(width int) string {
if m.Ext == 3 {
// if image is gif then return full size
width = 0
}
var size string
switch width {
case setting.ImageSizeSmall, setting.ImageSizeMiddle:
size = utils.ToStr(width)
default:
size = "full"
}
return "/img/" + m.GetToken() + "." + size + m.GetExt()
}
开发者ID:JessonChan,项目名称:wetalk,代码行数:14,代码来源:attachment.go
示例15: PostBrowsersAdd
func PostBrowsersAdd(uid int, ip string, post *models.Post) {
var key string
if uid == 0 {
key = ip
} else {
key = utils.ToStr(uid)
}
key = fmt.Sprintf("PCA.%d.%s", post.Id, key)
if setting.Cache.Get(key) != nil {
return
}
_, err := models.Posts().Filter("Id", post.Id).Update(orm.Params{
"Browsers": orm.ColValue(orm.Col_Add, 1),
})
if err != nil {
beego.Error("PostCounterAdd ", err)
}
setting.Cache.Put(key, true, 60)
}
开发者ID:netxfly,项目名称:wetalk,代码行数:19,代码来源:util.go
示例16: Valid
func (form *UserAvatarForm) Valid(v *validation.Validation) {
if len(utils.ToStr(form.AvatarType)) == 0 {
v.SetError("AvatarType", "Please select")
}
}
开发者ID:netxfly,项目名称:wetalk,代码行数:5,代码来源:form.go
示例17: String
func (m *Category) String() string {
return utils.ToStr(m.Id)
}
开发者ID:JessonChan,项目名称:wetalk,代码行数:3,代码来源:topic.go
示例18: String
func (m *Comment) String() string {
return utils.ToStr(m.Id)
}
开发者ID:netxfly,项目名称:wetalk,代码行数:3,代码来源:post.go
示例19: GetToken
func (m *Image) GetToken() string {
number := beego.Date(m.Created, "ymds") + utils.ToStr(m.Id)
return utils.NumberEncode(number, setting.ImageLinkAlphabets)
}
开发者ID:JessonChan,项目名称:wetalk,代码行数:4,代码来源:attachment.go
示例20: GenImagePath
func GenImagePath(img *models.Image) string {
return "upload/img/" + beego.Date(img.Created, "y/m/d/s/") + utils.ToStr(img.Id) + "/"
}
开发者ID:netxfly,项目名称:wetalk,代码行数:3,代码来源:storage.go
注:本文中的github.com/beego/wetalk/modules/utils.ToStr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论