Browse Source

no message

xingzai 1 year ago
parent
commit
c24d21b120
3 changed files with 36 additions and 8 deletions
  1. 11 0
      controllers/user.go
  2. 8 8
      controllers/yanxuan_special.go
  3. 17 0
      services/user_yanxuan_permission.go

+ 11 - 0
controllers/user.go

@@ -987,6 +987,17 @@ func (this *UserController) ApplyTryOut() {
 		}
 		title = ProductInteriorDetail.Title
 		source = "productinterior"
+	} else if tryType == "YanxuanSpecial" {
+		// 研选专栏
+		YanxuanSpecialBySpeciaDetail, e := models.GetYanxuanSpecialBySpecialId(detailId)
+		if e != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "产品内测信息有误, 不存在的detailId: " + strconv.Itoa(detailId)
+			return
+		}
+		title = YanxuanSpecialBySpeciaDetail.Title
+		source = "yanxuanspecial"
+		isResearch = true
 	}
 
 	//缓存校验

+ 8 - 8
controllers/yanxuan_special.go

@@ -217,7 +217,7 @@ func (this *BaseAuthMobileController) Detail() {
 	resp.ExamineStatus = item.Status
 	if item.UserId != user.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, user.Mobile) {
 		resp.CygxYanxuanSpecialItem = *new(models.CygxYanxuanSpecialItem) // 如果内容不可见,就把内容置空
-		resp.HasPermission = 2
+		//resp.HasPermission = 2
 	}
 
 	//如果在web端有样式或者上传了文件,小程序就禁止编辑修改内容
@@ -234,13 +234,13 @@ func (this *BaseAuthMobileController) Detail() {
 	}
 
 	var hasPermission int
-	if userId > 0 {
-		hasPermission, err = services.GetUserYxHasPermissionCode(user)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败, Err:" + err.Error()
-		}
-	}
+	//if userId > 0 {
+	//	hasPermission, err = services.GetUserYxHasPermissionCode(user)
+	//	if err != nil {
+	//		br.Msg = "获取失败"
+	//		br.ErrMsg = "获取失败, Err:" + err.Error()
+	//	}
+	//}
 
 	//if userId == 0 {
 	//	hasPermission = 1

+ 17 - 0
services/user_yanxuan_permission.go

@@ -27,6 +27,23 @@ func GetMfyxUserPermissionTotal(userId int) (toatal int) {
 
 // 查询研选的权限状态
 func GetUserRaiPermissionYanXuanInfo(user *models.WxUserItem) (hasPermission int, err error) {
+	uid := user.UserId
+	applyCount, e := models.GetApplyRecordCount(uid)
+	if e != nil {
+		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
+		return
+	}
+	if user.CompanyId <= 1 {
+		if applyCount == 0 {
+			hasPermission = 4
+		} else {
+			hasPermission = 5
+		}
+	} else {
+		hasPermission = 3
+	}
+
+	return
 	//判断用户是否开通了个人研选权限
 	mfyxUserPermissionTotal := GetMfyxUserPermissionTotal(user.UserId)
 	if mfyxUserPermissionTotal == 1 {