Преглед на файлове

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx преди 4 години
родител
ревизия
7f08545a7f

+ 2 - 2
controllers/base_api_controller.go Целия файл

@@ -2,7 +2,7 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
-	"XT_New/models"
5
+	//"XT_New/models"
6 6
 	"XT_New/service"
7 7
 	"fmt"
8 8
 	"strconv"
@@ -65,7 +65,7 @@ type BaseAuthAPIController struct {
65 65
 func (this *BaseAuthAPIController) Prepare() {
66 66
 	this.BaseAPIController.Prepare()
67 67
 	if this.GetAdminUserInfo() == nil {
68
-		var userAdmin models.AdminUser
68
+		//var userAdmin models.AdminUser
69 69
 		//userAdmin.Id = 400
70 70
 		//userAdmin.Mobile = "13535547901"
71 71
 		//

+ 5 - 3
controllers/new_mobile_api_controllers/home_api_controller.go Целия файл

@@ -48,9 +48,11 @@ func (this *HomeController) GetHomeData() {
48 48
 				if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
49 49
 					for _, item := range role_ids {
50 50
 						id, _ := strconv.ParseInt(item, 10, 64)
51
-						role, _ := service.GetRoleByRoleID(id)
52
-						if role.IsSystem == 1 && role.RoleName == "子管理员" {
53
-							isSubSuperAdmin = true
51
+						if id > 0 {
52
+							role, _ := service.GetRoleByRoleID(id)
53
+							if role.IsSystem == 1 && role.RoleName == "子管理员" {
54
+								isSubSuperAdmin = true
55
+							}
54 56
 						}
55 57
 					}
56 58
 				}

+ 33 - 20
controllers/new_mobile_api_controllers/new_role_api_controller.go Целия файл

@@ -20,12 +20,18 @@ func (this *NewRoleApiController) GetAllOrgUser() {
20 20
 	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
21 21
 	role_ids := strings.Split(app_role.RoleIds, ",")
22 22
 
23
-	if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
24
-		for _, item := range role_ids {
25
-			id, _ := strconv.ParseInt(item, 10, 64)
26
-			role, _ := service.GetRoleByRoleID(id)
27
-			if role.IsSystem == 1 && role.RoleName == "子管理员" {
28
-				isSubSuperAdmin = true
23
+	if len(role_ids) > 0 {
24
+		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
25
+			for _, item := range role_ids {
26
+				id, _ := strconv.ParseInt(item, 10, 64)
27
+				if id != 0 {
28
+					role, _ := service.GetRoleByRoleID(id)
29
+
30
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
31
+						isSubSuperAdmin = true
32
+					}
33
+				}
34
+
29 35
 			}
30 36
 		}
31 37
 	}
@@ -92,13 +98,16 @@ func (this *NewRoleApiController) GetAdminUserInfo() {
92 98
 	var isSubSuperAdmin bool = false
93 99
 	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
94 100
 	role_ids := strings.Split(app_role.RoleIds, ",")
95
-
96
-	if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
97
-		for _, item := range role_ids {
98
-			id, _ := strconv.ParseInt(item, 10, 64)
99
-			role, _ := service.GetRoleByRoleID(id)
100
-			if role.IsSystem == 1 && role.RoleName == "子管理员" {
101
-				isSubSuperAdmin = true
101
+	if len(role_ids) > 0 {
102
+		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
103
+			for _, item := range role_ids {
104
+				id, _ := strconv.ParseInt(item, 10, 64)
105
+				if id != 0 {
106
+					role, _ := service.GetRoleByRoleID(id)
107
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
108
+						isSubSuperAdmin = true
109
+					}
110
+				}
102 111
 			}
103 112
 		}
104 113
 	}
@@ -231,13 +240,17 @@ func (this *NewRoleApiController) GetAllOrgRole() {
231 240
 
232 241
 	app_role, _ := service.GetAppRoleById(adminUserInfo.AppRole.Id)
233 242
 	role_ids := strings.Split(app_role.RoleIds, ",")
234
-
235
-	if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
236
-		for _, item := range role_ids {
237
-			id, _ := strconv.ParseInt(item, 10, 64)
238
-			role, _ := service.GetRoleByRoleID(id)
239
-			if role.IsSystem == 1 && role.RoleName == "子管理员" {
240
-				isSubSuperAdmin = true
243
+	if len(role_ids) > 0 {
244
+
245
+		if adminUserInfo.AdminUser.Id != adminUserInfo.Org.Creator {
246
+			for _, item := range role_ids {
247
+				id, _ := strconv.ParseInt(item, 10, 64)
248
+				if id != 0 {
249
+					role, _ := service.GetRoleByRoleID(id)
250
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
251
+						isSubSuperAdmin = true
252
+					}
253
+				}
241 254
 			}
242 255
 		}
243 256
 	}

+ 1 - 1
controllers/new_mobile_api_controllers/role.json Целия файл

@@ -78,7 +78,7 @@
78 78
       "status": 1,
79 79
       "is_system": 0,
80 80
       "number": 9993,
81
-      "purview_ids": "",
81
+      "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,94,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,76,156,157,158,159,155,82,83,108,149,154,190,81,101,100,102,161,160,162,163,165,170,169,171,172,173,174,177,175,178,180,179,181,186,185,187,188,189,192",
82 82
       "func_ids": ""
83 83
 
84 84
 

+ 260 - 265
controllers/public_api_controller.go Целия файл

@@ -163,281 +163,276 @@ func (this *PublicApiController) GetJson() {
163 163
 }
164 164
 
165 165
 func (c *PublicApiController) HandleData() {
166
-	//org_app, _ := service.GetAllAppOrg()
166
+	org_app, _ := service.GetAllAppOrg()
167 167
 	org_role, _ := service.GetAllRole()
168 168
 
169 169
 	var org_ids []int64
170 170
 
171
-	//for _, apps := range org_app {
172
-	//	xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
173
-	//	scrm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 1)
174
-	//	cdm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 4)
175
-	//	mall_org_app, _ := service.GetAppByType(int64(apps.OrgId), 5)
176
-	//	org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
177
-	//	org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
178
-	//	org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
179
-	//	org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
180
-	//	org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
181
-	//	org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
182
-	//	org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
183
-	//	org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
184
-	//	org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
185
-	//	org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
186
-	//
187
-	//	var xt_temp_org_app *models.OrgApp
188
-	//	var mall_temp_org_app *models.OrgApp
189
-	//
190
-	//
191
-	//	if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
192
-	//
193
-	//		app, _ := service.GetOrgApp(0,3)
194
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
195
-	//
196
-	//		app.Id = 0
197
-	//		app.OrgId = apps.OrgId
198
-	//		app.Creator = int(org.Creator)
199
-	//		app.Number  = 0
200
-	//		app.Status = 1
201
-	//		app.ModifyTime = time.Now().Unix()
202
-	//		app.CreateTime = time.Now().Unix()
203
-	//		service.CreateOrgApp(app)
204
-	//		xt_temp_org_app = app
205
-	//	}else{
206
-	//
207
-	//		xt_temp_org_app = xt_org_app
208
-	//
209
-	//	}
210
-	//
211
-	//	if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
212
-	//
213
-	//		app, _ := service.GetOrgApp(0,1)
214
-	//		//org, _ := service.GetOrgById(int64(12))
215
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
216
-	//
217
-	//		app.OrgId = apps.OrgId
218
-	//		app.Id = 0
219
-	//
220
-	//		app.Creator = int(org.Creator)
221
-	//		app.Number  = 0
222
-	//		app.Status = 1
223
-	//		app.ModifyTime = time.Now().Unix()
224
-	//		app.CreateTime = time.Now().Unix()
225
-	//		service.CreateOrgApp(app)
226
-	//
227
-	//	}
228
-	//
229
-	//	if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
230
-	//		app, _ := service.GetOrgApp(0,4)
231
-	//		//org, _ := service.GetOrgById(int64(12))
232
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
233
-	//
234
-	//		app.OrgId = apps.OrgId
235
-	//		app.Creator = int(org.Creator)
236
-	//		app.Number  = 0
237
-	//		app.Id = 0
238
-	//
239
-	//		app.Status = 1
240
-	//		app.ModifyTime = time.Now().Unix()
241
-	//		app.CreateTime = time.Now().Unix()
242
-	//		service.CreateOrgApp(app)
243
-	//	}
244
-	//
245
-	//	if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
246
-	//		app, _ := service.GetOrgApp(0,5)
247
-	//		//org, _ := service.GetOrgById(int64(12))
248
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
249
-	//
250
-	//		app.OrgId = apps.OrgId
251
-	//		app.Creator = int(org.Creator)
252
-	//		app.Number  = 0
253
-	//		app.Id = 0
254
-	//
255
-	//		app.Status = 1
256
-	//		app.ModifyTime = time.Now().Unix()
257
-	//		app.CreateTime = time.Now().Unix()
258
-	//		service.CreateOrgApp(app)
259
-	//		mall_temp_org_app = app
260
-	//	}else{
261
-	//		mall_temp_org_app = mall_org_app
262
-	//	}
263
-	//
264
-	//
265
-	//
266
-	//	if org_app_6 == nil || org_app_6.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
267
-	//		app, _ := service.GetOrgApp(0,6)
268
-	//		//org, _ := service.GetOrgById(int64(12))
269
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
270
-	//
271
-	//		app.OrgId = apps.OrgId
272
-	//		app.Creator = int(org.Creator)
273
-	//		app.Number  = 0
274
-	//		app.Id = 0
275
-	//
276
-	//		app.Status = 1
277
-	//		app.ModifyTime = time.Now().Unix()
278
-	//		app.CreateTime = time.Now().Unix()
279
-	//		app.Pid  = xt_temp_org_app.Id
280
-	//		service.CreateOrgApp(app)
281
-	//
282
-	//
283
-	//	}
284
-	//	if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
285
-	//		app, _ := service.GetOrgApp(0,7)
286
-	//		//org, _ := service.GetOrgById(int64(12))
287
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
288
-	//
289
-	//		app.OrgId = apps.OrgId
290
-	//		app.Creator = int(org.Creator)
291
-	//		app.Number  = 0
292
-	//		app.Status = 1
293
-	//		app.Id = 0
294
-	//
295
-	//		app.ModifyTime = time.Now().Unix()
296
-	//		app.CreateTime = time.Now().Unix()
297
-	//		app.Pid  = xt_temp_org_app.Id
298
-	//
299
-	//		service.CreateOrgApp(app)
300
-	//	}
301
-	//	if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
302
-	//		app, _ := service.GetOrgApp(0,8)
303
-	//		//org, _ := service.GetOrgById(int64(12))
304
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
305
-	//
306
-	//		app.OrgId = apps.OrgId
307
-	//		app.Creator = int(org.Creator)
308
-	//		app.Number  = 0
309
-	//		app.Id = 0
310
-	//
311
-	//		app.Pid  = mall_temp_org_app.Id
312
-	//
313
-	//		app.Status = 1
314
-	//		app.ModifyTime = time.Now().Unix()
315
-	//		app.CreateTime = time.Now().Unix()
316
-	//		service.CreateOrgApp(app)
317
-	//	}
318
-	//	if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
319
-	//		app, _ := service.GetOrgApp(0,9)
320
-	//		//org, _ := service.GetOrgById(int64(12))
321
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
322
-	//
323
-	//		app.OrgId = apps.OrgId
324
-	//		app.Pid  = xt_temp_org_app.Id
325
-	//
326
-	//		app.Creator = int(org.Creator)
327
-	//		app.Number  = 0
328
-	//		app.Id = 0
329
-	//
330
-	//		app.Status = 1
331
-	//		app.ModifyTime = time.Now().Unix()
332
-	//		app.CreateTime = time.Now().Unix()
333
-	//		service.CreateOrgApp(app)
334
-	//
335
-	//	}
336
-	//	if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
337
-	//		app, _ := service.GetOrgApp(0,10)
338
-	//		//org, _ := service.GetOrgById(int64(12))
339
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
340
-	//
341
-	//		app.OrgId = apps.OrgId
342
-	//		app.Creator = int(org.Creator)
343
-	//		app.Pid  = xt_temp_org_app.Id
344
-	//
345
-	//		app.Number  = 0
346
-	//		app.Id = 0
347
-	//
348
-	//		app.Status = 1
349
-	//		app.ModifyTime = time.Now().Unix()
350
-	//		app.CreateTime = time.Now().Unix()
351
-	//		service.CreateOrgApp(app)
352
-	//	}
353
-	//	if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
354
-	//		app, _ := service.GetOrgApp(0,11)
355
-	//		//org, _ := service.GetOrgById(int64(12))
356
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
357
-	//
358
-	//		app.OrgId = app.OrgId
359
-	//		app.Creator = int(org.Creator)
360
-	//		app.Pid  = xt_temp_org_app.Id
361
-	//		app.Id = 0
362
-	//
363
-	//		app.Number  = 0
364
-	//		app.Status = 1
365
-	//		app.ModifyTime = time.Now().Unix()
366
-	//		app.CreateTime = time.Now().Unix()
367
-	//		service.CreateOrgApp(app)
368
-	//	}
369
-	//	if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
370
-	//		app, _ := service.GetOrgApp(0,12)
371
-	//		//org, _ := service.GetOrgById(int64(12))
372
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
373
-	//
374
-	//		app.OrgId = apps.OrgId
375
-	//		app.Creator = int(org.Creator)
376
-	//		app.Pid  = xt_temp_org_app.Id
377
-	//		app.Number  = 0
378
-	//		app.Status = 1
379
-	//		app.Id = 0
380
-	//
381
-	//		app.ModifyTime = time.Now().Unix()
382
-	//		app.CreateTime = time.Now().Unix()
383
-	//		service.CreateOrgApp(app)
384
-	//	}
385
-	//	if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
386
-	//		app, _ := service.GetOrgApp(0,13)
387
-	//		//org, _ := service.GetOrgById(int64(12))
388
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
389
-	//
390
-	//		app.OrgId = apps.OrgId
391
-	//		app.Creator = int(org.Creator)
392
-	//		app.Pid  = xt_temp_org_app.Id
393
-	//		app.Number  = 0
394
-	//		app.Id = 0
395
-	//
396
-	//		app.Status = 1
397
-	//		app.ModifyTime = time.Now().Unix()
398
-	//		app.CreateTime = time.Now().Unix()
399
-	//		service.CreateOrgApp(app)
400
-	//	}
401
-	//	if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
402
-	//		app, _ := service.GetOrgApp(0,14)
403
-	//		//org, _ := service.GetOrgById(int64(12))
404
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
405
-	//
406
-	//		app.OrgId = apps.OrgId
407
-	//		app.Creator = int(org.Creator)
408
-	//		app.Pid  = xt_temp_org_app.Id
409
-	//		app.Id = 0
410
-	//		app.Number  = 0
411
-	//		app.Status = 1
412
-	//		app.ModifyTime = time.Now().Unix()
413
-	//		app.CreateTime = time.Now().Unix()
414
-	//		service.CreateOrgApp(app)
415
-	//	}
416
-	//
417
-	//	if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
418
-	//		app, _ := service.GetOrgApp(0,15)
419
-	//		//org, _ := service.GetOrgById(int64(12))
420
-	//		org, _ := service.GetOrgById(int64(apps.OrgId))
421
-	//
422
-	//		app.OrgId = apps.OrgId
423
-	//		app.Creator = int(org.Creator)
424
-	//		app.Pid  = xt_temp_org_app.Id
425
-	//		app.Number  = 0
426
-	//		app.Status = 1
427
-	//		app.Id = 0
428
-	//		app.ModifyTime = time.Now().Unix()
429
-	//		app.CreateTime = time.Now().Unix()
430
-	//		service.CreateOrgApp(app)
431
-	//	}
432
-	//}
433
-	//
171
+	for _, apps := range org_app {
172
+		xt_org_app, _ := service.GetAppByType(int64(apps.OrgId), 3)
173
+		scrm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 1)
174
+		cdm_org_app, _ := service.GetAppByType(int64(apps.OrgId), 4)
175
+		mall_org_app, _ := service.GetAppByType(int64(apps.OrgId), 5)
176
+		org_app_6, _ := service.GetAppByType(int64(apps.OrgId), 6)
177
+		org_app_7, _ := service.GetAppByType(int64(apps.OrgId), 7)
178
+		org_app_8, _ := service.GetAppByType(int64(apps.OrgId), 8)
179
+		org_app_9, _ := service.GetAppByType(int64(apps.OrgId), 9)
180
+		org_app_10, _ := service.GetAppByType(int64(apps.OrgId), 10)
181
+		org_app_11, _ := service.GetAppByType(int64(apps.OrgId), 11)
182
+		org_app_12, _ := service.GetAppByType(int64(apps.OrgId), 12)
183
+		org_app_13, _ := service.GetAppByType(int64(apps.OrgId), 13)
184
+		org_app_14, _ := service.GetAppByType(int64(apps.OrgId), 14)
185
+		org_app_15, _ := service.GetAppByType(int64(apps.OrgId), 15)
186
+
187
+		var xt_temp_org_app *models.OrgApp
188
+		var mall_temp_org_app *models.OrgApp
189
+
190
+		if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
191
+
192
+			app, _ := service.GetOrgApp(0, 3)
193
+			org, _ := service.GetOrgById(int64(apps.OrgId))
194
+
195
+			app.Id = 0
196
+			app.OrgId = apps.OrgId
197
+			app.Creator = int(org.Creator)
198
+			app.Number = 0
199
+			app.Status = 1
200
+			app.ModifyTime = time.Now().Unix()
201
+			app.CreateTime = time.Now().Unix()
202
+			service.CreateOrgApp(app)
203
+			xt_temp_org_app = app
204
+		} else {
205
+
206
+			xt_temp_org_app = xt_org_app
207
+
208
+		}
209
+
210
+		if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
211
+
212
+			app, _ := service.GetOrgApp(0, 1)
213
+			//org, _ := service.GetOrgById(int64(12))
214
+			org, _ := service.GetOrgById(int64(apps.OrgId))
215
+
216
+			app.OrgId = apps.OrgId
217
+			app.Id = 0
218
+
219
+			app.Creator = int(org.Creator)
220
+			app.Number = 0
221
+			app.Status = 1
222
+			app.ModifyTime = time.Now().Unix()
223
+			app.CreateTime = time.Now().Unix()
224
+			service.CreateOrgApp(app)
225
+
226
+		}
227
+
228
+		if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
229
+			app, _ := service.GetOrgApp(0, 4)
230
+			//org, _ := service.GetOrgById(int64(12))
231
+			org, _ := service.GetOrgById(int64(apps.OrgId))
232
+
233
+			app.OrgId = apps.OrgId
234
+			app.Creator = int(org.Creator)
235
+			app.Number = 0
236
+			app.Id = 0
237
+
238
+			app.Status = 1
239
+			app.ModifyTime = time.Now().Unix()
240
+			app.CreateTime = time.Now().Unix()
241
+			service.CreateOrgApp(app)
242
+		}
243
+
244
+		if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
245
+			app, _ := service.GetOrgApp(0, 5)
246
+			//org, _ := service.GetOrgById(int64(12))
247
+			org, _ := service.GetOrgById(int64(apps.OrgId))
248
+
249
+			app.OrgId = apps.OrgId
250
+			app.Creator = int(org.Creator)
251
+			app.Number = 0
252
+			app.Id = 0
253
+
254
+			app.Status = 1
255
+			app.ModifyTime = time.Now().Unix()
256
+			app.CreateTime = time.Now().Unix()
257
+			service.CreateOrgApp(app)
258
+			mall_temp_org_app = app
259
+		} else {
260
+			mall_temp_org_app = mall_org_app
261
+		}
262
+
263
+		if org_app_6 == nil || org_app_6.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
264
+			app, _ := service.GetOrgApp(0, 6)
265
+			//org, _ := service.GetOrgById(int64(12))
266
+			org, _ := service.GetOrgById(int64(apps.OrgId))
267
+
268
+			app.OrgId = apps.OrgId
269
+			app.Creator = int(org.Creator)
270
+			app.Number = 1
271
+			app.Id = 0
272
+
273
+			app.Status = 1
274
+			app.ModifyTime = time.Now().Unix()
275
+			app.CreateTime = time.Now().Unix()
276
+			app.Pid = xt_temp_org_app.Id
277
+			service.CreateOrgApp(app)
278
+
279
+		}
280
+		if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
281
+			app, _ := service.GetOrgApp(0, 7)
282
+			//org, _ := service.GetOrgById(int64(12))
283
+			org, _ := service.GetOrgById(int64(apps.OrgId))
284
+
285
+			app.OrgId = apps.OrgId
286
+			app.Creator = int(org.Creator)
287
+			app.Number = 0
288
+			app.Status = 2
289
+			app.Id = 0
290
+
291
+			app.ModifyTime = time.Now().Unix()
292
+			app.CreateTime = time.Now().Unix()
293
+			app.Pid = xt_temp_org_app.Id
294
+
295
+			service.CreateOrgApp(app)
296
+		}
297
+		if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
298
+			app, _ := service.GetOrgApp(0, 8)
299
+			//org, _ := service.GetOrgById(int64(12))
300
+			org, _ := service.GetOrgById(int64(apps.OrgId))
301
+
302
+			app.OrgId = apps.OrgId
303
+			app.Creator = int(org.Creator)
304
+			app.Number = 3
305
+			app.Id = 0
306
+
307
+			app.Pid = mall_temp_org_app.Id
308
+
309
+			app.Status = 1
310
+			app.ModifyTime = time.Now().Unix()
311
+			app.CreateTime = time.Now().Unix()
312
+			service.CreateOrgApp(app)
313
+		}
314
+		if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
315
+			app, _ := service.GetOrgApp(0, 9)
316
+			//org, _ := service.GetOrgById(int64(12))
317
+			org, _ := service.GetOrgById(int64(apps.OrgId))
318
+
319
+			app.OrgId = apps.OrgId
320
+			app.Pid = xt_temp_org_app.Id
321
+
322
+			app.Creator = int(org.Creator)
323
+			app.Number = 4
324
+			app.Id = 0
325
+
326
+			app.Status = 1
327
+			app.ModifyTime = time.Now().Unix()
328
+			app.CreateTime = time.Now().Unix()
329
+			service.CreateOrgApp(app)
330
+
331
+		}
332
+		if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
333
+			app, _ := service.GetOrgApp(0, 10)
334
+			//org, _ := service.GetOrgById(int64(12))
335
+			org, _ := service.GetOrgById(int64(apps.OrgId))
336
+
337
+			app.OrgId = apps.OrgId
338
+			app.Creator = int(org.Creator)
339
+			app.Pid = xt_temp_org_app.Id
340
+
341
+			app.Number = 5
342
+			app.Id = 0
343
+
344
+			app.Status = 1
345
+			app.ModifyTime = time.Now().Unix()
346
+			app.CreateTime = time.Now().Unix()
347
+			service.CreateOrgApp(app)
348
+		}
349
+		if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
350
+			app, _ := service.GetOrgApp(0, 11)
351
+			//org, _ := service.GetOrgById(int64(12))
352
+			org, _ := service.GetOrgById(int64(apps.OrgId))
353
+
354
+			app.OrgId = app.OrgId
355
+			app.Creator = int(org.Creator)
356
+			app.Pid = xt_temp_org_app.Id
357
+			app.Id = 0
358
+
359
+			app.Number = 6
360
+			app.Status = 1
361
+			app.ModifyTime = time.Now().Unix()
362
+			app.CreateTime = time.Now().Unix()
363
+			service.CreateOrgApp(app)
364
+		}
365
+		if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
366
+			app, _ := service.GetOrgApp(0, 12)
367
+			//org, _ := service.GetOrgById(int64(12))
368
+			org, _ := service.GetOrgById(int64(apps.OrgId))
369
+
370
+			app.OrgId = apps.OrgId
371
+			app.Creator = int(org.Creator)
372
+			app.Pid = xt_temp_org_app.Id
373
+			app.Number = 7
374
+			app.Status = 1
375
+			app.Id = 0
376
+
377
+			app.ModifyTime = time.Now().Unix()
378
+			app.CreateTime = time.Now().Unix()
379
+			service.CreateOrgApp(app)
380
+		}
381
+		if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
382
+			app, _ := service.GetOrgApp(0, 13)
383
+			//org, _ := service.GetOrgById(int64(12))
384
+			org, _ := service.GetOrgById(int64(apps.OrgId))
385
+
386
+			app.OrgId = apps.OrgId
387
+			app.Creator = int(org.Creator)
388
+			app.Pid = xt_temp_org_app.Id
389
+			app.Number = 8
390
+			app.Id = 0
391
+			app.Status = 1
392
+			app.ModifyTime = time.Now().Unix()
393
+			app.CreateTime = time.Now().Unix()
394
+			service.CreateOrgApp(app)
395
+		}
396
+		if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
397
+			app, _ := service.GetOrgApp(0, 14)
398
+			//org, _ := service.GetOrgById(int64(12))
399
+			org, _ := service.GetOrgById(int64(apps.OrgId))
400
+
401
+			app.OrgId = apps.OrgId
402
+			app.Creator = int(org.Creator)
403
+			app.Pid = xt_temp_org_app.Id
404
+			app.Id = 0
405
+			app.Number = 9
406
+			app.Status = 1
407
+			app.ModifyTime = time.Now().Unix()
408
+			app.CreateTime = time.Now().Unix()
409
+			service.CreateOrgApp(app)
410
+		}
411
+
412
+		if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
413
+			app, _ := service.GetOrgApp(0, 15)
414
+			//org, _ := service.GetOrgById(int64(12))
415
+			org, _ := service.GetOrgById(int64(apps.OrgId))
416
+
417
+			app.OrgId = apps.OrgId
418
+			app.Creator = int(org.Creator)
419
+			app.Pid = xt_temp_org_app.Id
420
+			app.Number = 10
421
+			app.Status = 1
422
+			app.Id = 0
423
+			app.ModifyTime = time.Now().Unix()
424
+			app.CreateTime = time.Now().Unix()
425
+			service.CreateOrgApp(app)
426
+		}
427
+	}
428
+
434 429
 	for _, role := range org_role {
435 430
 		org_ids = append(org_ids, role.OrgId)
436 431
 	}
