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

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

xingzai 2 жил өмнө
parent
commit
ea662f8479

+ 86 - 37
controllers/activity.go

@@ -12,7 +12,6 @@ import (
 	"strconv"
 	"strings"
 	"time"
-	"unicode/utf8"
 )
 
 // 活动
@@ -2560,7 +2559,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 		return
 	}
 	var startSize int
-	pageSize = 20
+	pageSize = 1000
 	var sortTime string
 	var pars []interface{}
 	//活动可见限制
@@ -2588,6 +2587,45 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 		permissionNameStr += `, '宏观'`
 	}
 
+	var condition string
+	conditionActivity, err := services.GetActivityonditionList(user, "", chartPermissionIds, whichDay, activeState, "", isPower, 0, "", 0, 1)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
+		return
+	}
+	condition += `AND art.is_limit_people = 1 ` + conditionActivity
+	sortTime = ` mintimesort ASC `
+	listActivity, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	mapActivity := make(map[int][]*models.CygxActivityLabelList)
+	mapkeyWord := make(map[string]string)
+	for _, v := range listActivity {
+		if v.KeyWord == "" {
+			continue
+		}
+		// 如果是C类电话会就不展示内容,且合并到分析师电话会
+		if v.ActivityTypeId == 7 {
+			v.ActivityTypeId = 2
+		}
+		item := new(models.CygxActivityLabelList)
+		item.KeyWord = services.LabelStrV5(v.KeyWord, v.IsShowSubjectName, v.TemporaryLabel)
+		if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", item.KeyWord)]; ok {
+			continue
+		}
+		item.Resource = 1
+		item.ActivityId = v.ActivityId
+		if v.YidongActivityId > 0 {
+			item.IsExternalLabel = true
+		}
+		mapActivity[v.ActivityTypeId] = append(mapActivity[v.ActivityTypeId], item)
+		mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", item.KeyWord)] = item.KeyWord
+	}
+	//
 	list, err := models.GetActivityTypeHomeList()
 	if err != nil {
 		br.Msg = "获取失败"
@@ -2607,44 +2645,55 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	resp := new(models.ActivityTypeListHomeResp)
 	for k, v := range list {
 		// 如果是C类电话会就不展示内容,且合并到分析师电话会
-		if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
-			continue
-		}
-		var condition string
-		conditionActivity, err := services.GetActivityonditionList(user, strconv.Itoa(v.ActivityTypeId), chartPermissionIds, whichDay, activeState, "", isPower, 0, "", 0, 1)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
-			return
-		}
-		condition += `AND art.is_limit_people = 1 ` + conditionActivity
-		sortTime = ` mintimesort ASC `
-		labelList, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		var itemslabe []*models.CygxActivityLabelList
+		//if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
+		//	continue
+		//}
+		//var condition string
+		//conditionActivity, err := services.GetActivityonditionList(user, "", chartPermissionIds, whichDay, activeState, "", isPower, 0, "", 0, 1)
+		//if err != nil && err.Error() != utils.ErrNoRow() {
+		//	br.Msg = "获取失败"
+		//	br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
+		//	return
+		//}
+		//condition += `AND art.is_limit_people = 1 ` + conditionActivity
+		//sortTime = ` mintimesort ASC `
+		//labelList, err := models.GetActivityLabelListAll(condition, sortTime, pars, startSize, pageSize)
+		//if err != nil {
+		//	br.Msg = "获取失败"
+		//	br.ErrMsg = "获取失败,Err:" + err.Error()
+		//	return
+		//}
+		//var itemslabe []*models.CygxActivityLabelList
 
-		mapkeyWord := make(map[string]string)
+		//mapkeyWord := make(map[string]string)
 		//标签字段关联的产业与标签处理
