Quellcode durchsuchen

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

csx vor 4 Jahren
Ursprung
Commit
4ca1e45863

+ 112 - 0
controllers/dialysis_api_controller.go Datei anzeigen

@@ -54,6 +54,8 @@ func DialysisApiRegistRouters() {
54 54
 
55 55
 	beego.Router("/api/dryweight/commit", &DialysisApiController{}, "Post:UploadDryWeight")
56 56
 
57
+	beego.Router("/api/func_per/get", &DialysisApiController{}, "Get:GetFuncPurview")
58
+
57 59
 }
58 60
 
59 61
 func (c *DialysisApiController) PostPrescription() {
@@ -4932,3 +4934,113 @@ func (c *DialysisApiController) UploadDryWeight() {
4932 4934
 	}
4933 4935
 
4934 4936
 }
4937
+
4938
+func (this *DialysisApiController) GetFuncPurview() {
4939
+	adminUserInfo := this.GetAdminUserInfo()
4940
+	user_id := adminUserInfo.AdminUser.Id
4941
+	app_id := adminUserInfo.CurrentAppId
4942
+	org_id := adminUserInfo.CurrentOrgId
4943
+	create_url := this.GetString("create_url")
4944
+	modify_url := this.GetString("modify_url")
4945
+	modify_other_url := this.GetString("modify_other_url")
4946
+	del_url := this.GetString("del_url")
4947
+	del_other_url := this.GetString("del_other_url")
4948
+	exce_url := this.GetString("exce_url")
4949
+	check_url := this.GetString("check_url")
4950
+	modify_exce_url := this.GetString("modify_exce_url")
4951
+	module, _ := this.GetInt64("module", 0)
4952
+
4953
+	app_role, _ := service.GetAppRole(org_id, app_id, user_id)
4954
+	var is_has_create bool
4955
+	var is_has_modify bool
4956
+	var is_has_modify_other bool
4957
+	var is_has_del bool
4958
+	var is_has_del_other bool
4959
+	var is_has_exce bool
4960
+	var is_has_check bool
4961
+	var is_has_modify_exce bool
4962
+
4963
+	org, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
4964
+
4965
+	if adminUserInfo.AdminUser.Id != org.Creator {
4966
+
4967
+		if app_role != nil {
4968
+			if len(app_role.RoleIds) > 0 {
4969
+				roles := strings.Split(app_role.RoleIds, ",")
4970
+				var userRolePurviews string
4971
+				for _, item := range roles {
4972
+					role_id, _ := strconv.ParseInt(item, 10, 64)
4973
+					purviews, _ := service.GetRoleFuncPurviewIds(role_id)
4974
+					if len(userRolePurviews) == 0 {
4975
+						userRolePurviews = purviews
4976
+					} else {
4977
+						userRolePurviews = userRolePurviews + "," + purviews
4978
+					}
4979
+				}
4980
+				userRolePurviewsArr := RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
4981
+				funcPurviews, _ := service.FindAllFuncPurview(userRolePurviewsArr)
4982
+				for _, item := range funcPurviews {
4983
+					//for _, url := range strings.Split(item.Urlfor,","){
4984
+					if strings.Split(item.Urlfor, ",")[0] == create_url {
4985
+						is_has_create = true
4986
+					}
4987
+					if strings.Split(item.Urlfor, ",")[0] == modify_url {
4988
+						is_has_modify = true
4989
+					}
4990
+					if strings.Split(item.Urlfor, ",")[0] == modify_other_url {
4991
+						is_has_modify_other = true
4992
+					}
4993
+					if strings.Split(item.Urlfor, ",")[0] == del_url {
4994
+						is_has_del = true
4995
+					}
4996
+					if strings.Split(item.Urlfor, ",")[0] == del_other_url {
4997
+						is_has_del_other = true
4998
+					}
4999
+					if strings.Split(item.Urlfor, ",")[0] == exce_url {
5000
+						is_has_exce = true
5001
+					}
5002
+					if strings.Split(item.Urlfor, ",")[0] == check_url {
5003
+						is_has_check = true
5004
+					}
5005
+					if strings.Split(item.Urlfor, ",")[0] == modify_exce_url {
5006
+						is_has_modify_exce = true
5007
+					}
5008
+
5009
+				}
5010
+			} else {
5011
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRole)
5012
+				return
5013
+			}
5014
+			this.ServeSuccessJSON(map[string]interface{}{
5015
+				"is_has_create":       is_has_create,
5016
+				"is_has_modify":       is_has_modify,
5017
+				"is_has_modify_other": is_has_modify_other,
5018
+				"is_has_del":          is_has_del,
5019
+				"is_has_del_other":    is_has_del_other,
5020
+				"is_has_exce":         is_has_exce,
5021
+				"is_has_check":        is_has_check,
5022
+				"is_has_modify_exce":  is_has_modify_exce,
5023
+				"module":              module,
5024
+			})
5025
+		} else {
5026
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserIsExit)
5027
+			return
5028
+
5029
+		}
5030
+
5031
+	} else {
5032
+		this.ServeSuccessJSON(map[string]interface{}{
5033
+			"is_has_create":       true,
5034
+			"is_has_modify":       true,
5035
+			"is_has_modify_other": true,
5036
+			"is_has_del":          true,
5037
+			"is_has_del_other":    true,
5038
+			"is_has_exce":         true,
5039
+			"is_has_check":        true,
5040
+			"is_has_modify_exce":  true,
5041
+			"module":              true,
5042
+		})
5043
+
5044
+	}
5045
+
5046
+}

