Ai
1 Star 0 Fork 0

鹏程/studygolang

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
resource.go 1.79 KB
一键复制 编辑 原始数据 按行查看 历史
xuxinhua 提交于 2017-06-10 15:28 +08:00 . V3.0.0:
// Copyright 2013 The StudyGolang Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// http://studygolang.com
// Author: polaris polaris@studygolang.com
package model
const (
LinkForm = "只是链接"
ContentForm = "包括内容"
)
// 资源信息
type Resource struct {
Id int `json:"id" xorm:"pk autoincr"`
Title string `json:"title"`
Form string `json:"form"`
Content string `json:"content"`
Url string `json:"url"`
Uid int `json:"uid"`
Catid int `json:"catid"`
CatName string `json:"-" xorm:"-"`
Lastreplyuid int `json:"lastreplyuid"`
Lastreplytime OftenTime `json:"lastreplytime"`
Tags string `json:"tags"`
Ctime OftenTime `json:"ctime" xorm:"created"`
Mtime OftenTime `json:"mtime" xorm:"<-"`
// 排行榜阅读量
RankView int `json:"rank_view" xorm:"-"`
}
func (this *Resource) BeforeInsert() {
if this.Tags == "" {
this.Tags = AutoTag(this.Title+this.CatName, this.Content, 4)
}
this.Lastreplytime = NewOftenTime()
}
// 资源扩展(计数)信息
type ResourceEx struct {
Id int `json:"-" xorm:"pk"`
Viewnum int `json:"viewnum"`
Cmtnum int `json:"cmtnum"`
Likenum int `json:"likenum"`
Mtime string `json:"mtime" xorm:"<-"`
}
type ResourceInfo struct {
Resource `xorm:"extends"`
ResourceEx `xorm:"extends"`
}
func (*ResourceInfo) TableName() string {
return "resource"
}
// 资源分类信息
type ResourceCat struct {
Catid int `json:"catid" xorm:"pk autoincr"`
Name string `json:"name"`
Intro string `json:"intro"`
Ctime string `json:"ctime" xorm:"<-"`
}
func (*ResourceCat) TableName() string {
return "resource_category"
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/barry_zpc/studygolang.git
git@gitee.com:barry_zpc/studygolang.git
barry_zpc
studygolang
studygolang
master

搜索帮助