package user import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" ) type ModelSession struct { modules.MCompModel module *User } func (this *ModelSession) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompModel.Init(service, module, comp, options) this.module = module.(*User) this.TableName = comm.TableSession this.Expired = 0 //不自动过期 return } //获取用户 func (this *ModelSession) getUserSession(uid string) (user *pb.CacheUser) { user = &pb.CacheUser{} if err := this.GetListObj(comm.RDS_SESSION, uid, user); err != nil { this.module.Errorln(err) return nil } return user }