Cron_Admin/app/models/cronusermodel/cron_user.go

46 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cronusermodel
import (
"github.com/qit-team/snow-core/db"
"sync"
"time"
)
var (
once sync.Once
m *CronUserModel
)
// 实体
type CronUser struct {
UserId int `xorm:"'user_id' UNSIGNED INT pk autoincr"`
Name string `xorm:"'name' varchar(20)"`
Tel string `xorm:"'tel' varchar(200)"`
DtalkUserId string `xorm:"'dtalk_user_id' varchar(200)"`
DtalkDepId string `xorm:"'dtalk_dep_id' varchar(200)"`
WxOpenId string `xorm:"'wx_open_id' varchar(200)"`
CreateTime *time.Time `xorm:"'create_time' created datetime"`
UpdateTime time.Time `xorm:"'update_time' updated timestamp"`
DeletedTime time.Time `xorm:"'deleted_time' deleted datetime"`
Status int `xorm:"'status' TINYINT"`
}
// 表名
func (m *CronUser) TableName() string {
return "cron_user"
}
// 私有化防止被外部new
type CronUserModel struct {
db.Model //组合基础Model集成基础Model的属性和方法
}
// 单例模式
func GetInstance() *CronUserModel {
once.Do(func() {
m = new(CronUserModel)
//m.DiName = "" //设置数据库实例连接默认db.SingletonMain
})
return m
}