rcvr.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  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-system/impl/v1/application"
  7. "property-system/impl/v1/department"
  8. "property-system/impl/v1/garden"
  9. "property-system/impl/v1/msg_package"
  10. "property-system/impl/v1/permission"
  11. "property-system/impl/v1/spackage"
  12. "property-system/impl/v1/user"
  13. "property-system/pb"
  14. pb_v1 "property-system/pb/v1"
  15. "git.getensh.com/common/gopkgs/tasker/rpctasker"
  16. "google.golang.org/grpc"
  17. )
  18. // 具体实现
  19. type Rcvr struct {
  20. }
  21. func Register(s *grpc.Server) {
  22. pb.RegisterSystemServer(s, &Rcvr{})
  23. }
  24. // 系统用户登录
  25. func (c *Rcvr) Login(ctx context.Context, req *pb_v1.LoginRequest) (reply *pb_v1.LoginReply, err error) {
  26. t1 := func() error {
  27. reply, err = user.Login(ctx, req)
  28. return err
  29. }
  30. return reply, rpctasker.Exec(ctx, t1)
  31. }
  32. // 权限变更后重新获取权限
  33. func (c *Rcvr) PermissionReget(ctx context.Context, req *pb_v1.PermissionRegetRequest) (reply *pb_v1.PermissionRegetReply, err error) {
  34. t1 := func() error {
  35. reply, err = user.PermissionReget(ctx, req)
  36. return err
  37. }
  38. return reply, rpctasker.Exec(ctx, t1)
  39. }
  40. func (c *Rcvr) GardenChangeCompany(ctx context.Context, req *pb_v1.GardenChangeCompanyRequest) (reply *pb_v1.GardenChangeCompanyReply, err error) {
  41. t1 := func() error {
  42. reply, err = garden.GardenChangeCompany(ctx, req)
  43. return err
  44. }
  45. return reply, rpctasker.Exec(ctx, t1)
  46. }
  47. func (c *Rcvr) GardenRentSellCount(ctx context.Context, req *pb_v1.GardenRentSellCountRequest) (reply *pb_v1.GardenRentSellCountReply, err error) {
  48. t1 := func() error {
  49. reply, err = garden.GardenRentSellCount(ctx, req)
  50. return err
  51. }
  52. return reply, rpctasker.Exec(ctx, t1)
  53. }
  54. func (c *Rcvr) GardenInfos(ctx context.Context, req *pb_v1.GardenInfosRequest) (reply *pb_v1.GardenInfosReply, err error) {
  55. t1 := func() error {
  56. reply, err = garden.GardenInfos(ctx, req)
  57. return err
  58. }
  59. return reply, rpctasker.Exec(ctx, t1)
  60. }
  61. func (c *Rcvr) GardenIds(ctx context.Context, req *pb_v1.GardenIdsRequest) (reply *pb_v1.GardenIdsReply, err error) {
  62. t1 := func() error {
  63. reply, err = garden.GardenIds(ctx, req)
  64. return err
  65. }
  66. return reply, rpctasker.Exec(ctx, t1)
  67. }
  68. func (c *Rcvr) GardenList(ctx context.Context, req *pb_v1.GardenListRequest) (reply *pb_v1.GardenListReply, err error) {
  69. t1 := func() error {
  70. reply, err = garden.GardenList(ctx, req)
  71. return err
  72. }
  73. return reply, rpctasker.Exec(ctx, t1)
  74. }
  75. func (c *Rcvr) GardenAdd(ctx context.Context, req *pb_v1.GardenAddRequest) (reply *pb_v1.GardenAddReply, err error) {
  76. t1 := func() error {
  77. reply, err = garden.GardenAdd(ctx, req)
  78. return err
  79. }
  80. return reply, rpctasker.Exec(ctx, t1)
  81. }
  82. func (c *Rcvr) GardenUpdate(ctx context.Context, req *pb_v1.GardenUpdateRequest) (reply *pb_v1.GardenUpdateReply, err error) {
  83. t1 := func() error {
  84. reply, err = garden.GardenUpdate(ctx, req)
  85. return err
  86. }
  87. return reply, rpctasker.Exec(ctx, t1)
  88. }
  89. func (c *Rcvr) GardenDel(ctx context.Context, req *pb_v1.GardenDelRequest) (reply *pb_v1.GardenDelReply, err error) {
  90. t1 := func() error {
  91. reply, err = garden.GardenDel(ctx, req)
  92. return err
  93. }
  94. return reply, rpctasker.Exec(ctx, t1)
  95. }
  96. func (c *Rcvr) GardenKeyInfoChange(ctx context.Context, req *pb_v1.GardenKeyInfoChangeRequest) (reply *pb_v1.GardenKeyInfoChangeReply, err error) {
  97. t1 := func() error {
  98. reply, err = garden.GardenKeyInfoChange(ctx, req)
  99. return err
  100. }
  101. return reply, rpctasker.Exec(ctx, t1)
  102. }
  103. func (c *Rcvr) GardenKeyInfoApprove(ctx context.Context, req *pb_v1.GardenKeyInfoApproveRequest) (reply *pb_v1.GardenKeyInfoApproveReply, err error) {
  104. t1 := func() error {
  105. reply, err = garden.GardenKeyInfoApprove(ctx, req)
  106. return err
  107. }
  108. return reply, rpctasker.Exec(ctx, t1)
  109. }
  110. func (c *Rcvr) GardenKeyInfoChangeList(ctx context.Context, req *pb_v1.GardenKeyInfoChangeListRequest) (reply *pb_v1.GardenKeyInfoChangeListReply, err error) {
  111. t1 := func() error {
  112. reply, err = garden.GardenKeyInfoChangeList(ctx, req)
  113. return err
  114. }
  115. return reply, rpctasker.Exec(ctx, t1)
  116. }
  117. func (c *Rcvr) GardenApprove(ctx context.Context, req *pb_v1.GardenApproveRequest) (reply *pb_v1.GardenApproveReply, err error) {
  118. t1 := func() error {
  119. reply, err = garden.GardenApprove(ctx, req)
  120. return err
  121. }
  122. return reply, rpctasker.Exec(ctx, t1)
  123. }
  124. func (c *Rcvr) GardenEnableSet(ctx context.Context, req *pb_v1.GardenEnableSetRequest) (reply *pb_v1.GardenEnableSetReply, err error) {
  125. t1 := func() error {
  126. reply, err = garden.GardenEnableSet(ctx, req)
  127. return err
  128. }
  129. return reply, rpctasker.Exec(ctx, t1)
  130. }
  131. // 设置小区支付商户号
  132. func (c *Rcvr) GardenSetMch(ctx context.Context, req *pb_v1.GardenSetMchRequest) (reply *pb_v1.GardenSetMchReply, err error) {
  133. t1 := func() error {
  134. reply, err = garden.GardenSetMch(ctx, req)
  135. return err
  136. }
  137. return reply, rpctasker.Exec(ctx, t1)
  138. }
  139. func (c *Rcvr) GardenHouseCountLimit(ctx context.Context, req *pb_v1.GardenHouseCountLimitRequest) (reply *pb_v1.GardenHouseCountLimitReply, err error) {
  140. t1 := func() error {
  141. reply, err = garden.GardenHouseCountLimit(ctx, req)
  142. return err
  143. }
  144. return reply, rpctasker.Exec(ctx, t1)
  145. }
  146. func (c *Rcvr) GardenHouseCountChange(ctx context.Context, req *pb_v1.GardenHouseCountChangeRequest) (reply *pb_v1.GardenHouseCountChangeReply, err error) {
  147. t1 := func() error {
  148. reply, err = garden.GardenHouseCountChange(ctx, req)
  149. return err
  150. }
  151. return reply, rpctasker.Exec(ctx, t1)
  152. }
  153. // 设置小区支付模式
  154. func (c *Rcvr) GardenSetMchPayMode(ctx context.Context, req *pb_v1.GardenSetMchPayModeRequest) (reply *pb_v1.GardenSetMchPayModeReply, err error) {
  155. t1 := func() error {
  156. reply, err = garden.GardenSetMchPayMode(ctx, req)
  157. return err
  158. }
  159. return reply, rpctasker.Exec(ctx, t1)
  160. }
  161. // 获取公司下的小区支付模式信息
  162. func (c *Rcvr) CompanyMchGardenList(ctx context.Context, req *pb_v1.CompanyMchGardenListRequest) (reply *pb_v1.CompanyMchGardenListReply, err error) {
  163. t1 := func() error {
  164. reply, err = garden.CompanyMchGardenList(ctx, req)
  165. return err
  166. }
  167. return reply, rpctasker.Exec(ctx, t1)
  168. }
  169. func (c *Rcvr) LoginByPhone(ctx context.Context, req *pb_v1.LoginByPhoneRequest) (reply *pb_v1.LoginByPhoneReply, err error) {
  170. t1 := func() error {
  171. reply, err = user.LoginByPhone(ctx, req)
  172. return err
  173. }
  174. return reply, rpctasker.Exec(ctx, t1)
  175. }
  176. func (c *Rcvr) CheckPhone(ctx context.Context, req *pb_v1.CheckPhoneRequest) (reply *pb_v1.CheckPhoneReply, err error) {
  177. t1 := func() error {
  178. reply, err = user.CheckPhone(ctx, req)
  179. return err
  180. }
  181. return reply, rpctasker.Exec(ctx, t1)
  182. }
  183. func (c *Rcvr) CompanyEnterGarden(ctx context.Context, req *pb_v1.CompanyEnterGardenRequest) (reply *pb_v1.CompanyEnterGardenReply, err error) {
  184. t1 := func() error {
  185. reply, err = user.CompanyEnterGarden(ctx, req)
  186. return err
  187. }
  188. return reply, rpctasker.Exec(ctx, t1)
  189. }
  190. // 忘记密码重置密码
  191. func (c *Rcvr) ResetPassword(ctx context.Context, req *pb_v1.ResetPasswordRequest) (reply *pb_v1.ResetPasswordReply, err error) {
  192. t1 := func() error {
  193. reply, err = user.ResetPassword(ctx, req)
  194. return err
  195. }
  196. return reply, rpctasker.Exec(ctx, t1)
  197. }
  198. // 登录后修改密码
  199. func (c *Rcvr) ChangePassword(ctx context.Context, req *pb_v1.ChangePasswordRequest) (reply *pb_v1.ChangePasswordReply, err error) {
  200. t1 := func() error {
  201. reply, err = user.ChangePassword(ctx, req)
  202. return err
  203. }
  204. return reply, rpctasker.Exec(ctx, t1)
  205. }
  206. func (c *Rcvr) UserAdd(ctx context.Context, req *pb_v1.UserAddRequest) (reply *pb_v1.UserAddReply, err error) {
  207. t1 := func() error {
  208. reply, err = user.UserAdd(ctx, req)
  209. return err
  210. }
  211. return reply, rpctasker.Exec(ctx, t1)
  212. }
  213. func (c *Rcvr) UserDel(ctx context.Context, req *pb_v1.UserDelRequest) (reply *pb_v1.UserDelReply, err error) {
  214. t1 := func() error {
  215. reply, err = user.UserDel(ctx, req)
  216. return err
  217. }
  218. return reply, rpctasker.Exec(ctx, t1)
  219. }
  220. func (c *Rcvr) UserUpdate(ctx context.Context, req *pb_v1.UserUpdateRequest) (reply *pb_v1.UserUpdateReply, err error) {
  221. t1 := func() error {
  222. reply, err = user.UserUpdate(ctx, req)
  223. return err
  224. }
  225. return reply, rpctasker.Exec(ctx, t1)
  226. }
  227. func (c *Rcvr) UserList(ctx context.Context, req *pb_v1.UserListRequest) (reply *pb_v1.UserListReply, err error) {
  228. t1 := func() error {
  229. reply, err = user.UserList(ctx, req)
  230. return err
  231. }
  232. return reply, rpctasker.Exec(ctx, t1)
  233. }
  234. func (c *Rcvr) UserGardenChange(ctx context.Context, req *pb_v1.UserGardenChangeRequest) (reply *pb_v1.UserGardenChangeReply, err error) {
  235. t1 := func() error {
  236. reply, err = user.UserGardenChange(ctx, req)
  237. return err
  238. }
  239. return reply, rpctasker.Exec(ctx, t1)
  240. }
  241. func (c *Rcvr) GroupAdd(ctx context.Context, req *pb_v1.GroupAddRequest) (reply *pb_v1.GroupAddReply, err error) {
  242. t1 := func() error {
  243. reply, err = permission.GroupAdd(ctx, req)
  244. return err
  245. }
  246. return reply, rpctasker.Exec(ctx, t1)
  247. }
  248. func (c *Rcvr) GroupDel(ctx context.Context, req *pb_v1.GroupDelRequest) (reply *pb_v1.GroupDelReply, err error) {
  249. t1 := func() error {
  250. reply, err = permission.GroupDel(ctx, req)
  251. return err
  252. }
  253. return reply, rpctasker.Exec(ctx, t1)
  254. }
  255. func (c *Rcvr) GroupUpdate(ctx context.Context, req *pb_v1.GroupUpdateRequest) (reply *pb_v1.GroupUpdateReply, err error) {
  256. t1 := func() error {
  257. reply, err = permission.GroupUpdate(ctx, req)
  258. return err
  259. }
  260. return reply, rpctasker.Exec(ctx, t1)
  261. }
  262. func (c *Rcvr) GardenPermissionList(ctx context.Context, req *pb_v1.GardenPermissionListRequest) (reply *pb_v1.GardenPermissionListReply, err error) {
  263. t1 := func() error {
  264. reply, err = permission.GardenPermissionList(ctx, req)
  265. return err
  266. }
  267. return reply, rpctasker.Exec(ctx, t1)
  268. }
  269. func (c *Rcvr) GroupList(ctx context.Context, req *pb_v1.GroupListRequest) (reply *pb_v1.GroupListReply, err error) {
  270. t1 := func() error {
  271. reply, err = permission.GroupList(ctx, req)
  272. return err
  273. }
  274. return reply, rpctasker.Exec(ctx, t1)
  275. }
  276. func (c *Rcvr) GroupInfo(ctx context.Context, req *pb_v1.GroupInfoRequest) (reply *pb_v1.GroupInfoReply, err error) {
  277. t1 := func() error {
  278. reply, err = permission.GroupInfo(ctx, req)
  279. return err
  280. }
  281. return reply, rpctasker.Exec(ctx, t1)
  282. }
  283. func (c *Rcvr) SuperGroup(ctx context.Context, req *pb_v1.SuperGroupRequest) (reply *pb_v1.SuperGroupReply, err error) {
  284. t1 := func() error {
  285. reply, err = permission.SuperGroup(ctx, req)
  286. return err
  287. }
  288. return reply, rpctasker.Exec(ctx, t1)
  289. }
  290. func (c *Rcvr) DepartmentAdd(ctx context.Context, req *pb_v1.DepartmentAddRequest) (reply *pb_v1.DepartmentAddReply, err error) {
  291. t1 := func() error {
  292. reply, err = department.DepartmentAdd(ctx, req)
  293. return err
  294. }
  295. return reply, rpctasker.Exec(ctx, t1)
  296. }
  297. func (c *Rcvr) DepartmentDel(ctx context.Context, req *pb_v1.DepartmentDelRequest) (reply *pb_v1.DepartmentDelReply, err error) {
  298. t1 := func() error {
  299. reply, err = department.DepartmentDel(ctx, req)
  300. return err
  301. }
  302. return reply, rpctasker.Exec(ctx, t1)
  303. }
  304. func (c *Rcvr) DepartmentUpdate(ctx context.Context, req *pb_v1.DepartmentUpdateRequest) (reply *pb_v1.DepartmentUpdateReply, err error) {
  305. t1 := func() error {
  306. reply, err = department.DepartmentUpdate(ctx, req)
  307. return err
  308. }
  309. return reply, rpctasker.Exec(ctx, t1)
  310. }
  311. func (c *Rcvr) DepartmentList(ctx context.Context, req *pb_v1.DepartmentListRequest) (reply *pb_v1.DepartmentListReply, err error) {
  312. t1 := func() error {
  313. reply, err = department.DepartmentList(ctx, req)
  314. return err
  315. }
  316. return reply, rpctasker.Exec(ctx, t1)
  317. }
  318. // 应用相关
  319. func (c *Rcvr) ApplicationOrderAdd(ctx context.Context, req *pb_v1.ApplicationOrderAddRequest) (reply *pb_v1.ApplicationOrderAddReply, err error) {
  320. t1 := func() error {
  321. reply, err = application.ApplicationOrderAdd(ctx, req)
  322. return err
  323. }
  324. return reply, rpctasker.Exec(ctx, t1)
  325. }
  326. func (c *Rcvr) ApplicationOrderApprove(ctx context.Context, req *pb_v1.ApplicationOrderApproveRequest) (reply *pb_v1.ApplicationOrderApproveReply, err error) {
  327. t1 := func() error {
  328. reply, err = application.ApplicationOrderApprove(ctx, req)
  329. return err
  330. }
  331. return reply, rpctasker.Exec(ctx, t1)
  332. }
  333. func (c *Rcvr) ApplicationOrderAmount(ctx context.Context, req *pb_v1.ApplicationOrderAmountRequest) (reply *pb_v1.ApplicationOrderAmountReply, err error) {
  334. t1 := func() error {
  335. reply, err = application.ApplicationOrderAmount(ctx, req)
  336. return err
  337. }
  338. return reply, rpctasker.Exec(ctx, t1)
  339. }
  340. func (c *Rcvr) GardenApplicationList(ctx context.Context, req *pb_v1.GardenApplicationListRequest) (reply *pb_v1.GardenApplicationListReply, err error) {
  341. t1 := func() error {
  342. reply, err = application.GardenApplicationList(ctx, req)
  343. return err
  344. }
  345. return reply, rpctasker.Exec(ctx, t1)
  346. }
  347. // 套餐相关
  348. func (c *Rcvr) PackageOrderAdd(ctx context.Context, req *pb_v1.PackageOrderAddRequest) (reply *pb_v1.PackageOrderAddReply, err error) {
  349. t1 := func() error {
  350. reply, err = spackage.PackageOrderAdd(ctx, req)
  351. return err
  352. }
  353. return reply, rpctasker.Exec(ctx, t1)
  354. }
  355. func (c *Rcvr) PackageOrderApprove(ctx context.Context, req *pb_v1.PackageOrderApproveRequest) (reply *pb_v1.PackageOrderApproveReply, err error) {
  356. t1 := func() error {
  357. reply, err = spackage.PackageOrderApprove(ctx, req)
  358. return err
  359. }
  360. return reply, rpctasker.Exec(ctx, t1)
  361. }
  362. func (c *Rcvr) PackageOrderAmount(ctx context.Context, req *pb_v1.PackageOrderAmountRequest) (reply *pb_v1.PackageOrderAmountReply, err error) {
  363. t1 := func() error {
  364. reply, err = spackage.PackageOrderAmount(ctx, req)
  365. return err
  366. }
  367. return reply, rpctasker.Exec(ctx, t1)
  368. }
  369. func (c *Rcvr) CompanyPackageList(ctx context.Context, req *pb_v1.CompanyPackageListRequest) (reply *pb_v1.CompanyPackageListReply, err error) {
  370. t1 := func() error {
  371. reply, err = spackage.CompanyPackageList(ctx, req)
  372. return err
  373. }
  374. return reply, rpctasker.Exec(ctx, t1)
  375. }
  376. // 短信套餐相关
  377. func (c *Rcvr) MsgPackageOrderAdd(ctx context.Context, req *pb_v1.MsgPackageOrderAddRequest) (reply *pb_v1.MsgPackageOrderAddReply, err error) {
  378. t1 := func() error {
  379. reply, err = msg_package.MsgPackageOrderAdd(ctx, req)
  380. return err
  381. }
  382. return reply, rpctasker.Exec(ctx, t1)
  383. }
  384. func (c *Rcvr) MsgPackageOrderApprove(ctx context.Context, req *pb_v1.MsgPackageOrderApproveRequest) (reply *pb_v1.MsgPackageOrderApproveReply, err error) {
  385. t1 := func() error {
  386. reply, err = msg_package.MsgPackageOrderApprove(ctx, req)
  387. return err
  388. }
  389. return reply, rpctasker.Exec(ctx, t1)
  390. }
  391. func (c *Rcvr) MsgPackageOrderDecrease(ctx context.Context, req *pb_v1.MsgPackageOrderDecreaseRequest) (reply *pb_v1.MsgPackageOrderDecreaseReply, err error) {
  392. t1 := func() error {
  393. reply, err = msg_package.MsgPackageOrderDecrease(ctx, req)
  394. return err
  395. }
  396. return reply, rpctasker.Exec(ctx, t1)
  397. }
  398. func (c *Rcvr) MsgPackageOrderList(ctx context.Context, req *pb_v1.MsgPackageOrderListRequest) (reply *pb_v1.MsgPackageOrderListReply, err error) {
  399. t1 := func() error {
  400. reply, err = msg_package.MsgPackageOrderList(ctx, req)
  401. return err
  402. }
  403. return reply, rpctasker.Exec(ctx, t1)
  404. }