瀏覽代碼

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_10.5.1

xingzai 1 年之前
父節點
當前提交
effdeb7829

+ 108 - 411
controllers/activity.go

@@ -332,6 +332,10 @@ func (this *ActivityCoAntroller) Detail() {
 		br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
 		return
 	}
+	// 判断是否属于研选类型的活动
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
+	}
 
 	signupCount, err := models.GetActivitySignupSuccessByUserCountNoHz(activityId)
 	if err != nil {
@@ -341,16 +345,16 @@ func (this *ActivityCoAntroller) Detail() {
 	}
 	activityInfo.SignupNum = signupCount
 
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
-
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		//是否展示限免标签
-		if services.GetShowSustainable() && strings.Contains(activityInfo.ChartPermissionName, "研选") {
+		if services.GetShowSustainable() && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 			activityInfo.IsShowSustainable = true
 		}
 		resp.HasPermission = 1
@@ -371,23 +375,6 @@ func (this *ActivityCoAntroller) Detail() {
 		if activityInfo.IsHideAppointment == 0 {
 			activityInfo.IsShowAppointment = services.IsShowAppointment(activityInfo.ActivityTypeId, activityInfo.ChartPermissionName)
 		}
-		//if activityInfo.ReportLink != "" {
-		//	artList := strings.Split(activityInfo.ReportLink, "{|}")
-		//	if len(artList) > 0 {
-		//		for _, v := range artList {
-		//			artitem := new(models.ActivityArticleResp)
-		//			artitem.ReportLink = v
-		//			artIdSlice := strings.Split(v, "/")
-		//			if len(artIdSlice) > 0 {
-		//				articleId, _ := strconv.Atoi(artIdSlice[len(artIdSlice)-1])
-		//				artitem.ArticleId = articleId
-		//			}
-		//			activityInfo.ArticleList = append(activityInfo.ArticleList, artitem)
-		//		}
-		//	}
-		//} else {
-		//	activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
-		//}
 		activityInfo.ActivityTypeName = strings.Replace(activityInfo.ActivityTypeName, "(C类)", "", -1)
 
 		//处理活动关联的产业
@@ -538,8 +525,9 @@ func (this *ActivityCoAntroller) Detail() {
 		} else {
 			activityInfo.ArticleList = make([]*models.ActivityArticleResp, 0)
 		}
-		if (activityInfo.ActivityTypeId == 5 || activityInfo.ActivityTypeId == 6) && services.GetBelongingRai(user.Mobile) {
+		if (activityInfo.ActivityTypeId == 5 || activityInfo.ActivityTypeId == 6) && services.GetBelongingRai(user.Mobile) && activityInfo.SigninImg != "" {
 			activityInfo.IsShowSigninButton = true
+			activityInfo.IsShowSignUpDetail = true
 		}
 		//处理按钮是否展示问题
 		resp.Detail = services.ActivityButtonShow(activityInfo)
@@ -652,20 +640,18 @@ func (this *ActivityCoAntroller) SignupAdd() {
 	}
 	item := new(models.CygxActivitySignup)
 
-	//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 strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
+	}
+
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		hasPermission = 1
 		signupStatus = "Success"
@@ -861,8 +847,13 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		resp.HasPermission = hasPermission
 		resp.SellerName = sellerName
 		resp.SellerMobile = sellerMobile
+	}
 
+	// 判断是否属于研选类型的活动
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
 	}
+
 	//公司线下调研活动客户报名后给建会人,所属销售推送模板信息
 	if signupStatus == "Success" {
 		go services.SendResearchActivitiesTemplateMsg(user, activityInfo)
@@ -1167,41 +1158,24 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 	item := new(models.CygxActivityMeetingReminder)
 	resp := new(models.SignupStatus)
 	hasPermission := 0
-	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
-	userType, _, err = services.GetUserType(user.CompanyId)
-	if err != nil {
-		br.Msg = "获取信息失败!"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	if userType == 1 && strings.Contains(activityInfo.ChartPermissionName, "研选") {
-		br.Msg = "您暂无查看该活动权限"
-		br.ErrMsg = "被分享客户不可见,永续客户无法查看研选行业"
-		return
-	}
 	resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
 	if time.Now().After(resultTime.Add(-time.Minute * 15)) {
 		br.Msg = "活动开始前15分钟无法设置会议提醒"
 		return
 	}
-	havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+
+	// 判断是否属于研选类型的活动
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
+	}
+
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
 		return
 	}
-
+	resp.IsResearchSpecial = isResearchSpecial
 	if havePower {
 		hasPermission = 1
 		signupStatus = "Success"
@@ -1244,6 +1218,12 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 		resp.SellerName = sellerName
 		resp.SellerMobile = sellerMobile
 	}
+
+	// 判断是否属于研选类型的活动
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
+	}
+
 	resp.SignupStatus = signupStatus
 	resp.ActivityId = activityId
 	var total int
@@ -2067,8 +2047,7 @@ func (this *ActivityCoAntroller) CheckAsk() {
 		br.Ret = 408
 		return
 	}
-	uid := user.UserId
-	signupStatus := "Success"
+	var signupStatus string
 	var req models.ActivityIdRep
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
 	if err != nil {
@@ -2088,177 +2067,38 @@ func (this *ActivityCoAntroller) CheckAsk() {
 		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
 		return
 	}
-	//判断是否已经申请过
-	applyCount, err := models.GetApplyRecordCount(uid)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-		return
-	}
-	//获取销售信息
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "申请失败"
-		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-		return
-	}
 	resp := new(models.SignupStatus)
-
-	//处理冻结客户,流失客户的弹窗提示
-	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
-		}
-	}
 	hasPermission := 0
-	companyPermission, err := models.GetCompanyPermission(user.CompanyId)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
+		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.ActivityId = activityId
+	resp.IsResearchSpecial = isResearchSpecial
+	if havePower {
+		hasPermission = 1
+		signupStatus = "Success"
+		resp.HaqveJurisdiction = true
 		resp.HasPermission = hasPermission
-		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)
-	if err != nil {
-		br.Msg = "获取信息失败!"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	if userType == 1 && strings.Contains(activityInfo.ChartPermissionName, "研选") {
-		br.Msg = "您暂无查看该活动权限"
-		br.ErrMsg = "被分享客户不可见,永续客户无法查看研选行业"
-		return
-	}
-	if user.CompanyId > 1 {
-		companyItem, err := models.GetCompanyDetailById(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
-				return
-			} else {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取客户公司信息失败,Err:" + err.Error()
-				return
-			}
-		}
-		havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+		resp.SignupStatus = signupStatus
+	} else {
+		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
 		if err != nil {
 			br.Msg = "获取信息失败"
-			br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
+			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 			return
 		}
-		if havePower {
-			hasPermission = 1
-			signupStatus = "Success"
-			resp.HaqveJurisdiction = true
-		} 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"
-				} else {
-					resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
-					resp.MsgType = "Industry"
-				}
-			} else {
-				hasPermission = 5
-			}
-		}
-	} else { //潜在客户
-		if applyCount > 0 {
-			hasPermission = 4
-		} else {
-			if sellerItem != nil {
-				hasPermission = 5
-			} else {
-				hasPermission = 3
-			}
-		}
-		resp.OperationMode = "Apply"
-		resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+		resp.PopupMsg = popupMsg
+		resp.HasPermission = hasPermission
+		resp.SellerName = sellerName
+		resp.SellerMobile = sellerMobile
 	}
-	resp.HasPermission = hasPermission
-	resp.SignupStatus = signupStatus
+	// 判断是否属于研选类型的活动
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
+	}
+
 	resp.ActivityId = activityId
 	br.Ret = 200
 	br.Success = true
@@ -3421,218 +3261,75 @@ func (this *ActivityCoAntroller) ActivityAppointmentAdd() {
 		return
 	}
 
-	//判断是否已经申请过
-	applyCount, err := models.GetApplyRecordCount(uid)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-		return
-	}
-
-	//获取销售信息
-	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.CygxActivityAppointment)
 	resp := new(models.SignupStatus)
-	//处理冻结客户,流失客户的弹窗提示
-	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
-		}
-	}
 	hasPermission := 0
-
-	companyPermission, err := models.GetCompanyPermission(user.CompanyId)
+	havePower, isResearchSpecial, err := services.GetActivityDetailUserPower(user, activityInfo)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
+		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.IsResearchSpecial = isResearchSpecial
+	if havePower {
+		hasPermission = 1
+		signupStatus = "Success"
+		totalMeeting, errMeeting := models.GetUserCygxActivityAppointmentCount(uid, activityId)
+		if errMeeting != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
+			return
 		}
-		resp.ActivityId = activityId
-		resp.HasPermission = hasPermission
-		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)
-	if err != nil {
-		br.Msg = "获取信息失败!"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	if userType == 1 && strings.Contains(activityInfo.ChartPermissionName, "研选") {
-		br.Msg = "您暂无查看该活动权限"
-		br.ErrMsg = "被分享客户不可见,永续客户无法查看研选行业"
-		return
-	}
-	if user.CompanyId > 1 {
-		companyItem, err := models.GetCompanyDetailById(user.CompanyId)
-		//冻结客户
+		if totalMeeting > 0 {
+			br.Msg = "您已预约,请勿重复预约"
+			return
+		}
+		var sellerName string
+		sellerName, err = models.GetCompanySellerName(user.CompanyId)
 		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
-				//如果是FICC的客户类型,则默认他申请过
-				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
-				return
-			} else {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取客户公司信息失败,Err:" + err.Error()
-				return
-			}
+			br.Msg = "报名失败!"
+			br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
+			return
 		}
-
-		havePower, err := services.GetActivityDetailUserPower(user, activityInfo)
+		item.UserId = uid
+		item.ActivityId = activityId
+		item.CreateTime = time.Now()
+		item.Mobile = user.Mobile
+		item.Email = user.Email
+		item.CompanyId = user.CompanyId
+		item.CompanyName = user.CompanyName
+		item.SellerName = sellerName
+		item.RealName = user.RealName
+		err = models.AddCygxActivityAppointment(item)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "操作失败,Err:" + err.Error()
+			return
+		}
+		resp.HaqveJurisdiction = true
+		//1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
+		go services.ActivityUserRemind(user, activityInfo, 3)
+		resp.HasPermission = hasPermission
+		resp.SignupStatus = signupStatus
+	} else {
+		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionActivity(user, activityInfo)
 		if err != nil {
 			br.Msg = "获取信息失败"
-			br.ErrMsg = "校验用户权限失败,Err:" + err.Error()
+			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
 			return
 		}
-		if havePower {
-			hasPermission = 1
-			signupStatus = "Success"
-			totalMeeting, errMeeting := models.GetUserCygxActivityAppointmentCount(uid, activityId)
-			if errMeeting != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
-				return
-			}
-			if totalMeeting > 0 {
-				br.Msg = "您已预约,请勿重复预约"
-				return
-			}
-			var sellerName string
-			sellerName, err = models.GetCompanySellerName(user.CompanyId)
-			if err != nil {
-				br.Msg = "报名失败!"
-				br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
-				return
-			}
-			item.UserId = uid
-			item.ActivityId = activityId
-			item.CreateTime = time.Now()
-			item.Mobile = user.Mobile
-			item.Email = user.Email
-			item.CompanyId = user.CompanyId
-			item.CompanyName = user.CompanyName
-			item.SellerName = sellerName
-			item.RealName = user.RealName
-			err = models.AddCygxActivityAppointment(item)
-			if err != nil {
-				br.Msg = "操作失败"
-				br.ErrMsg = "操作失败,Err:" + err.Error()
-				return
-			}
-			resp.HaqveJurisdiction = true
-			//1:预约外呼 、2:设置会议提醒 、 3:预约纪要 、4:活动报名
-			go services.ActivityUserRemind(user, activityInfo, 3)
+		resp.PopupMsg = popupMsg
+		resp.HasPermission = hasPermission
+		resp.SellerName = sellerName
+		resp.SellerMobile = sellerMobile
+	}
 
-		} 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"
-				} else {
-					resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
-					resp.MsgType = "Industry"
-				}
-			} else {
-				hasPermission = 5
-			}
-		}
-	} else { //潜在客户
-		if applyCount > 0 {
-			hasPermission = 4
-		} else {
-			if sellerItem != nil {
-				hasPermission = 5
-			} else {
-				hasPermission = 3
-			}
-		}
-		resp.OperationMode = "Apply"
-		resp.PopupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+	// 判断是否属于研选类型的活动
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		resp.IsResearch = true
 	}
-	resp.HasPermission = hasPermission
-	resp.SignupStatus = signupStatus
+
 	resp.ActivityId = activityId
 	var total int
 	total, err = models.GetUserCygxActivityAppointmentCountByUid(user.UserId)

+ 167 - 34
controllers/activity_sign.go

@@ -6,6 +6,7 @@ import (
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -70,6 +71,15 @@ func (this *ActivitySignCoAntroller) Detail() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
+
+	//判断是否已经申请过
+	applyCount, err := models.GetApplyRecordCount(uid)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+		return
+	}
+
 	item := new(models.CygxActivitySignin)
 	item.ActivityId = activityId
 	item.UserId = user.UserId
