Преглед на файлове

Merge branch 'cygx_10.5.4' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai преди 1 година
родител
ревизия
a1fffaaaee
променени са 8 файла, в които са добавени 36 реда и са изтрити 23 реда
  1. 10 8
      controllers/activity.go
  2. 4 0
      controllers/report_selection.go
  3. 1 0
      models/activity.go
  4. 1 1
      models/activity_attendance_detail.go
  5. 1 0
      models/activity_signup.go
  6. 12 6
      services/activity.go
  7. 2 2
      services/task.go
  8. 5 6
      services/yidong.go

+ 10 - 8
controllers/activity.go

@@ -345,13 +345,13 @@ 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, utils.CHART_PERMISSION_NAME_YANXUAN) {
@@ -645,12 +645,13 @@ func (this *ActivityCoAntroller) SignupAdd() {
 		resp.IsResearch = true
 	}
 
-	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 {
 		hasPermission = 1
 		signupStatus = "Success"
@@ -1168,13 +1169,13 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
 		resp.IsResearch = true
 	}
 
-	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 {
 		hasPermission = 1
 		signupStatus = "Success"
@@ -2083,12 +2084,13 @@ func (this *ActivityCoAntroller) CheckAsk() {
 	}
 	resp := new(models.SignupStatus)
 	hasPermission := 0
-	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 {
 		hasPermission = 1
 		signupStatus = "Success"
@@ -3278,13 +3280,13 @@ func (this *ActivityCoAntroller) ActivityAppointmentAdd() {
 	item := new(models.CygxActivityAppointment)
 	resp := new(models.SignupStatus)
 	hasPermission := 0
-	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 {
 		hasPermission = 1
 		signupStatus = "Success"

+ 4 - 0
controllers/report_selection.go

@@ -36,7 +36,11 @@ func (this *ReportSelectionController) Detail() {
 	}
 	//uid := user.UserId
 	articleId, _ := this.GetInt("ArticleId")
+	activityId, _ := this.GetInt("ActivityId")
 	isBestNew, _ := this.GetBool("IsBestNew")
+	if activityId > 0 && articleId == 0 {
+		articleId = activityId
+	}
 	if articleId == 0 || isBestNew {
 		isBestNew = true
 		if isBestNew {

+ 1 - 0
models/activity.go

@@ -223,6 +223,7 @@ type CygxActivityResp struct {
 	SellerMobile      string `description:"销售电话"`
 	SellerName        string `description:"销售姓名"`
 	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
 	Detail            *ActivityDetail
 }
 

+ 1 - 1
models/activity_attendance_detail.go

@@ -142,7 +142,7 @@ func AddAttendancDetail(items []*CygxActivityAttendanceDetail, activityId int, m
 	//		return
 	//	}
 	//}
-	_, err = o.InsertMulti(1, items)
+	_, err = o.InsertMulti(len(items), items)
 	return
 }
 

+ 1 - 0
models/activity_signup.go

@@ -41,6 +41,7 @@ type SignupStatus struct {
 	GoOutboundMobile  bool   `description:"是否去绑定手机号"`
 	GoBindEmail       bool   `description:"是否去绑定邮箱"`
 	IsResearch        bool   `description:"是否属于研选"`
+	IsResearchSpecial bool   `description:"是否属于特殊的研选"`
 }
 
 // 我的日程

+ 12 - 6
services/activity.go

@@ -493,9 +493,13 @@ 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
+	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
+	if (activityInfo.ActivityTypeId == 3 || activityInfo.ActivityTypeId == 5) && activityInfo.YidongActivityId == "" && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+		isResearchSpecial = true
+	}
 	//如果是弘则的用户或者宏观的权限不做校验
 	if GetBelongingRai(user.Mobile) || activityInfo.ChartPermissionName == utils.HONG_GUAN_NAME {
 		havePower = true
@@ -533,7 +537,7 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 		return
 	}
 	//如果是 公司调研电话会:3,或 专家线下沙龙:5  而且  除易董同步过来的以外的研选类型活动,必须要有研选的正式权限
-	if (activityInfo.ActivityTypeId == 3 || activityInfo.ActivityTypeId == 5) && activityInfo.YidongActivityId == "" && strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+	if isResearchSpecial {
 		if !strings.Contains(permissionStrZhengShi, activityInfo.ChartPermissionName) {
 			havePower = false
 			return
@@ -1320,7 +1324,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"
@@ -1442,9 +1446,9 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 						fmt.Println("AddCygxActivityRestrictSignupByAdmin Err:", err.Error())
 						return err
 					}
-
-					go AddctivitySignupDetailByJmcj(needAddAttendanc, activityDetail.ActivityId)
 					go ActivityUserLabelLogAdd(activityDetail.ActivityId, mobileArr)
+					AddctivitySignupDetailByJmcj(needAddAttendanc, activityDetail.ActivityId)
+
 				}
 			}
 		}
@@ -1554,8 +1558,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)
 				}
 			}
 		}

+ 2 - 2
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)

+ 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)
 		}
 	}