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