437 432
 	//
438 433
 	//
439 434
 	////创建内置角色
440
-	//InitRoleAndPurviews(org_ids)
435
+	InitRoleAndPurviews(org_ids)
441 436
 
442 437
 	//var org_id int = 0
443 438
 	////管理员

+ 30 - 18
controllers/role_controller.go Целия файл

@@ -356,9 +356,11 @@ func (this *RoleAPIController) AdminMainView() {
356 356
 		if adminUserInfo.AdminUser.Id != org.Creator {
357 357
 			for _, item := range role_ids {
358 358
 				id, _ := strconv.ParseInt(item, 10, 64)
359
-				role, _ := service.GetRoleByRoleID(id)
360
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
361
-					isSubSuperAdmin = true
359
+				if id != 0 {
360
+					role, _ := service.GetRoleByRoleID(id)
361
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
362
+						isSubSuperAdmin = true
363
+					}
362 364
 				}
363 365
 			}
364 366
 		}
@@ -421,9 +423,11 @@ func (this *RoleAPIController) AddAdminInitData() {
421 423
 		if adminUserInfo.AdminUser.Id != org.Creator {
422 424
 			for _, item := range role_ids {
423 425
 				id, _ := strconv.ParseInt(item, 10, 64)
424
-				role, _ := service.GetRoleByRoleID(id)
425
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
426
-					isSubSuperAdmin = true
426
+				if id != 0 {
427
+					role, _ := service.GetRoleByRoleID(id)
428
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
429
+						isSubSuperAdmin = true
430
+					}
427 431
 				}
428 432
 			}
429 433
 		}
