Ai
1 Star 0 Fork 0

鹏程/studygolang

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gift.go 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
xuxinhua 提交于 2017-07-30 12:56 +08:00 . 增加描述
// Copyright 2017 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
import (
"time"
"github.com/go-xorm/xorm"
)
const (
GiftStateOnline = 1
GiftStateExpired = 3
GiftTypRedeem = 0
GiftTypDiscount = 1
)
var GiftTypeMap = map[int]string{
GiftTypRedeem: "兑换码",
GiftTypDiscount: "折扣",
}
type Gift struct {
Id int `json:"id" xorm:"pk autoincr"`
Name string
Description string
Price int
TotalNum int
RemainNum int
ExpireTime time.Time `xorm:"int"`
Supplier string
BuyLimit int
Typ int
State int
CreatedAt OftenTime `xorm:"<-"`
TypShow string `xorm:"-"`
}
func (this *Gift) AfterSet(name string, cell xorm.Cell) {
if name == "typ" {
this.TypShow = GiftTypeMap[this.Typ]
}
}
type GiftRedeem struct {
Id int `json:"id" xorm:"pk autoincr"`
GiftId int
Code string
Exchange int
Uid int
UpdatedAt OftenTime `xorm:"<-"`
}
type UserExchangeRecord struct {
Id int `json:"id" xorm:"pk autoincr"`
GiftId int
Uid int
Remark string
ExpireTime time.Time `xorm:"int"`
CreatedAt OftenTime `xorm:"<-"`
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/barry_zpc/studygolang.git
git@gitee.com:barry_zpc/studygolang.git
barry_zpc
studygolang
studygolang
master

搜索帮助