24 lines
476 B
Go
24 lines
476 B
Go
package register
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.apinb.com/bsm-sdk/core/errcode"
|
|
pb "git.apinb.com/bsm-sdk/sample/pb"
|
|
)
|
|
|
|
// 帐号密码注册
|
|
func Pwd(ctx context.Context, in *pb.RegisterRequest) (reply *pb.RegisterReply, err error) {
|
|
if in.Account == "" || in.Password == "" {
|
|
return nil, errcode.ErrInvalidArgument
|
|
}
|
|
|
|
//账号唯一验证
|
|
found := models.sampleAccountExists("account", in.Account)
|
|
if found {
|
|
return nil, errcode.ErrAlreadyExists
|
|
}
|
|
|
|
return Do(in)
|
|
}
|