rcvr.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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-common/impl/v1/application"
  7. "property-common/impl/v1/area"
  8. "property-common/impl/v1/cpackage"
  9. "property-common/impl/v1/material"
  10. "property-common/impl/v1/msg_package"
  11. "property-common/impl/v1/oss_obj"
  12. "property-common/impl/v1/system_permission"
  13. "property-common/pb"
  14. pb_v1 "property-common/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.RegisterCommonServer(s, &Rcvr{})
  23. }
  24. //
  25. func (c *Rcvr) SystemPermissionList(ctx context.Context, req *pb_v1.SystemPermissionListRequest) (reply *pb_v1.SystemPermissionListReply, err error) {
  26. t1 := func() error {
  27. reply, err = system_permission.SystemPermissionList(ctx, req)
  28. return err
  29. }
  30. return reply, rpctasker.Exec(ctx, t1)
  31. }
  32. func (c *Rcvr) SystemPermissionsNotTree(ctx context.Context, req *pb_v1.SystemPermissionsNotTreeRequest) (reply *pb_v1.SystemPermissionsNotTreeReply, err error) {
  33. t1 := func() error {
  34. reply, err = system_permission.SystemPermissionsNotTree(ctx, req)
  35. return err
  36. }
  37. return reply, rpctasker.Exec(ctx, t1)
  38. }
  39. func (c *Rcvr) SystemPermissionAdd(ctx context.Context, req *pb_v1.SystemPermissionAddRequest) (reply *pb_v1.SystemPermissionAddReply, err error) {
  40. t1 := func() error {
  41. reply, err = system_permission.SystemPermissionAdd(ctx, req)
  42. return err
  43. }
  44. return reply, rpctasker.Exec(ctx, t1)
  45. }
  46. func (c *Rcvr) SystemPermissionDel(ctx context.Context, req *pb_v1.SystemPermissionDelRequest) (reply *pb_v1.SystemPermissionDelReply, err error) {
  47. t1 := func() error {
  48. reply, err = system_permission.SystemPermissionDel(ctx, req)
  49. return err
  50. }
  51. return reply, rpctasker.Exec(ctx, t1)
  52. }
  53. func (c *Rcvr) SystemPermissionEnable(ctx context.Context, req *pb_v1.SystemPermissionEnableRequest) (reply *pb_v1.SystemPermissionEnableReply, err error) {
  54. t1 := func() error {
  55. reply, err = system_permission.SystemPermissionEnable(ctx, req)
  56. return err
  57. }
  58. return reply, rpctasker.Exec(ctx, t1)
  59. }
  60. func (c *Rcvr) SystemPermissionUpdate(ctx context.Context, req *pb_v1.SystemPermissionUpdateRequest) (reply *pb_v1.SystemPermissionUpdateReply, err error) {
  61. t1 := func() error {
  62. reply, err = system_permission.SystemPermissionUpdate(ctx, req)
  63. return err
  64. }
  65. return reply, rpctasker.Exec(ctx, t1)
  66. }
  67. // 省市区
  68. func (c *Rcvr) ProvinceCityArea(ctx context.Context, req *pb_v1.ProvinceCityAreaRequest) (reply *pb_v1.ProvinceCityAreaReply, err error) {
  69. t1 := func() error {
  70. reply, err = area.ProvinceCityArea(ctx, req)
  71. return err
  72. }
  73. return reply, rpctasker.Exec(ctx, t1)
  74. }
  75. func (c *Rcvr) City(ctx context.Context, req *pb_v1.CityRequest) (reply *pb_v1.CityReply, err error) {
  76. t1 := func() error {
  77. reply, err = area.City(ctx, req)
  78. return err
  79. }
  80. return reply, rpctasker.Exec(ctx, t1)
  81. }
  82. // 街道社区
  83. func (c *Rcvr) StreetCommittee(ctx context.Context, req *pb_v1.StreetCommitteeRequest) (reply *pb_v1.StreetCommitteeReply, err error) {
  84. t1 := func() error {
  85. reply, err = area.StreetCommittee(ctx, req)
  86. return err
  87. }
  88. return reply, rpctasker.Exec(ctx, t1)
  89. }
  90. // 对象存储删除无用的数据
  91. func (c *Rcvr) OssObjDelNotExist(ctx context.Context, req *pb_v1.OssObjDelNotExistRequest) (reply *pb_v1.OssObjDelNotExistReply, err error) {
  92. t1 := func() error {
  93. reply, err = oss_obj.OssObjDelNotExist(ctx, req)
  94. return err
  95. }
  96. return reply, rpctasker.Exec(ctx, t1)
  97. }
  98. // 对象存储添加到公共区
  99. func (c *Rcvr) OssObjAdd(ctx context.Context, req *pb_v1.OssObjAddRequest) (reply *pb_v1.OssObjAddReply, err error) {
  100. t1 := func() error {
  101. reply, err = oss_obj.OssObjAdd(ctx, req)
  102. return err
  103. }
  104. return reply, rpctasker.Exec(ctx, t1)
  105. }
  106. // 应用
  107. func (c *Rcvr) ApplicationAdd(ctx context.Context, req *pb_v1.ApplicationAddRequest) (reply *pb_v1.ApplicationAddReply, err error) {
  108. t1 := func() error {
  109. reply, err = application.ApplicationAdd(ctx, req)
  110. return err
  111. }
  112. return reply, rpctasker.Exec(ctx, t1)
  113. }
  114. func (c *Rcvr) ApplicationDel(ctx context.Context, req *pb_v1.ApplicationDelRequest) (reply *pb_v1.ApplicationDelReply, err error) {
  115. t1 := func() error {
  116. reply, err = application.ApplicationDel(ctx, req)
  117. return err
  118. }
  119. return reply, rpctasker.Exec(ctx, t1)
  120. }
  121. func (c *Rcvr) ApplicationUpdate(ctx context.Context, req *pb_v1.ApplicationUpdateRequest) (reply *pb_v1.ApplicationUpdateReply, err error) {
  122. t1 := func() error {
  123. reply, err = application.ApplicationUpdate(ctx, req)
  124. return err
  125. }
  126. return reply, rpctasker.Exec(ctx, t1)
  127. }
  128. func (c *Rcvr) ApplicationList(ctx context.Context, req *pb_v1.ApplicationListRequest) (reply *pb_v1.ApplicationListReply, err error) {
  129. t1 := func() error {
  130. reply, err = application.ApplicationList(ctx, req)
  131. return err
  132. }
  133. return reply, rpctasker.Exec(ctx, t1)
  134. }
  135. func (c *Rcvr) ApplicationEnableSet(ctx context.Context, req *pb_v1.ApplicationEnableSetRequest) (reply *pb_v1.ApplicationEnableSetReply, err error) {
  136. t1 := func() error {
  137. reply, err = application.ApplicationEnableSet(ctx, req)
  138. return err
  139. }
  140. return reply, rpctasker.Exec(ctx, t1)
  141. }
  142. func (c *Rcvr) ApplicationPermissionsSet(ctx context.Context, req *pb_v1.ApplicationPermissionsSetRequest) (reply *pb_v1.ApplicationPermissionsSetReply, err error) {
  143. t1 := func() error {
  144. reply, err = application.ApplicationPermissionsSet(ctx, req)
  145. return err
  146. }
  147. return reply, rpctasker.Exec(ctx, t1)
  148. }
  149. func (c *Rcvr) ApplicationPermissions(ctx context.Context, req *pb_v1.ApplicationPermissionsRequest) (reply *pb_v1.ApplicationPermissionsReply, err error) {
  150. t1 := func() error {
  151. reply, err = application.ApplicationPermissions(ctx, req)
  152. return err
  153. }
  154. return reply, rpctasker.Exec(ctx, t1)
  155. }
  156. func (c *Rcvr) ApplicationInfo(ctx context.Context, req *pb_v1.ApplicationInfoRequest) (reply *pb_v1.ApplicationInfoReply, err error) {
  157. t1 := func() error {
  158. reply, err = application.ApplicationInfo(ctx, req)
  159. return err
  160. }
  161. return reply, rpctasker.Exec(ctx, t1)
  162. }
  163. // 套餐
  164. func (c *Rcvr) PackageAdd(ctx context.Context, req *pb_v1.PackageAddRequest) (reply *pb_v1.PackageAddReply, err error) {
  165. t1 := func() error {
  166. reply, err = cpackage.PackageAdd(ctx, req)
  167. return err
  168. }
  169. return reply, rpctasker.Exec(ctx, t1)
  170. }
  171. func (c *Rcvr) PackageDel(ctx context.Context, req *pb_v1.PackageDelRequest) (reply *pb_v1.PackageDelReply, err error) {
  172. t1 := func() error {
  173. reply, err = cpackage.PackageDel(ctx, req)
  174. return err
  175. }
  176. return reply, rpctasker.Exec(ctx, t1)
  177. }
  178. func (c *Rcvr) PackageUpdate(ctx context.Context, req *pb_v1.PackageUpdateRequest) (reply *pb_v1.PackageUpdateReply, err error) {
  179. t1 := func() error {
  180. reply, err = cpackage.PackageUpdate(ctx, req)
  181. return err
  182. }
  183. return reply, rpctasker.Exec(ctx, t1)
  184. }
  185. func (c *Rcvr) PackageList(ctx context.Context, req *pb_v1.PackageListRequest) (reply *pb_v1.PackageListReply, err error) {
  186. t1 := func() error {
  187. reply, err = cpackage.PackageList(ctx, req)
  188. return err
  189. }
  190. return reply, rpctasker.Exec(ctx, t1)
  191. }
  192. func (c *Rcvr) PackageEnableSet(ctx context.Context, req *pb_v1.PackageEnableSetRequest) (reply *pb_v1.PackageEnableSetReply, err error) {
  193. t1 := func() error {
  194. reply, err = cpackage.PackageEnableSet(ctx, req)
  195. return err
  196. }
  197. return reply, rpctasker.Exec(ctx, t1)
  198. }
  199. func (c *Rcvr) PackageApplicationSet(ctx context.Context, req *pb_v1.PackageApplicationSetRequest) (reply *pb_v1.PackageApplicationSetReply, err error) {
  200. t1 := func() error {
  201. reply, err = cpackage.PackageApplicationSet(ctx, req)
  202. return err
  203. }
  204. return reply, rpctasker.Exec(ctx, t1)
  205. }
  206. func (c *Rcvr) PackageInfo(ctx context.Context, req *pb_v1.PackageInfoRequest) (reply *pb_v1.PackageInfoReply, err error) {
  207. t1 := func() error {
  208. reply, err = cpackage.PackageInfo(ctx, req)
  209. return err
  210. }
  211. return reply, rpctasker.Exec(ctx, t1)
  212. }
  213. // 短信套餐
  214. func (c *Rcvr) MsgPackageAdd(ctx context.Context, req *pb_v1.MsgPackageAddRequest) (reply *pb_v1.MsgPackageAddReply, err error) {
  215. t1 := func() error {
  216. reply, err = msg_package.MsgPackageAdd(ctx, req)
  217. return err
  218. }
  219. return reply, rpctasker.Exec(ctx, t1)
  220. }
  221. func (c *Rcvr) MsgPackageDel(ctx context.Context, req *pb_v1.MsgPackageDelRequest) (reply *pb_v1.MsgPackageDelReply, err error) {
  222. t1 := func() error {
  223. reply, err = msg_package.MsgPackageDel(ctx, req)
  224. return err
  225. }
  226. return reply, rpctasker.Exec(ctx, t1)
  227. }
  228. func (c *Rcvr) MsgPackageUpdate(ctx context.Context, req *pb_v1.MsgPackageUpdateRequest) (reply *pb_v1.MsgPackageUpdateReply, err error) {
  229. t1 := func() error {
  230. reply, err = msg_package.MsgPackageUpdate(ctx, req)
  231. return err
  232. }
  233. return reply, rpctasker.Exec(ctx, t1)
  234. }
  235. func (c *Rcvr) MsgPackageList(ctx context.Context, req *pb_v1.MsgPackageListRequest) (reply *pb_v1.MsgPackageListReply, err error) {
  236. t1 := func() error {
  237. reply, err = msg_package.MsgPackageList(ctx, req)
  238. return err
  239. }
  240. return reply, rpctasker.Exec(ctx, t1)
  241. }
  242. func (c *Rcvr) MsgPackageInfo(ctx context.Context, req *pb_v1.MsgPackageInfoRequest) (reply *pb_v1.MsgPackageInfoReply, err error) {
  243. t1 := func() error {
  244. reply, err = msg_package.MsgPackageInfo(ctx, req)
  245. return err
  246. }
  247. return reply, rpctasker.Exec(ctx, t1)
  248. }
  249. func (c *Rcvr) MaterialList(ctx context.Context, req *pb_v1.MaterialListRequest) (reply *pb_v1.MaterialListReply, err error) {
  250. t1 := func() error {
  251. reply, err = material.MaterialList(ctx, req)
  252. return err
  253. }
  254. return reply, rpctasker.Exec(ctx, t1)
  255. }
  256. func (c *Rcvr) MaterialAdd(ctx context.Context, req *pb_v1.MaterialAddRequest) (reply *pb_v1.MaterialAddReply, err error) {
  257. t1 := func() error {
  258. reply, err = material.MaterialAdd(ctx, req)
  259. return err
  260. }
  261. return reply, rpctasker.Exec(ctx, t1)
  262. }
  263. func (c *Rcvr) MaterialDel(ctx context.Context, req *pb_v1.MaterialDelRequest) (reply *pb_v1.MaterialDelReply, err error) {
  264. t1 := func() error {
  265. reply, err = material.MaterialDel(ctx, req)
  266. return err
  267. }
  268. return reply, rpctasker.Exec(ctx, t1)
  269. }
  270. func (c *Rcvr) MaterialEnable(ctx context.Context, req *pb_v1.MaterialEnableRequest) (reply *pb_v1.MaterialEnableReply, err error) {
  271. t1 := func() error {
  272. reply, err = material.MaterialEnable(ctx, req)
  273. return err
  274. }
  275. return reply, rpctasker.Exec(ctx, t1)
  276. }
  277. func (c *Rcvr) MaterialUpdate(ctx context.Context, req *pb_v1.MaterialUpdateRequest) (reply *pb_v1.MaterialUpdateReply, err error) {
  278. t1 := func() error {
  279. reply, err = material.MaterialUpdate(ctx, req)
  280. return err
  281. }
  282. return reply, rpctasker.Exec(ctx, t1)
  283. }
  284. func (c *Rcvr) MaterialInfo(ctx context.Context, req *pb_v1.MaterialInfoRequest) (reply *pb_v1.MaterialInfoReply, err error) {
  285. t1 := func() error {
  286. reply, err = material.MaterialInfo(ctx, req)
  287. return err
  288. }
  289. return reply, rpctasker.Exec(ctx, t1)
  290. }