@@ -570,9 +574,11 @@ func (this *RoleAPIController) EditAdminInitData() {
570 574
 		if adminUserInfo.AdminUser.Id != org.Creator {
571 575
 			for _, item := range role_ids {
572 576
 				id, _ := strconv.ParseInt(item, 10, 64)
573
-				role, _ := service.GetRoleByRoleID(id)
574
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
575
-					isSubSuperAdmin = true
577
+				if id != 0 {
578
+					role, _ := service.GetRoleByRoleID(id)
579
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
580
+						isSubSuperAdmin = true
581
+					}
576 582
 				}
577 583
 			}
578 584
 		}
@@ -836,9 +842,11 @@ func (this *RoleAPIController) GetAllOrgRole() {
836 842
 		if adminUserInfo.AdminUser.Id != org.Creator {
837 843
 			for _, item := range role_ids {
838 844
 				id, _ := strconv.ParseInt(item, 10, 64)
839
-				role, _ := service.GetRoleByRoleID(id)
840
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
841
-					isSubSuperAdmin = true
845
+				if id != 0 {
846
+					role, _ := service.GetRoleByRoleID(id)
847
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
848
+						isSubSuperAdmin = true
849
+					}
842 850
 				}
843 851
 			}
844 852
 		}
@@ -871,9 +879,11 @@ func (this *RoleAPIController) GetAllOrgUser() {
871 879
 		if adminUserInfo.AdminUser.Id != org.Creator {
872 880
 			for _, item := range role_ids {
873 881
 				id, _ := strconv.ParseInt(item, 10, 64)
874
-				role, _ := service.GetRoleByRoleID(id)
875
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
876
-					isSubSuperAdmin = true
882
+				if id != 0 {
883
+					role, _ := service.GetRoleByRoleID(id)
884
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
885
+						isSubSuperAdmin = true
886
+					}
877 887
 				}
878 888
 			}
879 889
 		}
