package repo import ( "gim/internal/business/domain/user/model" ) type masterRepo struct{} var MasterRepo = new(masterRepo) // Get 获取单个站长 func (*masterRepo) Get(masterId int64) (*model.Master, error) { master, err := MasterCache.Get(masterId) if err != nil { return nil, err } if master != nil { return master, nil } master, err = MasterDao.Get(masterId) if err != nil { return nil, err } if master != nil { err = MasterCache.Set(*master) if err != nil { return nil, err } } return master, err } func (*masterRepo) GetByPhone(phone string, masterId int64) (*model.Master, error) { return MasterDao.GetByPhone(phone) }