|
@@ -3227,9 +3227,18 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ fmt.Println(permissionNameStr)
|
|
|
+ //判断客户规模是否属于可见范围的活动
|
|
|
+ companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var sqlExport string
|
|
|
resp := new(models.ActivityTypeListHomeResp)
|
|
|
for k, v := range list {
|
|
|
- var sqlExport string
|
|
|
+
|
|
|
var condition string
|
|
|
permissionSqlStr = ` AND art.chart_permission_name IN (` + permissionNameStr + `)`
|
|
|
sqlExport = ` AND (art.customer_type_ids LIKE '%` + strconv.Itoa(userType) + `%' `
|
|
@@ -3281,13 +3290,6 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
|
|
|
} else {
|
|
|
conditionOr += ` OR ( art.is_limit_people = 0 ` + condition + `) `
|
|
|
}
|
|
|
- //判断客户规模是否属于可见范围的活动
|
|
|
- companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
if companyProduct != nil {
|
|
|
if companyProduct.Scale != "" {
|
|
@@ -3311,6 +3313,55 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
|
|
|
}
|
|
|
list[k].List = labelList
|
|
|
}
|
|
|
+
|
|
|
+ //userType = 1
|
|
|
+ //查询专项产业调研展示权限
|
|
|
+ var condition string
|
|
|
+ condition = ` AND art.publish_status = 1 AND art.label != '' `
|
|
|
+ if isPower == 1 {
|
|
|
+ condition += permissionSqlStr
|
|
|
+ }
|
|
|
+ //行业名称
|
|
|
+ if len(chartPermissionIds) > 0 {
|
|
|
+ condition += ` AND art.chart_permission_id IN (` + chartPermissionIds + `)`
|
|
|
+ }
|
|
|
+ var conditionOr string
|
|
|
+
|
|
|
+ if (userType == 2 || userType == 3 || userType == 4) && strings.Contains(permissionStr, "专家") {
|
|
|
+ conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%4%' ` + condition + `) `
|
|
|
+ }
|
|
|
+ if (userType == 5) && strings.Contains(permissionStr, "专家") {
|
|
|
+ conditionOr += ` OR (1=1 AND art.customer_type_ids LIKE '%5%' ` + condition + `) `
|
|
|
+ }
|
|
|
+ if userType == 1 {
|
|
|
+ conditionOr += ` OR (` + condition + permissionSqlStr + `) `
|
|
|
+ } else {
|
|
|
+ conditionOr += ` OR ( 1=1 ` + condition + `) `
|
|
|
+ }
|
|
|
+
|
|
|
+ if companyProduct != nil {
|
|
|
+ if companyProduct.Scale != "" {
|
|
|
+ conditionOr += ` OR ( art.scale LIKE '%` + companyProduct.Scale + `%' ` + condition + `) `
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ condition += sqlExport + conditionOr
|
|
|
+ specialList, err := models.GetActivityLabelSpecialListAll(condition, pars, startSize, 8)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k2, v2 := range specialList {
|
|
|
+ specialList[k2].KeyWord = services.LabelStr(v2.KeyWord)
|
|
|
+ }
|
|
|
+ itemList := new(models.ActivityTypeHome)
|
|
|
+ itemList.ActivityTypeName = "专项产业调研"
|
|
|
+ itemList.List = specialList
|
|
|
+ itemList.ActivityTypeId = 7
|
|
|
+ itemList.ImgUrl = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211216/YSo4QpqtQgwFJzYnxF9TNpAXrFIz.png"
|
|
|
+ itemList.ImgUrlBg = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211206/1tN4hKDCa6Nq2sZFMKWgJtMVdMvP.png"
|
|
|
+ list = append(list, itemList)
|
|
|
//获取对应活动的数量并排序
|
|
|
intArr := make([]int, 0)
|
|
|
var items []*models.ActivityTypeHome
|
|
@@ -3343,18 +3394,37 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //如果第三个活动数量比第四个多,则两者调换
|
|
|
- if len(itemsNew) > 3 {
|
|
|
- if len(itemsNew[2].List) > len(itemsNew[3].List) {
|
|
|
- var itemsNewCopy []*models.ActivityTypeHome
|
|
|
- for _, v := range itemsNew {
|
|
|
- itemsNewCopy = append(itemsNewCopy, v)
|
|
|
- }
|
|
|
- itemsNew[2] = itemsNewCopy[3]
|
|
|
- itemsNew[3] = itemsNewCopy[2]
|
|
|
+ //按照像素进行排序
|
|
|
+ rowHeight := 83 //每一行的行高
|
|
|
+ basicsHeight := 178 // 基础高度
|
|
|
+ position := 1 // 初始化位置 ,1,左边, 2 右边
|
|
|
+ var leftPx, rightPx int
|
|
|
+ for k, v := range itemsNew {
|
|
|
+ if leftPx <= rightPx {
|
|
|
+ position = 1
|
|
|
+ } else {
|
|
|
+ position = 2
|
|
|
+ }
|
|
|
+ itemsNew[k].Position = position
|
|
|
+ if position == 1 {
|
|
|
+ leftPx += basicsHeight + rowHeight*len(v.List)
|
|
|
+ } else {
|
|
|
+ rightPx += basicsHeight + rowHeight*len(v.List)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ ////如果第三个活动数量比第四个多,则两者调换
|
|
|
+ //if len(itemsNew) > 3 {
|
|
|
+ // if len(itemsNew[2].List) > len(itemsNew[3].List) {
|
|
|
+ // var itemsNewCopy []*models.ActivityTypeHome
|
|
|
+ // for _, v := range itemsNew {
|
|
|
+ // itemsNewCopy = append(itemsNewCopy, v)
|
|
|
+ // }
|
|
|
+ // itemsNew[2] = itemsNewCopy[3]
|
|
|
+ // itemsNew[3] = itemsNewCopy[2]
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
//记录用户搜索的筛选条件
|
|
|
|
|
|
item := new(models.CygxActivitySearchHistory)
|