423 Star 2K Fork 720

进击的皇虫/DocHub

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CoinLogModel.go 949 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2018-08-09 22:49 +08:00 . model层代码优化
package models
import (
"time"
"github.com/astaxie/beego/orm"
)
//金币变更日志
type CoinLog struct {
Id int `orm:"column(Id)"`
Uid int `orm:"column(Uid);index"` //用户id
Coin int `orm:"column(Coin);default(0)"` //金币变更,正表示加,负表示减
Log string `orm:"column(Log);size(512);default()"` //记录说明
TimeCreate int `orm:"column(TimeCreate)"` //记录变更时间
}
func NewCoinLog() *CoinLog {
return &CoinLog{}
}
func GetTableCoinLog() string {
return getTable("coin_log")
}
//记录金币记录变更情况,会自动对用户的金币做变更
//@param log 日志对象
//@return err 错误,nil表示true,否则表示false
func (this *CoinLog) LogRecord(log CoinLog) (err error) {
log.TimeCreate = int(time.Now().Unix())
_, err = orm.NewOrm().Insert(&log)
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/truthhun/DocHub.git
git@gitee.com:truthhun/DocHub.git
truthhun
DocHub
DocHub
01033d1926ec

搜索帮助