|
@@ -25,7 +25,7 @@ func PublicApiRegistRouters() {
|
25
|
25
|
beego.Router("/api/app/release", &PublicApiController{}, "Get:AppRelease")
|
26
|
26
|
beego.Router("/api/get", &PublicApiController{}, "Get:GetJson")
|
27
|
27
|
|
28
|
|
- beego.Router("/api/public/handledata", &PublicApiController{}, "Post:HandleData")
|
|
28
|
+ beego.Router("/api/public/handledata", &PublicApiController{}, "get:HandleData")
|
29
|
29
|
|
30
|
30
|
}
|
31
|
31
|
|
|
@@ -163,276 +163,331 @@ func (this *PublicApiController) GetJson() {
|
163
|
163
|
}
|
164
|
164
|
|
165
|
165
|
func (c *PublicApiController) HandleData() {
|
166
|
|
- org_app, _ := service.GetAllAppOrg()
|
167
|
|
- org_role, _ := service.GetAllRole()
|
168
|
|
-
|
169
|
|
- var org_ids []int64
|
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
|
|
- 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
|
|
- }
|
|
166
|
+ //org_app, _ := service.GetAllAppOrg()
|
|
167
|
+ //org_role, _ := service.GetAllRole()
|
|
168
|
+
|
|
169
|
+ //var org_ids []int64
|
|
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
|
+ // if xt_org_app == nil || xt_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
191
|
+ //
|
|
192
|
+ // app, _ := service.GetOrgAppA(0, 3)
|
|
193
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
194
|
+ // if org == nil || org.Id == 0 {
|
|
195
|
+ // continue
|
|
196
|
+ // }
|
|
197
|
+ //
|
|
198
|
+ // app.Id = 0
|
|
199
|
+ // app.OrgId = apps.OrgId
|
|
200
|
+ // app.Creator = int(org.Creator)
|
|
201
|
+ // app.Number = 0
|
|
202
|
+ // app.Status = 1
|
|
203
|
+ // app.ModifyTime = time.Now().Unix()
|
|
204
|
+ // app.CreateTime = time.Now().Unix()
|
|
205
|
+ // service.CreateOrgApp(app)
|
|
206
|
+ // xt_temp_org_app = app
|
|
207
|
+ // } else {
|
|
208
|
+ //
|
|
209
|
+ // xt_temp_org_app = xt_org_app
|
|
210
|
+ //
|
|
211
|
+ // }
|
|
212
|
+ //
|
|
213
|
+ // if scrm_org_app == nil || scrm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
214
|
+ //
|
|
215
|
+ // app, _ := service.GetOrgAppA(0, 1)
|
|
216
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
217
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
218
|
+ // if org == nil || org.Id == 0 {
|
|
219
|
+ // continue
|
|
220
|
+ // }
|
|
221
|
+ //
|
|
222
|
+ //
|
|
223
|
+ // app.OrgId = apps.OrgId
|
|
224
|
+ // app.Id = 0
|
|
225
|
+ //
|
|
226
|
+ // app.Creator = int(org.Creator)
|
|
227
|
+ // app.Number = 0
|
|
228
|
+ // app.Status = 1
|
|
229
|
+ // app.ModifyTime = time.Now().Unix()
|
|
230
|
+ // app.CreateTime = time.Now().Unix()
|
|
231
|
+ // service.CreateOrgApp(app)
|
|
232
|
+ //
|
|
233
|
+ // }
|
|
234
|
+ //
|
|
235
|
+ // if cdm_org_app == nil || cdm_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
236
|
+ // app, _ := service.GetOrgAppA(0, 4)
|
|
237
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
238
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
239
|
+ // if org == nil || org.Id == 0 {
|
|
240
|
+ // continue
|
|
241
|
+ // }
|
|
242
|
+ //
|
|
243
|
+ //
|
|
244
|
+ // app.OrgId = apps.OrgId
|
|
245
|
+ // app.Creator = int(org.Creator)
|
|
246
|
+ // app.Number = 0
|
|
247
|
+ // app.Id = 0
|
|
248
|
+ //
|
|
249
|
+ // app.Status = 1
|
|
250
|
+ // app.ModifyTime = time.Now().Unix()
|
|
251
|
+ // app.CreateTime = time.Now().Unix()
|
|
252
|
+ // service.CreateOrgApp(app)
|
|
253
|
+ // }
|
|
254
|
+ //
|
|
255
|
+ // if mall_org_app == nil || mall_org_app.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
256
|
+ // app, _ := service.GetOrgAppA(0, 5)
|
|
257
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
258
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
259
|
+ //
|
|
260
|
+ // if org == nil || org.Id == 0 {
|
|
261
|
+ // continue
|
|
262
|
+ // }
|
|
263
|
+ //
|
|
264
|
+ // app.OrgId = apps.OrgId
|
|
265
|
+ // app.Creator = int(org.Creator)
|
|
266
|
+ // app.Number = 0
|
|
267
|
+ // app.Id = 0
|
|
268
|
+ //
|
|
269
|
+ // app.Status = 1
|
|
270
|
+ // app.ModifyTime = time.Now().Unix()
|
|
271
|
+ // app.CreateTime = time.Now().Unix()
|
|
272
|
+ // service.CreateOrgApp(app)
|
|
273
|
+ // mall_temp_org_app = app
|
|
274
|
+ // } else {
|
|
275
|
+ // mall_temp_org_app = mall_org_app
|
|
276
|
+ // }
|
|
277
|
+ //
|
|
278
|
+ // if org_app_6 == nil || org_app_6.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
279
|
+ // app, _ := service.GetOrgAppA(0, 6)
|
|
280
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
281
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
282
|
+ // if org == nil || org.Id == 0 {
|
|
283
|
+ // continue
|
|
284
|
+ // }
|
|
285
|
+ //
|
|
286
|
+ //
|
|
287
|
+ // app.OrgId = apps.OrgId
|
|
288
|
+ // app.Creator = int(org.Creator)
|
|
289
|
+ // app.Number = 1
|
|
290
|
+ // app.Id = 0
|
|
291
|
+ //
|
|
292
|
+ // app.Status = 1
|
|
293
|
+ // app.ModifyTime = time.Now().Unix()
|
|
294
|
+ // app.CreateTime = time.Now().Unix()
|
|
295
|
+ // app.Pid = xt_temp_org_app.Id
|
|
296
|
+ // service.CreateOrgApp(app)
|
|
297
|
+ //
|
|
298
|
+ // }
|
|
299
|
+ // if org_app_7 == nil || org_app_7.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
300
|
+ // app, _ := service.GetOrgAppA(0, 7)
|
|
301
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
302
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
303
|
+ // if org == nil || org.Id == 0 {
|
|
304
|
+ // continue
|
|
305
|
+ // }
|
|
306
|
+ //
|
|
307
|
+ //
|
|
308
|
+ // app.OrgId = apps.OrgId
|
|
309
|
+ // app.Creator = int(org.Creator)
|
|
310
|
+ // app.Number = 2
|
|
311
|
+ // app.Status = 2
|
|
312
|
+ // app.Id = 0
|
|
313
|
+ //
|
|
314
|
+ // app.ModifyTime = time.Now().Unix()
|
|
315
|
+ // app.CreateTime = time.Now().Unix()
|
|
316
|
+ // app.Pid = xt_temp_org_app.Id
|
|
317
|
+ //
|
|
318
|
+ // service.CreateOrgApp(app)
|
|
319
|
+ // }
|
|
320
|
+ // if org_app_8 == nil || org_app_8.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
321
|
+ // app, _ := service.GetOrgAppA(0, 8)
|
|
322
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
323
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
324
|
+ // if org == nil || org.Id == 0 {
|
|
325
|
+ // continue
|
|
326
|
+ // }
|
|
327
|
+ //
|
|
328
|
+ //
|
|
329
|
+ // app.OrgId = apps.OrgId
|
|
330
|
+ // app.Creator = int(org.Creator)
|
|
331
|
+ // app.Number = 3
|
|
332
|
+ // app.Id = 0
|
|
333
|
+ //
|
|
334
|
+ // app.Pid = mall_temp_org_app.Id
|
|
335
|
+ //
|
|
336
|
+ // app.Status = 1
|
|
337
|
+ // app.ModifyTime = time.Now().Unix()
|
|
338
|
+ // app.CreateTime = time.Now().Unix()
|
|
339
|
+ // service.CreateOrgApp(app)
|
|
340
|
+ // }
|
|
341
|
+ // if org_app_9 == nil || org_app_9.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
342
|
+ // app, _ := service.GetOrgAppA(0, 9)
|
|
343
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
344
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
345
|
+ // if org == nil || org.Id == 0 {
|
|
346
|
+ // continue
|
|
347
|
+ // }
|
|
348
|
+ //
|
|
349
|
+ //
|
|
350
|
+ // app.OrgId = apps.OrgId
|
|
351
|
+ // app.Pid = xt_temp_org_app.Id
|
|
352
|
+ //
|
|
353
|
+ // app.Creator = int(org.Creator)
|
|
354
|
+ // app.Number = 4
|
|
355
|
+ // app.Id = 0
|
|
356
|
+ //
|
|
357
|
+ // app.Status = 1
|
|
358
|
+ // app.ModifyTime = time.Now().Unix()
|
|
359
|
+ // app.CreateTime = time.Now().Unix()
|
|
360
|
+ // service.CreateOrgApp(app)
|
|
361
|
+ //
|
|
362
|
+ // }
|
|
363
|
+ // if org_app_10 == nil || org_app_10.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
364
|
+ // app, _ := service.GetOrgAppA(0, 10)
|
|
365
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
366
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
367
|
+ // if org == nil || org.Id == 0 {
|
|
368
|
+ // continue
|
|
369
|
+ // }
|
|
370
|
+ //
|
|
371
|
+ //
|
|
372
|
+ // app.OrgId = apps.OrgId
|
|
373
|
+ // app.Creator = int(org.Creator)
|
|
374
|
+ // app.Pid = xt_temp_org_app.Id
|
|
375
|
+ //
|
|
376
|
+ // app.Number = 5
|
|
377
|
+ // app.Id = 0
|
|
378
|
+ //
|
|
379
|
+ // app.Status = 1
|
|
380
|
+ // app.ModifyTime = time.Now().Unix()
|
|
381
|
+ // app.CreateTime = time.Now().Unix()
|
|
382
|
+ // service.CreateOrgApp(app)
|
|
383
|
+ // }
|
|
384
|
+ // if org_app_11 == nil || org_app_11.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
385
|
+ // app, _ := service.GetOrgAppA(0, 11)
|
|
386
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
387
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
388
|
+ // if org == nil || org.Id == 0 {
|
|
389
|
+ // continue
|
|
390
|
+ // }
|
|
391
|
+ //
|
|
392
|
+ //
|
|
393
|
+ // app.OrgId = apps.OrgId
|
|
394
|
+ // app.Creator = int(org.Creator)
|
|
395
|
+ // app.Pid = xt_temp_org_app.Id
|
|
396
|
+ // app.Id = 0
|
|
397
|
+ //
|
|
398
|
+ // app.Number = 6
|
|
399
|
+ // app.Status = 1
|
|
400
|
+ // app.ModifyTime = time.Now().Unix()
|
|
401
|
+ // app.CreateTime = time.Now().Unix()
|
|
402
|
+ // service.CreateOrgApp(app)
|
|
403
|
+ // }
|
|
404
|
+ // if org_app_12 == nil || org_app_12.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
405
|
+ // app, _ := service.GetOrgAppA(0, 12)
|
|
406
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
407
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
408
|
+ // if org == nil || org.Id == 0 {
|
|
409
|
+ // continue
|
|
410
|
+ // }
|
|
411
|
+ //
|
|
412
|
+ //
|
|
413
|
+ // app.OrgId = apps.OrgId
|
|
414
|
+ // app.Creator = int(org.Creator)
|
|
415
|
+ // app.Pid = xt_temp_org_app.Id
|
|
416
|
+ // app.Number = 7
|
|
417
|
+ // app.Status = 1
|
|
418
|
+ // app.Id = 0
|
|
419
|
+ //
|
|
420
|
+ // app.ModifyTime = time.Now().Unix()
|
|
421
|
+ // app.CreateTime = time.Now().Unix()
|
|
422
|
+ // service.CreateOrgApp(app)
|
|
423
|
+ // }
|
|
424
|
+ // if org_app_13 == nil || org_app_13.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
425
|
+ // app, _ := service.GetOrgAppA(0, 13)
|
|
426
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
427
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
428
|
+ // if org == nil || org.Id == 0 {
|
|
429
|
+ // continue
|
|
430
|
+ // }
|
|
431
|
+ //
|
|
432
|
+ //
|
|
433
|
+ // app.OrgId = apps.OrgId
|
|
434
|
+ // app.Creator = int(org.Creator)
|
|
435
|
+ // app.Pid = xt_temp_org_app.Id
|
|
436
|
+ // app.Number = 8
|
|
437
|
+ // app.Id = 0
|
|
438
|
+ // app.Status = 1
|
|
439
|
+ // app.ModifyTime = time.Now().Unix()
|
|
440
|
+ // app.CreateTime = time.Now().Unix()
|
|
441
|
+ // service.CreateOrgApp(app)
|
|
442
|
+ // }
|
|
443
|
+ // if org_app_14 == nil || org_app_14.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
444
|
+ // app, _ := service.GetOrgAppA(0, 14)
|
|
445
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
446
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
447
|
+ // if org == nil || org.Id == 0 {
|
|
448
|
+ // continue
|
|
449
|
+ // }
|
|
450
|
+ //
|
|
451
|
+ //
|
|
452
|
+ // app.OrgId = apps.OrgId
|
|
453
|
+ // app.Creator = int(org.Creator)
|
|
454
|
+ // app.Pid = xt_temp_org_app.Id
|
|
455
|
+ // app.Id = 0
|
|
456
|
+ // app.Number = 9
|
|
457
|
+ // app.Status = 1
|
|
458
|
+ // app.ModifyTime = time.Now().Unix()
|
|
459
|
+ // app.CreateTime = time.Now().Unix()
|
|
460
|
+ // service.CreateOrgApp(app)
|
|
461
|
+ // }
|
|
462
|
+ //
|
|
463
|
+ // if org_app_15 == nil || org_app_15.Id == 0 { //判断之前是否有创建该app类型,如果没有则插入数据
|
|
464
|
+ // app, _ := service.GetOrgAppA(0, 15)
|
|
465
|
+ // //org, _ := service.GetOrgById(int64(12))
|
|
466
|
+ // org, _ := service.GetOrgByIdB(int64(apps.OrgId))
|
|
467
|
+ // if org == nil || org.Id == 0 {
|
|
468
|
+ // continue
|
|
469
|
+ // }
|
|
470
|
+ //
|
|
471
|
+ //
|
|
472
|
+ // app.OrgId = apps.OrgId
|
|
473
|
+ // app.Creator = int(org.Creator)
|
|
474
|
+ // app.Pid = xt_temp_org_app.Id
|
|
475
|
+ // app.Number = 10
|
|
476
|
+ // app.Status = 1
|
|
477
|
+ // app.Id = 0
|
|
478
|
+ // app.ModifyTime = time.Now().Unix()
|
|
479
|
+ // app.CreateTime = time.Now().Unix()
|
|
480
|
+ // service.CreateOrgApp(app)
|
|
481
|
+ // }
|
|
482
|
+ //}
|
428
|
483
|
|
429
|
|
- for _, role := range org_role {
|
430
|
|
- org_ids = append(org_ids, role.OrgId)
|
431
|
|
- }
|
|
484
|
+ //for _, role := range org_role {
|
|
485
|
+ // org_ids = append(org_ids, role.OrgId)
|
|
486
|
+ //}
|
432
|
487
|
//
|
433
|
488
|
//
|
434
|
489
|
////创建内置角色
|
435
|
|
- InitRoleAndPurviews(org_ids)
|
|
490
|
+ //InitRoleAndPurviews(org_ids)
|
436
|
491
|
|
437
|
492
|
//var org_id int = 0
|
438
|
493
|
////管理员
|
|
@@ -442,31 +497,29 @@ func (c *PublicApiController) HandleData() {
|
442
|
497
|
// if len(item.RoleIds) == 0{
|
443
|
498
|
// ids = strconv.FormatInt( item.RoleId,10)
|
444
|
499
|
// }else{
|
445
|
|
- //
|
446
|
500
|
// ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
|
447
|
501
|
// }
|
448
|
|
- //
|
449
|
502
|
// service.UpdateRoleIds(item.Id, ids)
|
450
|
503
|
//}
|
451
|
504
|
////护士医生
|
452
|
|
- //app_roles2 := service.GetAllUserRoleByUserTypeOther(org_id)
|
453
|
|
- //for _, item := range app_roles2{
|
454
|
|
- // var ids string
|
455
|
|
- // if len(item.RoleIds) == 0{
|
456
|
|
- // ids = strconv.FormatInt( item.RoleId,10)
|
457
|
|
- // }else{
|
458
|
|
- // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
|
459
|
|
- // }
|
460
|
|
- // if item.UserType == 2{
|
461
|
|
- // role := service.FindRoleByUserTypeOne(item.OrgId)
|
462
|
|
- // ids = ids +"," + strconv.FormatInt(role.Id,10)
|
463
|
|
- //
|
464
|
|
- // } else if item.UserType == 3{
|
465
|
|
- // role := service.FindRoleByUserTypeTwo(item.OrgId)
|
466
|
|
- // ids = ids +"," + strconv.FormatInt(role.Id,10)
|
467
|
|
- // }
|
468
|
|
- // service.UpdateRoleIds(item.Id, ids)
|
469
|
|
- //}
|
|
505
|
+ //app_roles2 := service.GetAllUserRoleByUserTypeOther()
|
|
506
|
+ // //for _, item := range app_roles2{
|
|
507
|
+ // // var ids string
|
|
508
|
+ // // if len(item.RoleIds) == 0{
|
|
509
|
+ // // ids = strconv.FormatInt( item.RoleId,10)
|
|
510
|
+ // // }else{
|
|
511
|
+ // // ids = item.RoleIds + ","+strconv.FormatInt( item.RoleId,10)
|
|
512
|
+ // // }
|
|
513
|
+ // // if item.UserType == 2{
|
|
514
|
+ // // role := service.FindRoleByUserTypeOne(item.OrgId)
|
|
515
|
+ // // ids = ids +"," + strconv.FormatInt(role.Id,10)
|
|
516
|
+ // //
|
|
517
|
+ // // } else if item.UserType == 3{
|
|
518
|
+ // // role := service.FindRoleByUserTypeTwo(item.OrgId)
|
|
519
|
+ // // ids = ids +"," + strconv.FormatInt(role.Id,10)
|
|
520
|
+ // // }
|
|
521
|
+ // // service.UpdateRoleIds(item.Id, ids)
|
|
522
|
+ // //}
|
470
|
523
|
c.ServeSuccessJSON(map[string]interface{}{
|
471
|
524
|
"msg": "ok",
|
472
|
525
|
})
|
|
@@ -476,7 +529,7 @@ func (c *PublicApiController) HandleData() {
|
476
|
529
|
func InitRoleAndPurviews(org_ids []int64) {
|
477
|
530
|
roles := LoadRoleConfig("./role.json").Roles
|
478
|
531
|
for _, org_id := range org_ids {
|
479
|
|
- app, _ := service.GetOrgApp(org_id, 3)
|
|
532
|
+ app, _ := service.GetOrgAppB(org_id, 3)
|
480
|
533
|
if app == nil || app.Id == 0 {
|
481
|
534
|
continue
|
482
|
535
|
}
|
|
@@ -494,7 +547,7 @@ func InitRoleAndPurviews(org_ids []int64) {
|
494
|
547
|
Number: item.Number,
|
495
|
548
|
IsSystem: item.IsSystem,
|
496
|
549
|
}
|
497
|
|
- err := service.CreateOrgRole(role)
|
|
550
|
+ err := service.CreateOrgRoleB(role)
|
498
|
551
|
if err == nil {
|
499
|
552
|
purview := &models.RolePurview{
|
500
|
553
|
RoleId: role.Id,
|
|
@@ -515,8 +568,8 @@ func InitRoleAndPurviews(org_ids []int64) {
|
515
|
568
|
Mtime: time.Now().Unix(),
|
516
|
569
|
}
|
517
|
570
|
|
518
|
|
- service.CreateRolePurview(purview)
|
519
|
|
- service.CreateFuncRolePurview(func_purview)
|
|
571
|
+ service.CreateRolePurviewB(purview)
|
|
572
|
+ service.CreateFuncRolePurviewB(func_purview)
|
520
|
573
|
}
|
521
|
574
|
}
|
522
|
575
|
|