|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
|
|
|
user "git.diulo.com/mogfee/protoc-gen-kit/proto/v1"
|
|
|
|
"git.diulo.com/mogfee/protoc-gen-kit/xerrors"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UserService struct {
|
|
|
|
user.UnimplementedUserServer
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*UserService) Login(ctx context.Context, req *user.LoginRequest) (*user.LoginResponse, error) {
|
|
|
|
return nil, xerrors.BadRequest("BadRequest", "B")
|
|
|
|
|
|
|
|
b, _ := json.Marshal(req)
|
|
|
|
return &user.LoginResponse{Token: string(b)}, nil
|
|
|
|
}
|
|
|
|
func (*UserService) List(ctx context.Context, req *user.LoginRequest) (*user.LoginResponse, error) {
|
|
|
|
//fmt.Println(ctx.Value("userId"))
|
|
|
|
//return nil, errors.Wrap(errors.InternalServer("InternalServer", "B"), "")
|
|
|
|
|
|
|
|
//b, _ := json.Marshal(req)
|
|
|
|
return &user.LoginResponse{Token: "123123"}, nil
|
|
|
|
}
|
|
|
|
func (*UserService) Delete(ctx context.Context, req *user.LoginRequest) (*user.LoginResponse, error) {
|
|
|
|
//return nil, errors.New("bad err")
|
|
|
|
|
|
|
|
b, _ := json.Marshal(req)
|
|
|
|
return &user.LoginResponse{Token: string(b)}, nil
|
|
|
|
}
|