浏览代码

Merge branch 'cygx_9.3.1_0' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 年之前
父节点
当前提交
d88c86e56f
共有 3 个文件被更改,包括 81 次插入51 次删除
  1. 29 27
      services/activity.go
  2. 51 24
      services/activity_special.go
  3. 1 0
      services/resource_data.go

+ 29 - 27
services/activity.go

@@ -708,35 +708,36 @@ func GetActivityonditionList(user *models.WxUserItem, activityTypeId, chartPermi
 	//condition += ` AND art.visible_range != 1  AND art.publish_status = 1 `
 	//condition += ` AND art.visible_range != 1  AND art.publish_status = 1 `
 	condition += `   AND art.publish_status = 1 `
 	condition += `   AND art.publish_status = 1 `
 
 
-	permissionZhengShiStr, errs := models.GetCompanyPermissionByUserZhengShi(user.CompanyId)
-	if errs != nil {
-		err = errs
-		return
-	}
+	//permissionZhengShiStr, errs := models.GetCompanyPermissionByUserZhengShi(user.CompanyId)
+	//if errs != nil {
+	//	err = errs
+	//	return
+	//}
 	//9:其他行业正式客户:前述所有正式客户以外的正式客户 查询处理
 	//9:其他行业正式客户:前述所有正式客户以外的正式客户 查询处理
-	if permissionZhengShiStr != "" {
-		slicePerZhengshi := strings.Split(permissionZhengShiStr, ",")
-		permissionZhengShiStr = ""
-		for _, v := range slicePerZhengshi {
-			if userType == 1 {
-				//研选权限处理(永续客户无法查看研选)
-				if !strings.Contains(v, utils.CHART_PERMISSION_NAME_YANXUAN) {
-					permissionZhengShiStr += "'" + v + "',"
-				}
-			} else {
-				permissionZhengShiStr += "'" + v + "',"
-			}
-		}
-		permissionZhengShiStr = strings.Replace(permissionZhengShiStr, "(主观)", "", -1)
-		permissionZhengShiStr = strings.Replace(permissionZhengShiStr, "(客观)", "", -1)
-		permissionZhengShiStr = strings.TrimRight(permissionZhengShiStr, ",")
-		//conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%3%'	   AND art.chart_permission_name  IN (` + permissionZhengShiStr + `)` + condition + `) `
-
-		if userType == 9 {
-			conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%9%'	   AND art.chart_permission_name  NOT  IN (` + permissionZhengShiStr + `)` + condition + `) `
-		}
-	}
+	//if permissionZhengShiStr != "" {
+	//	slicePerZhengshi := strings.Split(permissionZhengShiStr, ",")
+	//	permissionZhengShiStr = ""
+	//	for _, v := range slicePerZhengshi {
+	//		if userType == 1 {
+	//			//研选权限处理(永续客户无法查看研选)
+	//			if !strings.Contains(v, utils.CHART_PERMISSION_NAME_YANXUAN) {
+	//				permissionZhengShiStr += "'" + v + "',"
+	//			}
+	//		} else {
+	//			permissionZhengShiStr += "'" + v + "',"
+	//		}
+	//	}
+	//	permissionZhengShiStr = strings.Replace(permissionZhengShiStr, "(主观)", "", -1)
+	//	permissionZhengShiStr = strings.Replace(permissionZhengShiStr, "(客观)", "", -1)
+	//	permissionZhengShiStr = strings.TrimRight(permissionZhengShiStr, ",")
+	//	//conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%3%'	   AND art.chart_permission_name  IN (` + permissionZhengShiStr + `)` + condition + `) `
+	//
+	//	if userType == 9 {
+	//		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%9%'	   AND art.chart_permission_name  NOT  IN (` + permissionZhengShiStr + `)` + condition + `) `
+	//	}
+	//}
 
 
+	//if userType != 2 {
 	// 8: 行业升级套餐客户:该活动对应行业为升级权限的客户
 	// 8: 行业升级套餐客户:该活动对应行业为升级权限的客户
 	permissionShengji, errs := models.GetCompanyPermissionByUserZhengShiTrip(user.CompanyId)
 	permissionShengji, errs := models.GetCompanyPermissionByUserZhengShiTrip(user.CompanyId)
 	if errs != nil {
 	if errs != nil {
@@ -759,6 +760,7 @@ func GetActivityonditionList(user *models.WxUserItem, activityTypeId, chartPermi
 		permissionShengji = strings.TrimRight(permissionShengji, ",")
 		permissionShengji = strings.TrimRight(permissionShengji, ",")
 		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%8%'	   AND art.chart_permission_name  IN (` + permissionShengji + `)` + condition + `) `
 		conditionOr += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%8%'	   AND art.chart_permission_name  IN (` + permissionShengji + `)` + condition + `) `
 	}
 	}
+	//}
 
 
 	conditionHz = condition
 	conditionHz = condition
 	//活动仅决策人可见
 	//活动仅决策人可见

+ 51 - 24
services/activity_special.go

@@ -15,7 +15,7 @@ import (
 //	UpdateCygxActivitySpecialSignupNum()
 //	UpdateCygxActivitySpecialSignupNum()
 //}
 //}
 
 
-//修改专项调研,用户与公司的参与数量
+// 修改专项调研,用户与公司的参与数量
 func UpdateCygxActivitySpecialSignupNum(cont context.Context) (err error) {
 func UpdateCygxActivitySpecialSignupNum(cont context.Context) (err error) {
 	defer func() {
 	defer func() {
 		if err != nil {
 		if err != nil {
@@ -71,7 +71,7 @@ func UpdateCygxActivitySpecialSignupNum(cont context.Context) (err error) {
 	return
 	return
 }
 }
 
 
-//处理专项调研的展示
+// 处理专项调研的展示
 func GetActivityLabelSpecialList(user *models.WxUserItem, isPower int, chartPermissionIds, permissionNameStr string) (item *models.ActivityTypeHome, err error) {
 func GetActivityLabelSpecialList(user *models.WxUserItem, isPower int, chartPermissionIds, permissionNameStr string) (item *models.ActivityTypeHome, err error) {
 	itemList := new(models.ActivityTypeHome)
 	itemList := new(models.ActivityTypeHome)
 	if user.CompanyId <= 1 {
 	if user.CompanyId <= 1 {
@@ -159,7 +159,7 @@ func GetActivityLabelSpecialList(user *models.WxUserItem, isPower int, chartPerm
 	return
 	return
 }
 }
 
 
-//HandleActivityLabelSpecialPermission 处理专项产业调研的查询权限sql 永续
+// HandleActivityLabelSpecialPermission 处理专项产业调研的查询权限sql 永续
 func HandleActivityLabelSpecialPermission(user *models.WxUserItem) (condition string, err error) {
 func HandleActivityLabelSpecialPermission(user *models.WxUserItem) (condition string, err error) {
 	permissionStr, e := GetCompanyPermission(user.CompanyId)
 	permissionStr, e := GetCompanyPermission(user.CompanyId)
 	if e != nil {
 	if e != nil {
@@ -184,25 +184,27 @@ func HandleActivityLabelSpecialPermission(user *models.WxUserItem) (condition st
 	}
 	}
 	permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
 	permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
 	condition = ` AND art.publish_status = 1  AND art.label != ''  AND art.is_offline = 0  `
 	condition = ` AND art.publish_status = 1  AND art.label != ''  AND art.is_offline = 0  `
-	if permissionSqlStr != "" {
-		condition += ` AND art.chart_permission_name  IN (` + permissionSqlStr + `) `
-	}
+	//if permissionSqlStr != "" {
+	//	condition += ` AND art.chart_permission_name  IN (` + permissionSqlStr + `) `
+	//}
 	condition += ` AND  art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
 	condition += ` AND  art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
 	return
 	return
 }
 }
 
 
-//HandleActivityLabelSpecialPermisseion 处理专项产业调研的查询权限sql
+// HandleActivityLabelSpecialPermisseion 处理专项产业调研的查询权限sql
 func HandleActivityLabelSpecialTripPermission(user *models.WxUserItem) (condition string, err error) {
 func HandleActivityLabelSpecialTripPermission(user *models.WxUserItem) (condition string, err error) {
 	permissionStr, e := GetCompanyPermission(user.CompanyId)
 	permissionStr, e := GetCompanyPermission(user.CompanyId)
 	if e != nil {
 	if e != nil {
 		err = errors.New("GetCompanyPermission, Err: " + e.Error())
 		err = errors.New("GetCompanyPermission, Err: " + e.Error())
 		return
 		return
 	}
 	}
-	userType, e := GetSpecialUserType(user)
+	userType, _, e := GetUserType(user.CompanyId)
+	//userType, e := GetSpecialUserType(user)
 	if e != nil {
 	if e != nil {
 		err = errors.New("GetSpecialUserType, Err: " + e.Error())
 		err = errors.New("GetSpecialUserType, Err: " + e.Error())
 		return
 		return
 	}
 	}
+	//fmt.Println(userType)
 	slicePer := strings.Split(permissionStr, ",")
 	slicePer := strings.Split(permissionStr, ",")
 	var permissionSqlStr string
 	var permissionSqlStr string
 	for _, v := range slicePer {
 	for _, v := range slicePer {
@@ -216,14 +218,39 @@ func HandleActivityLabelSpecialTripPermission(user *models.WxUserItem) (conditio
 	}
 	}
 	permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
 	permissionSqlStr = strings.TrimRight(permissionSqlStr, ",")
 	condition = ` AND art.publish_status = 1  AND art.label != ''  AND art.is_offline = 0  `
 	condition = ` AND art.publish_status = 1  AND art.label != ''  AND art.is_offline = 0  `
-	if permissionSqlStr != "" {
-		condition += ` AND art.chart_permission_name  IN (` + permissionSqlStr + `) `
-	}
+	//if permissionSqlStr != "" {
+	//	condition += ` AND art.chart_permission_name  IN (` + permissionSqlStr + `) `
+	//}
 	condition += ` AND  art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
 	condition += ` AND  art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
+
+	//if userType != 2 {
+	// 8: 行业升级套餐客户:该活动对应行业为升级权限的客户
+	permissionShengji, errs := models.GetCompanyPermissionByUserZhengShiTrip(user.CompanyId)
+	if errs != nil {
+		err = errs
+		return
+	}
+	if permissionShengji != "" {
+		slicePerShengji := strings.Split(permissionShengji, ",")
+		permissionShengji = ""
+		for _, v := range slicePerShengji {
+			if userType == 1 {
+				//研选权限处理(永续客户无法查看研选)
+				if !strings.Contains(v, utils.CHART_PERMISSION_NAME_YANXUAN) {
+					permissionShengji += "'" + v + "',"
+				}
+			} else {
+				permissionShengji += "'" + v + "',"
+			}
+		}
+		permissionShengji = strings.TrimRight(permissionShengji, ",")
+		condition += ` OR (  art.is_limit_people = 1 AND art.customer_type_ids LIKE '%8%' AND art.chart_permission_name  IN (` + permissionShengji + `)` + condition + `) `
+	}
+
 	return
 	return
 }
 }
 
 
-//获取预报名列表
+// 获取预报名列表
 func GetActivitySpecialPrepareList(user *models.WxUserItem, startSize, pageSize int, keywords string) (list []*models.CygxActivitySpecialDetail, totalPrepare int, err error) {
 func GetActivitySpecialPrepareList(user *models.WxUserItem, startSize, pageSize int, keywords string) (list []*models.CygxActivitySpecialDetail, totalPrepare int, err error) {
 	companyDetail, e := models.GetCompanyDetailByIdGroupTrip(user.CompanyId)
 	companyDetail, e := models.GetCompanyDetailByIdGroupTrip(user.CompanyId)
 	if e != nil {
 	if e != nil {
@@ -361,7 +388,7 @@ func GetActivityLabelSpecialConfirmList(user *models.WxUserItem, startSize, page
 	return
 	return
 }
 }
 
 
-//获取用户已经报名的活动
+// 获取用户已经报名的活动
 func GetSpecialTripUserMap(activityIds []int, userId int) (mapUserId map[int]int, err error) {
 func GetSpecialTripUserMap(activityIds []int, userId int) (mapUserId map[int]int, err error) {
 	var condition string
 	var condition string
 	var pars []interface{}
 	var pars []interface{}
@@ -385,7 +412,7 @@ func GetSpecialTripUserMap(activityIds []int, userId int) (mapUserId map[int]int
 	return
 	return
 }
 }
 
 
-//获取用户已经报名的活动数量
+// 获取用户已经报名的活动数量
 func GetSpecialTripUserSchedule(userId int) (total int, err error) {
 func GetSpecialTripUserSchedule(userId int) (total int, err error) {
 	var condition string
 	var condition string
 	var pars []interface{}
 	var pars []interface{}
@@ -399,7 +426,7 @@ func GetSpecialTripUserSchedule(userId int) (total int, err error) {
 	return
 	return
 }
 }
 
 
-//GetActivitySpecialList 获取专项调研列表
+// GetActivitySpecialList 获取专项调研列表
 func GetActivitySpecialList(user *models.WxUserItem, currentIndex, pageSize int, keywords string) (list []*models.CygxActivitySpecialDetail, total int, err error) {
 func GetActivitySpecialList(user *models.WxUserItem, currentIndex, pageSize int, keywords string) (list []*models.CygxActivitySpecialDetail, total int, err error) {
 	listConfirm, totalConfirm, e := GetActivityLabelSpecialConfirmList(user, (currentIndex-1)*pageSize, pageSize, 4, keywords)
 	listConfirm, totalConfirm, e := GetActivityLabelSpecialConfirmList(user, (currentIndex-1)*pageSize, pageSize, 4, keywords)
 	if e != nil {
 	if e != nil {
@@ -487,7 +514,7 @@ func GetActivitySpecialList(user *models.WxUserItem, currentIndex, pageSize int,
 	return
 	return
 }
 }
 
 
-//HandleActivitySpecialShow 处理活动的状态
+// HandleActivitySpecialShow 处理活动的状态
 func HandleActivitySpecialShow(activityDetail *models.CygxActivitySpecialDetail, user *models.WxUserItem) (item *models.CygxActivitySpecialDetail, err error) {
 func HandleActivitySpecialShow(activityDetail *models.CygxActivitySpecialDetail, user *models.WxUserItem) (item *models.CygxActivitySpecialDetail, err error) {
 	var activityIds []int
 	var activityIds []int
 	resultTimeStart := utils.StrTimeToTime(activityDetail.ActivityTime)  //时间字符串格式转时间格式
 	resultTimeStart := utils.StrTimeToTime(activityDetail.ActivityTime)  //时间字符串格式转时间格式
@@ -521,7 +548,7 @@ func HandleActivitySpecialShow(activityDetail *models.CygxActivitySpecialDetail,
 	return
 	return
 }
 }
 
 
-//活动与专项调研搜索 GetActivitySpecialSearcheList
+// 活动与专项调研搜索 GetActivitySpecialSearcheList
 func GetActivitySpecialSearcheList(user *models.WxUserItem, condition string, startSize, pageSize int, keywords string) (items []*models.ActivityDetail, total int, err error) {
 func GetActivitySpecialSearcheList(user *models.WxUserItem, condition string, startSize, pageSize int, keywords string) (items []*models.ActivityDetail, total int, err error) {
 	var conditionSpecil string
 	var conditionSpecil string
 	var pars, parsSpecil []interface{}
 	var pars, parsSpecil []interface{}
@@ -584,7 +611,7 @@ func GetActivitySpecialSearcheList(user *models.WxUserItem, condition string, st
 	return
 	return
 }
 }
 
 
-//获取 专项调研客户类型   //1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //8、行业升级套餐客户 //9、其余正式客户;5、试用客户
+// 获取 专项调研客户类型   //1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //8、行业升级套餐客户 //9、其余正式客户;5、试用客户
 func GetActivitySpecialUserType(companyId int) (userType int, permissionStrnew string, err error) {
 func GetActivitySpecialUserType(companyId int) (userType int, permissionStrnew string, err error) {
 	var permissionStr string
 	var permissionStr string
 	if companyId <= 1 {
 	if companyId <= 1 {
@@ -642,8 +669,8 @@ func GetActivitySpecialUserType(companyId int) (userType int, permissionStrnew s
 	return
 	return
 }
 }
 
 
-//GetSpecialUserType 获取专项产业调研的用户身份类型
-//获取 专项调研客户类型   //1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //8、行业升级套餐客户 //9、其余正式客户;5、试用客户
+// GetSpecialUserType 获取专项产业调研的用户身份类型
+// 获取 专项调研客户类型   //1、永续客户 //2、大套餐客户(4个行业全开通的正式客户) //8、行业升级套餐客户 //9、其余正式客户;5、试用客户
 func GetSpecialUserType(user *models.WxUserItem) (userType int, err error) {
 func GetSpecialUserType(user *models.WxUserItem) (userType int, err error) {
 	companyId := user.CompanyId
 	companyId := user.CompanyId
 	companyDetail, e := models.GetCompanyDetailByIdGroupTrip(companyId)
 	companyDetail, e := models.GetCompanyDetailByIdGroupTrip(companyId)
@@ -687,7 +714,7 @@ func GetSpecialUserType(user *models.WxUserItem) (userType int, err error) {
 	return
 	return
 }
 }
 
 
-//GetSpecialDetailUserPower 处理用户查看专项调研详情的权限
+// GetSpecialDetailUserPower 处理用户查看专项调研详情的权限
 func GetSpecialDetailUserPower(user *models.WxUserItem, activityInfo *models.CygxActivitySpecialDetail) (havePower bool, err error) {
 func GetSpecialDetailUserPower(user *models.WxUserItem, activityInfo *models.CygxActivitySpecialDetail) (havePower bool, err error) {
 	permissionStr, e := GetCompanyPermissionUpgrade(user.CompanyId)
 	permissionStr, e := GetCompanyPermissionUpgrade(user.CompanyId)
 	if e != nil {
 	if e != nil {
@@ -729,7 +756,7 @@ func GetSpecialDetailUserPower(user *models.WxUserItem, activityInfo *models.Cyg
 	return
 	return
 }
 }
 
 
-//预报名活动,感兴趣人数满10人时,推送给活动负责人和王芳
+// 预报名活动,感兴趣人数满10人时,推送给活动负责人和王芳
 func SendWxMsgActivitySpecial10(activityInfo *models.CygxActivitySpecialDetail) (err error) {
 func SendWxMsgActivitySpecial10(activityInfo *models.CygxActivitySpecialDetail) (err error) {
 	activityId := activityInfo.ActivityId
 	activityId := activityInfo.ActivityId
 	var msg string
 	var msg string
@@ -797,7 +824,7 @@ func SendWxMsgActivitySpecial10(activityInfo *models.CygxActivitySpecialDetail)
 	return
 	return
 }
 }
 
 
-//SendWxMsgActivitySpecialTwoDays  活动开始前两天08:00,提醒报名客户 \提醒报名客户的对口销售
+// SendWxMsgActivitySpecialTwoDays  活动开始前两天08:00,提醒报名客户 \提醒报名客户的对口销售
 func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 	var msg string
 	var msg string
 	defer func() {
 	defer func() {
@@ -904,7 +931,7 @@ func SendWxMsgActivitySpecialTwoDays(cont context.Context) (err error) {
 	return
 	return
 }
 }
 
 
-//SendWxMsgActivitySpecialCancel  线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
+// SendWxMsgActivitySpecialCancel  线下活动前4天08:00报名人数不足7人,线上活动前3天08:00报名人数不足10人,活动自动取消发布,并推送模板消息至报名客户及对口销售
 func SendWxMsgActivitySpecialCancel(cont context.Context) (err error) {
 func SendWxMsgActivitySpecialCancel(cont context.Context) (err error) {
 	var msg string
 	var msg string
 	defer func() {
 	defer func() {

+ 1 - 0
services/resource_data.go

@@ -197,6 +197,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			} else {
 			} else {
 				v.TripStatus = 2
 				v.TripStatus = 2
 				v.TripImgLink = v.TripImgLinkFix
 				v.TripImgLink = v.TripImgLinkFix
+				v.ActivityTimeText = v.ActivityTimeTextByDay
 			}
 			}
 			resultTimeStart := utils.StrTimeToTime(v.ActivityTime)  //时间字符串格式转时间格式
 			resultTimeStart := utils.StrTimeToTime(v.ActivityTime)  //时间字符串格式转时间格式
 			resultTimeEnd := utils.StrTimeToTime(v.ActivityTimeEnd) //时间字符串格式转时间格式
 			resultTimeEnd := utils.StrTimeToTime(v.ActivityTimeEnd) //时间字符串格式转时间格式