rcvr.go 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package impl
  4. import (
  5. "context"
  6. "smart-supplier-management/pb"
  7. "smart-supplier-management/pb/v1"
  8. "github.com/jaryhe/gopkgs/tasker/rpctasker"
  9. "google.golang.org/grpc"
  10. "smart-supplier-management/impl/v1/user"
  11. "smart-supplier-management/impl/v1/device"
  12. )
  13. // 具体实现
  14. type Rcvr struct {
  15. }
  16. func Register(s *grpc.Server) {
  17. pb.RegisterSmartSiteSupplierServer(s, &Rcvr{})
  18. }
  19. func (c *Rcvr) Register(ctx context.Context, req *v1.RegisterRequest) (reply *v1.RegisterReply, err error) {
  20. t1 := func() error {
  21. reply, err = user.Register(ctx, req)
  22. return err
  23. }
  24. return reply, rpctasker.Exec(ctx, t1)
  25. }
  26. func (c *Rcvr) EmailUpdate(ctx context.Context, req *v1.EmailUpdateRequest) (reply *v1.EmailUpdateReply, err error) {
  27. t1 := func() error {
  28. reply, err = user.EmailUpdate(ctx, req)
  29. return err
  30. }
  31. return reply, rpctasker.Exec(ctx, t1)
  32. }
  33. func (c *Rcvr) EmailPrepare(ctx context.Context, req *v1.EmailPrepareRequest) (reply *v1.EmailPrepareReply, err error) {
  34. t1 := func() error {
  35. reply, err = user.EmailPrepare(ctx, req)
  36. return err
  37. }
  38. return reply, rpctasker.Exec(ctx, t1)
  39. }
  40. func (c *Rcvr) PhoneUpdate(ctx context.Context, req *v1.PhoneUpdateRequest) (reply *v1.PhoneUpdateReply, err error) {
  41. t1 := func() error {
  42. reply, err = user.PhoneUpdate(ctx, req)
  43. return err
  44. }
  45. return reply, rpctasker.Exec(ctx, t1)
  46. }
  47. func (c *Rcvr) UserInfo(ctx context.Context, req *v1.UserInfoRequest) (reply *v1.UserInfoReply, err error) {
  48. t1 := func() error {
  49. reply, err = user.UserInfo(ctx, req)
  50. return err
  51. }
  52. return reply, rpctasker.Exec(ctx, t1)
  53. }
  54. func (c *Rcvr) ProviderApproveStatus(ctx context.Context, req *v1.ProviderApproveStatusRequest) (reply *v1.ProviderApproveStatusReply, err error) {
  55. t1 := func() error {
  56. reply, err = user.ProviderApproveStatus(ctx, req)
  57. return err
  58. }
  59. return reply, rpctasker.Exec(ctx, t1)
  60. }
  61. func (c *Rcvr) Login(ctx context.Context, req *v1.LoginRequest) (reply *v1.LoginReply, err error) {
  62. t1 := func() error {
  63. reply, err = user.Login(ctx, req)
  64. return err
  65. }
  66. return reply, rpctasker.Exec(ctx, t1)
  67. }
  68. func (c *Rcvr) Publicity(ctx context.Context, req *v1.PublicityRequest) (reply *v1.PublicityReply, err error) {
  69. t1 := func() error {
  70. reply, err = user.Publicity(ctx, req)
  71. return err
  72. }
  73. return reply, rpctasker.Exec(ctx, t1)
  74. }
  75. func (c *Rcvr) DeviceDocking(ctx context.Context, req *v1.DeviceDockingRequest) (reply *v1.DeviceDockingReply, err error) {
  76. t1 := func() error {
  77. reply, err = device.DeviceDocking(ctx, req)
  78. return err
  79. }
  80. return reply, rpctasker.Exec(ctx, t1)
  81. }
  82. func (c *Rcvr) DeviceAdd(ctx context.Context, req *v1.DeviceAddRequest) (reply *v1.DeviceAddReply, err error) {
  83. t1 := func() error {
  84. reply, err = device.DeviceAdd(ctx, req)
  85. return err
  86. }
  87. return reply, rpctasker.Exec(ctx, t1)
  88. }
  89. func (c *Rcvr) DeviceDel(ctx context.Context, req *v1.DeviceDelRequest) (reply *v1.DeviceDelReply, err error) {
  90. t1 := func() error {
  91. reply, err = device.DeviceDel(ctx, req)
  92. return err
  93. }
  94. return reply, rpctasker.Exec(ctx, t1)
  95. }
  96. func (c *Rcvr) DeviceDelJobList(ctx context.Context, req *v1.DeviceDelJobListRequest) (reply *v1.DeviceDelJobListReply, err error) {
  97. t1 := func() error {
  98. reply, err = device.DeviceDelJobList(ctx, req)
  99. return err
  100. }
  101. return reply, rpctasker.Exec(ctx, t1)
  102. }
  103. func (c *Rcvr) DeviceTypeList(ctx context.Context, req *v1.DeviceTypeListRequest) (reply *v1.DeviceTypeListReply, err error) {
  104. t1 := func() error {
  105. reply, err = device.DeviceTypeList(ctx, req)
  106. return err
  107. }
  108. return reply, rpctasker.Exec(ctx, t1)
  109. }
  110. func (c *Rcvr) DeviceList(ctx context.Context, req *v1.DeviceListRequest) (reply *v1.DeviceListReply, err error) {
  111. t1 := func() error {
  112. reply, err = device.DeviceList(ctx, req)
  113. return err
  114. }
  115. return reply, rpctasker.Exec(ctx, t1)
  116. }
  117. func (c *Rcvr) VedioList(ctx context.Context, req *v1.VedioListRequest) (reply *v1.VedioListReply, err error) {
  118. t1 := func() error {
  119. reply, err = device.VedioList(ctx, req)
  120. return err
  121. }
  122. return reply, rpctasker.Exec(ctx, t1)
  123. }
  124. func (c *Rcvr) ProjectList(ctx context.Context, req *v1.ProjectListRequest) (reply *v1.ProjectListReply, err error) {
  125. t1 := func() error {
  126. reply, err = device.ProjectList(ctx, req)
  127. return err
  128. }
  129. return reply, rpctasker.Exec(ctx, t1)
  130. }
  131. func (c *Rcvr) SetPasswd(ctx context.Context, req *v1.SetPasswdRequest) (reply *v1.SetPasswdReply, err error) {
  132. t1 := func() error {
  133. reply, err = user.SetPasswd(ctx, req)
  134. return err
  135. }
  136. return reply, rpctasker.Exec(ctx, t1)
  137. }
  138. func (c *Rcvr) ChannelList(ctx context.Context, req *v1.ChannelListRequest) (reply *v1.ChannelListReply, err error) {
  139. t1 := func() error {
  140. reply, err = device.ChannelList(ctx, req)
  141. return err
  142. }
  143. return reply, rpctasker.Exec(ctx, t1)
  144. }
  145. func (c *Rcvr) ChannelAdd(ctx context.Context, req *v1.ChannelAddRequest) (reply *v1.ChannelAddReply, err error) {
  146. t1 := func() error {
  147. reply, err = device.ChannelAdd(ctx, req)
  148. return err
  149. }
  150. return reply, rpctasker.Exec(ctx, t1)
  151. }
  152. func (c *Rcvr) ChannelUpdate(ctx context.Context, req *v1.ChannelUpdateRequest) (reply *v1.ChannelUpdateReply, err error) {
  153. t1 := func() error {
  154. reply, err = device.ChannelUpdate(ctx, req)
  155. return err
  156. }
  157. return reply, rpctasker.Exec(ctx, t1)
  158. }
  159. func (c *Rcvr) VedioAdd(ctx context.Context, req *v1.VedioAddRequest) (reply *v1.VedioAddReply, err error) {
  160. t1 := func() error {
  161. reply, err = device.VedioAdd(ctx, req)
  162. return err
  163. }
  164. return reply, rpctasker.Exec(ctx, t1)
  165. }
  166. func (c *Rcvr) ChangePasswd(ctx context.Context, req *v1.ChangePasswdRequest) (reply *v1.ChangePasswdReply, err error) {
  167. t1 := func() error {
  168. reply, err = user.ChangePasswd(ctx, req)
  169. return err
  170. }
  171. return reply, rpctasker.Exec(ctx, t1)
  172. }