You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB
Go

8 months ago
package logic
8 months ago
import (
"exhibition-register/internal/dao"
"exhibition-register/pb/exhibition"
)
8 months ago
type IRegister interface {
8 months ago
CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error)
8 months ago
}
func NewRegister() IRegister {
return &Register{}
8 months ago
}
type Register struct {
}
8 months ago
// CheckPhone 通过手机号检索 存在的就返回数据
8 months ago
func (r *Register) CheckByPhone(in *exhibition.RegisterInfo) (out *exhibition.CheckPhoneResp, err error) {
8 months ago
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
}