init_api_data.go 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. package base
  2. import (
  3. "github.com/suyuan32/simple-admin-common/utils/pointy"
  4. "github.com/suyuan32/simple-admin-core/rpc/types/core"
  5. )
  6. func (l *InitDatabaseLogic) insertApiData() (err error) {
  7. // LabelRelationship
  8. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  9. ServiceName: pointy.GetPointer("Wechat"),
  10. Path: pointy.GetPointer("/label_relationship/create"),
  11. Description: pointy.GetPointer("apiDesc.createLabelRelationship"),
  12. ApiGroup: pointy.GetPointer("label_relationship"),
  13. Method: pointy.GetPointer("POST"),
  14. })
  15. if err != nil {
  16. return err
  17. }
  18. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  19. ServiceName: pointy.GetPointer("Wechat"),
  20. Path: pointy.GetPointer("/label_relationship/update"),
  21. Description: pointy.GetPointer("apiDesc.updateLabelRelationship"),
  22. ApiGroup: pointy.GetPointer("label_relationship"),
  23. Method: pointy.GetPointer("POST"),
  24. })
  25. if err != nil {
  26. return err
  27. }
  28. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  29. ServiceName: pointy.GetPointer("Wechat"),
  30. Path: pointy.GetPointer("/label_relationship/delete"),
  31. Description: pointy.GetPointer("apiDesc.deleteLabelRelationship"),
  32. ApiGroup: pointy.GetPointer("label_relationship"),
  33. Method: pointy.GetPointer("POST"),
  34. })
  35. if err != nil {
  36. return err
  37. }
  38. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  39. ServiceName: pointy.GetPointer("Wechat"),
  40. Path: pointy.GetPointer("/label_relationship/list"),
  41. Description: pointy.GetPointer("apiDesc.getLabelRelationshipList"),
  42. ApiGroup: pointy.GetPointer("label_relationship"),
  43. Method: pointy.GetPointer("POST"),
  44. })
  45. if err != nil {
  46. return err
  47. }
  48. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  49. ServiceName: pointy.GetPointer("Wechat"),
  50. Path: pointy.GetPointer("/label_relationship"),
  51. Description: pointy.GetPointer("apiDesc.getLabelRelationshipById"),
  52. ApiGroup: pointy.GetPointer("label_relationship"),
  53. Method: pointy.GetPointer("POST"),
  54. })
  55. if err != nil {
  56. return err
  57. }
  58. // Label
  59. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  60. ServiceName: pointy.GetPointer("Wechat"),
  61. Path: pointy.GetPointer("/label/create"),
  62. Description: pointy.GetPointer("apiDesc.createLabel"),
  63. ApiGroup: pointy.GetPointer("label"),
  64. Method: pointy.GetPointer("POST"),
  65. })
  66. if err != nil {
  67. return err
  68. }
  69. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  70. ServiceName: pointy.GetPointer("Wechat"),
  71. Path: pointy.GetPointer("/label/update"),
  72. Description: pointy.GetPointer("apiDesc.updateLabel"),
  73. ApiGroup: pointy.GetPointer("label"),
  74. Method: pointy.GetPointer("POST"),
  75. })
  76. if err != nil {
  77. return err
  78. }
  79. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  80. ServiceName: pointy.GetPointer("Wechat"),
  81. Path: pointy.GetPointer("/label/delete"),
  82. Description: pointy.GetPointer("apiDesc.deleteLabel"),
  83. ApiGroup: pointy.GetPointer("label"),
  84. Method: pointy.GetPointer("POST"),
  85. })
  86. if err != nil {
  87. return err
  88. }
  89. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  90. ServiceName: pointy.GetPointer("Wechat"),
  91. Path: pointy.GetPointer("/label/list"),
  92. Description: pointy.GetPointer("apiDesc.getLabelList"),
  93. ApiGroup: pointy.GetPointer("label"),
  94. Method: pointy.GetPointer("POST"),
  95. })
  96. if err != nil {
  97. return err
  98. }
  99. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  100. ServiceName: pointy.GetPointer("Wechat"),
  101. Path: pointy.GetPointer("/label"),
  102. Description: pointy.GetPointer("apiDesc.getLabelById"),
  103. ApiGroup: pointy.GetPointer("label"),
  104. Method: pointy.GetPointer("POST"),
  105. })
  106. if err != nil {
  107. return err
  108. }
  109. // Contact
  110. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  111. ServiceName: pointy.GetPointer("Wechat"),
  112. Path: pointy.GetPointer("/contact/create"),
  113. Description: pointy.GetPointer("apiDesc.createContact"),
  114. ApiGroup: pointy.GetPointer("contact"),
  115. Method: pointy.GetPointer("POST"),
  116. })
  117. if err != nil {
  118. return err
  119. }
  120. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  121. ServiceName: pointy.GetPointer("Wechat"),
  122. Path: pointy.GetPointer("/contact/update"),
  123. Description: pointy.GetPointer("apiDesc.updateContact"),
  124. ApiGroup: pointy.GetPointer("contact"),
  125. Method: pointy.GetPointer("POST"),
  126. })
  127. if err != nil {
  128. return err
  129. }
  130. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  131. ServiceName: pointy.GetPointer("Wechat"),
  132. Path: pointy.GetPointer("/contact/delete"),
  133. Description: pointy.GetPointer("apiDesc.deleteContact"),
  134. ApiGroup: pointy.GetPointer("contact"),
  135. Method: pointy.GetPointer("POST"),
  136. })
  137. if err != nil {
  138. return err
  139. }
  140. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  141. ServiceName: pointy.GetPointer("Wechat"),
  142. Path: pointy.GetPointer("/contact/list"),
  143. Description: pointy.GetPointer("apiDesc.getContactList"),
  144. ApiGroup: pointy.GetPointer("contact"),
  145. Method: pointy.GetPointer("POST"),
  146. })
  147. if err != nil {
  148. return err
  149. }
  150. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  151. ServiceName: pointy.GetPointer("Wechat"),
  152. Path: pointy.GetPointer("/contact"),
  153. Description: pointy.GetPointer("apiDesc.getContactById"),
  154. ApiGroup: pointy.GetPointer("contact"),
  155. Method: pointy.GetPointer("POST"),
  156. })
  157. if err != nil {
  158. return err
  159. }
  160. // Wx
  161. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  162. ServiceName: pointy.GetPointer("Wechat"),
  163. Path: pointy.GetPointer("/wx/create"),
  164. Description: pointy.GetPointer("apiDesc.createWx"),
  165. ApiGroup: pointy.GetPointer("wx"),
  166. Method: pointy.GetPointer("POST"),
  167. })
  168. if err != nil {
  169. return err
  170. }
  171. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  172. ServiceName: pointy.GetPointer("Wechat"),
  173. Path: pointy.GetPointer("/wx/update"),
  174. Description: pointy.GetPointer("apiDesc.updateWx"),
  175. ApiGroup: pointy.GetPointer("wx"),
  176. Method: pointy.GetPointer("POST"),
  177. })
  178. if err != nil {
  179. return err
  180. }
  181. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  182. ServiceName: pointy.GetPointer("Wechat"),
  183. Path: pointy.GetPointer("/wx/delete"),
  184. Description: pointy.GetPointer("apiDesc.deleteWx"),
  185. ApiGroup: pointy.GetPointer("wx"),
  186. Method: pointy.GetPointer("POST"),
  187. })
  188. if err != nil {
  189. return err
  190. }
  191. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  192. ServiceName: pointy.GetPointer("Wechat"),
  193. Path: pointy.GetPointer("/wx/list"),
  194. Description: pointy.GetPointer("apiDesc.getWxList"),
  195. ApiGroup: pointy.GetPointer("wx"),
  196. Method: pointy.GetPointer("POST"),
  197. })
  198. if err != nil {
  199. return err
  200. }
  201. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  202. ServiceName: pointy.GetPointer("Wechat"),
  203. Path: pointy.GetPointer("/wx"),
  204. Description: pointy.GetPointer("apiDesc.getWxById"),
  205. ApiGroup: pointy.GetPointer("wx"),
  206. Method: pointy.GetPointer("POST"),
  207. })
  208. if err != nil {
  209. return err
  210. }
  211. // Server
  212. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  213. ServiceName: pointy.GetPointer("Wechat"),
  214. Path: pointy.GetPointer("/server/create"),
  215. Description: pointy.GetPointer("apiDesc.createServer"),
  216. ApiGroup: pointy.GetPointer("server"),
  217. Method: pointy.GetPointer("POST"),
  218. })
  219. if err != nil {
  220. return err
  221. }
  222. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  223. ServiceName: pointy.GetPointer("Wechat"),
  224. Path: pointy.GetPointer("/server/update"),
  225. Description: pointy.GetPointer("apiDesc.updateServer"),
  226. ApiGroup: pointy.GetPointer("server"),
  227. Method: pointy.GetPointer("POST"),
  228. })
  229. if err != nil {
  230. return err
  231. }
  232. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  233. ServiceName: pointy.GetPointer("Wechat"),
  234. Path: pointy.GetPointer("/server/delete"),
  235. Description: pointy.GetPointer("apiDesc.deleteServer"),
  236. ApiGroup: pointy.GetPointer("server"),
  237. Method: pointy.GetPointer("POST"),
  238. })
  239. if err != nil {
  240. return err
  241. }
  242. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  243. ServiceName: pointy.GetPointer("Wechat"),
  244. Path: pointy.GetPointer("/server/list"),
  245. Description: pointy.GetPointer("apiDesc.getServerList"),
  246. ApiGroup: pointy.GetPointer("server"),
  247. Method: pointy.GetPointer("POST"),
  248. })
  249. if err != nil {
  250. return err
  251. }
  252. _, err = l.svcCtx.CoreRpc.CreateApi(l.ctx, &core.ApiInfo{
  253. ServiceName: pointy.GetPointer("Wechat"),
  254. Path: pointy.GetPointer("/server"),
  255. Description: pointy.GetPointer("apiDesc.getServerById"),
  256. ApiGroup: pointy.GetPointer("server"),
  257. Method: pointy.GetPointer("POST"),
  258. })
  259. if err != nil {
  260. return err
  261. }
  262. return err
  263. }