package models import ( "errors" "github.com/ouxuanserver/osmanthuswine/src/core" ) const OrderEntryPersonTableName = TableNamePrefix + "order_entry_person" type OrderEntryPerson struct { Model `xorm:"extends"` Name string `json:"name" xorm:"not null default('') comment('名字') VARCHAR(255)"` Account string `json:"account" xorm:"not null default('') comment('账号') VARCHAR(255)"` Password string `json:"password" xorm:"not null default('') comment('密码') VARCHAR(255)"` Pid int `json:"pid" xorm:"not null default 0 comment('主账号') VARCHAR(255)"` AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') BIGINT(20)"` ActivityId int `json:"activity_id" xorm:"not null default 0 comment('主活动id') BIGINT(20)"` Token string `json:"token" xorm:"not null default '' comment('token') VARCHAR(255)"` // 展示字段 AreaName string `json:"area_name" xorm:"-"` ActivityName string `json:"activity_name" xorm:"-"` IsSpecial int `json:"is_special" xorm:"-"` } func (t *OrderEntryPerson) TableName() string { return OrderEntryPersonTableName } func (t *OrderEntryPerson) Auth(account, password, activityId interface{}) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and account = ? and password = ? and activity_id = ?", account, password, activityId).Get(t) } func (t *OrderEntryPerson) GetByToken(token string) error { exist, err := core.GetXormAuto().Where("is_delete=0 and token=?", token).Get(t) if err != nil { return err } if !exist { return errors.New("录入人员信息异常") } return nil }