Browse Source

弹窗提示消息修改

xingzai 3 years ago
parent
commit
3b09e738ec
4 changed files with 85 additions and 27 deletions
  1. 77 23
      controllers/activity.go
  2. 0 1
      controllers/report.go
  3. 3 0
      models/activity.go
  4. 5 3
      models/activity_signup.go

+ 77 - 23
controllers/activity.go

@@ -108,13 +108,10 @@ func (this *ActivityCoAntroller) ActivityList() {
 		return
 	}
 	var userType int
-
 	if user.CompanyId <= 1 {
 		userType = 0
 	} else {
-
 		companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
-
 		if err != nil {
 			br.Msg = "获取信息失败!"
 			br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
@@ -130,7 +127,6 @@ func (this *ActivityCoAntroller) ActivityList() {
 		//3、分行业套餐客户(开通对应行业的正式客户)
 		//4、仅开通专家套餐的正式客户
 		//5、开通对应行业套餐或专家套餐的试用客户
-
 		if companyDetail.Status == "永续" {
 			userType = 1
 		} else if companyDetail.Status == "试用" {
@@ -152,8 +148,6 @@ func (this *ActivityCoAntroller) ActivityList() {
 			}
 		}
 	}
-
-	fmt.Println(userType)
 	var startSize int
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
@@ -299,6 +293,24 @@ func (this *ActivityCoAntroller) Detail() {
 		br.Msg = "请输入活动ID"
 		return
 	}
+	var companyDetailStatus string
+	if user.CompanyId <= 1 {
+		companyDetailStatus = ""
+	} else {
+		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
+		}
+		companyDetailStatus = companyDetail.Status
+	}
+
 	activityInfo, err := models.GetAddActivityInfoByIdShow(uid, activityId)
 	if activityInfo == nil {
 		br.Msg = "活动不存在"
@@ -343,7 +355,7 @@ func (this *ActivityCoAntroller) Detail() {
 			if err.Error() == utils.ErrNoRow() {
 				resp.HasPermission = 4
 				resp.OperationMode = "Apply"
-				resp.PopupMsg = "您暂无权限参加 【" + activityInfo.ChartPermissionName + "】行业活动,若想参加可以申请开通哦"
+				resp.PopupMsg = "您暂无权限参加 【" + activityInfo.ChartPermissionName + "】行业活动"
 				br.Ret = 200
 				br.Success = true
 				br.Msg = "获取成功"
@@ -355,15 +367,18 @@ func (this *ActivityCoAntroller) Detail() {
 				return
 			}
 		}
+
 		//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
 		//OperationMode     string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
-		if (activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") {
+		if (activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式" {
 			hasPermission = 1
 			resp.HaqveJurisdiction = true
 		} else {
 			if activityInfo.ActivityTypeId != 1 && activityInfo.ActivityTypeId != 3 && permissionStr == "专家" {
-				resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+				resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动"
 				resp.SellerMobile = companyItem.Mobile
+				resp.SellerName = companyItem.SellerName
+				resp.MsgType = "Type"
 				resp.OperationMode = "Call"
 				hasPermission = 2
 			} else {
@@ -371,8 +386,10 @@ func (this *ActivityCoAntroller) Detail() {
 					hasPermission = 1
 					resp.HaqveJurisdiction = true
 				} else {
-					resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+					resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动"
 					resp.SellerMobile = companyItem.Mobile
+					resp.SellerName = companyItem.SellerName
+					resp.MsgType = "Industry"
 					resp.OperationMode = "Call"
 					hasPermission = 2
 				}
@@ -433,6 +450,23 @@ func (this *ActivityCoAntroller) SignupAdd() {
 	signupType := req.SignupType
 	//SignupStatus "报名状态:人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
 	//HasPermission "1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
+	var companyDetailStatus string
+	if user.CompanyId <= 1 {
+		companyDetailStatus = ""
+	} else {
+		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
+		}
+		companyDetailStatus = companyDetail.Status
+	}
 	item := new(models.CygxActivitySignup)
 	resp := new(models.SignupStatus)
 	hasPermission := 0
@@ -482,12 +516,14 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
 		//OperationMode     string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
 		if activityInfo.ActivityTypeId != 1 && activityInfo.ActivityTypeId != 3 && permissionStr == "专家" {
-			resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+			resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动"
 			resp.SellerMobile = companyItem.Mobile
+			resp.SellerName = companyItem.SellerName
+			resp.MsgType = "Type"
 			resp.OperationMode = "Call"
 			hasPermission = 2
 		} else {
-			if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || ((activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家")) {
+			if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || ((activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式") {
 				hasPermission = 1
 				signupStatus = "Success"
 				resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
@@ -506,7 +542,7 @@ func (this *ActivityCoAntroller) SignupAdd() {
 				//如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
 				if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
 					//判断优先级:总人数限制→单机构2人限制→爽约3次限制
-					totalRestrict, err := models.GetUserRestrictCount(user.UserId)
+					totalRestrict, err := models.GetUserRestrictCount(user.Mobile)
 					if err != nil {
 						br.Msg = "获取信息失败"
 						br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
@@ -635,8 +671,10 @@ func (this *ActivityCoAntroller) SignupAdd() {
 					resp.HaqveJurisdiction = true
 				}
 			} else {
-				resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+				resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动"
 				resp.SellerMobile = companyItem.Mobile
+				resp.SellerName = companyItem.SellerName
+				resp.MsgType = "Industry"
 				resp.OperationMode = "Call"
 				hasPermission = 2
 			}
@@ -910,7 +948,24 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 	item := new(models.CygxActivityMeetingReminder)
 	resp := new(models.SignupStatus)
 	hasPermission := 0
-
+	var companyDetailStatus string
+	if user.CompanyId <= 1 {
+		companyDetailStatus = ""
+	} else {
+		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
+		}
+		companyDetailStatus = companyDetail.Status
+	}
+	fmt.Println(companyDetailStatus)
 	//判断是否已经申请过
 	applyCount, err := models.GetApplyRecordCount(uid)
 	if err != nil && err.Error() != utils.ErrNoRow() {
@@ -942,11 +997,6 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 			return
 		}
 		companyItem, err := models.GetCompanyDetailAllById(user.CompanyId)
-		//if err != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
-		//	return
-		//}
 		//冻结客户
 		if err != nil {
 			if err.Error() == utils.ErrNoRow() {
@@ -965,12 +1015,14 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 			}
 		}
 		if activityInfo.ActivityTypeId != 1 && activityInfo.ActivityTypeId != 3 && permissionStr == "专家" {
-			resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+			resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动"
 			resp.SellerMobile = companyItem.Mobile
+			resp.SellerName = companyItem.SellerName
+			resp.MsgType = "Type"
 			resp.OperationMode = "Call"
 			hasPermission = 2
 		} else {
-			if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || ((activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家")) {
+			if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || ((activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式") {
 				hasPermission = 1
 				signupStatus = "Success"
 				totalMeeting, errMeeting := models.GetActivityMeetingReminderCount(uid, activityId)
@@ -998,8 +1050,10 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 				}
 				resp.HaqveJurisdiction = true
 			} else {
-				resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+				resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动"
 				resp.SellerMobile = companyItem.Mobile
+				resp.SellerName = companyItem.SellerName
+				resp.MsgType = "Industry"
 				resp.OperationMode = "Call"
 				hasPermission = 2
 			}

+ 0 - 1
controllers/report.go

@@ -43,7 +43,6 @@ func (this *ReportController) TradeList() {
 		br.Msg = "请输入分类ID"
 		return
 	}
-	fmt.Println(uid)
 	list, err := models.GetTradeAll(ChartPermissionId)
 	if err != nil {
 		br.Msg = "获取信息失败"

+ 3 - 0
models/activity.go

@@ -88,6 +88,7 @@ type ActivityDetail struct {
 	ActiveState             string `description:"活动进行状态 未开始:1、进行中2、已结束3"`
 	IsCancelMeetingReminder int    `description:"是否取消会议提醒 1展示取消会议提醒 ,0展示会议提醒"`
 	ArticleId               int    `description:"报告id(报告链接跳转使用)"`
+	CustomerTypeIds         string `description:"活动可见的客户类型,多个ID用 , 隔开"`
 }
 
 type CygxActivityResp struct {
@@ -95,7 +96,9 @@ type CygxActivityResp struct {
 	OperationMode     string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
 	HasPermission     int    `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
 	PopupMsg          string `description:"权限弹窗信息"`
+	MsgType           string `description:"Type : 类型 , Industry : 行业"`
 	SellerMobile      string `description:"销售电话"`
+	SellerName        string `description:"销售姓名"`
 	Detail            *ActivityDetail
 }
 

+ 5 - 3
models/activity_signup.go

@@ -30,6 +30,8 @@ type SignupStatus struct {
 	HasPermission     int    `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请"`
 	PopupMsg          string `description:"权限弹窗信息"`
 	SellerMobile      string `description:"销售电话"`
+	MsgType           string `description:"Type : 类型 , Industry : 行业"`
+	SellerName        string `description:"销售姓名"`
 }
 
 //我的日程
@@ -187,10 +189,10 @@ func GetActivitySignupCompanyCount(activityId, companyId int) (count int, err er
 }
 
 //获取某一用户是否被限制报名
-func GetUserRestrictCount(uid int) (count int, err error) {
-	sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_restrict_signup WHERE is_restrict=1  AND user_id=? `
+func GetUserRestrictCount(mobile string) (count int, err error) {
+	sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_restrict_signup WHERE is_restrict=1  AND mobile=? `
 	o := orm.NewOrm()
-	err = o.Raw(sqlCount, uid).QueryRow(&count)
+	err = o.Raw(sqlCount, mobile).QueryRow(&count)
 	return
 }