Browse Source

no message

xingzai 2 years ago
parent
commit
230876593e
2 changed files with 228 additions and 308 deletions
  1. 173 308
      controllers/activity.go
  2. 55 0
      services/company_permission.go

+ 173 - 308
controllers/activity.go

@@ -532,13 +532,12 @@ func (this *ActivityCoAntroller) Detail() {
 		//处理按钮是否展示问题
 		resp.Detail = services.ActivityButtonShow(activityInfo)
 	} else {
-		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
+		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
 		if err != nil {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 			return
 		}
-		popupMsg = "暂无查看权限"
 		resp.PopupMsg = popupMsg
 		resp.HasPermission = hasPermission
 		resp.SellerName = sellerName
@@ -601,40 +600,6 @@ func (this *ActivityCoAntroller) SignupAdd() {
 	if signupType == 1 && user.Mobile == "" && user.OutboundMobile == "" {
 		resp.GoBindEmail = true
 	}
-	//处理冻结客户,流失客户的弹窗提示
-	if user.CompanyId > 1 {
-		sellerMobile, sellerRealName, err := services.CheckActivityUserPermission(user)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-			return
-		}
-		if sellerMobile != "" {
-			resp.HasPermission = 2
-			resp.SellerMobile = sellerMobile
-			resp.SellerName = sellerRealName
-			br.Ret = 200
-			br.Success = true
-			br.Msg = "获取成功"
-			br.Data = resp
-			return
-		}
-	}
-	//判断是否已经申请过
-	applyCount, err := models.GetApplyRecordCount(uid)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-		return
-	}
-
-	//获取FICC销售信息
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "申请失败"
-		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-		return
-	}
 
 	activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
 	if activityInfo == nil {
@@ -650,59 +615,8 @@ func (this *ActivityCoAntroller) SignupAdd() {
 	//SignupStatus "报名状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
 	//HasPermission "1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
 
-	companyPermission, err := models.GetCompanyPermission(user.CompanyId)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-		return
-	}
-	if companyPermission == "" {
-		if applyCount > 0 {
-			hasPermission = 4
-		} else {
-			if sellerItem != nil {
-				hasPermission = 5
-			} else {
-				//获取权益销售信息 如果是FICC的客户类型,则默认他申请过
-				sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-				if err != nil && err.Error() != utils.ErrNoRow() {
-					br.Msg = "获取信息失败"
-					br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-					return
-				}
-				if sellerItemQy != nil {
-					hasPermission = 2
-					resp.SellerMobile = sellerItemQy.Mobile
-					resp.SellerName = sellerItemQy.RealName
-				} else {
-					hasPermission = 3
-				}
-			}
-		}
-		resp.HasPermission = hasPermission
-		resp.ActivityId = activityId
-		resp.OperationMode = "Apply"
-		resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
-		br.Ret = 200
-		br.Success = true
-		br.Msg = "获取成功"
-		br.Data = resp
-		return
-	}
-	companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
-	if err != nil {
-		br.Msg = "获取信息失败!"
-		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-		return
-	}
-	if companyDetail == nil {
-		br.Msg = "获取信息失败!"
-		br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId) + "CompanyId:" + strconv.Itoa(user.CompanyId)
-		return
-	}
 	var userType int
-	var permissionStr string
-	userType, permissionStr, err = services.GetUserType(user.CompanyId)
+	userType, _, err = services.GetUserType(user.CompanyId)
 	if err != nil {
 		br.Msg = "获取信息失败!"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
@@ -713,212 +627,137 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		br.ErrMsg = "被分享客户不可见,永续客户无法查看研选行业"
 		return
 	}
-
 	item := new(models.CygxActivitySignup)
