userBindInfo.go 969 Bytes
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
package user_m

import (
	"git.hilo.cn/hilo-common/domain"
	"time"
)

type UserBindInfo struct {
	UserId       uint64    `json:"user_id"`
	Phone        string    `json:"phone"`
	PhoneCountry string    `json:"phone_country"`
	Pwd          string    `json:"pwd"`
	AreaCode     string    `json:"area_code"`
	Icon         string    `json:"icon"`
	CreateAt     time.Time `json:"create_at"`
	UpdateAt     time.Time `json:"update_at"`
}

func (*UserBindInfo) TableName() string {
	return "user_bind_info"
}

type UserPhoneInfo struct {
	Phone        string `json:"phone"`
	PhoneCountry string `json:"phoneCountry"`
	AreaCode     string `json:"areaCode"`
	Icon         string `json:"icon"`
}

// 获取用户手机号绑定信息
func GetUserBindInfoByUserId(model *domain.Model, userId uint64) (*UserBindInfo, error) {
	res := new(UserBindInfo)
	err := model.DB().Where(&UserBindInfo{UserId: userId}).First(&res).Error
	if err != nil {
		return nil, err
	}
	return res, nil
}