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


Golang models.Photo类代码示例

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


在下文中一共展示了Photo类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Cover

//设置封面
func (this *PhotoController) Cover() {
	id, _ := this.GetInt("id")
	photo := models.Photo{Id: id}
	if photo.Read() == nil {
		photo.Delete()
	}
	this.Redirect("/admin/photo/list", 302)
}
开发者ID:cnitfarmer,项目名称:blog,代码行数:9,代码来源:photo.go

示例2: Delete

//删除照片
func (this *PhotoController) Delete() {
	id, _ := this.GetInt64("id")
	albumid := this.GetString("albumid")
	photo := models.Photo{Id: id}
	if photo.Read() == nil {
		photo.Delete()
	}
	this.Redirect("/admin/photo/list?albumid="+albumid, 302)
}
开发者ID:qiaogw,项目名称:blog,代码行数:10,代码来源:photo.go

示例3: List

//照片列表
func (this *PhotoController) List() {
	var albumid int64
	var list []*models.Photo
	var photo models.Photo

	if albumid, _ = this.GetInt("albumid"); albumid < 1 {
		albumid = 1
	}
	photo.Query().Filter("albumid", albumid).OrderBy("-posttime").All(&list)
	for _, v := range list {
		v.Small = strings.Replace(v.Url, "bigpic", "smallpic", 1)
	}
	this.Data["list"] = list
	this.Data["albumid"] = albumid
	this.display()
}
开发者ID:cnitfarmer,项目名称:blog,代码行数:17,代码来源:photo.go

示例4: Insert

//插入照片
func (this *PhotoController) Insert(albumid int64, desc, url string) {
	var photo models.Photo
	photo.Albumid = albumid
	photo.Des = desc
	photo.Posttime = time.Now()
	photo.Url = url
	if err := photo.Insert(); err != nil {
		this.showmsg(err.Error())
	}
}
开发者ID:cnitfarmer,项目名称:blog,代码行数:11,代码来源:photo.go


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