Эх сурвалжийг харах

Merge branch 'cygx_4.4' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 3 жил өмнө
parent
commit
89b0cd8473
1 өөрчлөгдсөн 58 нэмэгдсэн , 55 устгасан
  1. 58 55
      controllers/activity.go

+ 58 - 55
controllers/activity.go

@@ -574,18 +574,13 @@ func (this *ActivityCoAntroller) Detail() {
 		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 		return
 	}
-	//如果是FICC的客户类型,则默认他申请过
-	if applyCount == 0 {
-		//获取销售信息
-		sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "申请失败"
-			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-			return
-		}
-		if sellerItem != nil {
-			applyCount = 1
-		}
+
+	//获取FICC销售信息 如果是FICC的客户类型,则默认他申请过
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
+		return
 	}
 	if user.CompanyId <= 1 {
 		companyDetailStatus = ""
@@ -602,6 +597,9 @@ func (this *ActivityCoAntroller) Detail() {
 			} else {
 				hasPermission = 3
 			}
+			if sellerItem != nil {
+				hasPermission = 2
+			}
 			resp.HasPermission = hasPermission
 			resp.OperationMode = "Apply"
 			resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
@@ -681,7 +679,11 @@ func (this *ActivityCoAntroller) Detail() {
 		//冻结客户
 		if err != nil {
 			if err.Error() == utils.ErrNoRow() {
-				resp.HasPermission = 4
+				hasPermission = 4
+				if sellerItem != nil {
+					hasPermission = 2
+				}
+				resp.HasPermission = hasPermission
 				resp.OperationMode = "Apply"
 				resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 				br.Ret = 200
@@ -725,6 +727,9 @@ func (this *ActivityCoAntroller) Detail() {
 		} else {
 			hasPermission = 3
 		}
+		if sellerItem != nil {
+			hasPermission = 2
+		}
 		resp.OperationMode = "Apply"
 		resp.PopupMsg = "您暂无权限参加 【" + activityInfo.ChartPermissionName + "】行业活动,若想参加可以申请开通哦"
 	}
@@ -798,19 +803,15 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 		return
 	}
-	//如果是FICC的客户类型,则默认他申请过
-	if applyCount == 0 {
-		//获取销售信息
-		sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "申请失败"
-			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-			return
-		}
-		if sellerItem != nil {
-			applyCount = 1
-		}
+
+	//获取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 {
 		br.Msg = "操作失败"
@@ -840,6 +841,9 @@ func (this *ActivityCoAntroller) SignupAdd() {
 			} else {
 				hasPermission = 3
 			}
+			if sellerItem != nil {
+				hasPermission = 2
+			}
 			resp.HasPermission = hasPermission
 			resp.OperationMode = "Apply"
 			resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
@@ -882,18 +886,15 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		//冻结客户
 		if err != nil {
 			if err.Error() == utils.ErrNoRow() {
-				//获取销售信息
-				sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-				if err != nil && err.Error() != utils.ErrNoRow() {
-					br.Msg = "申请失败"
-					br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-					return
+				if applyCount > 0 {
+					hasPermission = 3
+				} else {
+					hasPermission = 4
 				}
 				if sellerItem != nil {
-					resp.HasPermission = 3
-				} else {
-					resp.HasPermission = 4
+					hasPermission = 2
 				}
+				resp.HasPermission = hasPermission
 				resp.OperationMode = "Apply"
 				resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 				br.Ret = 200
@@ -1128,6 +1129,9 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		} else {
 			hasPermission = 3
 		}
+		if sellerItem != nil {
+			hasPermission = 2
+		}
 		resp.OperationMode = "Apply"
 		resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 	}
@@ -1432,19 +1436,15 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 		return
 	}
-	//如果是FICC的客户类型,则默认他申请过
-	if applyCount == 0 {
-		//获取销售信息
-		sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "申请失败"
-			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-			return
-		}
-		if sellerItem != nil {
-			applyCount = 1
-		}
+
+	//获取销售信息
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "申请失败"
+		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
+		return
 	}
+
 	//SignupStatus string `description:"报名状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
 	item := new(models.CygxActivityMeetingReminder)
 	resp := new(models.SignupStatus)
@@ -1465,6 +1465,9 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 			} else {
 				hasPermission = 3
 			}
+			if sellerItem != nil {
+				hasPermission = 2
+			}
 			resp.HasPermission = hasPermission
 			resp.OperationMode = "Apply"
 			resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
@@ -1511,18 +1514,15 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 		if err != nil {
 			if err.Error() == utils.ErrNoRow() {
 				//如果是FICC的客户类型,则默认他申请过
-				//获取销售信息
-				sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-				if err != nil && err.Error() != utils.ErrNoRow() {
-					br.Msg = "申请失败"
-					br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-					return
+				if applyCount > 0 {
+					hasPermission = 4
+				} else {
+					hasPermission = 3
 				}
 				if sellerItem != nil {
-					resp.HasPermission = 3
-				} else {
-					resp.HasPermission = 4
+					hasPermission = 2
 				}
+				resp.HasPermission = hasPermission
 				resp.OperationMode = "Apply"
 				resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 				br.Ret = 200
@@ -1590,6 +1590,9 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 		} else {
 			hasPermission = 3
 		}
+		if sellerItem != nil {
+			hasPermission = 2
+		}
 		resp.OperationMode = "Apply"
 		resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
 	}