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.
49 lines
1.9 KiB
49 lines
1.9 KiB
package models
|
|
|
|
import (
|
|
"errors"
|
|
"github.com/ouxuanserver/osmanthuswine/src/core"
|
|
)
|
|
|
|
const OrderEntryPersonTableName = TableNamePrefix + "order_entry_person"
|
|
|
|
type OrderEntryPerson struct {
|
|
Model `xorm:"extends"`
|
|
//Id int `json:"id" xorm:"pk autoincr BIGINT(20)"`
|
|
//IsDelete bool `json:"-" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
|
|
//CreatedAt time.Time `json:"-" xorm:"not null created comment('创建时间') DATETIME"`
|
|
//UpdatedAt time.Time `json:"-" xorm:"not null updated comment('更新时间') DATETIME"`
|
|
|
|
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
|
|
}
|