@@ -914,9 +924,11 @@ func (this *RoleAPIController) GetRoleStaff() {
914 924
 		if adminUserInfo.AdminUser.Id != org.Creator {
915 925
 			for _, item := range role_ids {
916 926
 				id, _ := strconv.ParseInt(item, 10, 64)
917
-				role, _ := service.GetRoleByRoleID(id)
918
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
919
-					isSubSuperAdmin = true
927
+				if id != 0 {
928
+					role, _ := service.GetRoleByRoleID(id)
929
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
930
+						isSubSuperAdmin = true
931
+					}
920 932
 				}
921 933
 			}
922 934
 		}

+ 22 - 15
service/role_service.go Целия файл

@@ -45,9 +45,11 @@ func GetAppRole(orgID int64, appID int64, adminUserID int64) (*models.App_Role,
45 45
 		role_ids := strings.Split(appRole.RoleIds, ",")
46 46
 		for _, item := range role_ids {
47 47
 			id, _ := strconv.ParseInt(item, 10, 64)
48
-			role, _ := GetRoleByRoleID(id)
49
-			if role.IsSystem == 1 && role.RoleName == "子管理员" {
50
-				appRole.IsSubSuperAdmin = true
48
+			if id != 0 {
49
+				role, _ := GetRoleByRoleID(id)
50
+				if role.IsSystem == 1 && role.RoleName == "子管理员" {
51
+					appRole.IsSubSuperAdmin = true
52
+				}
51 53
 			}
52 54
 		}
53 55
 	}
@@ -164,17 +166,20 @@ func GetAdminUsersAndLoginInfo(orgID int64, appID int64, page int, count int) ([
164 166
 			ids := strings.Split(item.RoleIds, ",")
165 167
 			for _, id := range ids {
166 168
 				id, _ := strconv.ParseInt(id, 10, 64)
167
-				role, _ := GetRoleByRoleID(id)
168
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
169
-					item.IsSubSuperAdmin = true
170
-				}
171
-
172
-				if len(item.RoleName) == 0 {
173
-					item.RoleName = role.RoleName
174
-				} else {
175
-					item.RoleName = item.RoleName + "," + role.RoleName
169
+				if id != 0 {
170
+					role, _ := GetRoleByRoleID(id)
171
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
172
+						item.IsSubSuperAdmin = true
173
+					}
174
+
175
+					if len(item.RoleName) == 0 {
176
+						item.RoleName = role.RoleName
177
+					} else {
178
+						item.RoleName = item.RoleName + "," + role.RoleName
179
+					}
176 180
 				}
177 181
 			}
182
+
178 183
 		}
179 184
 
180 185
 		//admin, _ := GetAdminUserByUserID(int64(item.AdminUserId))
@@ -612,9 +617,11 @@ func GetAllAdminUsersAndRole(orgID int64, appID int64, page int, count int) ([]*
612 617
 			ids := strings.Split(items.RoleIds, ",")
613 618
 			for _, ids := range ids {
614 619
 				id, _ := strconv.ParseInt(ids, 10, 64)
615
-				role, _ := GetRoleByRoleID(id)
616
-				if role.IsSystem == 1 && role.RoleName == "子管理员" {
617
-					items.IsSubAdmin = true
620
+				if id != 0 {
621
+					role, _ := GetRoleByRoleID(id)
622
+					if role.IsSystem == 1 && role.RoleName == "子管理员" {
623
+						items.IsSubAdmin = true
624
+					}
618 625
 				}
619 626
 			}
620 627
 		}