@@ -2,7 +2,6 @@ package common
2
2
3
3
import (
4
4
"errors"
5
- "reflect"
6
5
"server/config"
7
6
"server/model"
8
7
"server/util"
@@ -97,7 +96,6 @@ func InitData() {
97
96
menuIcon := "menu"
98
97
roleIcon := "role"
99
98
userIcon := "user"
100
- settingIcon := "config"
101
99
102
100
menus := []model.Menu {
103
101
{
@@ -252,72 +250,60 @@ func InitData() {
252
250
},
253
251
{
254
252
Model : gorm.Model {ID : systemId + 1 },
255
- Name : "Settings" ,
256
- Title : "系统配置" ,
257
- Icon : & settingIcon ,
258
- Path : "settings" ,
259
- Component : "/system/settings/index" ,
260
- Sort : systemId + 1 ,
261
- ParentId : & systemId ,
262
- Roles : roles [:1 ],
263
- Creator : "系统" ,
264
- },
265
- {
266
- Model : gorm.Model {ID : systemId + 2 },
267
253
Name : "User" ,
268
254
Title : "用户管理" ,
269
255
Icon : & userIcon ,
270
256
Path : "user" ,
271
257
Component : "/system/user/index" ,
272
- Sort : systemId + 2 ,
258
+ Sort : systemId + 1 ,
273
259
ParentId : & systemId ,
274
260
Roles : roles [:1 ],
275
261
Creator : "系统" ,
276
262
},
277
263
{
278
- Model : gorm.Model {ID : systemId + 3 },
264
+ Model : gorm.Model {ID : systemId + 2 },
279
265
Name : "Role" ,
280
266
Title : "角色管理" ,
281
267
Icon : & roleIcon ,
282
268
Path : "role" ,
283
269
Component : "/system/role/index" ,
284
- Sort : systemId + 3 ,
270
+ Sort : systemId + 2 ,
285
271
ParentId : & systemId ,
286
272
Roles : roles [:1 ],
287
273
Creator : "系统" ,
288
274
},
289
275
{
290
- Model : gorm.Model {ID : systemId + 4 },
276
+ Model : gorm.Model {ID : systemId + 3 },
291
277
Name : "Menu" ,
292
278
Title : "菜单管理" ,
293
279
Icon : & menuIcon ,
294
280
Path : "menu" ,
295
281
Component : "/system/menu/index" ,
296
- Sort : systemId + 4 ,
282
+ Sort : systemId + 3 ,
297
283
ParentId : & systemId ,
298
284
Roles : roles [:1 ],
299
285
Creator : "系统" ,
300
286
},
301
287
{
302
- Model : gorm.Model {ID : systemId + 5 },
288
+ Model : gorm.Model {ID : systemId + 4 },
303
289
Name : "Api" ,
304
290
Title : "接口管理" ,
305
291
Icon : & apiIcon ,
306
292
Path : "api" ,
307
293
Component : "/system/api/index" ,
308
- Sort : systemId + 5 ,
294
+ Sort : systemId + 4 ,
309
295
ParentId : & systemId ,
310
296
Roles : roles [:1 ],
311
297
Creator : "系统" ,
312
298
},
313
299
{
314
- Model : gorm.Model {ID : systemId + 6 },
300
+ Model : gorm.Model {ID : systemId + 5 },
315
301
Name : "OperationLog" ,
316
302
Title : "操作日志" ,
317
303
Icon : & apiLogIcon ,
318
304
Path : "operation-log" ,
319
305
Component : "/system/operation-log/index" ,
320
- Sort : systemId + 6 ,
306
+ Sort : systemId + 5 ,
321
307
ParentId : & systemId ,
322
308
Roles : roles [:1 ],
323
309
Creator : "系统" ,
@@ -361,28 +347,6 @@ func InitData() {
361
347
Creator : "系统" ,
362
348
Roles : roles [:1 ],
363
349
},
364
- //{
365
- // Model: gorm.Model{ID: 3},
366
- // Username: "user",
367
- // Password: util.GenPasswd("123456"),
368
- // Mobile: "13899999999",
369
- // Avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
370
- // Introduction: new(string),
371
- // Status: 1,
372
- // Creator: "系统",
373
- // Roles: roles[1:2],
374
- //},
375
- //{
376
- // Model: gorm.Model{ID: 4},
377
- // Username: "guest",
378
- // Password: util.GenPasswd("123456"),
379
- // Mobile: "13833333333",
380
- // Avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
381
- // Introduction: new(string),
382
- // Status: 1,
383
- // Creator: "系统",
384
- // Roles: roles[1:2],
385
- //},
386
350
}
387
351
388
352
for _ , user := range users {
@@ -947,27 +911,6 @@ func InitData() {
947
911
Desc : "批量删除rasp日志" ,
948
912
Creator : "系统" ,
949
913
},
950
- {
951
- Method : "POST" ,
952
- Path : "/settings/update" ,
953
- Category : "settings" ,
954
- Desc : "更新系统配置" ,
955
- Creator : "系统" ,
956
- },
957
- {
958
- Method : "GET" ,
959
- Path : "/settings/list" ,
960
- Category : "settings" ,
961
- Desc : "获取系统配置" ,
962
- Creator : "系统" ,
963
- },
964
- {
965
- Method : "POST" ,
966
- Path : "/settings/getProjectInfo" ,
967
- Category : "settings" ,
968
- Desc : "获取项目guid" ,
969
- Creator : "系统" ,
970
- },
971
914
}
972
915
newApi := make ([]model.Api , 0 )
973
916
newRoleCasbin := make ([]model.RoleCasbin , 0 )
@@ -1029,46 +972,4 @@ func InitData() {
1029
972
Log .Errorf ("写入casbin数据失败:%v" , err )
1030
973
}
1031
974
}
1032
-
1033
- // 写入系统默认设置
1034
- settings := []model.SystemSetting {
1035
- {
1036
- Name : "autoUpdate" ,
1037
- Type : reflect .Bool .String (),
1038
- Value : "false" ,
1039
- },
1040
- {
1041
- Name : "reportUrl" ,
1042
- Type : reflect .String .String (),
1043
- Value : "" ,
1044
- },
1045
- {
1046
- Name : "projectGuid" ,
1047
- Type : reflect .String .String (),
1048
- Value : "" ,
1049
- },
1050
- {
1051
- Name : "updateUrl" ,
1052
- Type : reflect .String .String (),
1053
- Value : "ws://security.epoint.com.cn:8024" ,
1054
- },
1055
- {
1056
- Name : "projectType" ,
1057
- Type : reflect .String .String (),
1058
- Value : "live-project" ,
1059
- },
1060
- }
1061
- newSettings := make ([]model.SystemSetting , 0 )
1062
- for i , item := range settings {
1063
- item .ID = uint (i + 1 )
1064
- err := DB .First (& item , item .ID ).Error
1065
- if errors .Is (err , gorm .ErrRecordNotFound ) {
1066
- newSettings = append (newSettings , item )
1067
- }
1068
- }
1069
- if len (newSettings ) > 0 {
1070
- if err := DB .Create (& newSettings ).Error ; err != nil {
1071
- Log .Errorf ("写入settings数据失败:%v" , err )
1072
- }
1073
- }
1074
975
}
0 commit comments