package logic import ( "exhibition-register/internal/dao" "exhibition-register/pb/exhibition" ) type IRegister interface { CheckPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error) } func NewRegister() IRegister { return &Register{} } type Register struct { } // CheckPhone 通过手机号检索 存在的就返回数据 func (r *Register) CheckPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error) { out = &exhibition.CheckPhoneResp{} record, err := dao.CheckByPhone(in.PhoneNum) if err != nil { return nil, err } if record == nil { out.IsExist = false return out, nil } data := &exhibition.RegisterInfo{ Id: int32(record.ID), Uuid: record.UUID, ArtistName: record.ArtistName, Gender: record.Gender, PhoneNum: record.PhoneNum, IdCard: record.IdCard, Address: record.Address, IdCardPhoto: record.IdCardPhoto, ArtistPhoto: record.ArtistPhoto, CreatedAt: record.CreatedAt.String(), UpdatedAt: record.UpdatedAt.String(), } out.Data = data out.IsExist = true return out, nil }