Ver código fonte

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

csx 4 anos atrás
pai
commit
cdcae894d5

+ 2 - 3
controllers/base_api_controller.go Ver arquivo

@@ -69,8 +69,8 @@ func (this *BaseAuthAPIController) Prepare() {
69 69
 		//userAdmin.Id = 400
70 70
 		//userAdmin.Mobile = "13535547901"
71 71
 		//
72
-		//userAdmin.Id = 597
73
-		//userAdmin.Mobile = "19874122664"
72
+		////userAdmin.Id = 597
73
+		////userAdmin.Mobile = "19874122664"
74 74
 		//userAdmin.IsSuperAdmin = false
75 75
 		//userAdmin.Status = 1
76 76
 		//userAdmin.CreateTime = 1530786071
@@ -100,7 +100,6 @@ func (this *BaseAuthAPIController) Prepare() {
100 100
 	adminUserInfo := this.GetAdminUserInfo()
101 101
 
102 102
 	if this.Ctx.Request.Header.Get("Permission") == "2" {
103
-		fmt.Println("1111111")
104 103
 		org, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
105 104
 		if adminUserInfo.AdminUser.Id != org.Creator { //超级管理员不受此限制
106 105
 

+ 38 - 17
controllers/verify_login_controller.go Ver arquivo

@@ -161,12 +161,12 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
161 161
 				}
162 162
 			}
163 163
 
164
+			var pruviews []*models.Purview
164 165
 			var curAppUrlfors []string
165 166
 			if len(curAppUrlfors) == 0 {
166 167
 				if adminUser.Id == curOrg.Creator { //超级管理员
167 168
 					urlfors, _, _ := service.GetSuperAdminUsersPurviewTreeAndUrlfors(3)
168 169
 					curAppUrlfors = urlfors
169
-
170 170
 				} else {
171 171
 					appRole, _ := service.FindAdminUserIDA(appRole.Id)
172 172
 					if appRole.Id > 0 && len(appRole.RoleIds) > 0 {
@@ -181,33 +181,54 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
181 181
 								ids = ids + "," + purview_ids
182 182
 							}
183 183
 						}
184
-						pruviews, _ := service.GetPurviewById(ids)
185
-						for _, item := range pruviews {
186
-							if item.Module == 3 && item.Parentid > 0 {
187
-								fmt.Println(item.Urlfor)
188
-								curAppUrlfors = append(curAppUrlfors, item.Urlfor)
184
+						if len(ids) != 0 {
185
+							pruviews, _ = service.GetPurviewById(ids)
186
+							for _, item := range pruviews {
187
+								if item.Module == 3 && item.Parentid > 0 {
188
+									fmt.Println(item.Urlfor)
189
+									curAppUrlfors = append(curAppUrlfors, item.Urlfor)
190
+								}
189 191
 							}
192
+						} else {
193
+
194
+							curAppUrlfors = append(curAppUrlfors, "")
190 195
 						}
191 196
 					}
192 197
 				}
193 198
 			}
194 199
 
200
+			var didRegistedForSCRM bool = false
201
+			var didRegistedForCDM bool = false
202
+			var didRegistedForMall bool = false
203
+
204
+			for _, item := range pruviews {
205
+				if item.Module == 6 {
206
+					didRegistedForSCRM = true
207
+				}
208
+				if item.Module == 4 {
209
+					didRegistedForCDM = true
210
+				}
211
+				if item.Module == 7 {
212
+					didRegistedForMall = true
213
+				}
214
+			}
215
+
195 216
 			subscibe, _ := service.GetOrgSubscibe(adminUserInfo.CurrentOrgId)
196 217
 
197 218
 			this.SetSession("admin_user_info", adminUserInfo)
198 219
 
199 220
 			this.ServeSuccessJSON(map[string]interface{}{
200
-				"user":           userInfo,
201
-				"org":            org,
202
-				"urlfors":        curAppUrlfors,
203
-				"current_org_id": adminUserInfo.CurrentOrgId,
204
-				"current_app_id": adminUserInfo.CurrentAppId,
205
-				"subscibe":       subscibe,
206
-				//"scrm_role_exist": didRegistedForSCRM,
207
-				//"cdm_role_exist":  didRegistedForCDM,
208
-				//"mall_role_exist": didRegistedForMall,
209
-				"template_info": template_info,
210
-				"fileds":        FiledList,
221
+				"user":            userInfo,
222
+				"org":             org,
223
+				"urlfors":         curAppUrlfors,
224
+				"current_org_id":  adminUserInfo.CurrentOrgId,
225
+				"current_app_id":  adminUserInfo.CurrentAppId,
226
+				"subscibe":        subscibe,
227
+				"scrm_role_exist": didRegistedForSCRM,
228
+				"cdm_role_exist":  didRegistedForCDM,
229
+				"mall_role_exist": didRegistedForMall,
230
+				"template_info":   template_info,
231
+				"fileds":          FiledList,
211 232
 			})
212 233
 			return
213 234
 		}