package user_record

import "time"

// UserRecord 联系人表
type UserRecord struct {
	UserRecordID   uint64    `gorm:"primaryKey;column:user_record_id;type:bigint(20) unsigned;not null" json:"-"` // 用户id
	OpenID         string    `gorm:"index:open_id;column:open_id;type:varchar(32);default:''" json:"openId"`      // open_id
	UnionID        string    `gorm:"column:union_id;type:varchar(64);default:''" json:"unionId"`
	Subscribe      int8      `gorm:"column:subscribe;type:tinyint(1);default:0" json:"subscribe"`                  // 是否关注
	NickName       string    `gorm:"index:nick_name;column:nick_name;type:varchar(32);default:''" json:"nickName"` // 用户昵称
	RealName       string    `gorm:"column:real_name;type:varchar(32);default:''" json:"realName"`                 // 用户实际名称
	BindAccount    string    `gorm:"column:bind_account;type:varchar(128);default:''" json:"bindAccount"`          // 绑定时的账号
	Sex            int64     `gorm:"column:sex;type:bigint(20);default:1" json:"sex"`                              // 普通用户性别，1为男性，2为女性
	Province       string    `gorm:"column:province;type:varchar(30);default:''" json:"province"`                  // 普通用户个人资料填写的省份
	City           string    `gorm:"column:city;type:varchar(30);default:''" json:"city"`                          // 普通用户个人资料填写的城市
	Country        string    `gorm:"column:country;type:varchar(30);default:''" json:"country"`                    // 国家，如中国为CN
	Headimgurl     string    `gorm:"column:headimgurl;type:varchar(512);default:''" json:"headimgurl"`
	CreateTime     time.Time `gorm:"column:create_time;type:datetime;default:CURRENT_TIMESTAMP" json:"createTime"`                     // 创建时间
	CreatePlatform int8      `gorm:"index:idx_create_platform;column:create_platform;type:tinyint(4);default:1" json:"createPlatform"` // 注册平台,1:日度点评公众号,2:管理后台，3：pc端网站,4:查研观向小程序
	SessionKey     string    `gorm:"column:session_key;type:varchar(255);default:''" json:"sessionKey"`                                // 微信小程序会话密钥
	UserID         int       `gorm:"index:idx_user_id;column:user_id;type:int(11);default:0" json:"userId"`                            // 用户id
}

// TableName get sql table name.获取数据库表名
func (m *UserRecord) TableName() string {
	return "user_record"
}

// UserRecordColumns get sql column name.获取数据库列名
var UserRecordColumns = struct {
	UserRecordID   string
	OpenID         string
	UnionID        string
	Subscribe      string
	NickName       string
	RealName       string
	BindAccount    string
	Sex            string
	Province       string
	City           string
	Country        string
	Headimgurl     string
	CreateTime     string
	CreatePlatform string
	SessionKey     string
	UserID         string
}{
	UserRecordID:   "user_record_id",
	OpenID:         "open_id",
	UnionID:        "union_id",
	Subscribe:      "subscribe",
	NickName:       "nick_name",
	RealName:       "real_name",
	BindAccount:    "bind_account",
	Sex:            "sex",
	Province:       "province",
	City:           "city",
	Country:        "country",
	Headimgurl:     "headimgurl",
	CreateTime:     "create_time",
	CreatePlatform: "create_platform",
	SessionKey:     "session_key",
	UserID:         "user_id",
}
