You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
3.3 KiB

4 years ago
package user
import (
"github.com/golangkit/formatime"
"recook/internal/libs/phonedata"
)
type Information struct {
ID uint `gorm:"column:id;primary_key" json:"id"`
AncestorID uint `gorm:"column:ancestor_id" json:"-"`
Nickname string `gorm:"column:nickname" json:"nickname"`
HeadImgUrl string `gorm:"column:head_img_url" json:"headImgUrl"`
WxUnionId string `gorm:"column:wx_union_id" json:"wxUnionId"`
WxAppOpenId string `gorm:"column:wx_app_open_id" json:"-"`
WxMiniOpenId string `gorm:"wx_mini_open_id" json:"-"`
WxGzhOpenId string `gorm:"wx_gzh_open_id" json:"-"`
Mobile string `gorm:"column:mobile" json:"mobile"`
Gender uint `gorm:"column:gender;default:0" json:"gender"`
Birthday formatime.Second `gorm:"column:birthday" json:"birthday"`
InvitationNo string `gorm:"column:invitation_no" json:"invitationNo"`
//Role uint `gorm:"column:role" json:"role"`
Type uint `gorm:"column:type" json:"type"`
CreatedAt formatime.Second `gorm:"column:created_at" json:"createdAt"`
UpdatedAt formatime.Second `gorm:"column:updated_at" json:"-"`
Address string `gorm:"column:address;size:300" json:"addr"`
Phone string `gorm:"column:phone;size:20" json:"phone"`
WechatNo string `gorm:"column:wechat_no;size:30" json:"wechatNo"`
RemarkName string `gorm:"column:remark_name;size:32" json:"remarkName"`
IntroCode string `gorm:"column:intro_code" json:"introCode" `
UpgradeCode string `gorm:"column:upgrade_code" json:"upgradeCode" `
Audit int8 `gorm:"column:audit" json:"audit"` // 用户审核状态, 1 待审核, 2 通过, 3 拒绝了
RealName string `gorm:"column:real_name" json:"realName"`
IDCard string `gorm:"column:id_card" json:"idCard"`
RealInfoStatus int64 `gorm:"column:realinfo_status" json:"realInfoStatus"`
SeqNo string `gorm:"column:seq_no" json:"seqNo"`
AssessBegin formatime.Second `gorm:"column:assess_begin" json:"assessBegin"`
AssessEnd formatime.Date `gorm:"column:assess_end" json:"assessEnd"`
Identifier string `gorm:"column:identifier" json:"identifier"` //用户编号
LevelId uint `json:"levelId"`
Secret uint `json:"secret"`
Province string `json:"province"`
City string `json:"city"`
Level int `json:"level"`
ParentID uint `json:"parent_id"`
UpgradeTime1 formatime.Second `json:"upgrade_time1"`
UpgradeTime2 formatime.Second `json:"upgrade_time2"`
AgentID uint `json:"agent_id"`
4 years ago
}
const (
AuditWait = 1
AuditPass = 2
AuditDecline = 3
// 结果1验证一致计费2验证不一致计费3异常情况不计费
RealInfoErr = 1
RealInfoPass = 2
)
// TableName sets the insert table name for this struct type
func (i *Information) TableName() string {
return "recook_user_info"
}
func (i *Information) BeforeCreate() (err error) {
if len(i.Mobile) == 11 {
pr, e := phonedata.Find(i.Mobile)
if e != nil {
return
}
i.Province = pr.Province
i.City = pr.City
}
return
}