24 lines
544 B
Go
24 lines
544 B
Go
|
package dao
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"exhibition-register/internal/model"
|
||
|
"exhibition-register/pkg/app"
|
||
|
"exhibition-register/pkg/msg"
|
||
|
"go.uber.org/zap"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
func CheckByPhone(phone string) (record *model.RegisterRecord, err error) {
|
||
|
res := app.ModuleClients.ExhibitionRegister.Where("phone_num=?", phone).First(record)
|
||
|
if res.Error != nil {
|
||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
zap.L().Error("Register err CheckByPhone", zap.Error(err))
|
||
|
err = errors.New(msg.ErrorSelect)
|
||
|
return
|
||
|
}
|
||
|
return
|
||
|
}
|