-	if user.CompanyId > 1 {
-		companyItem, err := models.GetCompanyDetailById(user.CompanyId)
-		//冻结客户
+
+	//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
+	//OperationMode     string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
+	//havePower, err := services.GetHavePower(activityInfo, permissionStr, companyDetailStatus, userType)
+	//if err != nil {
+	//	br.Msg = "获取信息失败!"
+	//	br.ErrMsg = "获取失败,Err:" + err.Error()
+	//	return
+	//}
+	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
+		return
+	}
+	if havePower {
+		hasPermission = 1
+		signupStatus = "Success"
+		resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
+		if time.Now().After(resultTime.Add(-time.Minute * 60)) {
+			signupStatus = "Overtime"
+			resp.SignupType = signupType
+			resp.SignupStatus = signupStatus
+			resp.HasPermission = hasPermission
+			resp.PopupMsg = "活动开始前1小时内无法预约,请联系对口销售处理"
+			br.Ret = 200
+			br.Success = true
+			br.Msg = ""
+			br.Data = resp
+			return
+		}
+		var sellerName string
+		sellerName, err = models.GetCompanySellerName(user.CompanyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
-				if applyCount > 0 {
-					hasPermission = 4
-				} else {
-					if sellerItem != nil {
-						hasPermission = 5
-					} else {
-						hasPermission = 3
-					}
-				}
-				resp.ActivityId = activityId
-				resp.HasPermission = hasPermission
-				resp.OperationMode = "Apply"
-				resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
-				br.Ret = 200
-				br.Success = true
-				br.Msg = "获取成功"
-				br.Data = resp
+			br.Msg = "报名失败!"
+			br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
+			return
+		}
+		//人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
+		//如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
+		//if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
+		if activityInfo.IsLimitPeople == 1 {
+			//判断优先级:总人数限制→单机构2人限制→爽约3次限制
+			totalRestrict, err := models.GetUserRestrictCount(user.Mobile)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
 				return
-			} else {
+			}
+			if totalRestrict >= 1 {
+				signupStatus = "BreakPromise"
+				resp.PopupMsg = "由于爽约次数过多,您暂时被限制报名资格,请联系对口销售"
+				item.FailType = 3
+			}
+			totalSignupCompany, err := models.GetActivitySignupCompanyCount(activityId, user.CompanyId)
+			if err != nil {
 				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取客户公司信息失败,Err:" + err.Error()
+				br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
 				return
 			}
-		}
-		//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
-		//OperationMode     string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
-		//havePower, err := services.GetHavePower(activityInfo, permissionStr, companyDetailStatus, userType)
-		//if err != nil {
-		//	br.Msg = "获取信息失败!"
-		//	br.ErrMsg = "获取失败,Err:" + err.Error()
-		//	return
-		//}
-		havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
-			return
-		}
-		if havePower {
-			hasPermission = 1
-			signupStatus = "Success"
-			resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
-			if time.Now().After(resultTime.Add(-time.Minute * 60)) {
-				signupStatus = "Overtime"
-				resp.SignupType = signupType
-				resp.SignupStatus = signupStatus
-				resp.HasPermission = hasPermission
-				resp.PopupMsg = "活动开始前1小时内无法预约,请联系对口销售处理"
-				br.Ret = 200
-				br.Success = true
-				br.Msg = ""
-				br.Data = resp
+			if totalSignupCompany >= 2 {
+				signupStatus = "TwoPeople"
+				resp.PopupMsg = "单机构最多2人报名同一活动,您所在机构报名人数已满"
+				item.FailType = 2
+			}
+			totaSignupPeopleNum, err := models.GetActivitySignupSuccessCount(activityId)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
 				return
 			}
-			var sellerName string
-			sellerName, err = models.GetCompanySellerName(user.CompanyId)
+			if totaSignupPeopleNum >= activityInfo.LimitPeopleNum {
+				signupStatus = "FullStarffed"
+				resp.PopupMsg = "此活动报名人数已满,请留意下期活动"
+				item.FailType = 1
+			}
+			totalUserRestrictCount, err := models.GetActivitySignupByUserRestrictCount(uid, activityId)
 			if err != nil {
-				br.Msg = "报名失败!"
-				br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取失败,Err:" + err.Error()
 				return
 			}
-			//人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
-			//如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
-			//if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
-			if activityInfo.IsLimitPeople == 1 {
-				//判断优先级:总人数限制→单机构2人限制→爽约3次限制
-				totalRestrict, err := models.GetUserRestrictCount(user.Mobile)
-				if err != nil {
-					br.Msg = "获取信息失败"
-					br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
-					return
-				}
-				if totalRestrict >= 1 {
-					signupStatus = "BreakPromise"
-					resp.PopupMsg = "由于爽约次数过多,您暂时被限制报名资格,请联系对口销售"
-					item.FailType = 3
-				}
-				totalSignupCompany, err := models.GetActivitySignupCompanyCount(activityId, user.CompanyId)
-				if err != nil {
-					br.Msg = "获取信息失败"
-					br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+			//解除报名限制之后二次报名相同活动
+			if totalUserRestrictCount > 0 && totalRestrict == 0 && resp.GoBindEmail != true {
+				item.UserId = uid
+				item.RealName = user.RealName
+				item.SellerName = sellerName
+				item.ActivityId = activityId
+				item.CreateTime = time.Now()
+				item.Mobile = user.Mobile
+				item.Email = user.Email
+				item.CompanyId = user.CompanyId
+				item.CompanyName = user.CompanyName
+				item.SignupType = signupType
+				item.FailType = 0
+				item.DoFailType = 0
+				_, errSignup := models.AddActivitySignupByRestrict(item)
+				if errSignup != nil {
+					br.Msg = "操作失败"
+					br.ErrMsg = "操作失败,Err:" + errSignup.Error()
 					return
 				}
-				if totalSignupCompany >= 2 {
-					signupStatus = "TwoPeople"
-					resp.PopupMsg = "单机构最多2人报名同一活动,您所在机构报名人数已满"
-					item.FailType = 2
-				}
-				totaSignupPeopleNum, err := models.GetActivitySignupSuccessCount(activityId)
+				resp.HaqveJurisdiction = true
+				resp.SignupType = signupType
+				resp.SignupStatus = "Success"
+				resp.HasPermission = hasPermission
+				resp.ActivityId = activityId
+				total, err = models.GetUserMeetingReminderCount(user.UserId)
 				if err != nil {
 					br.Msg = "获取信息失败"
-					br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
-					return
-				}
-				if totaSignupPeopleNum >= activityInfo.LimitPeopleNum {
-					signupStatus = "FullStarffed"
-					resp.PopupMsg = "此活动报名人数已满,请留意下期活动"
-					item.FailType = 1
-				}
-				totalUserRestrictCount, err := models.GetActivitySignupByUserRestrictCount(uid, activityId)
-				if err != nil {
-					br.Msg = "获取失败"
-					br.ErrMsg = "获取失败,Err:" + err.Error()
-					return
-				}
-				//解除报名限制之后二次报名相同活动
-				if totalUserRestrictCount > 0 && totalRestrict == 0 && resp.GoBindEmail != true {
-					item.UserId = uid
-					item.RealName = user.RealName
-					item.SellerName = sellerName
-					item.ActivityId = activityId
-					item.CreateTime = time.Now()
-					item.Mobile = user.Mobile
-					item.Email = user.Email
-					item.CompanyId = user.CompanyId
-					item.CompanyName = user.CompanyName
-					item.SignupType = signupType
-					item.FailType = 0
-					item.DoFailType = 0
-					_, errSignup := models.AddActivitySignupByRestrict(item)
-					if errSignup != nil {
-						br.Msg = "操作失败"
-						br.ErrMsg = "操作失败,Err:" + errSignup.Error()
-						return
-					}
-					resp.HaqveJurisdiction = true
-					resp.SignupType = signupType
-					resp.SignupStatus = "Success"
-					resp.HasPermission = hasPermission
-					resp.ActivityId = activityId
-					total, err = models.GetUserMeetingReminderCount(user.UserId)
-					if err != nil {
-						br.Msg = "获取信息失败"
-						br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
-						return
-					}
-					if total == 0 {
-						resp.GoFollow = true
-					}
-					br.Ret = 200
-					br.Success = true
-					br.Msg = "操作成功"
-					br.Data = resp
-					return
-				}
-				totalMy, err := models.GetActivitySignupByUserCount(uid, activityId)
-				if err != nil {
-					br.Msg = "获取失败"
-					br.ErrMsg = "获取失败,Err:" + err.Error()
+					br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
 					return
 				}
-
-				if signupStatus != "Success" && totalMy == 0 && resp.GoBindEmail != true {
-					item.UserId = uid
-					item.RealName = user.RealName
-					item.SellerName = sellerName
-					item.ActivityId = activityId
-					item.CreateTime = time.Now()
-					item.Mobile = user.Mobile
-					item.Email = user.Email
-					item.CompanyId = user.CompanyId
-					item.CompanyName = user.CompanyName
-					item.SignupType = signupType
-					item.DoFailType = item.FailType
-					if user.OutboundMobile != "" {
-						item.OutboundMobile = user.OutboundMobile
-						if user.OutboundCountryCode == "" {
-							item.CountryCode = "86"
-						} else {
-							item.CountryCode = user.OutboundCountryCode
-						}
-					} else {
-						item.OutboundMobile = user.Mobile
-						if user.CountryCode == "" {
-							item.CountryCode = "86"
-						} else {
-							item.CountryCode = user.CountryCode
-						}
-					}
-					//添加报名信息,但是不加入日程
-					_, errSignup := models.AddActivitySignupNoSchedule(item)
-					if errSignup != nil {
-						br.Msg = "操作失败"
-						br.ErrMsg = "操作失败,Err:" + errSignup.Error()
-						return
-					}
+				if total == 0 {
+					resp.GoFollow = true
 				}
+				br.Ret = 200
+				br.Success = true
+				br.Msg = "操作成功"
+				br.Data = resp
+				return
 			}
-			totalMySuccess, err := models.GetActivitySignupCount(uid, activityId)
+			totalMy, err := models.GetActivitySignupByUserCount(uid, activityId)
 			if err != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取失败,Err:" + err.Error()
 				return
 			}
-			if totalMySuccess > 0 {
-				br.Msg = "您已报名这个活动"
-				return
-			}
-			if signupStatus == "Success" && resp.GoBindEmail != true {
+
+			if signupStatus != "Success" && totalMy == 0 && resp.GoBindEmail != true {
 				item.UserId = uid
 				item.RealName = user.RealName
 				item.SellerName = sellerName
@@ -929,9 +768,7 @@ func (this *ActivityCoAntroller) SignupAdd() {
 				item.CompanyId = user.CompanyId
 				item.CompanyName = user.CompanyName
 				item.SignupType = signupType
-				item.FailType = 0
-				item.DoFailType = 0
-				item.OutboundMobile = user.Mobile
+				item.DoFailType = item.FailType
 				if user.OutboundMobile != "" {
 					item.OutboundMobile = user.OutboundMobile
 					if user.OutboundCountryCode == "" {
@@ -947,53 +784,83 @@ func (this *ActivityCoAntroller) SignupAdd() {
 						item.CountryCode = user.CountryCode
 					}
 				}
-				_, errSignup := models.AddActivitySignup(item)
+				//添加报名信息,但是不加入日程
+				_, errSignup := models.AddActivitySignupNoSchedule(item)
 				if errSignup != nil {
 					br.Msg = "操作失败"
 					br.ErrMsg = "操作失败,Err:" + errSignup.Error()
 					return
 				}
-				resp.HaqveJurisdiction = true
-				//1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
-				if signupType == 1 {
-					go services.ActivityUserRemind(user, activityInfo, 1)
-					resp.PopupMsg = item.CountryCode + "-" + item.Mobile + "<br/>预约成功,已加入您的活动日程<br/><br/>想要及时获取活动时间变更通知,请关注【查研观向小助手】公众号"
-				} else {
-					go services.ActivityUserRemind(user, activityInfo, 4)
-					resp.PopupMsg = "报名成功,已加入您的活动日程<br/><br/>想要及时获取活动时间变更通知,请关注【查研观向小助手】公众号"
-				}
 			}
-		} else {
-			if companyItem.ProductId == 2 {
-				hasPermission = 2
-				resp.SellerMobile = companyItem.Mobile
-				resp.SellerName = companyItem.SellerName
-				resp.MsgType = "Type"
-				resp.OperationMode = "Call"
-				if permissionStr == "专家" {
-					resp.PopupMsg = "您暂无权限参加【" + activityInfo.ActivityTypeName + "】类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
-					resp.MsgType = "Type"
+		}
+		totalMySuccess, err := models.GetActivitySignupCount(uid, activityId)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+			return
+		}
+		if totalMySuccess > 0 {
+			br.Msg = "您已报名这个活动"
+			return
+		}
+		if signupStatus == "Success" && resp.GoBindEmail != true {
+			item.UserId = uid
+			item.RealName = user.RealName
+			item.SellerName = sellerName
+			item.ActivityId = activityId
+			item.CreateTime = time.Now()
+			item.Mobile = user.Mobile
+			item.Email = user.Email
+			item.CompanyId = user.CompanyId
+			item.CompanyName = user.CompanyName
+			item.SignupType = signupType
+			item.FailType = 0
+			item.DoFailType = 0
+			item.OutboundMobile = user.Mobile
+			if user.OutboundMobile != "" {
+				item.OutboundMobile = user.OutboundMobile
+				if user.OutboundCountryCode == "" {
+					item.CountryCode = "86"
 				} else {
-					resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
-					resp.MsgType = "Industry"
+					item.CountryCode = user.OutboundCountryCode
 				}
 			} else {
-				hasPermission = 5
+				item.OutboundMobile = user.Mobile
+				if user.CountryCode == "" {
+					item.CountryCode = "86"
+				} else {
+					item.CountryCode = user.CountryCode
+				}
 			}
-		}
-	} else { //潜在客户
-		if applyCount > 0 {
-			hasPermission = 4
-		} else {
-			if sellerItem != nil {
-				hasPermission = 5
+			_, errSignup := models.AddActivitySignup(item)
+			if errSignup != nil {
+				br.Msg = "操作失败"
+				br.ErrMsg = "操作失败,Err:" + errSignup.Error()
+				return
+			}
+			resp.HaqveJurisdiction = true
+			//1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
+			if signupType == 1 {
+				go services.ActivityUserRemind(user, activityInfo, 1)
+				resp.PopupMsg = item.CountryCode + "-" + item.Mobile + "<br/>预约成功,已加入您的活动日程<br/><br/>想要及时获取活动时间变更通知,请关注【查研观向小助手】公众号"
 			} else {
-				hasPermission = 3
+				go services.ActivityUserRemind(user, activityInfo, 4)
+				resp.PopupMsg = "报名成功,已加入您的活动日程<br/><br/>想要及时获取活动时间变更通知,请关注【查研观向小助手】公众号"
 			}
 		}
-		resp.OperationMode = "Apply"
-		resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+	} else {
+		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+			return
+		}
+		resp.PopupMsg = popupMsg
+		resp.HasPermission = hasPermission
+		resp.SellerName = sellerName
+		resp.SellerMobile = sellerMobile
 	}
+
 	if signupType == 1 && user.IsMsgOutboundMobile == 0 {
 		resp.GoOutboundMobile = true
 		if user.Mobile != "" || user.OutboundMobile != "" {
@@ -1304,12 +1171,10 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
 		return
 	}
-
 	//SignupStatus string `description:"报名状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
 	item := new(models.CygxActivityMeetingReminder)
 	resp := new(models.SignupStatus)
 	hasPermission := 0
-
 	//处理冻结客户,流失客户的弹窗提示
 	if user.CompanyId > 1 {
 		sellerMobile, sellerRealName, err := services.CheckActivityUserPermission(user)

+ 55 - 0
services/company_permission.go

@@ -139,3 +139,58 @@ func GetUserHasPermissionArticle(user *models.WxUserItem) (hasPermission int, se
 	popupMsg = "需要升级行业套餐权限才可查看此报告,请联系对口销售"
 	return
 }
+
+// 获取用户对应的权限申请状态 活动详情
+func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.ActivityDetail) (hasPermission int, sellerName, sellerMobile, popupMsg string, err error) {
+	//HasPermission     int    `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请,5:有IFCC、无权益"`
+	uid := user.UserId
+	applyCount, e := models.GetApplyRecordCount(uid)
+	if e != nil {
+		err = errors.New("GetApplyRecordCount, Err: " + e.Error())
+		return
+	}
+	companyItem, err := models.GetCompanyDetailById(user.CompanyId)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			if applyCount > 0 {
+				hasPermission = 4
+			} else {
+				//获取FICC销售信息
+				sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
+				if e != nil && e.Error() != utils.ErrNoRow() {
+					err = e
+					return
+				}
+				if sellerItem != nil {
+					hasPermission = 5
+				} else {
+					hasPermission = 3
+				}
+			}
+			hasPermission = hasPermission
+			popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+			return
+		} else {
+			return
+		}
+	}
+	if companyItem.ProductId == 2 {
+		hasPermission = 2
+		sellerMobile = companyItem.Mobile
+		sellerName = companyItem.SellerName
+		companyPermission, e := models.GetCompanyPermission(user.CompanyId)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetCompanyPermission, Err: " + e.Error())
+			return
+		}
+		if companyPermission == "专家" {
+			popupMsg = "您暂无权限参加【" + activityInfo.ActivityTypeName + "】类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+
+		} else {
+			popupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+		}
+	} else {
+		hasPermission = 5
+	}
+	return
+}