api.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. package sys
  2. import (
  3. "dy-admin/internal/pcmserver/common"
  4. "dy-admin/internal/pcmserver/global"
  5. "dy-admin/internal/pcmserver/sys/model"
  6. "gorm.io/gorm/clause"
  7. "time"
  8. )
  9. var APIInitEntities = []model.Api{
  10. // base
  11. 1: {Model: common.Model{ID: 1}, Path: "/base/login", Action: "POST", Type: "SYS", Description: "登录", ApiGroup: "base", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  12. // api
  13. 10: {Model: common.Model{ID: 10}, Path: "/sys/v1/api", Action: "POST", Type: "SYS", Description: "创建API", ApiGroup: "api", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  14. 11: {Model: common.Model{ID: 11}, Path: "/sys/v1/api", Action: "DELETE", Type: "SYS", Description: "删除API", ApiGroup: "api", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  15. 12: {Model: common.Model{ID: 12}, Path: "/sys/v1/api/list", Action: "GET", Type: "SYS", Description: "分页获取API", ApiGroup: "api", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  16. 13: {Model: common.Model{ID: 13}, Path: "/sys/v1/api/one", Action: "GET", Type: "SYS", Description: "获取单条API", ApiGroup: "api", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  17. 14: {Model: common.Model{ID: 14}, Path: "/sys/v1/api", Action: "PUT", Type: "SYS", Description: "修改API", ApiGroup: "api", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  18. 15: {Model: common.Model{ID: 15}, Path: "/sys/v1/api/ids", Action: "DELETE", Type: "SYS", Description: "批量删除API", ApiGroup: "api", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  19. // dept
  20. 20: {Model: common.Model{ID: 20}, Path: "/sys/v1/dept", Action: "POST", Type: "SYS", Description: "创建部门", ApiGroup: "部门", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  21. 21: {Model: common.Model{ID: 21}, Path: "/sys/v1/dept", Action: "PUT", Type: "SYS", Description: "更新部门", ApiGroup: "部门", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  22. 22: {Model: common.Model{ID: 22}, Path: "/sys/v1/dept", Action: "DELETE", Type: "SYS", Description: "删除部门", ApiGroup: "部门", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  23. 23: {Model: common.Model{ID: 23}, Path: "/sys/v1/dept/tree", Action: "GET", Type: "SYS", Description: "获取部门树", ApiGroup: "部门", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  24. 24: {Model: common.Model{ID: 24}, Path: "/sys/v1/dept/one", Action: "GET", Type: "SYS", Description: "获取单个部门", ApiGroup: "部门", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  25. // 菜单
  26. 30: {Model: common.Model{ID: 30}, Path: "/sys/v1/menu", Action: "POST", Type: "SYS", Description: "创建菜单", ApiGroup: "菜单", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  27. 31: {Model: common.Model{ID: 31}, Path: "/sys/v1/menu", Action: "PUT", Type: "SYS", Description: "修改菜单", ApiGroup: "菜单", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  28. 32: {Model: common.Model{ID: 32}, Path: "/sys/v1/menu", Action: "DELETE", Type: "SYS", Description: "删除菜单", ApiGroup: "菜单", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  29. 33: {Model: common.Model{ID: 33}, Path: "/sys/v1/menu/one", Action: "GET", Type: "SYS", Description: "获取菜单", ApiGroup: "菜单", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  30. 34: {Model: common.Model{ID: 34}, Path: "/sys/v1/menu/tree", Action: "GET", Type: "SYS", Description: "获取菜单树", ApiGroup: "菜单", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  31. // 角色
  32. 40: {Model: common.Model{ID: 40}, Path: "/sys/v1/role", Action: "POST", Type: "SYS", Description: "创建角色", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  33. 41: {Model: common.Model{ID: 41}, Path: "/sys/v1/role", Action: "PUT", Type: "SYS", Description: "更新角色", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  34. 42: {Model: common.Model{ID: 42}, Path: "/sys/v1/role", Action: "DELETE", Type: "SYS", Description: "删除角色", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  35. 43: {Model: common.Model{ID: 43}, Path: "/sys/v1/role/list", Action: "GET", Type: "SYS", Description: "分页获取角色", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  36. 44: {Model: common.Model{ID: 44}, Path: "/sys/v1/role/one", Action: "GET", Type: "SYS", Description: "获取单条角色", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  37. 45: {Model: common.Model{ID: 45}, Path: "/sys/v1/role/deptIds", Action: "GET", Type: "SYS", Description: "获取角色部门ids", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  38. 46: {Model: common.Model{ID: 46}, Path: "/sys/v1/role/menuIds", Action: "GET", Type: "SYS", Description: "获取角色菜单ids", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  39. 47: {Model: common.Model{ID: 47}, Path: "/sys/v1/role/dataScope", Action: "PUT", Type: "SYS", Description: "修改角色数据权限", ApiGroup: "角色", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  40. // 用户
  41. 50: {Model: common.Model{ID: 50}, Path: "/sys/v1/user/register", Action: "POST", Type: "SYS", Description: "注册系统用户", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  42. 51: {Model: common.Model{ID: 51}, Path: "/sys/v1/user/resetPassword", Action: "PUT", Type: "SYS", Description: "重置密码", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  43. 52: {Model: common.Model{ID: 52}, Path: "/sys/v1/user/changePassword", Action: "PUT", Type: "SYS", Description: "更改密码", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  44. 53: {Model: common.Model{ID: 53}, Path: "/sys/v1/user/list", Action: "GET", Type: "SYS", Description: "获取用户列表", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  45. 54: {Model: common.Model{ID: 54}, Path: "/sys/v1/user", Action: "DELETE", Type: "SYS", Description: "删除用户", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  46. 55: {Model: common.Model{ID: 55}, Path: "/sys/v1/user/setUserInfo", Action: "PUT", Type: "SYS", Description: "修改用户信息", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  47. 56: {Model: common.Model{ID: 56}, Path: "/sys/v1/user/getUserInfo", Action: "GET", Type: "SYS", Description: "获取用户详情", ApiGroup: "用户", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  48. // 操作记录
  49. 60: {Model: common.Model{ID: 60}, Path: "/sys/v1/operation", Action: "DELETE", Type: "SYS", Description: "删除操作记录", ApiGroup: "操作记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  50. 61: {Model: common.Model{ID: 61}, Path: "/sys/v1/operation", Action: "GET", Type: "SYS", Description: "获取单条操作记录", ApiGroup: "操作记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  51. 62: {Model: common.Model{ID: 62}, Path: "/sys/v1/operation/list", Action: "GET", Type: "SYS", Description: "分页获取操作记录", ApiGroup: "操作记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  52. 63: {Model: common.Model{ID: 63}, Path: "/sys/v1/operation/ids", Action: "DELETE", Type: "SYS", Description: "批量删除操作记录", ApiGroup: "操作记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  53. // 登录记录
  54. 70: {Model: common.Model{ID: 70}, Path: "/sys/v1/loginRecord/ids", Action: "DELETE", Type: "SYS", Description: "批量删除登录记录", ApiGroup: "登录记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  55. 71: {Model: common.Model{ID: 71}, Path: "/sys/v1/loginRecord", Action: "GET", Type: "SYS", Description: "获取单条登录记录", ApiGroup: "登录记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  56. 72: {Model: common.Model{ID: 72}, Path: "/sys/v1/loginRecord/list", Action: "GET", Type: "SYS", Description: "分页获取登录记录", ApiGroup: "登录记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  57. // 业务api
  58. // 柜子
  59. 1000: {Model: common.Model{ID: 1000}, Path: "/bus/v1/cabinet", Action: "POST", Type: "BUS", Description: "创建手机柜", ApiGroup: "手机柜", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  60. 1001: {Model: common.Model{ID: 1001}, Path: "/bus/v1/cabinet", Action: "PUT", Type: "BUS", Description: "修改手机柜", ApiGroup: "手机柜", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  61. 1002: {Model: common.Model{ID: 1002}, Path: "/bus/v1/cabinet", Action: "GET", Type: "BUS", Description: "获取手机柜", ApiGroup: "手机柜", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  62. 1003: {Model: common.Model{ID: 1003}, Path: "/bus/v1/cabinet", Action: "DELETE", Type: "BUS", Description: "删除手机柜", ApiGroup: "手机柜", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  63. 1004: {Model: common.Model{ID: 1004}, Path: "/bus/v1/cabinet/list", Action: "GET", Type: "BUS", Description: "分页获取手机柜", ApiGroup: "手机柜", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  64. 1005: {Model: common.Model{ID: 1005}, Path: "/bus/v1/cabinet/status", Action: "PUT", Type: "BUS", Description: "更新手机柜是否允许开", ApiGroup: "手机柜", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  65. // 柜子时间
  66. 1010: {Model: common.Model{ID: 1010}, Path: "/bus/v1/cabinetTime", Action: "POST", Type: "BUS", Description: "创建时间规则", ApiGroup: "柜子时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  67. 1011: {Model: common.Model{ID: 1011}, Path: "/bus/v1/cabinetTime", Action: "PUT", Type: "BUS", Description: "修改时间规则", ApiGroup: "柜子时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  68. 1012: {Model: common.Model{ID: 1012}, Path: "/bus/v1/cabinetTime", Action: "GET", Type: "BUS", Description: "获取时间规则", ApiGroup: "柜子时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  69. 1013: {Model: common.Model{ID: 1013}, Path: "/bus/v1/cabinetTime", Action: "DELETE", Type: "BUS", Description: "删除时间规则", ApiGroup: "柜子时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  70. // 格子
  71. 1020: {Model: common.Model{ID: 1020}, Path: "/bus/v1/grid/open", Action: "POST", Type: "BUS", Description: "开启格子", ApiGroup: "格子", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  72. 1021: {Model: common.Model{ID: 1021}, Path: "/bus/v1/grid/list", Action: "GET", Type: "BUS", Description: "格子列表", ApiGroup: "格子", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  73. // 请假
  74. 1030: {Model: common.Model{ID: 1030}, Path: "/bus/v1/leave", Action: "POST", Type: "BUS", Description: "创建请假", ApiGroup: "请假", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  75. 1031: {Model: common.Model{ID: 1031}, Path: "/bus/v1/leave", Action: "PUT", Type: "BUS", Description: "更新请假", ApiGroup: "请假", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  76. 1032: {Model: common.Model{ID: 1032}, Path: "/bus/v1/leave", Action: "GET", Type: "BUS", Description: "获取请假", ApiGroup: "请假", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  77. 1033: {Model: common.Model{ID: 1033}, Path: "/bus/v1/leave", Action: "DELETE", Type: "BUS", Description: "删除请假", ApiGroup: "请假", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  78. 1034: {Model: common.Model{ID: 1034}, Path: "/bus/v1/leave/list", Action: "GET", Type: "BUS", Description: "分页获取请假", ApiGroup: "请假", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  79. // 人员
  80. 1040: {Model: common.Model{ID: 1040}, Path: "/bus/v1/staff", Action: "POST", Type: "BUS", Description: "创建人员", ApiGroup: "人员", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  81. 1041: {Model: common.Model{ID: 1041}, Path: "/bus/v1/staff", Action: "PUT", Type: "BUS", Description: "更新人员", ApiGroup: "人员", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  82. 1042: {Model: common.Model{ID: 1042}, Path: "/bus/v1/staff", Action: "GET", Type: "BUS", Description: "获取人员", ApiGroup: "人员", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  83. 1043: {Model: common.Model{ID: 1043}, Path: "/bus/v1/staff", Action: "DELETE", Type: "BUS", Description: "删除人员", ApiGroup: "人员", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  84. 1044: {Model: common.Model{ID: 1044}, Path: "/bus/v1/staff/list", Action: "GET", Type: "BUS", Description: "分页获取人员", ApiGroup: "人员", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  85. // 工作时间
  86. 1050: {Model: common.Model{ID: 1050}, Path: "/bus/v1/workTime", Action: "POST", Type: "BUS", Description: "创建工作时间", ApiGroup: "工作时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  87. 1051: {Model: common.Model{ID: 1051}, Path: "/bus/v1/workTime", Action: "PUT", Type: "BUS", Description: "更新工作时间", ApiGroup: "工作时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  88. 1052: {Model: common.Model{ID: 1052}, Path: "/bus/v1/workTime/status", Action: "PUT", Type: "BUS", Description: "切换状态", ApiGroup: "工作时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  89. 1053: {Model: common.Model{ID: 1053}, Path: "/bus/v1/workTime", Action: "DELETE", Type: "BUS", Description: "删除工作时间", ApiGroup: "工作时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  90. 1054: {Model: common.Model{ID: 1054}, Path: "/bus/v1/workTime", Action: "GET", Type: "BUS", Description: "分页获取工作时间", ApiGroup: "工作时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  91. // 例外时间
  92. 1060: {Model: common.Model{ID: 1060}, Path: "/bus/v1/specTime", Action: "POST", Type: "BUS", Description: "创建例外时间", ApiGroup: "例外时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  93. 1061: {Model: common.Model{ID: 1061}, Path: "/bus/v1/specTime", Action: "PUT", Type: "BUS", Description: "更新例外时间", ApiGroup: "例外时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  94. 1062: {Model: common.Model{ID: 1062}, Path: "/bus/v1/specTime/status", Action: "PUT", Type: "BUS", Description: "切换状态", ApiGroup: "例外时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  95. 1063: {Model: common.Model{ID: 1063}, Path: "/bus/v1/specTime", Action: "DELETE", Type: "BUS", Description: "删除例外时间", ApiGroup: "例外时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  96. 1064: {Model: common.Model{ID: 1064}, Path: "/bus/v1/specTime", Action: "GET", Type: "BUS", Description: "分页获取例外时间", ApiGroup: "例外时间", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  97. // 开关门记录
  98. 1070: {Model: common.Model{ID: 1070}, Path: "/bus/v1/open", Action: "POST", Type: "BUS", Description: "创建开关门记录(测试使用)", ApiGroup: "开关门记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  99. 1071: {Model: common.Model{ID: 1071}, Path: "/bus/v1/open", Action: "DELETE", Type: "BUS", Description: "删除记录", ApiGroup: "开关门记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  100. 1072: {Model: common.Model{ID: 1072}, Path: "/bus/v1/open/list", Action: "GET", Type: "BUS", Description: "分页获取记录", ApiGroup: "开关门记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  101. 1073: {Model: common.Model{ID: 1073}, Path: "/bus/v1/open/statistics", Action: "GET", Type: "BUS", Description: "开关门统计", ApiGroup: "开关门记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  102. // 存物日志
  103. 1080: {Model: common.Model{ID: 1080}, Path: "/bus/v1/store", Action: "POST", Type: "BUS", Description: "创建存取记录(测试使用)", ApiGroup: "存取记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  104. 1081: {Model: common.Model{ID: 1081}, Path: "/bus/v1/store", Action: "DELETE", Type: "BUS", Description: "删除记录", ApiGroup: "存取记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  105. 1082: {Model: common.Model{ID: 1082}, Path: "/bus/v1/store/list", Action: "GET", Type: "BUS", Description: "分页获取记录", ApiGroup: "存取记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  106. 1083: {Model: common.Model{ID: 1083}, Path: "/bus/v1/store/statistics", Action: "GET", Type: "BUS", Description: "存物统计", ApiGroup: "存取记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  107. // 警告日志
  108. 1090: {Model: common.Model{ID: 1090}, Path: "/bus/v1/warn", Action: "POST", Type: "BUS", Description: "创建警告记录(测试使用)", ApiGroup: "警告记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  109. 1091: {Model: common.Model{ID: 1091}, Path: "/bus/v1/warn", Action: "DELETE", Type: "BUS", Description: "删除记录", ApiGroup: "警告记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  110. 1092: {Model: common.Model{ID: 1092}, Path: "/bus/v1/warn/list", Action: "GET", Type: "BUS", Description: "分页获取记录", ApiGroup: "警告记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  111. 1093: {Model: common.Model{ID: 1093}, Path: "/bus/v1/warn/statistics", Action: "GET", Type: "BUS", Description: "告警统计", ApiGroup: "警告记录", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  112. //内存接口
  113. 1100: {Model: common.Model{ID: 1100}, Path: "/bus/v1/mem/cabinets", Action: "GET", Type: "BUS", Description: "内存柜子信息", ApiGroup: "内存信息", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  114. 1101: {Model: common.Model{ID: 1101}, Path: "/bus/v1/mem/jobs", Action: "GET", Type: "BUS", Description: "内存定时任务", ApiGroup: "内存信息", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  115. 1102: {Model: common.Model{ID: 1102}, Path: "/bus/v1/mem/config", Action: "GET", Type: "BUS", Description: "内存配置信息", ApiGroup: "内存信息", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  116. //ws接口
  117. 1200: {Model: common.Model{ID: 1200}, Path: "/bus/v1/homePage", Action: "GET", Type: "BUS", Description: "首页ws连接", ApiGroup: "WS", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  118. // 设备接口
  119. 1300: {Model: common.Model{ID: 1300}, Path: "/bus/v1/device", Action: "POST", Type: "BUS", Description: "创建设备日志(测试使用)", ApiGroup: "设备日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  120. 1301: {Model: common.Model{ID: 1301}, Path: "/bus/v1/device", Action: "DELETE", Type: "BUS", Description: "删除设备日志", ApiGroup: "设备日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  121. 1302: {Model: common.Model{ID: 1302}, Path: "/bus/v1/device/list", Action: "GET", Type: "BUS", Description: "设备日志列表", ApiGroup: "设备日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  122. 1401: {Model: common.Model{ID: 1401}, Path: "/bus/v1/cron", Action: "DELETE", Type: "BUS", Description: "删除定时任务日志", ApiGroup: "定时任务日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  123. 1402: {Model: common.Model{ID: 1402}, Path: "/bus/v1/cron/list", Action: "GET", Type: "BUS", Description: "定时任务日志列表", ApiGroup: "定时任务日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  124. 1501: {Model: common.Model{ID: 1501}, Path: "/bus/v1/connect", Action: "DELETE", Type: "BUS", Description: "删除连接日志", ApiGroup: "连接日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  125. 1502: {Model: common.Model{ID: 1502}, Path: "/bus/v1/connect/list", Action: "GET", Type: "BUS", Description: "连接日志列表", ApiGroup: "连接日志", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  126. 1601: {Model: common.Model{ID: 1601}, Path: "/bus/v1/config", Action: "PUT", Type: "BUS", Description: "更新配置", ApiGroup: "配置", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  127. 1602: {Model: common.Model{ID: 1602}, Path: "/bus/v1/config", Action: "GET", Type: "BUS", Description: "获取配置", ApiGroup: "配置", ModelTime: common.ModelTime{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
  128. }
  129. func initApiData() error {
  130. entities := make([]model.Api, 0)
  131. for _, entity := range APIInitEntities {
  132. if entity.ID != 0 {
  133. entities = append(entities, entity)
  134. }
  135. }
  136. if err := global.DB.Clauses(clause.OnConflict{UpdateAll: true}).Create(&entities).Error; err != nil {
  137. return err
  138. }
  139. return nil
  140. }