-		for k2, v2 := range labelList {
-			if v2.YidongActivityId != 0 {
-				v2.IsExternalLabel = true
-			}
-			if utf8.RuneCountInString(v2.City) != 2 {
-				labelList[k2].City = ""
-			}
-			labelList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName, v2.TemporaryLabel)
-			labelList[k2].ImgUrlBg = v.ImgUrlBgs
-			if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)]; ok {
-				continue
+		//for k2, v2 := range labelList {
+		//	if v2.YidongActivityId != 0 {
+		//		v2.IsExternalLabel = true
+		//	}
+		//	if v2.ActivityTypeId == 7 {
+		//		v2.ActivityTypeId = 2
+		//	}
+		//	if v.ActivityTypeId == 7 {
+		//		v.ActivityTypeId = 2
+		//	}
+		//	if utf8.RuneCountInString(v2.City) != 2 {
+		//		labelList[k2].City = ""
+		//	}
+		//	labelList[k2].KeyWord = services.LabelStrV5(v2.KeyWord, v2.IsShowSubjectName, v2.TemporaryLabel)
+		//	labelList[k2].ImgUrlBg = v.ImgUrlBgs
+		//	if _, ok := mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)]; ok {
+		//		continue
+		//	}
+		//	itemslabe = append(itemslabe, labelList[k2])
+		//	mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)] = labelList[k2].KeyWord
+		//}
+		if len(mapActivity[v.ActivityTypeId]) > 0 {
+			for _, v2 := range mapActivity[v.ActivityTypeId] {
+				v2.ImgUrlBg = v.ImgUrlBgs
 			}
-			itemslabe = append(itemslabe, labelList[k2])
-			mapkeyWord[fmt.Sprint(v.ActivityTypeId, "-", labelList[k2].KeyWord)] = labelList[k2].KeyWord
 		}
-		list[k].List = itemslabe
+		list[k].List = mapActivity[v.ActivityTypeId]
 		list[k].Resource = 1
 	}
 
@@ -2773,7 +2822,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} models.GetCygxActivitySpecialDetailListResp
-// @router /special/list [get]
+// @router /special/del_list [get]
 func (this *ActivityCoAntroller) SpecialList() {
 	br := new(models.BaseResponse).Init()
 	defer func() {

+ 2 - 1
models/activity.go

@@ -718,12 +718,13 @@ type CygxActivityLabelList struct {
 	TripStatus        int    `description:"行程进行状态 1:预报名,2:确定行程"`
 	City              string `description:"城市"`
 	Days              int    `description:"天数"`
+	ActivityTypeId    int    `description:"活动类型id"`
 }
 
 // 主题列表
 func GetActivityLabelListAll(condition, sortTime string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityLabelList, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT	activity_id, label,temporary_label,is_show_subject_name, MAX( art.activity_time ) AS timesort, MIn( art.activity_time ) AS mintimesort , yidong_activity_id,city
+	sql := `SELECT	activity_id,activity_type_id, label,temporary_label,is_show_subject_name, MAX( art.activity_time ) AS timesort, MIn( art.activity_time ) AS mintimesort , yidong_activity_id,city
 		FROM cygx_activity as art WHERE 1= 1 `
 	if condition != "" {
 		sql += condition

+ 1 - 1
services/activity.go

@@ -631,7 +631,7 @@ func GetActivityonditionList(user *models.WxUserItem, activityTypeId, chartPermi
 	var conditionAdmin string
 	var conditionHz string // 弘则权限处理
 	var sqlExport string   // 专家权限处理
-	permissionSqlStr = `  AND art.chart_permission_name  IN (` + permissionNameStr + `)`
+	//permissionSqlStr = `  AND art.chart_permission_name  IN (` + permissionNameStr + `)`
 	sqlExport = ` AND (art.customer_type_ids LIKE '%` + userTypeStr + `%' `
 	//if userType == 2 {
 	//	sqlExport += ` OR  art.customer_type_ids LIKE '%3%' `

+ 15 - 1
services/activity_special.go

@@ -352,7 +352,7 @@ func GetActivityLabelSpecialConfirmList(user *models.WxUserItem, startSize, page
 		return
 	}
 	var conditionOr string
-	if permissionShengji != "" && userType != 2 {
+	if permissionShengji != "" {
 		slicePerShengji := strings.Split(permissionShengji, ",")
 		permissionShengji = ""
 		for _, v := range slicePerShengji {
@@ -795,6 +795,20 @@ func GetSpecialDetailUserPower(user *models.WxUserItem, activityInfo *models.Cyg
 	}
 	if total == 1 {
 		havePower = true
+		return
+	}
+
+	// 8: 行业升级套餐客户:该活动对应行业为升级权限的客户
+	permissionShengji, errs := models.GetCompanyPermissionByUserZhengShiTrip(user.CompanyId)
+	if errs != nil {
+		err = errs
+		return
+	}
+	if permissionShengji != "" {
+		if strings.Contains(permissionShengji, activityInfo.ChartPermissionName) && strings.Contains(activityInfo.CustomerTypeIds, "8") {
+			havePower = true
+			return
+		}
 	}
 	return
 }