rcvr.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package impl
  4. import (
  5. "context"
  6. "property-company/impl/v1/company"
  7. "property-company/impl/v1/garden"
  8. "property-company/impl/v1/statistic"
  9. "property-company/impl/v1/user"
  10. "property-company/pb"
  11. pb_v1 "property-company/pb/v1"
  12. "git.getensh.com/common/gopkgs/tasker/rpctasker"
  13. "google.golang.org/grpc"
  14. )
  15. // 具体实现
  16. type Rcvr struct {
  17. }
  18. func Register(s *grpc.Server) {
  19. pb.RegisterCompanyServer(s, &Rcvr{})
  20. }
  21. //
  22. func (c *Rcvr) Login(ctx context.Context, req *pb_v1.LoginRequest) (reply *pb_v1.LoginReply, err error) {
  23. t1 := func() error {
  24. reply, err = user.Login(ctx, req)
  25. return err
  26. }
  27. return reply, rpctasker.Exec(ctx, t1)
  28. }
  29. func (c *Rcvr) Register(ctx context.Context, req *pb_v1.RegisterRequest) (reply *pb_v1.RegisterReply, err error) {
  30. t1 := func() error {
  31. reply, err = company.Register(ctx, req)
  32. return err
  33. }
  34. return reply, rpctasker.Exec(ctx, t1)
  35. }
  36. func (c *Rcvr) LoginByPhone(ctx context.Context, req *pb_v1.LoginByPhoneRequest) (reply *pb_v1.LoginByPhoneReply, err error) {
  37. t1 := func() error {
  38. reply, err = user.LoginByPhone(ctx, req)
  39. return err
  40. }
  41. return reply, rpctasker.Exec(ctx, t1)
  42. }
  43. func (c *Rcvr) CheckPhone(ctx context.Context, req *pb_v1.CheckPhoneRequest) (reply *pb_v1.CheckPhoneReply, err error) {
  44. t1 := func() error {
  45. reply, err = user.CheckPhone(ctx, req)
  46. return err
  47. }
  48. return reply, rpctasker.Exec(ctx, t1)
  49. }
  50. // 忘记密码重置密码
  51. func (c *Rcvr) ResetPassword(ctx context.Context, req *pb_v1.ResetPasswordRequest) (reply *pb_v1.ResetPasswordReply, err error) {
  52. t1 := func() error {
  53. reply, err = user.ResetPassword(ctx, req)
  54. return err
  55. }
  56. return reply, rpctasker.Exec(ctx, t1)
  57. }
  58. // 登录后修改密码
  59. func (c *Rcvr) ChangePassword(ctx context.Context, req *pb_v1.ChangePasswordRequest) (reply *pb_v1.ChangePasswordReply, err error) {
  60. t1 := func() error {
  61. reply, err = user.ChangePassword(ctx, req)
  62. return err
  63. }
  64. return reply, rpctasker.Exec(ctx, t1)
  65. }
  66. func (c *Rcvr) CompanyApprove(ctx context.Context, req *pb_v1.CompanyApproveRequest) (reply *pb_v1.CompanyApproveReply, err error) {
  67. t1 := func() error {
  68. reply, err = company.CompanyApprove(ctx, req)
  69. return err
  70. }
  71. return reply, rpctasker.Exec(ctx, t1)
  72. }
  73. func (c *Rcvr) CompanyInfo(ctx context.Context, req *pb_v1.CompanyInfoRequest) (reply *pb_v1.CompanyInfoReply, err error) {
  74. t1 := func() error {
  75. reply, err = company.CompanyInfo(ctx, req)
  76. return err
  77. }
  78. return reply, rpctasker.Exec(ctx, t1)
  79. }
  80. func (c *Rcvr) CompanyUpdate(ctx context.Context, req *pb_v1.CompanyUpdateRequest) (reply *pb_v1.CompanyUpdateReply, err error) {
  81. t1 := func() error {
  82. reply, err = company.CompanyUpdate(ctx, req)
  83. return err
  84. }
  85. return reply, rpctasker.Exec(ctx, t1)
  86. }
  87. func (c *Rcvr) CompanyList(ctx context.Context, req *pb_v1.CompanyListRequest) (reply *pb_v1.CompanyListReply, err error) {
  88. t1 := func() error {
  89. reply, err = company.CompanyList(ctx, req)
  90. return err
  91. }
  92. return reply, rpctasker.Exec(ctx, t1)
  93. }
  94. // 设置商户号
  95. func (c *Rcvr) CompanyMchIdSet(ctx context.Context, req *pb_v1.CompanyMchIdSetRequest) (reply *pb_v1.CompanyMchIdSetReply, err error) {
  96. t1 := func() error {
  97. reply, err = company.CompanyMchIdSet(ctx, req)
  98. return err
  99. }
  100. return reply, rpctasker.Exec(ctx, t1)
  101. }
  102. // 设置支付方式 仅线下/支付到公司账户/支付到软件系统提供商账户
  103. func (c *Rcvr) CompanyPayModel(ctx context.Context, req *pb_v1.CompanyPayModelRequest) (reply *pb_v1.CompanyPayModelReply, err error) {
  104. t1 := func() error {
  105. reply, err = company.CompanyPayModel(ctx, req)
  106. return err
  107. }
  108. return reply, rpctasker.Exec(ctx, t1)
  109. }
  110. // 微信商户申请
  111. func (c *Rcvr) CompanyWxAccountApply(ctx context.Context, req *pb_v1.CompanyWxAccountApplyRequest) (reply *pb_v1.CompanyWxAccountApplyReply, err error) {
  112. t1 := func() error {
  113. reply, err = company.CompanyWxAccountApply(ctx, req)
  114. return err
  115. }
  116. return reply, rpctasker.Exec(ctx, t1)
  117. }
  118. // 微信商户申请资料
  119. func (c *Rcvr) CompanyWxAccountApplyInfo(ctx context.Context, req *pb_v1.CompanyWxAccountApplyInfoRequest) (reply *pb_v1.CompanyWxAccountApplyInfoReply, err error) {
  120. t1 := func() error {
  121. reply, err = company.CompanyWxAccountApplyInfo(ctx, req)
  122. return err
  123. }
  124. return reply, rpctasker.Exec(ctx, t1)
  125. }
  126. // 微信商户申请列表
  127. func (c *Rcvr) CompanyWxAccountApplyList(ctx context.Context, req *pb_v1.CompanyWxAccountApplyListRequest) (reply *pb_v1.CompanyWxAccountApplyListReply, err error) {
  128. t1 := func() error {
  129. reply, err = company.CompanyWxAccountApplyList(ctx, req)
  130. return err
  131. }
  132. return reply, rpctasker.Exec(ctx, t1)
  133. }
  134. func (c *Rcvr) CompanyChangeFreeGarden(ctx context.Context, req *pb_v1.CompanyChangeFreeGardenRequest) (reply *pb_v1.CompanyChangeFreeGardenReply, err error) {
  135. t1 := func() error {
  136. reply, err = company.CompanyChangeFreeGarden(ctx, req)
  137. return err
  138. }
  139. return reply, rpctasker.Exec(ctx, t1)
  140. }
  141. func (c *Rcvr) CompanyAddGarden(ctx context.Context, req *pb_v1.CompanyAddGardenRequest) (reply *pb_v1.CompanyAddGardenReply, err error) {
  142. t1 := func() error {
  143. reply, err = garden.CompanyAddGarden(ctx, req)
  144. return err
  145. }
  146. return reply, rpctasker.Exec(ctx, t1)
  147. }
  148. func (c *Rcvr) CompanyGardenDecrease(ctx context.Context, req *pb_v1.CompanyGardenDecreaseRequest) (reply *pb_v1.CompanyGardenDecreaseReply, err error) {
  149. t1 := func() error {
  150. reply, err = garden.CompanyGardenDecrease(ctx, req)
  151. return err
  152. }
  153. return reply, rpctasker.Exec(ctx, t1)
  154. }
  155. // 检查是否可以新增小区
  156. func (c *Rcvr) CompanyCanAddGarden(ctx context.Context, req *pb_v1.CompanyCanAddGardenRequest) (reply *pb_v1.CompanyCanAddGardenReply, err error) {
  157. t1 := func() error {
  158. reply, err = garden.CompanyCanAddGarden(ctx, req)
  159. return err
  160. }
  161. return reply, rpctasker.Exec(ctx, t1)
  162. }
  163. func (c *Rcvr) CompanyUserAdd(ctx context.Context, req *pb_v1.CompanyUserAddRequest) (reply *pb_v1.CompanyUserAddReply, err error) {
  164. t1 := func() error {
  165. reply, err = user.CompanyUserAdd(ctx, req)
  166. return err
  167. }
  168. return reply, rpctasker.Exec(ctx, t1)
  169. }
  170. func (c *Rcvr) CompanyUserDel(ctx context.Context, req *pb_v1.CompanyUserDelRequest) (reply *pb_v1.CompanyUserDelReply, err error) {
  171. t1 := func() error {
  172. reply, err = user.CompanyUserDel(ctx, req)
  173. return err
  174. }
  175. return reply, rpctasker.Exec(ctx, t1)
  176. }
  177. func (c *Rcvr) CompanyUserUpdate(ctx context.Context, req *pb_v1.CompanyUserUpdateRequest) (reply *pb_v1.CompanyUserUpdateReply, err error) {
  178. t1 := func() error {
  179. reply, err = user.CompanyUserUpdate(ctx, req)
  180. return err
  181. }
  182. return reply, rpctasker.Exec(ctx, t1)
  183. }
  184. func (c *Rcvr) CompanyUserList(ctx context.Context, req *pb_v1.CompanyUserListRequest) (reply *pb_v1.CompanyUserListReply, err error) {
  185. t1 := func() error {
  186. reply, err = user.CompanyUserList(ctx, req)
  187. return err
  188. }
  189. return reply, rpctasker.Exec(ctx, t1)
  190. }
  191. func (c *Rcvr) CompanyStatistic(ctx context.Context, req *pb_v1.CompanyStatisticRequest) (reply *pb_v1.CompanyStatisticReply, err error) {
  192. t1 := func() error {
  193. reply, err = statistic.CompanyStatistic(ctx, req)
  194. return err
  195. }
  196. return reply, rpctasker.Exec(ctx, t1)
  197. }
  198. func (c *Rcvr) CompanyObjStatisticSet(ctx context.Context, req *pb_v1.CompanyObjStatisticSetRequest) (reply *pb_v1.CompanyObjStatisticSetReply, err error) {
  199. t1 := func() error {
  200. reply, err = statistic.CompanyObjStatisticSet(ctx, req)
  201. return err
  202. }
  203. return reply, rpctasker.Exec(ctx, t1)
  204. }
  205. func (c *Rcvr) CompanyDealStatisticSet(ctx context.Context, req *pb_v1.CompanyDealStatisticSetRequest) (reply *pb_v1.CompanyDealStatisticSetReply, err error) {
  206. t1 := func() error {
  207. reply, err = statistic.CompanyDealStatisticSet(ctx, req)
  208. return err
  209. }
  210. return reply, rpctasker.Exec(ctx, t1)
  211. }