+ 2 - 2
controllers/new_mobile_api_controllers/role.json Datei anzeigen

@@ -18,7 +18,7 @@
18 18
       "is_system": 2,
19 19
       "number": 9998,
20 20
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,15571,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,155",
21
-      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028"
21
+      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20030"
22 22
 
23 23
 
24 24
     },
@@ -30,7 +30,7 @@
30 30
       "is_system": 3,
31 31
       "number": 9997,
32 32
       "purview_ids": "49,74,75,73,48,52,110,93,121,122,124,125,120",
33
-      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028"
33
+      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20051,20052,20053"
34 34
     },
35 35
     {
36 36
       "role_name": "库存",

+ 2 - 2
controllers/role.json Datei anzeigen

@@ -18,7 +18,7 @@
18 18
       "is_system": 2,
19 19
       "number": 9998,
20 20
       "purview_ids": "49,71,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,15571,72,70,74,75,73,127,128,48,52,110,93,121,122,124,125,120,101,100,102,156,157,158,159,155",
21
-      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028"
21
+      "func_ids": "20001,20002,20004,20005,20007,20008,20010,20011,20012,20034,20035,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20030"
22 22
 
23 23
 
24 24
     },
@@ -30,7 +30,7 @@
30 30
       "is_system": 3,
31 31
       "number": 9997,
32 32
       "purview_ids": "49,74,75,73,48,52,110,93,121,122,124,125,120",
33
-      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028"
33
+      "func_ids": "20007,20008,20010,20011,20012,20055,20056,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20051,20052,20053"
34 34
     }
35 35
   ]
36 36
 }

+ 8 - 4
controllers/verify_login_controller.go Datei anzeigen

@@ -141,6 +141,10 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
141 141
 				"address":        curOrg.Address,
142 142
 			}
143 143
 
144
+			var didRegistedForSCRM bool = false
145
+			var didRegistedForCDM bool = false
146
+			var didRegistedForMall bool = false
147
+
144 148
 			tempInfo, _ := service.GetOrgInfoTemplate(curOrg.Id)
145 149
 			fmt.Println("teimpInfo", tempInfo)
146 150
 			template_info := map[string]interface{}{
@@ -166,6 +170,10 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
166 170
 			if len(curAppUrlfors) == 0 {
167 171
 				if adminUser.Id == curOrg.Creator { //超级管理员
168 172
 					urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(3)
173
+					didRegistedForSCRM = true
174
+					didRegistedForCDM = true
175
+					didRegistedForMall = true
176
+
169 177
 					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(4)
170 178
 					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(5)
171 179
 					//urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(6)
@@ -204,10 +212,6 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
204 212
 				}
205 213
 			}
206 214
 
207
-			var didRegistedForSCRM bool = false
208
-			var didRegistedForCDM bool = false
209
-			var didRegistedForMall bool = false
210
-
211 215
 			for _, item := range pruviews {
212 216
 				if item.Module == 6 {
213 217
 					didRegistedForSCRM = true