2024-01-30 03:52:56 +00:00
|
|
|
package logic
|
|
|
|
|
2024-01-30 09:39:04 +00:00
|
|
|
import (
|
|
|
|
"exhibition-register/internal/dao"
|
|
|
|
"exhibition-register/pb/exhibition"
|
|
|
|
)
|
|
|
|
|
2024-01-30 03:52:56 +00:00
|
|
|
type IRegister interface {
|
2024-01-31 01:23:32 +00:00
|
|
|
CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error)
|
2024-01-30 09:39:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewRegister() IRegister {
|
|
|
|
return &Register{}
|
2024-01-30 03:52:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Register struct {
|
|
|
|
}
|
2024-01-30 09:39:04 +00:00
|
|
|
|
|
|
|
// CheckPhone 通过手机号检索 存在的就返回数据
|
2024-01-31 01:23:32 +00:00
|
|
|
func (r *Register) CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error) {
|
2024-01-30 09:39:04 +00:00
|
|
|
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
|
|
|
|
}
|