caipin 4 سال پیش
والد
کامیت
edbd136f66
2فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 1 1
      conf/redis.go
  2. 7 2
      web/middleware/accessAuth.go

+ 1 - 1
conf/redis.go

@@ -33,4 +33,4 @@ var RdsCacheList = []RdsConfig{
 	},
 }
 
-var RdsCache RdsConfig = RdsCacheList[1]
+var RdsCache RdsConfig = RdsCacheList[0]

+ 7 - 2
web/middleware/accessAuth.go

@@ -45,6 +45,13 @@ type path struct {
 // 权限验证中间件
 func AccessAuth(ctx iris.Context) {
 
+	// 1.获得成员信息
+	account := ctx.Values().Get("account").(*models.CmProjectAccount)
+	if account.Enable == 0 {
+		ctx.JSON(iris.Map{"code": 2, "msg": "该账号被禁用"})
+		return
+	}
+
 	// 需要先设置标段ID,在获得权限进行判断
 	// 账号活动状态下,入口必须是 /api/contract/survey,
 	path := ctx.Path()
@@ -52,8 +59,6 @@ func AccessAuth(ctx iris.Context) {
 		ctx.Next()
 		return
 	}
-	// 1.获得成员信息
-	account := ctx.Values().Get("account").(*models.CmProjectAccount)
 
 	// 1-1获得标段ID
 	key := fmt.Sprintf("pm_%d_%d", account.ProjectId, account.Id)