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.
34 lines
806 B
34 lines
806 B
5 years ago
|
package user
|
||
|
|
||
|
import (
|
||
|
"github.com/golangkit/formatime"
|
||
|
"live/app/lib/db"
|
||
|
)
|
||
|
|
||
|
type UserIm struct {
|
||
|
db.BaseModel
|
||
|
Id uint `gorm:"column:id" json:"id"`
|
||
|
UserId uint `gorm:"column:user_id" json:"userId"`
|
||
|
Identifier string `gorm:"column:identifier" json:"identifier"`
|
||
|
CreatedAt formatime.Second `gorm:"column:created_at" json:"createdAt"`
|
||
|
UpdatedAt formatime.Second `gorm:"column:updated_at" json:"updatedAt"`
|
||
|
}
|
||
|
|
||
|
// 插入
|
||
|
func (u *UserIm) Create(userIm *UserIm) uint {
|
||
|
u.GetDb().Model(u).Create(userIm)
|
||
|
if userIm.Id > 0 {
|
||
|
return userIm.Id
|
||
|
}
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
// @Title 获取会员im登录信息
|
||
|
func (u *UserIm) GetByUserId(userId uint) (result UserIm) {
|
||
|
if userId == 0 {
|
||
|
return
|
||
|
}
|
||
|
u.GetDb().Model(u).First(&result, &UserIm{UserId: userId})
|
||
|
return
|
||
|
}
|