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.
|
|
package models
import ( "time"
"github.com/ouxuanserver/osmanthuswine/src/core" )
const UserTN = TableNamePrefix + "user"
//用户
type User struct { Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` Phone string `json:"phone" description:"手机号码"` Code string `json:"code" description:"验证码"` City string `json:"city" xorm:"not null"` Province string `json:"province" xorm:"not null"` Country string `json:"country"` Unionid string `json:"unionid" description:"unionid"` Openid string `json:"openid" description:"openid"` AccessToken string `json:"access_token" description:"token"` Nickname string `json:"nickname" description:"昵称"` Avatar string `json:"avatar" description:"头像"` Gender string `json:"gender" description:"性别[男,女]"` Balance float64 `json:"balance" description:"余额"` ActivityId int64 `json:"activity_id" description:"主活动id"` // 不存在
AreaId int64 `json:"area_id" description:"地区id"` // 不存在
AreaName string `json:"area_name" description:"地区名字"` Sig string `json:"sig" xorm:"-"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"` }
func (t *User) TableName() string { return UserTN }
func (t *User) Alias(name string) string { return AliasTableName(t, name) }
func (t *User) GetUserByOpenid(openId string) (bool, error) { return core.GetXormAuto().Where("openid=?", openId).Get(t) }
func (t *User) SaveUserInfo(uid interface{}) (int64, error) { return core.GetXormAuto().Where("id=?", uid).Cols("nickname", "gender", "avatar", "unionid", "city", "province", "country").Update(t) }
func GetUsersByIds(ids interface{}) ([]*User, error) { users := make([]*User, 0) err := core.GetXormAuto().In("id", ids).Find(&users) return users, err }
|