@@ -82,7 +92,7 @@ func (this *ActivitySignCoAntroller) Detail() {
 	item.CountryCode = user.CountryCode
 	item.OpenId = user.OpenId
 	item.CreateTime = time.Now()
-	if total == 0 && user.Mobile != "" {
+	if total == 0 && (user.Mobile != "" || user.Email != "") && (applyCount > 0 || user.CompanyId > 1) {
 		err = models.AddCygxActivitySignin(item)
 		if err != nil {
 			br.Msg = "签到失败"
@@ -126,17 +136,36 @@ func (this *ActivitySignCoAntroller) Detail() {
 
 		//后期扫码签到,处理是否爽约限制
 		services.CygxActivityRestrictSignupByuid(user.UserId, activityId)
-	}
 
-	if user.Mobile != "" || total > 0 {
+		//线下调研活动扫码签到给对应销售发模版消息
+		services.SendActivitieSignTemplateMsg(user, activityInfo)
+	}
+	//1,没有签到记录不为潜在客户
+	//2,没有签到记录,手机号不为空,没有申请记录
+	//3,已经有签到记录的
+	if total == 0 && user.CompanyId > 1 || ((user.Mobile != "" || user.Email != "") && applyCount > 0) || total > 0 {
 		resp.IsBindingMobile = true
 	}
 	if user.CompanyId == 1 {
 		detail.IsNewUser = true
 	}
+
+	//潜在客户提交过申请的显示提交时候的公司
+	if applyCount > 0 && (user.Mobile != "" || user.Email != "") && user.CompanyId == 1 {
+		detail, err := models.GetCygxApplyRecordByMobile(user.Mobile)
+		if err != nil {
+			br.Msg = "签到失败"
+			br.ErrMsg = "GetCygxApplyRecordByMobile,Err:" + err.Error()
+			return
+		}
+		user.CompanyName = detail.CompanyName
+	}
 	detail.ActivityId = activityId
 	detail.ActivityName = activityInfo.ActivityName
 	detail.Mobile = user.Mobile
+	if user.Mobile == "" {
+		detail.Mobile = user.Email
+	}
 	detail.RealName = user.RealName
 	detail.CompanyName = user.CompanyName
 
@@ -154,6 +183,9 @@ func (this *ActivitySignCoAntroller) Detail() {
 		if signinDetail != nil {
 			detail.BusinessCard = signinDetail.BusinessCard
 			detail.Mobile = signinDetail.Mobile
+			if signinDetail.Mobile == "" {
+				detail.Mobile = signinDetail.Email
+			}
 			detail.RealName = signinDetail.RealName
 			detail.CompanyName = signinDetail.CompanyName
 			detail.IsNewUser = true
@@ -236,44 +268,61 @@ func (this *ActivitySignCoAntroller) ByHand() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
-	if signinType == 1 {
-		if req.Mobile == "" {
-			br.Msg = "参数错误"
-			br.ErrMsg = "参数错误,手机号为空 为空"
-			return
-		}
-		itemMsgCode, err := models.GetMsgCode(req.Mobile, req.VCode)
-		if err != nil {
-			if err.Error() == utils.ErrNoRow() {
-				br.Msg = "验证码错误,请重新输入"
-				br.ErrMsg = "校验验证码失败,Err:" + err.Error()
+	if user.Mobile == "" && user.Email == "" {
+		if signinType == 1 {
+			if req.Mobile == "" {
+				br.Msg = "参数错误"
+				br.ErrMsg = "参数错误,手机号为空 为空"
 				return
-			} else {
+			}
+			itemMsgCode, err := models.GetMsgCode(req.Mobile, req.VCode)
+			if err != nil {
+				if err.Error() == utils.ErrNoRow() {
+					br.Msg = "验证码错误,请重新输入"
+					br.ErrMsg = "校验验证码失败,Err:" + err.Error()
+					return
+				} else {
+					br.Msg = "验证码错误,请重新输入"
+					br.ErrMsg = "校验验证码失败,Err:" + err.Error()
+					return
+				}
+			}
+			if itemMsgCode == nil {
 				br.Msg = "验证码错误,请重新输入"
-				br.ErrMsg = "校验验证码失败,Err:" + err.Error()
 				return
 			}
-		}
-		if itemMsgCode == nil {
-			br.Msg = "验证码错误,请重新输入"
-			return
-		}
-		userMobile, err := models.GetWxUserItemByMobile(Mobile)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "签到失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		if userMobile != nil {
-			user = userMobile
+			userMobile, err := models.GetWxUserItemByMobile(Mobile)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "签到失败"
+				br.ErrMsg = "获取失败,Err:" + err.Error()
+				return
+			}
+			if userMobile != nil {
+				user = userMobile
+			}
+		} else {
+			if BusinessCard == "" {
+				br.Msg = "签到失败"
+				br.ErrMsg = "签到失败名片地址为空,Err:"
+				return
+			}
+			item.BusinessCard = BusinessCard
 		}
 	} else {
-		if BusinessCard == "" {
-			br.Msg = "签到失败"
-			br.ErrMsg = "签到失败名片地址为空,Err:"
-			return
+		if signinType == 1 {
+			if CompanyName == "" {
+				br.Msg = "请输入公司名称"
+				return
+			}
+			if RealName == "" {
+				br.Msg = "请输入姓名"
+				return
+			}
 		}
-		item.BusinessCard = BusinessCard
+	}
+	//如果是用邮箱登录的,就把手机号置空
+	if strings.Contains(Mobile, "@") {
+		Mobile = ""
 	}
 	item.ActivityId = activityId
 	item.UserId = user.UserId
@@ -336,3 +385,87 @@ func (this *ActivitySignCoAntroller) ByHand() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title  活动签到到会详情
+// @Description 活动签到到会详情接口
+// @Param   ActivityId   query   int  true       "活动ID"
+// @Success Ret=200 {object} models.CygxActivityResp
+// @router /signup/detail [get]
+func (this *ActivitySignCoAntroller) SignupDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+
+	activityId, _ := this.GetInt("ActivityId")
+	if activityId < 1 {
+		br.Msg = "请输入活动ID"
+		return
+	}
+	resp := new(models.CygxActivityOfflineMeetingDetailResp)
+	activityInfo, err := models.GetAddActivityInfoById(activityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取活动详情信息失败,Err:" + err.Error()
+		return
+	}
+	if !services.GetBelongingRai(user.Mobile) {
+		br.Msg = "你暂无查看权限"
+		br.ErrMsg = "你暂无查看权限,UserId:" + strconv.Itoa(user.UserId)
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND do_fail_type = 0 AND activity_id  = ?`
+	pars = append(pars, activityId)
+
+	listSignup, err := models.GetActivitySignupList(condition, pars)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetOfflineMeetingListWithUser,UserId:" + strconv.Itoa(user.UserId)
+		return
+	}
+	//获取对应销售所能查看的用户手机号
+	UserMobileMap, err := services.GetAdminCheckUserMobileMap(user)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetAdminCheckUserMobileMap,UserId:" + strconv.Itoa(user.UserId)
+		return
+	}
+	//获取用户的签到时间
+	SigninTimeMap, err := services.GetUserActivitySigninTimeMap(activityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetUserActivitySigninTimeMap,activityId:" + strconv.Itoa(activityId)
+		return
+	}
+	for _, v := range listSignup {
+		if _, ok := UserMobileMap[v.Mobile]; ok {
+			item := new(models.CygxActivitySignupResp)
+			item.RealName = v.RealName
+			item.CompanyName = v.CompanyName
+			if _, ok := SigninTimeMap[v.UserId]; ok {
+				item.IsMeeting = 1
+				item.SigninTime = SigninTimeMap[v.UserId]
+			}
+			resp.List = append(resp.List, item)
+		}
+	}
+	if len(resp.List) == 0 {
+		resp.List = make([]*models.CygxActivitySignupResp, 0)
+	}
+	resp.ActivityId = activityId
+	resp.ActivityName = activityInfo.ActivityName
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 4 - 1
controllers/article.go

@@ -86,7 +86,10 @@ func (this *ArticleController) Detail() {
 	if _, ok := lyjhTypeMap[detail.CategoryId]; ok {
 		detail.IsRoadShow = true
 	}
-
+	// 判断是否属于研选类型的报告
+	if strings.Contains(detail.CategoryName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		detail.IsResearch = true
+	}
 	// 高毅资产的联系人,有权限的行业也不能查看报告详情页。提示无权限页面
 	if detail.ArticleTypeId == 0 && user.CompanyId == utils.GAO_YI_ZI_CHAN_COMPANY_ID {
 		_, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermissionArticle(user)

+ 97 - 0
controllers/config.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
+	"strings"
 	"time"
 )
 
@@ -238,3 +239,99 @@ func (this *ConfigController) AboutUsAdd() {
 	br.Success = true
 	br.Msg = "操作成功!"
 }
+
+// @Title 买方研选产品介绍(无需token)
+// @Description 买方研选产品介绍接口(无需token)
+// @Success 200 {object} models.ConfigImgListResp
+// @router /research/introduce [get]
+func (this *BaseConfigController) ResearchIntroduce() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	conf, err := models.GetConfigByCode("research_introduce_img_url")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "买方研选产品介绍信息失败,Err:" + err.Error()
+		return
+	}
+	if conf.ConfigValue == "" {
+		br.Msg = "获取失败"
+		br.ErrMsg = "买方研选产品介绍信息失败"
+		return
+	}
+	list := new(*models.ConfigImgListResp)
+	if err = json.Unmarshal([]byte(conf.ConfigValue), &list); err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "买方研选产品介绍信配置值解析失败, Err: " + err.Error()
+		return
+	}
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = list
+}
+
+// @Title 买方研选报价单(无需token)
+// @Description 买方研选报价单(无需token)
+// @Success 200 {object} models.ConfigImgListResp
+// @router /research/quotation [get]
+func (this *BaseConfigController) ResearchQuotation() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	conf, err := models.GetConfigByCode("research_quotation_img_url")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "买方研选产品介绍信息失败,Err:" + err.Error()
+		return
+	}
+	if conf.ConfigValue == "" {
+		br.Msg = "获取失败"
+		br.ErrMsg = "买方研选产品介绍信息失败"
+		return
+	}
+	list := new(*models.ConfigImgListResp)
+	if err = json.Unmarshal([]byte(conf.ConfigValue), &list); err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "买方研选产品介绍信配置值解析失败, Err: " + err.Error()
+		return
+	}
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = list
+}
+
+// @Title 买方研选升级新资源海报(无需token)
+// @Description 买方研选升级新资源海报(无需token)
+// @Success 200 {object} models.ConfigImgListResp
+// @router /research/hb [get]
+func (this *BaseConfigController) ResearchHb() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	detail, err := models.GetConfigByCode("research_hb_img_url")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "买方研选升级新资源海报信息失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ConfigImgHbResp)
+	list := strings.Split(detail.ConfigValue, "{|}")
+	if len(list) == 0 {
+		list = make([]string, 0)
+	}
+	resp.HbImg = list[0]
+	resp.ButtonImg = list[len(list)-1]
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}

+ 0 - 36
controllers/report.go

@@ -522,37 +522,6 @@ func (this *ReportController) List() {
 	}
 	if categoryId != 99999 {
 		resp := new(models.TacticsListResp)
-		//获取该产业下所对应的行业图片
-		//detail, errCategory := models.GetdetailByCategoryIdOne(categoryId)
-		//if errCategory != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取信息失败,Err:" + errCategory.Error() + "categoryID 不存在:" + strconv.Itoa(categoryId)
-		//	return
-		//}
-		////对应行业的图片
-		//detailChartPermissionUrl, err := models.GetConfigByCode("category_chart_permissionimg_url")
-		//if err != nil {
-		//	br.Msg = "获取数据失败"
-		//	br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//chartPermissionUrlList := strings.Split(detailChartPermissionUrl.ConfigValue, "{|}")
-		//mapChartPermission := make(map[string]string)
-		//var permissionName string
-		//var imgUrlChartPermission string
-		//for _, v := range chartPermissionUrlList {
-		//	vslice := strings.Split(v, "_")
-		//	permissionName = vslice[0]
-		//	imgUrlChartPermission = vslice[len(vslice)-1]
-		//	mapChartPermission[permissionName] = imgUrlChartPermission
-		//}
-		//total, err := models.GetReportIndustrialCount(categoryId, industrialManagementId)
-		//if err != nil {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
-		//	return
-		//}
-
 		list, total, err := models.GetReportAndproductInteriorIndustrialList(pars, categoryId, industrialManagementId, uid, startSize, pageSize)
 		if err != nil {
 			br.Msg = "获取信息失败"
@@ -596,11 +565,6 @@ func (this *ReportController) List() {
 			if v.Resource == 2 {
 				v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 			}
-			//if mapCategoryUrl[v.CategoryId] == "" {
-			//	if detail.ChartPermissionId == utils.YI_YAO_ID {
-			//		list[k].ImgUrlPc = utils.YI_YAO_QI_TA
-			//	}
-			//}
 		}
 
 		//resp.CategoryImgUrlPc = mapChartPermission[detail.ChartPermissionName]

+ 102 - 13
controllers/report_selection.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"encoding/json"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
@@ -35,20 +36,26 @@ func (this *ReportSelectionController) Detail() {
 	}
 	//uid := user.UserId
 	articleId, _ := this.GetInt("ArticleId")
+	activityId, _ := this.GetInt("ActivityId")
 	isBestNew, _ := this.GetBool("IsBestNew")
-	isBestNew = true
-	if isBestNew {
-		tbdb := "cygx_report_selection"
-		condition := ` AND publish_status = 1  `
-		var pars []interface{}
-		list, err := models.GetReportSelectionListPublic(condition, "1", tbdb, pars, 0, 1)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		for _, v := range list {
-			articleId = v.ArticleId
+	if activityId > 0 && articleId == 0 {
+		articleId = activityId
+	}
+	if articleId == 0 || isBestNew {
+		isBestNew = true
+		if isBestNew {
+			tbdb := "cygx_report_selection"
+			condition := ` AND publish_status = 1  `
+			var pars []interface{}
+			list, err := models.GetReportSelectionListPublic(condition, "1", tbdb, pars, 0, 1)
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取失败,Err:" + err.Error()
+				return
+			}
+			for _, v := range list {
+				articleId = v.ArticleId
+			}
 		}
 	}
 	if articleId < 1 {
@@ -307,3 +314,85 @@ func (this *ReportSelectionController) AddStopTime() {
 	br.Success = true
 	br.Msg = "操作成功"
 }
+
+// @Title 获取报告精选列表
+// @Description 获取报告精选列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.ReportSelectionLetailResp
+// @router /list [get]
+func (this *ReportSelectionController) List() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	resp := new(models.CygxReportSelectionListPublicRep)
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	condition += ` AND art.publish_status = 1 AND article_id >= 16 `
+	total, err := models.GetCygxReportSelectionCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	condition += "	ORDER BY art.publish_date  DESC "
+	list, err := models.GetReportSelectionList(condition, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	var articleIdArr []int
+	for _, v := range list {
+		v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+		articleIdArr = append(articleIdArr, v.ArticleId)
+	}
+
+	lenarticleIdArr := len(articleIdArr)
+	maplabel := make(map[int]string)
+	if lenarticleIdArr > 0 {
+		condition = ""
+		pars = make([]interface{}, 0)
+		condition = ` AND is_new = 1  AND article_id IN (` + utils.GetOrmInReplace(lenarticleIdArr) + `)`
+		pars = append(pars, articleIdArr)
+		listLog, err := models.GetCygxReportSelectionLog(condition, pars, 0, 9999)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,GetCygxReportSelectionLogErr:" + err.Error()
+			return
+		}
+		for _, v := range listLog {
+			maplabel[v.ArticleId] += v.SubjectName + ","
+		}
+	}
+	for _, v := range list {
+		v.SubjectName = strings.TrimRight(maplabel[v.ArticleId], ",")
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = list
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 37 - 0
controllers/user.go

@@ -643,6 +643,9 @@ func (this *UserController) InterviewApplyList() {
 	lenList := len(list)
 	for i := 0; i < lenList; i++ {
 		item := list[i]
+		if articleMap[item.ArticleId] == nil {
+			continue
+		}
 		article := articleMap[item.ArticleId]
 		bodySub, _ := services.GetReportContentTextSub(article.Body)
 		list[i].Title = article.Title
@@ -1776,3 +1779,37 @@ func (this *UserController) Tracking() {
 	br.Ret = 200
 	br.Success = true
 }
+
+// @Title 未付费申请试用详情
+// @Description 未付费申请试用详情接口
+// @Param   ApplyRecordId    query   int true       "申请ID"
+// @Success 200 {object} models.ArticleCollectListResp
+// @Success 200
+// @router /apply/detail [get]
+func (this *UserController) ApplyDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	resp := new(models.CygxApplyRecordResp)
+	applyRecordId, _ := this.GetInt("ApplyRecordId")
+	detail, err := models.GetCygxApplyRecordById(applyRecordId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp.Detail = detail
+	br.Msg = "申请成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}

+ 25 - 1
models/activity.go

@@ -66,6 +66,8 @@ type CygxActivity struct {
 	YidongSignUpStart       string    `description:"易董活动截止时间"` // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
 	IsExternalLabel         int       `description:"是否为外部资源 1是,0否"`
 	YidongActivityIdByCygx  string    `description:"通过查研观向建会易董返回的活动ID"`
+	JmcjRoadshowTitle       string    `description:"进门财经的活动标题"`
+	JmcjActivityId          string    `description:"进门财经的活动ID"`
 }
 
 type Activity struct {
@@ -206,6 +208,7 @@ type ActivityDetail struct {
 	TencentConferenceNumber string                     `description:"腾讯会议号"`
 	YidongActivityIdByCygx  string                     `description:"通过查研观向建会易董返回的活动ID"`
 	IsShowSigninButton      bool                       `description:"是否展示签到码按钮"`
+	IsShowSignUpDetail      bool                       `description:"是否展示报名详情按钮"`
 	SigninImg               string                     `description:"签到码图片"`
 }
 type ListArticleActivity struct {
@@ -221,6 +224,8 @@ type CygxActivityResp struct {
 	MsgType           string `description:"Type : 类型 , Industry : 行业"`
 	SellerMobile      string `description:"销售电话"`
 	SellerName        string `description:"销售姓名"`
+	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
 	Detail            *ActivityDetail
 }
 
@@ -1008,7 +1013,7 @@ func AddCygxActivity(item *CygxActivity) (lastId int64, err error) {
 func GetActivityListByYidong(condition string) (items []*ActivityDetail, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_activity WHERE 1 = 1 
-	AND ( yidong_activity_id != '' OR yidong_activity_id_by_cygx != '' )  `
+	AND ( yidong_activity_id != '' OR yidong_activity_id_by_cygx != '' )  AND publish_status = 1  `
 	if condition != "" {
 		sql += condition
 	}
@@ -1223,3 +1228,22 @@ func GetCygxActivityList(condition string, pars []interface{}, startSize, pageSi
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
+
+// 批量修改弘则活动与进门财经的一个活动关联
+func UpdateJmcjActivityIdGroup(items map[int]string) (err error) {
+	o := orm.NewOrm()
+	p, err := o.Raw("UPDATE cygx_activity SET jmcj_activity_id = ? WHERE activity_id = ? AND jmcj_activity_id= '' ").Prepare()
+	if err != nil {
+		return
+	}
+	defer func() {
+		_ = p.Close() // 别忘记关闭 statement
+	}()
+	for k, v := range items {
+		_, err = p.Exec(v, k)
+		if err != nil {
+			return
+		}
+	}
+	return
+}

+ 28 - 23
models/activity_attendance_detail.go

@@ -3,6 +3,7 @@ package models
 import (
 	"fmt"
 	"github.com/beego/beego/v2/client/orm"
+	"hongze/hongze_cygx/utils"
 	"time"
 )
 
@@ -83,28 +84,6 @@ func AddCygxActivityAttendanceDetail(item *CygxActivityAttendanceDetail) (lastId
 	return
 }
 
-type RoadshowData struct {
-	Id                    int    `orm:"column(id);pk;"description:"主键ID"`
-	Company               string `description:"公司名称"`
-	UserName              string `description:"用户名"`
-	UserPhone             string `description:"手机号"`
-	UserinfoUource        string `description:"用户来源"`
-	AuthInfo              string `description:"用户参会鉴权"`
-	GuestUsername         string `description:"嘉宾名称, 多个用,隔开"`
-	FirstWatchTime        string `description:"首次观看时间"`
-	LastWatchTime         string `description:"最后观看时间"`
-	RoadshowId            string `description:"路演ID"`
-	RoadshowTitle         string `description:"路演标题"`
-	RoadshowBeginTime     string `description:"路演开始时间"`
-	RoadshowEndTime       string `description:"路演结束时间"`
-	JoinTime              int    `description:"参与时长"`
-	JoinType              int    `description:"参与方式, 1网络, 2电话"`
-	DataType              int    `description:"数据类型: 1直播, 2回放"`
-	Occupation            string `description:"职位"`
-	UseridEntity          int    `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
-	CrmCompanyMapStatusId int    `description:"转换后的对应状态信息:1=正式客户, 2=曾使用客户, 3=其他"`
-}
-
 func AddAttendancDetail(items []*CygxActivityAttendanceDetail, activityId int, mobileStr string) (err error) {
 	if len(items) == 0 {
 		return
@@ -142,7 +121,7 @@ func AddAttendancDetail(items []*CygxActivityAttendanceDetail, activityId int, m
 	//		return
 	//	}
 	//}
-	_, err = o.InsertMulti(1, items)
+	_, err = o.InsertMulti(len(items), items)
 	return
 }
 
@@ -196,3 +175,29 @@ func GetActivityAttendanceDetailListAll() (items []*CygxActivityAttendanceDetail
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetActivityAttendanceDetailListCondition(condition string, pars []interface{}) (items []*CygxActivityAttendanceDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity_attendance_detail WHERE   1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+func AddAttendancDetailNew(items []*CygxActivityAttendanceDetail, activityIds []int) (err error) {
+	if len(items) == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	//修改活动是否上传到会信息字段
+	sql := `UPDATE cygx_activity SET  is_submit_meeting=1   WHERE activity_id IN  (` + utils.GetOrmInReplace(len(activityIds)) + `)  `
+	_, err = o.Raw(sql, activityIds).Exec()
+	if err != nil {
+		return
+	}
+	_, err = o.InsertMulti(len(items), items)
+	return
+}

+ 181 - 1
models/activity_meet_detail_log.go

@@ -3,6 +3,7 @@ package models
 import (
 	"fmt"
 	"github.com/beego/beego/v2/client/orm"
+	"hongze/hongze_cygx/utils"
 	"strconv"
 	"strings"
 	"time"
@@ -20,6 +21,27 @@ type CygxActivityMeetDetailLog struct {
 	ActivityTime string    `description:"活动时间"`
 }
 
+// 批量添加
+func AddCygxActivityMeetDetailLogMulti(items []*CygxActivityMeetDetailLog) (err error) {
+	o := orm.NewOrm()
+	if len(items) > 0 {
+		//批量添加
+		_, err = o.InsertMulti(len(items), items)
+	}
+	return
+}
+
+// 列表
+func GetCygxActivityMeetDetailLogList(condition string, pars []interface{}) (items []*CygxActivityMeetDetailLog, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity_meet_detail_log as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
 func GetOfflineMeetingDetailListCompanyIdStr(companyIdStr string) (item []*CygxActivityMeetDetailLog, err error) {
 	if companyIdStr == "" {
 		return
@@ -80,6 +102,37 @@ func GetActivityMeetDetailLogCount(condition string) (count int, err error) {
 	return
 }
 
+// 报名
+type CygxActivityMeetDetailLogCountResp struct {
+	Mobile    string `description:"手机号"`
+	CompanyId int    `description:"公司id 不在数据库的用户为0"`
+	Count     int    `description:"公司id 不在数据库的用户为0"`
+}
+
+// 获取数量
+func GetActivityMeetDetailLogCountCompany(companyIds []int) (item []*CygxActivityMeetDetailLogCountResp, err error) {
+	lenArr := len(companyIds)
+	if lenArr == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `  SELECT company_id, COUNT(1) AS count  FROM cygx_activity_meet_detail_log WHERE 1=1 AND company_id IN  (` + utils.GetOrmInReplace(lenArr) + `)   GROUP BY company_id`
+	_, err = o.Raw(sql, companyIds).QueryRows(&item)
+	return
+}
+
+// 获取数量
+func GetActivityMeetDetailLogCountMobile(mobiles []string) (item []*CygxActivityMeetDetailLogCountResp, err error) {
+	lenArr := len(mobiles)
+	if lenArr == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `  SELECT mobile, COUNT(1) AS count  FROM cygx_activity_meet_detail_log WHERE 1=1 AND mobile IN  (` + utils.GetOrmInReplace(lenArr) + `)   GROUP BY company_id`
+	_, err = o.Raw(sql, mobiles).QueryRows(&item)
+	return
+}
+
 // 修改公司参会数量
 func UpdateActivityMeetDetailLog(companyName string, num int) (err error) {
 	sql := ` UPDATE cygx_activity_meet_detail_log SET  company_meet_num= ?  WHERE company_name = ?`
@@ -175,7 +228,7 @@ func AddCygxActivityMeetDetailLogOnline(list []*CygxActivityAttendanceDetail, ac
 }
 
 // 添加线上到会记录
-func AddCygxActivityMeetDetailLogOnlineByList(list []*CygxActivityAttendanceDetail, activityIds string) (err error) {
+func AddCygxActivityMeetDetailLogOnlineByListNew(list []*CygxActivityAttendanceDetail, activityIds string) (err error) {
 	o, err := orm.NewOrm().Begin()
 	if err != nil {
 		return
@@ -369,3 +422,130 @@ func AddCygxActivityMeetDetailLogOffline(activityId int) (err error) {
 	}
 	return
 }
+
+// 添加线上到会记录
+func AddCygxActivityMeetDetailLogOnlineByList(list []*CygxActivityAttendanceDetail, activityIds string) (err error) {
+	o, err := orm.NewOrm().Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		fmt.Println(err)
+		if err == nil {
+			o.Commit()
+		} else {
+			o.Rollback()
+		}
+	}()
+	var CompanyName string
+	var MobileStr string
+	var items []*CygxActivityMeetDetailLog
+	//删除原有数据
+	sql := ` DELETE FROM cygx_activity_meet_detail_log WHERE activity_id IN (` + activityIds + `)`
+	_, err = o.Raw(sql).Exec()
+	if err != nil {
+		return
+	}
+	//插入新的数据
+	for _, v := range list {
+		item := new(CygxActivityMeetDetailLog)
+		item.ActivityId = v.ActivityId
+		item.Mobile = v.Mobile
+		fmt.Println(v.CompanyName)
+		item.CompanyName = v.CompanyName
+		item.CompanyId = v.CompanyId
+		item.ActivityTime = v.ActivityTime
+		item.CreateTime = v.CreateTime
+		if strings.Index(CompanyName, v.CompanyName) == -1 && v.CompanyName != "" {
+			CompanyName += "'" + v.CompanyName + "',"
+		}
+		if strings.Index(MobileStr, v.Mobile) == -1 && v.Mobile != "" {
+			MobileStr += v.Mobile + ","
+		}
+		items = append(items, item)
+	}
+	CompanyName = strings.TrimRight(CompanyName, ",")
+	MobileStr = strings.TrimRight(MobileStr, ",")
+	_, err = o.InsertMulti(1, items)
+	listCompany, err := GetOfflineMeetingDetailListCompanyName(CompanyName)
+	fmt.Println("公司数量", len(listCompany))
+	if err != nil {
+		return
+	}
+	//修改公司对应的数量
+	var condition string
+	for _, v := range listCompany {
+		var total int
+		condition = ` AND company_name = '` + v.CompanyName + `' `
+		total, err = GetActivityMeetDetailLogCount(condition)
+		if err != nil {
+			return
+		}
+		sql := ` UPDATE cygx_activity_meet_detail_log SET  company_meet_num= ?  WHERE company_name = ?`
+		_, err = o.Raw(sql, total, v.CompanyName).Exec()
+		fmt.Println("处理公司", v.CompanyName)
+		if err != nil {
+			return
+		}
+	}
+	listMobile, err := GetActivityMeetDetailLog(MobileStr)
+	fmt.Println("用户数量", len(listMobile))
+	if err != nil {
+		return
+	}
+	//修改个人对应的数量
+	for _, v := range listMobile {
+		var total int
+		condition = ` AND mobile = '` + v.Mobile + `' `
+		total, err = GetActivityMeetDetailLogCount(condition)
+		if err != nil {
+			return
+		}
+		sql := ` UPDATE cygx_activity_meet_detail_log SET  user_meet_num= ?  WHERE mobile = ?`
+		_, err = o.Raw(sql, total, v.Mobile).Exec()
+		fmt.Println("处理用户", v.Mobile)
+		if err != nil {
+			return
+		}
+	}
+	fmt.Println("user_end")
+	return
+}
+
+// UpdateActivitySpecialSignupNumMulti 批量修改个人参会数量
+func UpdateCygxActivityMeetDetailLogMobileNumMulti(items []*CygxActivityMeetDetailLogCountResp) (err error) {
+	o := orm.NewOrm()
+	p, err := o.Raw("UPDATE cygx_activity_meet_detail_log SET user_meet_num = ? WHERE mobile = ?").Prepare()
+	if err != nil {
+		return
+	}
+	defer func() {
+		_ = p.Close()
+	}()
+	for _, v := range items {
+		_, err = p.Exec(v.Count, v.Mobile)
+		if err != nil {
+			return
+		}
+	}
+	return
+}
+
+// UpdateActivitySpecialSignupNumMulti 批量修改机构参会数量
+func UpdateCygxActivityMeetDetailLogCompanyNumMulti(items []*CygxActivityMeetDetailLogCountResp) (err error) {
+	o := orm.NewOrm()
+	p, err := o.Raw("UPDATE cygx_activity_meet_detail_log SET company_meet_num = ? WHERE company_id = ?").Prepare()
+	if err != nil {
+		return
+	}
+	defer func() {
+		_ = p.Close()
+	}()
+	for _, v := range items {
+		_, err = p.Exec(v.Count, v.CompanyId)
+		if err != nil {
+			return
+		}
+	}
+	return
+}

+ 17 - 0
models/activity_offline_meeting_detail.go

@@ -72,3 +72,20 @@ func GetOfflineMeetingListByUser(meetingUids string, activityId int) (items []*C
 	_, err = o.Raw(sql, activityId).QueryRows(&items)
 	return
 }
+
+// 报名
+type CygxActivityOfflineMeetingDetailResp struct {
+	ActivityId   int    `description:"活动ID "`
+	ActivityName string `description:"活动名称"`
+	List         []*CygxActivitySignupResp
+}
+
+// 预约外呼列表
+func GetOfflineMeetingListWithUser(condition string, pars []interface{}) (items []*CygxActivitySignupList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT s.* , u.real_name
+			FROM cygx_activity_offline_meeting_detail  as s 
+			INNER JOIN wx_user as u ON u.user_id = s.user_id  WHERE 1 =1 ` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 13 - 0
models/activity_signin.go

@@ -64,6 +64,19 @@ func GetCygxActivitySigninCount(condition string, pars []interface{}) (count int
 	return
 }
 
+// GetCygxActivitySigninList 获取签到列表信息
+func GetCygxActivitySigninList(condition string, pars []interface{}) (items []*CygxActivitySignin, err error) {
+	sql := `SELECT
+			*
+		FROM
+			cygx_activity_signin AS art
+		WHERE
+			1 = 1 	` + condition
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
 func GetCygxActivitySigninDetail(condition string, pars []interface{}) (item *CygxActivitySignin, err error) {
 	sql := `SELECT *  FROM cygx_activity_signin as art WHERE 1= 1 `
 	if condition != "" {

+ 34 - 1
models/activity_signup.go

@@ -40,6 +40,8 @@ type SignupStatus struct {
 	CountryCode       string `description:"外呼手机号区号"`
 	GoOutboundMobile  bool   `description:"是否去绑定手机号"`
 	GoBindEmail       bool   `description:"是否去绑定邮箱"`
+	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
 }
 
 // 我的日程
@@ -519,6 +521,14 @@ type CygxActivitySignupList struct {
 	Mobile      string `description:"手机号"`
 	Email       string `description:"邮箱"`
 	CompanyId   int    `description:"公司id"`
+	SigninTime  string `description:"签到时间"`
+}
+
+type CygxActivitySignupResp struct {
+	CompanyName string `description:"公司名称"`
+	RealName    string `description:"姓名"`
+	IsMeeting   int    `description:"是否到会 ,1是, 0否"`
+	SigninTime  string `description:"签到时间"`
 }
 
 // 获取用户报名列表
@@ -631,10 +641,33 @@ func GetActivitySignupInnerActivityList(condition string, pars []interface{}) (i
 			*
 		FROM
 			cygx_activity_signup AS v
-			INNER JOIN cygx_activity as a 
+			INNER JOIN cygx_activity as a  ON a.activity_id = v.activity_id
 		WHERE
 			1 = 1 	` + condition
 	o := orm.NewOrm()
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// UpdateCygxActivitySignupIsMeeting 批量标记用户的到会信息
+func UpdateCygxActivitySignupIsMeeting(items []*CygxActivityAttendanceDetail) (err error) {
+	o := orm.NewOrm()
+	p, err := o.Raw(` UPDATE cygx_activity_signup SET
+							is_meeting = 1
+							WHERE outbound_mobile = ? AND activity_id = ? `).Prepare()
+	if err != nil {
+		return
+	}
+	defer func() {
+		_ = p.Close() // 别忘记关闭 statement
+	}()
+	for _, v := range items {
+		_, err = p.Exec(
+			v.Mobile,
+			v.ActivityId)
+		if err != nil {
+			return
+		}
+	}
+	return
+}

+ 13 - 0
models/activity_signup_break.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"hongze/hongze_cygx/utils"
 	"time"
 )
 
@@ -51,3 +52,15 @@ func DeleteCygxActivitySignupBreakById(activityId int) (err error) {
 	_, err = o.Raw(sql, activityId).Exec()
 	return
 }
+
+// 批量删除
+func DeleteCygxActivitySignupBreakByIds(activityIds []int) (err error) {
+	lenactivityIds := len(activityIds)
+	if lenactivityIds == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := ` DELETE FROM cygx_activity_signup_break  WHERE  activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
+	_, err = o.Raw(sql, activityIds).Exec()
+	return
+}

+ 19 - 0
models/admin.go

@@ -61,6 +61,13 @@ func GetSysAdminById(adminId int) (item *Admin, err error) {
 	return
 }
 
+func GetSysAdminByMobile(mobile string) (item *Admin, err error) {
+	sql := `SELECT * FROM admin WHERE mobile=? LIMIT 1 `
+	o := orm.NewOrm()
+	err = o.Raw(sql, mobile).QueryRow(&item)
+	return
+}
+
 // 获取权益内部人员手机号
 func GetRaiAdmin() (items []*AdminMobileResp, err error) {
 	o := orm.NewOrm()
@@ -78,3 +85,15 @@ WHERE
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+type GetSellerUserMobileResp struct {
+	Mobile string `description:"手机号"`
+}
+
+// 获取销售所能查看到的手机号
+func GetSellerUserMobile(adminId int) (items []*GetSellerUserMobileResp, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT mobile FROM user_seller_relation WHERE seller_id  = ? `
+	_, err = o.Raw(sql, adminId).QueryRows(&items)
+	return
+}

+ 29 - 7
models/apply_record.go

@@ -6,13 +6,15 @@ import (
 )
 
 type CygxApplyRecord struct {
-	ApplyRecordId   int       `orm:"column(apply_record_id);pk" description:"申请试用id"`
-	BusinessCardUrl string    `description:"名片地址"`
-	RealName        string    `description:"姓名"`
-	CompanyName     string    `description:"公司名称"`
-	Mobile          string    `description:"手机号"`
-	CreateTime      time.Time `description:"创建时间"`
-	ApplyMethod     int       `description:"1:已付费客户申请试用,2:非客户申请试用"`
+	ApplyRecordId    int       `orm:"column(apply_record_id);pk" description:"申请试用id"`
+	BusinessCardUrl  string    `description:"名片地址"`
+	RealName         string    `description:"姓名"`
+	CompanyName      string    `description:"公司名称"`
+	CompanyNamePay   string    `description:"公司名称"`
+	Mobile           string    `description:"手机号"`
+	CreateTime       time.Time `description:"创建时间"`
+	ApplyMethod      int       `description:"1:已付费客户申请试用,2:非客户申请试用"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
 }
 
 func AddApplyRecord(item *ApplyTryReq, mobile, companyNamePay string, userId, companyIdPay, CompanyIdType int) (err error) {
@@ -52,3 +54,23 @@ func GetApplyRecordCount(userId int) (count int, err error) {
 	err = o.Raw(sql, userId).QueryRow(&count)
 	return
 }
+
+// 通过手机号获取详情
+func GetCygxApplyRecordByMobile(mobile string) (item *CygxApplyRecord, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_apply_record   WHERE mobile=? AND status=0   ORDER BY apply_record_id DESC   LIMIT 1 `
+	err = o.Raw(sql, mobile).QueryRow(&item)
+	return
+}
+
+// 通过ID获取详情
+func GetCygxApplyRecordById(applyRecordId int) (item *CygxApplyRecord, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_apply_record  WHERE apply_record_id=?  `
+	err = o.Raw(sql, applyRecordId).QueryRow(&item)
+	return
+}
+
+type CygxApplyRecordResp struct {
+	Detail *CygxApplyRecord
+}

+ 1 - 0
models/article.go

@@ -236,6 +236,7 @@ type ArticleDetailResp struct {
 	SellerMobile     string `description:"销售电话"`
 	SellerName       string `description:"销售姓名"`
 	IsSpecialArticle bool   `description:"是否属于专项调研报告"`
+	IsResearch       bool   `description:"是否属于研选"`
 }
 
 type ArticleDetailHtgjResp struct {

+ 16 - 2
models/config.go

@@ -30,7 +30,7 @@ func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
 	return
 }
 
-//更改配置信息
+// 更改配置信息
 func UpdateConfigByCode(configValue, countryCode string) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_config SET  config_value= ? WHERE config_code=? `
@@ -44,7 +44,21 @@ type ConfigResp struct {
 	ListHot []*KeyWord `description:"热搜关键词"`
 }
 
-//获取是否展示限免标签
+type ConfigImgListResp struct {
+	List []*ConfigImgResp
+}
+
+type ConfigImgResp struct {
+	Img    string `description:"图片"`
+	Height string `description:"高度"`
+}
+
+type ConfigImgHbResp struct {
+	HbImg     string `description:"海报"`
+	ButtonImg string `description:"按钮图片"`
+}
+
+// 获取是否展示限免标签
 func GetShowSustainable() (count int, err error) {
 	o := orm.NewOrm()
 	sqlCount := ` SELECT COUNT(1) FROM cygx_config WHERE config_code= 'is_show_sustainable' AND config_value = 1 `

+ 39 - 0
models/jmcj_comein_data.go

@@ -0,0 +1,39 @@
+package models
+
+import "github.com/beego/beego/v2/client/orm"
+
+type RoadshowData struct {
+	Id                    int    `orm:"column(id);pk;"description:"主键ID"`
+	Company               string `description:"公司名称"`
+	UserName              string `description:"用户名"`
+	UserPhone             string `description:"手机号"`
+	UserinfoUource        string `description:"用户来源"`
+	AuthInfo              string `description:"用户参会鉴权"`
+	GuestUsername         string `description:"嘉宾名称, 多个用,隔开"`
+	FirstWatchTime        string `description:"首次观看时间"`
+	LastWatchTime         string `description:"最后观看时间"`
+	RoadshowId            string `description:"路演ID"`
+	RoadshowTitle         string `description:"路演标题"`
+	RoadshowBeginTime     string `description:"路演开始时间"`
+	RoadshowEndTime       string `description:"路演结束时间"`
+	JoinTime              int    `description:"参与时长"`
+	JoinType              int    `description:"参与方式, 1网络, 2电话"`
+	DataType              int    `description:"数据类型: 1直播, 2回放"`
+	Occupation            string `description:"职位"`
+	UseridEntity          int    `description:"参会者身份. 1:主讲人, 2:主持人, 3:嘉宾, 4:普通参会者, 5:联席主讲人, 6:会议助理"`
+	CrmCompanyMapStatusId int    `description:"转换后的对应状态信息:1=正式客户, 2=曾使用客户, 3=其他"`
+}
+
+// 获取列表
+func GetJmcjRoadshowDataList(condition string, pars []interface{}) (list []*RoadshowData, err error) {
+	if condition == "" {
+		return
+	}
+	o := orm.NewOrmUsingDB("comein_data")
+	sql := `SELECT * FROM roadshow_data WHERE  1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&list)
+	return
+}

+ 32 - 4
models/report.go

@@ -1110,8 +1110,17 @@ WHERE
 	WHERE
 	mm.id = mmc.meeting_id
 	AND mm.status = 1
-	AND mmc.industry_id = ? ) AS t `
-	err = o.Raw(sql, industrialManagementId, industrialManagementId).QueryRow(&count)
+	AND mmc.industry_id = ? UNION ALL
+	SELECT
+		COUNT( 1 ) count 
+	FROM
+		cygx_product_interior AS p
+		INNER JOIN cygx_product_interior_industrial_group_management AS pm 
+	WHERE
+		p.product_interior_id = pm.product_interior_id 
+		AND p.visible_range = 1 
+	AND pm.industrial_management_id = ?  ) AS t `
+	err = o.Raw(sql, industrialManagementId, industrialManagementId, industrialManagementId).QueryRow(&count)
 	return
 }
 
@@ -1126,6 +1135,7 @@ type TimeLineReportItem struct {
 	SubCategoryName string `description:"二级分类"`
 	IsRed           bool   `description:"是否标红"`
 	Readnum         int    `description:"阅读数量"`
+	Resource        int    `description:"来源类型,1:文章、2:产品内测、3:晨报点评"`
 }
 
 // 获取产业报告+晨会点评列表
@@ -1142,6 +1152,7 @@ FROM
 		a.video_url,
 		a.sub_category_name,
 		'' AS content,
+		1 AS resource,
 		( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = a.article_id ) AS readnum 
 	FROM
 		cygx_article AS a
@@ -1157,6 +1168,7 @@ FROM
 		'' AS video_url,
 		'时间线' AS sub_category_name,
 		mmc.content,
+		3 AS resource,
 		0  AS readnum 
 	FROM
 		cygx_morning_meeting_review_chapter AS mmc
@@ -1164,12 +1176,28 @@ FROM
 	WHERE
 		mm.id = mmc.meeting_id 
 		AND mm.STATUS = 1 
-		AND mmc.industry_id = ? 
+		AND mmc.industry_id = ? UNION ALL
+	SELECT
+		p.product_interior_id AS id,
+		p.title,
+		p.publish_time,
+		'' AS video_url,
+		'' AS sub_category_name,
+		'' AS content,
+		2 AS resource,
+		0 AS readnum 
+	FROM
+		cygx_product_interior AS p
+		INNER JOIN cygx_product_interior_industrial_group_management AS pm 
+	WHERE
+		p.product_interior_id = pm.product_interior_id 
+		AND p.visible_range = 1 
+	AND pm.industrial_management_id = ? 
 	) AS t 
 `
 	sql += ` ORDER BY 
 	t.publish_time DESC LIMIT ?,? `
-	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
+	_, err = o.Raw(sql, industrialManagementId, industrialManagementId, industrialManagementId, startSize, pageSize).QueryRows(&items)
 	return
 }
 

+ 24 - 17
models/report_selection.go

@@ -3,7 +3,6 @@ package models
 import (
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
-	"time"
 )
 
 type CygxReportSelectionRep struct {
@@ -16,6 +15,7 @@ type CygxReportSelectionRep struct {
 	UpdateDescription string `description:"更新说明"`
 	IsRed             bool   `description:"是否标记红点"`
 	ReadNum           int    `description:"阅读次数"`
+	SubjectName       string `description:"标的名称"`
 }
 
 type CygxReportSelectionListPublicRep struct {
@@ -100,6 +100,29 @@ func GetCygxReportSelectionPublic(condition, tbdb string, pars []interface{}) (c
 	return
 }
 
+// 获取数量
+func GetCygxReportSelectionCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_report_selection as art WHERE 1= 1 AND art.publish_status = 1   `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+// 列表
+func GetReportSelectionList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_report_selection  as art WHERE 1= 1 AND art.publish_status = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += `   LIMIT ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 // 通过ID获取详情
 func GetCygxReportSelectionInfoById(articleId int) (item *DetailCygxReportSelectionRep, err error) {
 	o := orm.NewOrm()
@@ -140,22 +163,6 @@ func GetReportSelectionListHome(condition, tbdb string, pars []interface{}, star
 	return
 }
 
-type CygxReportSelectionLog struct {
-	ArticleSunId           int       `description:"子级报告id"`
-	ArticleId              int       `description:"父级报告Id"`
-	ChartPermissionId      int       `description:"行业ID"`
-	PermissionName         string    `description:"行业ID"`
-	CreateTime             time.Time `description:"创建时间"`
-	Body                   string    `description:"内容"`
-	IndustrialSubjectId    int       `description:"标的ID"`
-	IndustrialManagementId string    `description:"产业资源包Id  多个用 , 隔开"`
-	SubjectName            string    `description:"标的名称"`
-	IcoLink                string    `orm:"column(image_url)"description:"图标链接"`
-	CompanyLabel           []string  `description:"公司标签"`
-	Label                  string    `description:"公司标签"`
-	OverviewArticleId      int       `description:"综述报告Id"`
-}
-
 // 列表
 func GetReportSelectionlogListAll(articleId int) (items []*CygxReportSelectionLog, err error) {
 	o := orm.NewOrm()

+ 34 - 0
models/report_selection_log.go

@@ -0,0 +1,34 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxReportSelectionLog struct {
+	ArticleSunId           int       `description:"子级报告id"`
+	ArticleId              int       `description:"父级报告Id"`
+	ChartPermissionId      int       `description:"行业ID"`
+	PermissionName         string    `description:"行业ID"`
+	CreateTime             time.Time `description:"创建时间"`
+	Body                   string    `description:"内容"`
+	IndustrialSubjectId    int       `description:"标的ID"`
+	IndustrialManagementId string    `description:"产业资源包Id  多个用 , 隔开"`
+	SubjectName            string    `description:"标的名称"`
+	IcoLink                string    `orm:"column(image_url)"description:"图标链接"`
+	CompanyLabel           []string  `description:"公司标签"`
+	Label                  string    `description:"公司标签"`
+	OverviewArticleId      int       `description:"综述报告Id"`
+}
+
+// 列表
+func GetCygxReportSelectionLog(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionLog, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_report_selection_log as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 14 - 0
models/wx_user.go

@@ -602,3 +602,17 @@ func UserSubscribe(subscribeTime string, userId int) (err error) {
 	_, err = o.Raw(sql, subscribeTime, userId).Exec()
 	return
 }
+
+func GetWxUserOutboundMobiles(mobiles []string) (item []*WxUserOutboundMobile, err error) {
+	lenmobiles := len(mobiles)
+	if lenmobiles == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `SELECT u.real_name,u.mobile,u.outbound_mobile,u.company_id,p.company_name ,GROUP_CONCAT( DISTINCT p.seller_name SEPARATOR '/' ) AS seller_name
+			FROM wx_user as u 
+			INNER JOIN company_product AS p ON p.company_id = u.company_id 
+			WHERE outbound_mobile IN(` + utils.GetOrmInReplace(lenmobiles) + `)   OR mobile IN (` + utils.GetOrmInReplace(lenmobiles) + `)   GROUP BY u.user_id`
+	_, err = o.Raw(sql, mobiles, mobiles).QueryRows(&item)
+	return
+}

+ 54 - 0
routers/commentsRouter.go

@@ -250,6 +250,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivitySignCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivitySignCoAntroller"],
+        beego.ControllerComments{
+            Method: "SignupDetail",
+            Router: `/signup/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivitySpecialCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ActivitySpecialCoAntroller"],
         beego.ControllerComments{
             Method: "SpecialTripAdd",
@@ -421,6 +430,33 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"],
+        beego.ControllerComments{
+            Method: "ResearchHb",
+            Router: `/research/hb`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"],
+        beego.ControllerComments{
+            Method: "ResearchIntroduce",
+            Router: `/research/introduce`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"],
+        beego.ControllerComments{
+            Method: "ResearchQuotation",
+            Router: `/research/quotation`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHomeController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHomeController"],
         beego.ControllerComments{
             Method: "ListHomePublic",
@@ -1078,6 +1114,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportSelectionController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportSelectionController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ResearchController"],
         beego.ControllerComments{
             Method: "ArticleHotList",
@@ -1258,6 +1303,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "ApplyDetail",
+            Router: `/apply/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:UserController"],
         beego.ControllerComments{
             Method: "ApplyTryOut",

+ 36 - 15
services/activity.go

@@ -426,6 +426,13 @@ func GetUserTypeZhengShi(companyId int) (userType int, permissionStrnew, permiss
 				return
 			}
 			permissionStrnew = permissionStr
+
+			permissionZhengShiStr, errs = models.GetCompanyPermissionByUserZhengShi(companyId)
+			if errs != nil {
+				err = errs
+				return
+			}
+			permissionStrZhengShinew = permissionZhengShiStr
 			//大套餐客户,数据库添加标识,
 			companyUserTypeDetail, errs := models.GetCygxCompanyUserType(companyId)
 			if errs != nil && errs.Error() != utils.ErrNoRow() {
@@ -438,11 +445,6 @@ func GetUserTypeZhengShi(companyId int) (userType int, permissionStrnew, permiss
 					return
 				}
 			}
-			permissionZhengShiStr, errs = models.GetCompanyPermissionByUserZhengShi(companyId)
-			if errs != nil {
-				err = errs
-				return
-			}
 			//1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //3、分行业套餐客户(开通对应行业的正式客户) //4、仅开通专家套餐的正式客户 //5、开通对应行业套餐或专家套餐的试用客户、 10: 30W套餐客户
 			//大套餐客户定义:医药、消费、科技、智造、策略。5个行业中任意4个及以上是正式权限的,属于大套餐客户(医药、消费、科技、智造需要主客观都开)
 			if companyDetail.Status == "永续" {
@@ -493,14 +495,35 @@ func GetUserTypeZhengShi(companyId int) (userType int, permissionStrnew, permiss
 }
 
 // GetSpecialDetailUserPower 处理用户查看详情的权限
-func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.ActivityDetail) (havePower bool, err error) {
+func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.ActivityDetail) (havePower, isResearchSpecial bool, err error) {
 	var companyDetailStatus string
 	var userTypeStr string
+
 	//如果是弘则的用户或者宏观的权限不做校验
 	if GetBelongingRai(user.Mobile) || activityInfo.ChartPermissionName == utils.HONG_GUAN_NAME {
 		havePower = true
 		return
 	}
+	userType, permissionStr, permissionStrZhengShi, e := GetUserTypeZhengShi(user.CompanyId)
+	if e != nil {
+		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
+		return
+	}
+	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
+	if (activityInfo.ActivityTypeId == 3 || activityInfo.ActivityTypeId == 5) && activityInfo.YidongActivityId == "" && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		isResearchSpecial = true
+	}
+	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
+	if isResearchSpecial {
+		if !strings.Contains(permissionStr, utils.CHART_PERMISSION_NAME_YANXUAN) {
+			//如果连试用权限都没有,那么久按照普通的研选样式展示
+			isResearchSpecial = false
+		}
+		if !strings.Contains(permissionStrZhengShi, activityInfo.ChartPermissionName) {
+			havePower = false
+			return
+		}
+	}
 	//处理决策人可见权限
 	if user.IsMaker == 0 && activityInfo.IsMakerShow == 1 {
 		havePower = false
@@ -526,12 +549,6 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 			return
 		}
 	}
-
-	userType, permissionStr, permissionStrZhengShi, e := GetUserTypeZhengShi(user.CompanyId)
-	if e != nil {
-		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
-		return
-	}
 	if permissionStr == "" {
 		return
 	}
@@ -1312,7 +1329,7 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 	var activityIds string
 	var activityIdsLongTime string //可回放的会议,到会详情持续更新加入到不做14天限制的活动中
 	fmt.Println("开始同步")
-	dateTime := time.Now().AddDate(0, 0, -14).Format(utils.FormatDate)
+	dateTime := time.Now().AddDate(0, 0, -7).Format(utils.FormatDate)
 	dateNow := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
 	startDate := dateTime + " 00:00:00"
 	endDate := dateNow + " 23:59:59"
@@ -1435,8 +1452,10 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 						return err
 					}
 
-					go AddctivitySignupDetailByJmcj(needAddAttendanc, activityDetail.ActivityId)
 					go ActivityUserLabelLogAdd(activityDetail.ActivityId, mobileArr)
+
+					AddctivitySignupDetailByJmcj(needAddAttendanc, activityDetail.ActivityId)
+
 				}
 			}
 		}
@@ -1546,8 +1565,10 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 						return err
 					}
 					activityIds += strconv.Itoa(vAct.ActivityId) + ","
-					go AddctivitySignupDetailByJmcj(needAddAttendanc, vAct.ActivityId)
+
 					go ActivityUserLabelLogAdd(vAct.ActivityId, mobileArr)
+					AddctivitySignupDetailByJmcj(needAddAttendanc, vAct.ActivityId)
+
 				}
 			}
 		}

+ 659 - 0
services/activity_meeting.go

@@ -0,0 +1,659 @@
+package services
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//func init() {
+//	fmt.Println(strings.Contains("渠道新声第583期运动服饰渠道调研更新反馈", "运动服饰渠道调研更新反馈"))
+//	fmt.Println(len("反馈"))
+//	GroupingActivityToJmcj()
+//	GetActivityMeetingByJmcj()
+//}
+
+// GroupingActivityToJmcj 建立与进门财经的活动关联
+func GroupingActivityToJmcj(cont context.Context) (err error) {
+	//func GroupingActivityToJmcj() (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("建立与进门财经的活动关联失败"+err.Error(), 2)
+		}
+	}()
+	dateTime := time.Now().AddDate(0, 0, -7).Format(utils.FormatDate)
+	dateNow := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
+	startDate := dateTime + " 00:00:00"
+	endDate := dateNow + " 23:59:59"
+	var condition string
+	var pars []interface{}
+	condition = " AND roadshow_begin_time BETWEEN ? AND ? "
+	//condition += " AND roadshow_id = 95871  "
+	pars = append(pars, startDate, endDate)
+	condition += ` GROUP BY roadshow_id `
+	listJmcj, e := models.GetJmcjRoadshowDataList(condition, pars)
+	if e != nil {
+		err = errors.New("GetJmcjRoadshowDataList, Err: " + e.Error())
+		return
+	}
+	textLen := 15
+	pars = make([]interface{}, 0)
+	condition = " AND activity_time BETWEEN ? AND ? AND publish_status = 1  AND jmcj_activity_id = '' "
+	//condition += " AND activity_id = 1339   "
+	pars = append(pars, startDate, endDate)
+	listHz, e := models.GetActivityListByCondition(condition, pars)
+	if e != nil {
+		err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+		return
+	}
+
+	mapGroupActivityid := make(map[int]string)
+	//通过进门财经匹配弘则
+	for _, vJmcj := range listJmcj {
+		var roadshowTitle, roadshowTitle1, roadshowTitle2, roadshowTitle3, roadshowTitle4 string
+		roadshowTitle = vJmcj.RoadshowTitle
+		roadshowTitle = strings.Replace(roadshowTitle, " ", "", -1)
+		roadshowBeginTime := utils.TimeRemoveHms2(vJmcj.RoadshowBeginTime)
+		nameSlice1 := strings.Split(roadshowTitle, "|")
+		nameSlice2 := strings.Split(roadshowTitle, ":")
+		nameSlice3 := strings.Split(roadshowTitle, "】")
+		nameSlice4 := strings.Split(roadshowTitle, "-")
+		if len(nameSlice1) >= 1 {
+			roadshowTitle1 = nameSlice1[len(nameSlice1)-1]
+		}
+		if len(nameSlice2) >= 1 {
+			roadshowTitle2 = nameSlice2[len(nameSlice2)-1]
+		}
+		if len(nameSlice3) >= 1 {
+			roadshowTitle3 = nameSlice3[len(nameSlice3)-1]
+		}
+		if len(nameSlice4) >= 1 {
+			roadshowTitle4 = nameSlice4[len(nameSlice4)-1]
+		}
+
+		if roadshowTitle == "" {
+			continue
+		}
+		//fmt.Println(roadshowTitle1)
+		//fmt.Println(roadshowTitle2)
+		//fmt.Println(roadshowTitle3)
+		//fmt.Println(roadshowTitle4)
+
+		for _, vHz := range listHz {
+			//如果同一时间标题匹配就建立匹配关系
+			if roadshowBeginTime == utils.TimeRemoveHms2(vHz.ActivityTime) {
+				if strings.Contains(vHz.ActivityNameTask, roadshowTitle) || strings.Contains(vHz.JmcjRoadshowTitle, roadshowTitle) {
+					mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+					break
+				}
+
+				//去掉空格标识,完全等于时候的匹配
+				if strings.Replace(vHz.ActivityName, " ", "", -1) == strings.Replace(vJmcj.RoadshowTitle, " ", "", -1) {
+					mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+					break
+				}
+
+				if len(roadshowTitle1) > textLen {
+					if strings.Contains(vHz.ActivityNameTask, roadshowTitle1) || strings.Contains(vHz.JmcjRoadshowTitle, roadshowTitle1) {
+						mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+						break
+					}
+				}
+				if len(roadshowTitle2) > textLen {
+					if strings.Contains(vHz.ActivityNameTask, roadshowTitle2) || strings.Contains(vHz.JmcjRoadshowTitle, roadshowTitle2) {
+						mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+						break
+					}
+				}
+				if len(roadshowTitle3) > textLen {
+					if strings.Contains(vHz.ActivityNameTask, roadshowTitle3) || strings.Contains(vHz.JmcjRoadshowTitle, roadshowTitle3) {
+						mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+						break
+					}
+				}
+				if len(roadshowTitle4) > textLen {
+					if strings.Contains(vHz.ActivityNameTask, roadshowTitle4) || strings.Contains(vHz.JmcjRoadshowTitle, roadshowTitle4) {
+						mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+						break
+					}
+				}
+			}
+		}
+	}
+
+	//通过弘则匹配进门财经
+	for _, vHz := range listHz {
+		if mapGroupActivityid[vHz.ActivityId] != "" {
+			continue
+		}
+		var roadshowTitle string
+		roadshowTitle = vHz.ActivityName
+		nameSlice := strings.Split(roadshowTitle, "】")
+		if len(nameSlice) >= 1 {
+			roadshowTitle = nameSlice[len(nameSlice)-1]
+			if len(roadshowTitle) > textLen {
+				vHz.ActivityTime = utils.TimeRemoveHms2(vHz.ActivityTime)
+				for _, vJmcj := range listJmcj {
+					//如果同一时间标题匹配就建立匹配关系
+					if vHz.ActivityTime == utils.TimeRemoveHms2(vJmcj.RoadshowBeginTime) {
+						if strings.Contains(vJmcj.RoadshowTitle, roadshowTitle) {
+							mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+							break
+						}
+						if strings.Contains(vJmcj.RoadshowTitle, vHz.JmcjRoadshowTitle) && vHz.JmcjRoadshowTitle != "" {
+							mapGroupActivityid[vHz.ActivityId] = vJmcj.RoadshowId
+							break
+						}
+					}
+				}
+			}
+		}
+	}
+
+	if len(mapGroupActivityid) > 0 {
+		e = models.UpdateJmcjActivityIdGroup(mapGroupActivityid)
+		if e != nil {
+			err = errors.New("UpdateJmcjActivityIdGroup, Err: " + e.Error())
+		}
+	}
+
+	return
+
+}
+
+// GetActivityMeetingByJmcj 同步进门财经到会信息,并处理爽约记录
+func GetActivityMeetingByJmcj(cont context.Context) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取进门财经的到会信息失败,Err"+err.Error(), 2)
+		}
+	}()
+
+	//获取需要一直同步的活动信息
+	configCode := "jin_meng_activity_id"
+	detail, e := models.GetConfigByCode(configCode)
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error())
+		return
+	}
+	mapActivityIdlLongTime := make(map[string]string)
+	sliceValue := strings.Split(detail.ConfigValue, ",")
+	for _, v := range sliceValue {
+		mapActivityIdlLongTime[v] = v
+	}
+	dateTime := time.Now().AddDate(0, 0, 14).Format(utils.FormatDate)
+	dateNow := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
+	startDate := dateTime + " 00:00:00"
+	endDate := dateNow + " 23:59:59"
+	var condition string
+	var pars []interface{}
+	//获取弘则要同步到会信息的活动
+	condition = ` AND activity_time BETWEEN ? AND ? AND publish_status = 1  AND  jmcj_activity_id != '' OR (  activity_id IN (` + detail.ConfigValue + `) AND publish_status = 1 AND  jmcj_activity_id != '' ) `
+	pars = append(pars, startDate, endDate)
+	listHz, e := models.GetActivityListByCondition(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+		return
+	}
+
+	var jmcjActivityIds []string
+	var activityIds []int
+	mapGroupActivityid := make(map[string]int)
+	mapGroupActivityTime := make(map[string]string)
+	for _, v := range listHz {
+		jmcjActivityIds = append(jmcjActivityIds, v.JmcjActivityId)
+		activityIds = append(activityIds, v.ActivityId)
+		mapGroupActivityid[v.JmcjActivityId] = v.ActivityId
+		mapGroupActivityTime[v.JmcjActivityId] = v.ActivityTime
+	}
+
+	//return
+	lenjmcjActivityIds := len(jmcjActivityIds)
+	if lenjmcjActivityIds == 0 {
+		return
+	}
+	//获取进门财经对应的路演ID的到会列表
+	pars = make([]interface{}, 0)
+	condition = ` AND roadshow_id IN (` + utils.GetOrmInReplace(lenjmcjActivityIds) + `)`
+	pars = append(pars, jmcjActivityIds)
+	listJmcj, e := models.GetJmcjRoadshowDataList(condition, pars)
+	if e != nil {
+		err = errors.New("GetJmcjRoadshowDataList, Err: " + e.Error())
+		return
+	}
+
+	//获取已经写入到会信息的参会人员
+	lenactivityIds := len(activityIds)
+	pars = make([]interface{}, 0)
+	condition = ` AND activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
+	pars = append(pars, activityIds)
+	attendanceDetailList, e := models.GetActivityAttendanceDetailListCondition(condition, pars)
+	if e != nil {
+		err = errors.New("GetActivityAttendanceDetailListCondition, Err: " + e.Error())
+		return
+	}
+	mapAttendanceDetail := make(map[string]int)
+	for _, v := range attendanceDetailList {
+		mapAttendanceDetail[fmt.Sprint("ActivityId:", v.ActivityId, "Mobile:", v.Mobile)] = v.ActivityId
+	}
+
+	var mobiles []string
+	var mobileMap = make(map[string]string)
+	//var isPlayback bool                    // 是否包含回放
+	var isPlaybackMap = make(map[int]bool) // 是否包含回放map
+	var activityIdsLongTime string         //包含回放的活动ID
+	needAddAttendanc := make([]*models.CygxActivityAttendanceDetail, 0)
+	for _, v := range listJmcj {
+		if v.UserPhone == "" {
+			continue
+		}
+		if mapGroupActivityid[v.RoadshowId] == 0 {
+			continue
+		}
+		//如果数据已经存在了那么就不做数据更新
+		if mapAttendanceDetail[fmt.Sprint("ActivityId:", mapGroupActivityid[v.RoadshowId], "Mobile:", v.UserPhone)] > 0 {
+			continue
+		}
+		item := new(models.CygxActivityAttendanceDetail)
+		item.ActivityId = mapGroupActivityid[v.RoadshowId]
+		item.RealName = v.UserName
+		item.Mobile = v.UserPhone
+		item.CompanyName = v.Company
+		item.FirstMeetingTime = v.FirstWatchTime
+		item.LastMeetingTime = v.LastWatchTime
+		item.IsMeetingStr = 1
+		item.Duration = utils.GetAttendanceDetailSeconds(v.JoinTime)
+		if v.JoinType == 1 {
+			item.MeetingTypeStr = "网络"
+		} else {
+			item.MeetingTypeStr = "电话"
+		}
+		item.MeetingAuthentication = v.AuthInfo
+		if v.DataType == 1 {
+			item.MeetingStatusStr = "直播"
+		} else {
+			item.MeetingStatusStr = "回放"
+			if !isPlaybackMap[item.ActivityId] && mapActivityIdlLongTime[strconv.Itoa(item.ActivityId)] == "" {
+				activityIdsLongTime += strconv.Itoa(item.ActivityId) + ","
+			}
+			isPlaybackMap[item.ActivityId] = true
+		}
+		item.Position = v.Occupation
+		item.UseridEntity = v.UseridEntity
+		item.ActivityTime = mapGroupActivityTime[v.RoadshowId]
+		item.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
+		item.CreateTime = time.Now()
+		needAddAttendanc = append(needAddAttendanc, item)
+		if mobileMap[v.UserPhone] == "" {
+			mobiles = append(mobiles, v.UserPhone)
+			mobileMap[v.UserPhone] = v.UserPhone
+		}
+	}
+
+	if len(needAddAttendanc) == 0 {
+		return
+	}
+
+	//根据手机号获取这些用户的信息
+	listUser, e := models.GetWxUserOutboundMobiles(mobiles)
+	if e != nil {
+		err = errors.New("GetWxUserOutboundMobiles, Err: " + e.Error())
+		return
+	}
+
+	mapUser := make(map[string]*models.WxUserOutboundMobile)
+	for _, v := range listUser {
+		mapUser[v.Mobile] = v
+		mapUser[v.OutboundMobile] = v
+	}
+
+	var updateActivityIds []int                   // 需要更新的活动ID
+	var updateActivityIdsMap = make(map[int]bool) // 需要更新的活动ID
+	for k, v := range needAddAttendanc {
+		if needAddAttendanc[k].CompanyId == 0 && mapUser[v.Mobile] != nil {
+			needAddAttendanc[k].CompanyId = mapUser[v.Mobile].CompanyId
+			needAddAttendanc[k].SellerName = mapUser[v.Mobile].SellerName
+			needAddAttendanc[k].CompanyName = mapUser[v.Mobile].CompanyName
+			needAddAttendanc[k].IsMeetingStr = 1
+		}
+		if !updateActivityIdsMap[v.ActivityId] {
+			updateActivityIds = append(updateActivityIds, v.ActivityId)
+			updateActivityIdsMap[v.ActivityId] = true
+		}
+		attendanceDetailList = append(attendanceDetailList, v)
+	}
+	if len(updateActivityIds) == 0 {
+		return
+	}
+
+	// 更新需要长时间同步到会信息的活动
+	if activityIdsLongTime != "" {
+		activityIdsLongTime = strings.TrimRight(activityIdsLongTime, ",")
+		activityIdsLongTime = detail.ConfigValue + "," + activityIdsLongTime
+		e = models.UpdateConfigByCode(activityIdsLongTime, configCode)
+		if e != nil {
+			err = errors.New("UpdateConfigByCode, Err: " + e.Error())
+			return
+		}
+	}
+
+	//return
+	{
+		//参会记录
+		e = models.AddAttendancDetailNew(needAddAttendanc, updateActivityIds)
+		if e != nil {
+			err = errors.New("AddAttendancDetailNew, Err: " + e.Error())
+			return err
+		}
+	}
+
+	{
+		//标记到会信息
+		e = models.UpdateCygxActivitySignupIsMeeting(needAddAttendanc)
+		if e != nil {
+			err = errors.New("UpdateCygxActivitySignupIsMeeting, Err: " + e.Error())
+			return err
+		}
+	}
+
+	{
+		//处理是否限制报名
+		AddCygxActivityRestrictSignupByAdminNew(updateActivityIds)
+	}
+
+	{
+		//通过进门财经添加用户参数信息
+		AddctivitySignupDetailByJmcjNew(needAddAttendanc, updateActivityIds)
+	}
+
+	{
+		//添加报名日志 (对个人以及机构互动数量进行排序下载使用)
+		CygxActivityMeetSort(needAddAttendanc, updateActivityIds)
+	}
+	return
+}
+
+// 查研观向处理活动用户限制报名
+func AddCygxActivityRestrictSignupByAdminNew(activityIds []int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go utils.SendAlarmMsg("查研观向处理活动用户限制报名失败,AddCygxActivityRestrictSignupByAdminNew,Err:"+err.Error()+"activityIds"+fmt.Sprint(activityIds), 3)
+		}
+	}()
+
+	var condition string
+	var pars []interface{}
+	lenactivityIds := len(activityIds)
+	if lenactivityIds == 0 {
+		return
+	}
+	condition = ` AND	is_meeting = 1  AND activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
+	pars = append(pars, activityIds)
+	//获取到会了的人员
+	meetingList, e := models.GetActivitySignupList(condition, pars)
+	if e != nil {
+		err = errors.New("GetActivitySignupList" + e.Error())
+		return
+	}
+	var userIdArr []int
+	if len(meetingList) > 0 {
+		for _, v := range meetingList {
+			userIdArr = append(userIdArr, v.UserId)
+		}
+		lenuserIdArr := len(userIdArr)
+		var condition string
+		var pars []interface{}
+		condition = ` AND user_id IN (` + utils.GetOrmInReplace(lenuserIdArr) + `)`
+		pars = append(pars, userIdArr)
+		restrictSignupList, e := models.GetCygxActivityRestrictSignupList(condition, pars, 0, 9999)
+		if e != nil {
+			err = errors.New("GetCygxActivityRestrictSignupList" + e.Error())
+			return
+		}
+
+		//获取这些用户是否被加入到限制报名了
+		maptotalRestrict := make(map[int]bool)
+		for _, v := range restrictSignupList {
+			maptotalRestrict[v.UserId] = true
+		}
+
+		pars = make([]interface{}, 0)
+		condition = `   AND a.is_limit_people  = 1  AND  v.is_meeting = 0 	AND  v.do_fail_type = 0   AND  v.user_id IN (` + utils.GetOrmInReplace(lenuserIdArr) + `) AND a.activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
+		pars = append(pars, userIdArr, activityIds)
+		listSignup, e := models.GetActivitySignupInnerActivityList(condition, pars)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetActivitySignupInnerActivityList" + e.Error())
+			return
+		}
+
+		mapNomeet := make(map[int]int)
+		if len(listSignup) > 0 {
+			for _, v := range listSignup {
+				mapNomeet[v.UserId]++
+			}
+		}
+		var userIdDelArr []int
+		for _, v := range meetingList {
+			//如果加入了爽约限制但是爽约次数少于3条就删除爽约记录
+			if maptotalRestrict[v.UserId] && mapNomeet[v.UserId] < 3 {
+				userIdDelArr = append(userIdDelArr, v.UserId)
+			}
+		}
+		//if len(userIdDelArr) > 0 {
+		//	e = models.DeleteCygxActivityRestrictSignupByUserIds(userIdDelArr)
+		//	if e != nil {
+		//		err = errors.New("DeleteCygxActivityRestrictSignupByUserIds" + e.Error())
+		//		return
+		//	}
+		//}
+	}
+
+	//获取未到会的人员
+	pars = make([]interface{}, 0)
+	condition = `   AND  v.is_meeting = 0 	AND  v.do_fail_type = 0  AND v.activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
+	pars = append(pars, activityIds)
+	nomeetingListlist, e := models.GetActivitySignupInnerActivityList(condition, pars)
+	if e != nil {
+		err = errors.New("GetActivitySignupNomeetingCountList" + e.Error())
+		return
+	}
+	var userIdSiginArr []int
+	var items []*models.CygxActivitySignupBreak
+	for _, v := range nomeetingListlist {
+		userIdSiginArr = append(userIdSiginArr, v.UserId)
+		//添加爽约记录
+		item := new(models.CygxActivitySignupBreak)
+		item.UserId = v.UserId
+		item.ActivityId = v.ActivityId
+		item.CreateTime = time.Now()
+		item.Mobile = v.Mobile
+		item.Email = v.Email
+		item.CompanyId = v.CompanyId
+		item.CompanyName = v.CompanyName
+		item.RealName = v.RealName
+		item.SellerName = v.SellerName
+		items = append(items, item)
+	}
+	lenuserIdSiginArr := len(userIdSiginArr)
+	if lenuserIdSiginArr == 0 {
+		return
+	}
+
+	var itemsRestrict []*models.CygxActivityRestrictSignup
+	maptotalRestrict := make(map[int]bool)
+
+	//var condition string
+	pars = make([]interface{}, 0)
+	condition = ""
+	restrictSignupList, e := models.GetCygxActivityRestrictSignupList(condition, pars, 0, 9999)
+	if e != nil {
+		err = errors.New("GetCygxActivityRestrictSignupList" + e.Error())
+		return
+	}
+
+	//获取这些用户是否被加入到限制报名了
+	for _, v := range restrictSignupList {
+		maptotalRestrict[v.UserId] = true
+	}
+
+	pars = make([]interface{}, 0)
+	condition = `    AND a.is_limit_people  = 1  AND  v.is_meeting = 0 	AND  v.do_fail_type = 0  AND user_id IN (` + utils.GetOrmInReplace(lenuserIdSiginArr) + `)`
+	pars = append(pars, userIdSiginArr)
+	listSignup, e := models.GetActivitySignupInnerActivityList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetActivitySignupInnerActivityList" + e.Error())
+		return
+	}
+	mapNomeet := make(map[int]int)
+	if len(listSignup) > 0 {
+		for _, v := range listSignup {
+			mapNomeet[v.UserId]++
+		}
+	}
+
+	for _, v := range meetingList {
+		//如果加入了爽约限制但是爽约次数少于3条就删除爽约记录
+		if !maptotalRestrict[v.UserId] && mapNomeet[v.UserId] >= 3 {
+			itemRestrict := new(models.CygxActivityRestrictSignup)
+			itemRestrict.UserId = v.UserId
+			itemRestrict.CreateTime = time.Now()
+			itemRestrict.Mobile = v.Mobile
+			itemRestrict.Email = v.Email
+			itemRestrict.CompanyId = v.CompanyId
+			itemRestrict.CompanyName = v.CompanyName
+			itemRestrict.IsRestrict = 1
+			itemsRestrict = append(itemsRestrict, itemRestrict)
+			maptotalRestrict[v.UserId] = true
+		}
+	}
+
+	e = models.DeleteCygxActivitySignupBreakByIds(activityIds)
+	if e != nil {
+		err = errors.New("DeleteCygxActivitySignupBreakById" + e.Error())
+		return
+	}
+
+	//添加爽约记录
+	if len(items) > 0 {
+		_, e = models.AddCygxActivitySignupBreakList(items)
+		if e != nil {
+			err = errors.New("AddCygxActivitySignupBreakList, Err: " + e.Error())
+			return
+		}
+	}
+
+	//添加报名限制
+	if len(itemsRestrict) > 0 {
+		_, e = models.AddCygxActivityRestrictSignupList(itemsRestrict)
+		if e != nil {
+			err = errors.New("AddCygxActivityRestrictSignupList, Err: " + e.Error())
+			return
+		}
+	}
+
+	return
+}
+
+// 对个人以及机构互动数量进行排序下载使用
+func CygxActivityMeetSort(list []*models.CygxActivityAttendanceDetail, activityIds []int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go utils.SendAlarmMsg("查研观向处理活动用户限制报名失败,AddCygxActivityRestrictSignupByAdminNew,Err:"+err.Error()+"activityIds"+fmt.Sprint(activityIds), 3)
+		}
+	}()
+	var items []*models.CygxActivityMeetDetailLog
+	var condition string
+	var pars []interface{}
+	lenactivityIds := len(activityIds)
+	if lenactivityIds == 0 {
+		return
+	}
+	//获取已经写入到会信息的参会人员
+	pars = make([]interface{}, 0)
+	condition = ` AND activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
+	pars = append(pars, activityIds)
+	activityMeetDetailLogList, e := models.GetCygxActivityMeetDetailLogList(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxActivityMeetDetailLogList, Err: " + e.Error())
+		return
+	}
+	mapActivityMeetDetailL := make(map[string]int)
+	for _, v := range activityMeetDetailLogList {
+		mapActivityMeetDetailL[fmt.Sprint("ActivityId:", v.ActivityId, "Mobile:", v.Mobile)] = v.ActivityId
+	}
+
+	var companyIds []int
+	var companyIdsMap = make(map[int]bool)
+	var mobiles []string
+	var mobilesMap = make(map[string]bool)
+	for _, v := range list {
+		if mapActivityMeetDetailL[fmt.Sprint("ActivityId:", v.ActivityId, "Mobile:", v.Mobile)] > 0 {
+			continue
+		}
+		item := new(models.CygxActivityMeetDetailLog)
+		item.ActivityId = v.ActivityId
+		item.Mobile = v.Mobile
+		item.CompanyName = v.CompanyName
+		item.CompanyId = v.CompanyId
+		item.ActivityTime = v.ActivityTime
+		item.CreateTime = v.CreateTime
+		if !companyIdsMap[v.CompanyId] {
+			companyIds = append(companyIds, v.CompanyId)
+		}
+		if !mobilesMap[v.Mobile] {
+			mobiles = append(mobiles, v.Mobile)
+		}
+		items = append(items, item)
+	}
+	//插入
+	e = models.AddCygxActivityMeetDetailLogMulti(items)
+	if e != nil {
+		err = errors.New("AddCygxActivityMeetDetailLogMulti, Err: " + e.Error())
+		return
+	}
+
+	{
+		//批量修改个人参会数量
+		listMobileCount, e := models.GetActivityMeetDetailLogCountMobile(mobiles)
+		if e != nil {
+			err = errors.New("GetActivityMeetDetailLogCountCompany, Err: " + e.Error())
+			return
+		}
+
+		if len(listMobileCount) > 0 {
+			e = models.UpdateCygxActivityMeetDetailLogMobileNumMulti(listMobileCount)
+			if e != nil {
+				err = errors.New("UpdateCygxActivityMeetDetailLogMobileNumMulti, Err: " + e.Error())
+				return
+			}
+		}
+	}
+
+	{
+		//批量修改机构参会数量
+		listCompanyCount, e := models.GetActivityMeetDetailLogCountCompany(companyIds)
+		if e != nil {
+			err = errors.New("GetActivityMeetDetailLogCountCompany, Err: " + e.Error())
+			return
+		}
+
+		if len(listCompanyCount) > 0 {
+			e = models.UpdateCygxActivityMeetDetailLogCompanyNumMulti(listCompanyCount)
+			if e != nil {
+				err = errors.New("UpdateCygxActivityMeetDetailLogCompanyNumMulti, Err: " + e.Error())
+				return
+			}
+		}
+	}
+	return
+
+}

+ 27 - 0
services/activity_signin.go

@@ -179,3 +179,30 @@ func CygxActivityRestrictSignupByuid(uid, activityId int) (err error) {
 	}
 	return
 }
+
+// GetUserActivitySigninTimeMap  获取用户的签到时间
+func GetUserActivitySigninTimeMap(activityId int) (mapItem map[int]string, err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("扫码签到日志记录,失败,活动ID:"+strconv.Itoa(activityId)+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition = "  AND activity_id = ?  "
+	pars = append(pars, activityId)
+	userList, e := models.GetCygxActivitySigninList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySigninList" + e.Error())
+		return
+	}
+	mapItem = make(map[int]string, 0)
+	for _, v := range userList {
+		if v.UserId == 0 {
+			continue
+		}
+		mapItem[v.UserId] = v.CreateTime.Format(utils.FormatDateTime)
+	}
+	return
+}

+ 95 - 2
services/activity_signup_detail.go

@@ -7,7 +7,7 @@ import (
 	"hongze/hongze_cygx/utils"
 )
 
-//AddctivitySignupDetail  获取当天已结束的活动的报名信息。添加到到会详情
+// AddctivitySignupDetail  获取当天已结束的活动的报名信息。添加到到会详情
 func AddctivitySignupDetail(cont context.Context) (err error) {
 	defer func() {
 		if err != nil {
@@ -93,7 +93,7 @@ func AddctivitySignupDetail(cont context.Context) (err error) {
 	return err
 }
 
-//AddctivitySignupDetailByJmcj 通过进门财经添加用户参数信息
+// AddctivitySignupDetailByJmcj 通过进门财经添加用户参数信息
 func AddctivitySignupDetailByJmcj(itemsDetail []*models.CygxActivityAttendanceDetail, activityId int) (err error) {
 	defer func() {
 		if err != nil {
@@ -207,3 +207,96 @@ func GetCygxActivityAttendanceDetail() {
 	}
 	//fmt.Println(mapDetal)
 }
+
+// AddctivitySignupDetailByJmcj 通过进门财经添加用户参数信息
+func AddctivitySignupDetailByJmcjNew(itemsDetail []*models.CygxActivityAttendanceDetail, activityIds []int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("通过进门财经添加用户参数信息失败 ErrMsg:"+err.Error(), 2)
+		}
+	}()
+	actLen := len(activityIds)
+	var condition string
+	var pars []interface{}
+	if actLen > 0 {
+		condition += ` AND activity_id IN (` + utils.GetOrmInReplace(actLen) + `)`
+		pars = append(pars, activityIds)
+	}
+
+	signUpDetailList, err := models.GetSignupDetailList(condition, pars)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return err
+	}
+
+	mapsignUpDetai := make(map[string]string)
+	if len(signUpDetailList) > 0 {
+		for _, v := range signUpDetailList {
+			mapsignUpDetai[fmt.Sprint("ActivityId", v.ActivityId, "Mobile", v.Mobile)] = v.Mobile
+		}
+	}
+
+	//获取当天已经结束了 活动的报名人数
+	signUpList, err := models.GetSignupDetailBySignup(condition, pars)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return err
+	}
+	//建立外呼号与手机号的绑定
+	mapsignUp := make(map[string]string)
+	if len(signUpList) > 0 {
+		for _, v := range signUpList {
+			mapsignUp[fmt.Sprint(v.OutboundMobile)] = v.Mobile
+		}
+	}
+
+	var itemsAdd []*models.CygxActivitySignupDetail
+	var itemsUpdate []*models.CygxActivitySignupDetail
+
+	for _, v := range itemsDetail {
+		var item = new(models.CygxActivitySignupDetail)
+		item.ActivityId = v.ActivityId
+		item.RealName = v.RealName
+		//如果手机号存在那么就是报名的,不存在就是直接参与的
+		if _, ok := mapsignUp[v.Mobile]; ok {
+			item.Mobile = mapsignUp[v.Mobile]
+		} else {
+			item.Mobile = v.Mobile
+		}
+		item.OutboundMobile = v.Mobile
+		item.CompanyName = v.CompanyName
+		item.CompanyId = v.CompanyId
+		item.SellerName = v.SellerName
+		item.FirstMeetingTime = v.FirstMeetingTime
+		item.LastMeetingTime = v.LastMeetingTime
+		item.Duration = v.Duration
+		item.MeetingTypeStr = v.MeetingTypeStr
+		item.MeetingAuthentication = v.MeetingAuthentication
+		item.MeetingStatusStr = v.MeetingStatusStr
+		item.CreateTime = v.CreateTime
+		item.Position = v.Position
+		item.IsMeeting = 1
+		item.UseridEntity = v.UseridEntity
+		item.ActivityTime = v.ActivityTime
+		item.CrmCompanyMapStatusId = v.CrmCompanyMapStatusId
+
+		if _, ok := mapsignUpDetai[fmt.Sprint("ActivityId", v.ActivityId, "Mobile", item.Mobile)]; !ok {
+			itemsAdd = append(itemsAdd, item)
+		} else {
+			itemsUpdate = append(itemsUpdate, item)
+		}
+	}
+	if len(itemsAdd) > 0 {
+		err = models.AddCygxActivitySignupDetail(itemsAdd)
+		if err != nil {
+			return
+		}
+	}
+	if len(itemsUpdate) > 0 {
+		err = models.UpdateActivitySignupDetailMulti(itemsUpdate)
+		if err != nil {
+			return
+		}
+	}
+
+	return err
+}

+ 67 - 0
services/activity_wx_template_msg.go

@@ -83,3 +83,70 @@ func SendResearchActivitiesTemplateMsg(user *models.WxUserItem, activityDetail *
 	}
 	return
 }
+
+// SendActivitieSignTemplateMsg 线下调研活动扫码签到给对应销售发模班消息
+func SendActivitieSignTemplateMsg(user *models.WxUserItem, activityDetail *models.ActivityDetail) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("线下调研活动扫码签到给对应销售发模班消息推送失败Err:", err.Error(), "活动ID:", activityDetail.ActivityId, "手机号:", user.Mobile), 2)
+		}
+	}()
+	var mobiles []string
+	//获取销售信息
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	if sellerItem != nil {
+		mobiles = append(mobiles, sellerItem.Mobile)
+	}
+
+	var first string
+	var keyword1 string
+	var keyword2 string
+	var keyword3 string
+	var keyword4 string
+	var remark string
+	var redirectUrl string
+
+	first = ""
+	keyword1 = activityDetail.ActivityName
+	keyword2 = user.RealName + "——" + user.CompanyName
+	keyword3 = time.Now().Format(utils.FormatDateTime)
+	keyword4 = ""
+	remark = ""
+
+	openIdList, e := models.GetWxOpenIdByMobileSliceList(mobiles)
+	if e != nil {
+		err = errors.New("GetWxOpenIdByMobileList, Err: " + e.Error())
+		return
+	}
+	openIdArr := make([]string, 0)
+	for _, v := range openIdList {
+		openIdArr = append(openIdArr, v.OpenId)
+	}
+	if utils.RunMode != "release" {
+		redirectUrl = utils.WX_MSG_PATH_ACTIVITY_DETAIL + strconv.Itoa(activityDetail.ActivityId)
+	} else {
+		redirectUrl = utils.WX_MSG_PATH_ACTIVITY_SIGN + strconv.Itoa(activityDetail.ActivityId)
+	}
+
+	sendInfo := new(SendWxTemplate)
+	sendInfo.First = first
+	sendInfo.Keyword1 = keyword1
+	sendInfo.Keyword2 = keyword2
+	sendInfo.Keyword3 = keyword3
+	sendInfo.Keyword4 = keyword4
+	sendInfo.Remark = remark
+	sendInfo.TemplateId = utils.WxMsgTemplateIdActivitySign
+	sendInfo.RedirectUrl = redirectUrl
+	sendInfo.RedirectTarget = 3
+	sendInfo.Resource = strconv.Itoa(activityDetail.ActivityId)
+	sendInfo.SendType = utils.TEMPLATE_MSG_CYGX_COMMENT
+	sendInfo.OpenIdArr = openIdArr
+	err = PublicSendTemplateMsg(sendInfo)
+	if err != nil {
+		return
+	}
+	return
+}

+ 20 - 0
services/admin.go

@@ -64,3 +64,23 @@ func GetBelongingRai(mobile string) (isBelong bool) {
 	}
 	return
 }
+
+// GetAdminCheckUserMobileMap  获取对应销售所能查看的用户手机号
+func GetAdminCheckUserMobileMap(user *models.WxUserItem) (mapItem map[string]string, err error) {
+	admin, e := models.GetSysAdminByMobile(user.Mobile)
+	if e != nil {
+		err = e
+		return
+	}
+	userList, e := models.GetSellerUserMobile(admin.AdminId)
+	if e != nil {
+		err = e
+		return
+	}
+	mapMobile := make(map[string]string)
+	for _, v := range userList {
+		mapMobile[v.Mobile] = v.Mobile
+	}
+	mapItem = mapMobile
+	return
+}

+ 25 - 6
services/company_permission.go

@@ -149,7 +149,12 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 		err = errors.New("GetApplyRecordCount, Err: " + e.Error())
 		return
 	}
-	popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+
+	if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		popupMsg = "暂无<b>买方研选</b>权限<br/>您可申请开通试用"
+	} else {
+		popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+	}
 	if user.CompanyId == 1 {
 		if applyCount > 0 {
 			hasPermission = 4
@@ -177,7 +182,12 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 				}
 			}
 			hasPermission = hasPermission
-			popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+			if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+				popupMsg = "暂无<b>买方研选</b>权限<br/>您可申请开通试用"
+			} else {
+				popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+			}
+
 			return
 		} else {
 			return
@@ -192,11 +202,20 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 			err = errors.New("GetCompanyPermission, Err: " + e.Error())
 			return
 		}
-		if companyPermission == "专家" {
-			popupMsg = "您暂无权限参加【" + activityInfo.ActivityTypeName + "】类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
-
+		if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+			//popupMsg = "暂无<b>买方研选</b>权限<br/>点击提交申请,提醒对口销售为你开通试用"
+			if !strings.Contains(companyPermission, utils.CHART_PERMISSION_NAME_YANXUAN) && (activityInfo.ActivityTypeId == 3 || activityInfo.ActivityTypeId == 5) {
+				popupMsg = "暂无<b>买方研选</b>权限<br/>点击提交申请,提醒对口销售为你开通试用"
+			} else {
+				popupMsg = "签约买方研选套餐才可参与此活动,请联系对口销售"
+			}
 		} else {
-			popupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+			if companyPermission == "专家" {
+				popupMsg = "您暂无权限参加【" + activityInfo.ActivityTypeName + "】类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+
+			} else {
+				popupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
+			}
 		}
 	} else {
 		hasPermission = 5

+ 11 - 4
services/task.go

@@ -29,8 +29,8 @@ func Task() {
 		sendEmailUserWhiteListChange := task.NewTask("sendEmailUserWhiteListChange", "0 00 17 * * *", SendEmailUserWhiteListChange) //新增 和冻结的客户白名单
 		task.AddTask("白名单发送", sendEmailUserWhiteListChange)
 
-		dotongbuShangHaiSendEmail := task.NewTask("dotongbuShangHaiSendEmail", "0 00 4 * * *", DotongbuShangHaiSendEmail) //发送上海策略品台同步结果名单的邮件附件
-		task.AddTask("发送上海策略品台同步结果名单的邮件附件", dotongbuShangHaiSendEmail)
+		//dotongbuShangHaiSendEmail := task.NewTask("dotongbuShangHaiSendEmail", "0 00 4 * * *", DotongbuShangHaiSendEmail) //发送上海策略品台同步结果名单的邮件附件
+		//task.AddTask("发送上海策略品台同步结果名单的邮件附件", dotongbuShangHaiSendEmail)
 
 		getChartListByApi := task.NewTask("getChartListByApi", "0 */10 * * * *", GetChartDetailByChartId) //同步图表
 		task.AddTask("getChartListByApi", getChartListByApi)
@@ -65,8 +65,15 @@ func Task() {
 		//更改对应产业的文章阅读数量
 		chageIndustrialArticleNum := task.NewTask("chageIndustrialArticleNum", "0 01 00 * * *", ChageIndustrialArticleNum) //更改对应产业的文章阅读数量
 		task.AddTask("chageIndustrialArticleNum", chageIndustrialArticleNum)
-		activityAttendanceDetail := task.NewTask("activityAttendanceDetail", "0 00 3 * * *", ActivityAttendanceDetail) //同步进门财经的路演信息
-		task.AddTask("sendEmailUserWhiteListChange", activityAttendanceDetail)
+
+		//activityAttendanceDetail := task.NewTask("activityAttendanceDetail", "0 00 3 * * *", ActivityAttendanceDetail) //同步进门财经的路演信息
+		//task.AddTask("activityAttendanceDetail", activityAttendanceDetail)
+
+		groupingActivityToJmcj := task.NewTask("groupingActivityToJmcj", "0 00 1 * * *", GroupingActivityToJmcj) //建立进门财经与弘则活动的匹配关系
+		task.AddTask("groupingActivityToJmcj", groupingActivityToJmcj)
+
+		getActivityMeetingByJmcj := task.NewTask("getActivityMeetingByJmcj", "0 00 3 * * *", GetActivityMeetingByJmcj) //同步进门财经的路演信息
+		task.AddTask("getActivityMeetingByJmcj", getActivityMeetingByJmcj)
 
 		sendEmailFileForAskMsgResearch := task.NewTask("sendEmailFileForAskMsgResearch", "0 */5 6-23 * * *", SendEmailFileForAskMsgResearch) //研选系列专家电话会,会前1小时将问题列表发送给邮箱
 		task.AddTask("sendEmailFileForAskMsgResearch", sendEmailFileForAskMsgResearch)

+ 11 - 0
services/wechat_send_msg.go

@@ -9,6 +9,7 @@ import (
 	"hongze/hongze_cygx/utils"
 	"io/ioutil"
 	"net/http"
+	"strconv"
 	"strings"
 	"time"
 )
@@ -156,6 +157,16 @@ func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod s
 	var keyword4 string
 	var remark string
 	var redirectUrl string
+
+	detail, e := models.GetCygxApplyRecordByMobile(mobile)
+	if e != nil {
+		err = errors.New("GetActivitySignupNomeetingCountList" + e.Error())
+		return
+	}
+	//如果是潜在客户就推送可查看详情的模版消息
+	if detail.ApplyMethod == 2 && utils.RunMode == "release" {
+		redirectUrl = utils.WX_MSG_PATH_APPLY_DETAIL + strconv.Itoa(detail.ApplyRecordId)
+	}
 	keyword1 = "权限申请:" + realName + "【" + companyName + "】"
 	keyword2 = mobile
 	keyword3 = time.Now().Format(utils.FormatDateTime)

+ 5 - 6
services/yidong.go

@@ -554,6 +554,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 	endDate := time.Now().Add(-time.Minute * 120).Format(utils.FormatDateTime)
 	condition += ` AND   activity_time > ` + "'" + startDate + "'"
 	condition += ` AND  activity_time < ` + "'" + endDate + "'"
+
 	//fmt.Println(startDate)
 	artivityListYidong, err := models.GetActivityListByYidong(condition)
 	if err != nil {
@@ -701,11 +702,10 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 					item.Duration = vresult.Duration
 					item.IsMeetingStr = 1
 					mobileStrMeet += "'" + vresult.PersonTelephone + "'" + ","
-
+					item.CreateTime = time.Now()
+					needAddAttendanc = append(needAddAttendanc, item)
 				}
 				mobileStr += "'" + vresult.PersonTelephone + "'" + ","
-				item.CreateTime = time.Now()
-				needAddAttendanc = append(needAddAttendanc, item)
 
 			}
 			lenmobiles := len(mobiles)
@@ -753,7 +753,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 					}
 				}
 			}
-			//fmt.Println(mobileStr)
+
 			//参会记录
 			err = models.AddAttendancDetail(needAddAttendanc, v.ActivityId, mobileStrMeet)
 			if err != nil {
@@ -766,8 +766,7 @@ func GetYiDongActivityMeeting(cont context.Context) (err error) {
 				fmt.Println("AddCygxActivityRestrictSignupByAdmin Err:", err.Error())
 				return err
 			}
-			fmt.Println(len(needAddAttendanc))
-			go AddctivitySignupDetailByJmcj(needAddAttendanc, v.ActivityId)
+			AddctivitySignupDetailByJmcj(needAddAttendanc, v.ActivityId)
 		}
 	}
 

+ 3 - 0
utils/config.go

@@ -44,6 +44,7 @@ var (
 	WxMsgTemplateIdArticleUserRemind      string //用户阅读报告通知-模板ID
 	WxMsgTemplateIdArticleUserRemindXzs   string //用户阅读报告通知-模板ID(小助手)
 	WxMsgTemplateIdActivityChangeApplyXzs string //查研观向活动变更通知-模板ID(小助手)
+	WxMsgTemplateIdActivitySign           string //查研观向活动签到通知-模板ID(小助手)
 )
 
 // 微信公众号配置信息
@@ -227,6 +228,7 @@ func init() {
 		WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"         ////预约取消提醒(小助手)
 		TemplateIdByProductXzs = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"                //产品运行报告通知-模板ID(小助手)
 		WxMsgTemplateIdActivityChangeApplyXzs = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //查研观向活动变更通知-模板ID(小助手)
+		WxMsgTemplateIdActivitySign = "3l5cxpqH6c9kkLe9ow7qzqd0uYEOdY3A_PB8wRWkiHk"           //查研观向活动签到通知-模板ID(小助手)
 	} else {
 		//新的模板ID
 		WxPublicIdXzs = "wxb7cb8a15abad5b8e"                                                  //查研观向小助手
@@ -237,6 +239,7 @@ func init() {
 		WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM"         ////预约取消提醒(小助手)
 		TemplateIdByProductXzs = "tNcCUiK_uUkuxaFF7M9NP2RwLkw8uHFjG-TDIxGUKxo"                //产品运行报告通知-模板ID(小助手)
 		WxMsgTemplateIdActivityChangeApplyXzs = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s" //查研观向活动变更通知-模板ID(小助手)
+		WxMsgTemplateIdActivitySign = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s"           //查研观向活动签到通知-模板ID(小助手)
 	}
 
 	//易董开放api配置

+ 2 - 0
utils/constants.go

@@ -170,6 +170,8 @@ const (
 	WX_MSG_PATH_LAST_WEEK_DETAIL       = "reportPages/reportSecretDetail/reportSecretDetail?type=3&id=" //上周纪要汇总详情模板消息地址
 	WX_MSG_PATH_KEY_COMPANY_DETAIL     = "reportPages/keyCompany/keyCompany"                            //重点公司详情模板消息地址
 	WX_MSG_PATH_RESEARCHTHEME_DETAIL   = "reportPages/researchTheme/researchTheme?id="                  //主题详情模板消息地址
+	WX_MSG_PATH_ACTIVITY_SIGN          = "pages-message/activityTemplate/activityTemplate?id="          //活动模板消息地址
+	WX_MSG_PATH_APPLY_DETAIL           = "pages-message/applyFor/applyFor?id="                          //潜在用户试用权限申请
 )
 
 //2:文章详情  https://web.hzinsights.com/material/info/8436  小程序路径:/pageMy/reportDetail/reportDetail?id=