Kaynağa Gözat

修复登录 app 优先级选择的 bug

庄逸洲 5 yıl önce
ebeveyn
işleme
ae4c2522d8

+ 8 - 8
controllers/verify_token_controller.go Dosyayı Görüntüle

@@ -416,14 +416,6 @@ func (this *VerifyTokenController) _createAppIfNeeded(adminUserID int, orgID int
416 416
 
417 417
 	// 自动创建所有应用
418 418
 	didCreateNew := false
419
-	if did_patient_manage_create == false {
420
-		err := service.CreateOrgApp(adminUserID, orgID, 1, false)
421
-		if err != nil {
422
-			utils.ErrorLog("自动创建酷医聚客应用失败:%v", err)
423
-			return false, &enums.SGJError{Code: enums.ErrorCodeDataException}
424
-		}
425
-		didCreateNew = true
426
-	}
427 419
 	if did_dialysis_manage_create == false {
428 420
 		err := service.CreateOrgApp(adminUserID, orgID, 3, false)
429 421
 		if err != nil {
@@ -440,6 +432,14 @@ func (this *VerifyTokenController) _createAppIfNeeded(adminUserID int, orgID int
440 432
 		}
441 433
 		didCreateNew = true
442 434
 	}
435
+	if did_patient_manage_create == false {
436
+		err := service.CreateOrgApp(adminUserID, orgID, 1, false)
437
+		if err != nil {
438
+			utils.ErrorLog("自动创建酷医聚客应用失败:%v", err)
439
+			return false, &enums.SGJError{Code: enums.ErrorCodeDataException}
440
+		}
441
+		didCreateNew = true
442
+	}
443 443
 	if did_mall_manage_create == false {
444 444
 		err := service.CreateOrgApp(adminUserID, orgID, 5, false)
445 445
 		if err != nil {

+ 1 - 1
service/login_service.go Dosyayı Görüntüle

@@ -73,7 +73,7 @@ func GetAdminUserLastLoginLog(adminUserID int, appType int) (*models.AdminUserLo
73 73
 }
74 74
 
75 75
 func GetAdminUserPrioritizedAppType(adminUserID int) (int8, error) {
76
-	rows, err := readUserDb.Raw("SELECT app.app_type FROM sgj_user_org_app AS app, sgj_user_admin_role AS r WHERE r.admin_user_id = ? AND r.app_id = app.id AND app.status = 1 AND r.status = 1 ORDER BY app.org_id ASC, app.app_type ASC LIMIT 1;", adminUserID).Rows()
76
+	rows, err := readUserDb.Raw("SELECT app.app_type FROM sgj_user_org_app AS app, sgj_user_admin_role AS r WHERE r.admin_user_id = ? AND r.app_id = app.id AND app.status = 1 AND app.open_status = 1 AND r.status = 1 ORDER BY app.org_id ASC, app.app_type ASC LIMIT 1;", adminUserID).Rows()
77 77
 	defer rows.Close()
78 78
 	if err != nil {
79 79
 		return 0, err

+ 4 - 3
service/org_service.go Dosyayı Görüntüle

@@ -30,15 +30,16 @@ func CreateOrg(org *models.Org, mobile string, openXT bool, openCDM bool, openSC
30 30
 		return err
31 31
 	}
32 32
 
33
-	if err := createOrgApp(tx_admin, &role, mobile, 1, openSCRM); err != nil {
33
+	// app 的创建顺序也决定了登录后前往 app 的优先级
34
+	if err := createOrgApp(tx_admin, &role, mobile, 3, openXT); err != nil {
34 35
 		tx_admin.Rollback()
35 36
 		return err
36 37
 	}
37
-	if err := createOrgApp(tx_admin, &role, mobile, 3, openXT); err != nil {
38
+	if err := createOrgApp(tx_admin, &role, mobile, 4, openCDM); err != nil {
38 39
 		tx_admin.Rollback()
39 40
 		return err
40 41
 	}
41
-	if err := createOrgApp(tx_admin, &role, mobile, 4, openCDM); err != nil {
42
+	if err := createOrgApp(tx_admin, &role, mobile, 1, openSCRM); err != nil {
42 43
 		tx_admin.Rollback()
43 44
 		return err
44 45
 	}