realname.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package grpc
  2. import (
  3. "context"
  4. "go-common/app/service/main/member/api"
  5. )
  6. // RealnameStatus get the member realname status
  7. func (s *MemberServer) RealnameStatus(ctx context.Context, req *api.MemberMidReq) (*api.RealnameStatusReply, error) {
  8. res, err := s.svr.RealnameStatus(ctx, req.Mid)
  9. if err != nil {
  10. return nil, err
  11. }
  12. var realnameStatusReply = &api.RealnameStatusReply{
  13. RealnameStatus: int8(res),
  14. }
  15. return realnameStatusReply, nil
  16. }
  17. // RealnameApplyStatus get member realname apply status
  18. func (s *MemberServer) RealnameApplyStatus(ctx context.Context, req *api.MemberMidReq) (*api.RealnameApplyInfoReply, error) {
  19. res, err := s.svr.RealnameApplyStatus(ctx, req.Mid)
  20. if err != nil {
  21. return nil, err
  22. }
  23. var realnameStatusReply = &api.RealnameApplyInfoReply{
  24. Status: int8(res.Status),
  25. Remark: res.Remark,
  26. }
  27. return realnameStatusReply, nil
  28. }
  29. // RealnameTelCapture mobilePhone realname certification
  30. func (s *MemberServer) RealnameTelCapture(ctx context.Context, req *api.MemberMidReq) (*api.EmptyStruct, error) {
  31. _, err := s.svr.RealnameTelCapture(ctx, req.Mid)
  32. if err != nil {
  33. return nil, err
  34. }
  35. return &api.EmptyStruct{}, nil
  36. }
  37. // RealnameApply apply for realname certification
  38. func (s *MemberServer) RealnameApply(ctx context.Context, req *api.ArgRealnameApplyReq) (*api.EmptyStruct, error) {
  39. err := s.svr.RealnameApply(ctx, req.Mid, int(req.CaptureCode), req.Realname, req.CardType, req.CardCode, req.Country, req.HandIMGToken, req.FrontIMGToken, req.BackIMGToken)
  40. if err != nil {
  41. return nil, err
  42. }
  43. return &api.EmptyStruct{}, nil
  44. }
  45. // RealnameDetail detail about realname by mid
  46. func (s *MemberServer) RealnameDetail(ctx context.Context, req *api.MemberMidReq) (*api.RealnameDetailReply, error) {
  47. res, err := s.svr.RealnameDetail(ctx, req.Mid)
  48. if err != nil {
  49. return nil, err
  50. }
  51. var realnameDetail = &api.RealnameDetailReply{
  52. Realname: res.Realname,
  53. Card: res.Card,
  54. CardType: int8(res.CardType),
  55. Status: int8(res.Status),
  56. Gender: res.Gender,
  57. HandImg: res.HandIMG,
  58. }
  59. return realnameDetail, nil
  60. }
  61. // RealnameStrippedInfo is
  62. func (s *MemberServer) RealnameStrippedInfo(ctx context.Context, req *api.MemberMidReq) (*api.RealnameStrippedInfoReply, error) {
  63. return s.svr.RealnameStrippedInfo(ctx, req.Mid)
  64. }
  65. // MidByRealnameCard is
  66. func (s *MemberServer) MidByRealnameCard(ctx context.Context, req *api.MidByRealnameCardsReq) (*api.MidByRealnameCardReply, error) {
  67. return s.svr.MidByRealnameCard(ctx, req)
  68. }