|
@@ -110,6 +110,7 @@ func (this *ActivityCoAntroller) ActivityList() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
var userType int
|
|
var userType int
|
|
|
|
+ var permissionStr string
|
|
if user.CompanyId <= 1 {
|
|
if user.CompanyId <= 1 {
|
|
userType = 0
|
|
userType = 0
|
|
} else {
|
|
} else {
|
|
@@ -134,7 +135,7 @@ func (this *ActivityCoAntroller) ActivityList() {
|
|
} else if companyDetail.Status == "试用" {
|
|
} else if companyDetail.Status == "试用" {
|
|
userType = 5
|
|
userType = 5
|
|
} else if companyDetail.Status == "正式" {
|
|
} else if companyDetail.Status == "正式" {
|
|
- permissionStr, err := models.GetCompanyPermission(user.CompanyId)
|
|
|
|
|
|
+ permissionStr, err = models.GetCompanyPermission(user.CompanyId)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|
|
br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
@@ -162,6 +163,10 @@ func (this *ActivityCoAntroller) ActivityList() {
|
|
var pars []interface{}
|
|
var pars []interface{}
|
|
//活动可见限制
|
|
//活动可见限制
|
|
condition += ` AND (is_limit_people = 0 OR(is_limit_people = 1 AND customer_type_ids LIKE'%` + strconv.Itoa(userType) + `%')) `
|
|
condition += ` AND (is_limit_people = 0 OR(is_limit_people = 1 AND customer_type_ids LIKE'%` + strconv.Itoa(userType) + `%')) `
|
|
|
|
+ if userType == 3 && strings.Contains(permissionStr, "专家") {
|
|
|
|
+ condition += ` AND (is_limit_people = 0 OR(is_limit_people = 1 AND customer_type_ids LIKE'%4%')) `
|
|
|
|
+ }
|
|
|
|
+
|
|
if keyWord != "" {
|
|
if keyWord != "" {
|
|
condition += ` AND (art.activity_name LIKE '%` + keyWord + `%' )`
|
|
condition += ` AND (art.activity_name LIKE '%` + keyWord + `%' )`
|
|
}
|
|
}
|
|
@@ -362,6 +367,7 @@ func (this *ActivityCoAntroller) Detail() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
if userType == 3 {
|
|
if userType == 3 {
|
|
if !strings.Contains(permissionStr, "专家") && activityInfo.LimitPeopleNum > 0 && (!strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) || activityInfo.CustomerTypeIds == "4") {
|
|
if !strings.Contains(permissionStr, "专家") && activityInfo.LimitPeopleNum > 0 && (!strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) || activityInfo.CustomerTypeIds == "4") {
|
|
br.Msg = "您暂无权限查看该活动"
|
|
br.Msg = "您暂无权限查看该活动"
|
|
@@ -424,33 +430,33 @@ func (this *ActivityCoAntroller) Detail() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
|
|
//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
|
|
//OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
|
|
//OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
|
|
|
|
+ var havePower bool
|
|
if (activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式" {
|
|
if (activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式" {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if companyDetailStatus == "正式" && strings.Contains(permissionStr, "专家") && strings.Contains(activityInfo.CustomerTypeIds, "4") {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(userType)) {
|
|
|
|
+ havePower = true
|
|
|
|
+ }
|
|
|
|
+ if havePower {
|
|
hasPermission = 1
|
|
hasPermission = 1
|
|
resp.HaqveJurisdiction = true
|
|
resp.HaqveJurisdiction = true
|
|
} else {
|
|
} else {
|
|
- if activityInfo.ActivityTypeId != 1 && activityInfo.ActivityTypeId != 3 && permissionStr == "专家" {
|
|
|
|
- resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动"
|
|
|
|
- resp.SellerMobile = companyItem.Mobile
|
|
|
|
- resp.SellerName = companyItem.SellerName
|
|
|
|
|
|
+ if permissionStr == "专家" {
|
|
|
|
+ resp.PopupMsg = "您暂无权限参加【" + activityInfo.ActivityTypeName + "】类型活动"
|
|
resp.MsgType = "Type"
|
|
resp.MsgType = "Type"
|
|
- resp.OperationMode = "Call"
|
|
|
|
- hasPermission = 2
|
|
|
|
} else {
|
|
} else {
|
|
- if strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
|
|
|
|
- hasPermission = 1
|
|
|
|
- resp.HaqveJurisdiction = true
|
|
|
|
- } else {
|
|
|
|
- resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动"
|
|
|
|
- resp.SellerMobile = companyItem.Mobile
|
|
|
|
- resp.SellerName = companyItem.SellerName
|
|
|
|
- resp.MsgType = "Industry"
|
|
|
|
- resp.OperationMode = "Call"
|
|
|
|
- hasPermission = 2
|
|
|
|
- }
|
|
|
|
|
|
+ resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动"
|
|
|
|
+ resp.MsgType = "Industry"
|
|
}
|
|
}
|
|
|
|
+ resp.SellerMobile = companyItem.Mobile
|
|
|
|
+ resp.SellerName = companyItem.SellerName
|
|
|
|
+ resp.OperationMode = "Call"
|
|
|
|
+ hasPermission = 2
|
|
}
|
|
}
|
|
} else { //潜在客户
|
|
} else { //潜在客户
|
|
if applyCount > 0 {
|
|
if applyCount > 0 {
|
|
@@ -492,6 +498,7 @@ func (this *ActivityCoAntroller) SignupAdd() {
|
|
br.Ret = 408
|
|
br.Ret = 408
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ fmt.Println(user.Mobile)
|
|
uid := user.UserId
|
|
uid := user.UserId
|
|
//var signupStatus string
|
|
//var signupStatus string
|
|
signupStatus := ""
|
|
signupStatus := ""
|
|
@@ -524,6 +531,42 @@ func (this *ActivityCoAntroller) SignupAdd() {
|
|
}
|
|
}
|
|
companyDetailStatus = companyDetail.Status
|
|
companyDetailStatus = companyDetail.Status
|
|
}
|
|
}
|
|
|
|
+ var userType int
|
|
|
|
+ var permissionStr string
|
|
|
|
+ if user.CompanyId <= 1 {
|
|
|
|
+ userType = 0
|
|
|
|
+ } else {
|
|
|
|
+ companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败!"
|
|
|
|
+ br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if companyDetail == nil {
|
|
|
|
+ br.Msg = "获取信息失败!"
|
|
|
|
+ br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId) + "CompanyId:" + strconv.Itoa(user.CompanyId)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if companyDetail.Status == "永续" {
|
|
|
|
+ userType = 1
|
|
|
|
+ } else if companyDetail.Status == "试用" {
|
|
|
|
+ userType = 5
|
|
|
|
+ } else if companyDetail.Status == "正式" {
|
|
|
|
+ permissionStr, err = models.GetCompanyPermission(user.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if permissionStr == "专家" {
|
|
|
|
+ userType = 4
|
|
|
|
+ } else if strings.Contains(permissionStr, "医药") && strings.Contains(permissionStr, "消费") && strings.Contains(permissionStr, "科技") && strings.Contains(permissionStr, "智造") {
|
|
|
|
+ userType = 2
|
|
|
|
+ } else {
|
|
|
|
+ userType = 3
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
item := new(models.CygxActivitySignup)
|
|
item := new(models.CygxActivitySignup)
|
|
resp := new(models.SignupStatus)
|
|
resp := new(models.SignupStatus)
|
|
hasPermission := 0
|
|
hasPermission := 0
|
|
@@ -572,143 +615,116 @@ func (this *ActivityCoAntroller) SignupAdd() {
|
|
}
|
|
}
|
|
//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
|
|
//1专家电话会、2分析师电话会、3公司调研电话会、4公司线下调研、5专家线下沙龙、6分析师线下沙龙
|
|
//OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
|
|
//OperationMode string `description:"操作方式 Apply:立即申请、Call:拨号 为空则为有权限"`
|
|
- if activityInfo.ActivityTypeId != 1 && activityInfo.ActivityTypeId != 3 && permissionStr == "专家" {
|
|
|
|
- resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
|
|
- resp.SellerMobile = companyItem.Mobile
|
|
|
|
- resp.SellerName = companyItem.SellerName
|
|
|
|
- resp.MsgType = "Type"
|
|
|
|
- resp.OperationMode = "Call"
|
|
|
|
- hasPermission = 2
|
|
|
|
- } else {
|
|
|
|
- if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || ((activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式") {
|
|
|
|
- hasPermission = 1
|
|
|
|
- signupStatus = "Success"
|
|
|
|
- resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
|
|
|
|
- if time.Now().After(resultTime.Add(-time.Minute * 60)) {
|
|
|
|
- signupStatus = "Overtime"
|
|
|
|
- resp.SignupType = signupType
|
|
|
|
- resp.SignupStatus = signupStatus
|
|
|
|
- resp.HasPermission = hasPermission
|
|
|
|
- br.Ret = 200
|
|
|
|
- br.Success = true
|
|
|
|
- br.Msg = ""
|
|
|
|
- br.Data = resp
|
|
|
|
|
|
+ var havePower bool
|
|
|
|
+ if (activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式" {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if companyDetailStatus == "正式" && strings.Contains(permissionStr, "专家") && strings.Contains(activityInfo.CustomerTypeIds, "4") {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(userType)) {
|
|
|
|
+ havePower = true
|
|
|
|
+ }
|
|
|
|
+ if havePower {
|
|
|
|
+ hasPermission = 1
|
|
|
|
+ signupStatus = "Success"
|
|
|
|
+ resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
|
|
|
|
+ if time.Now().After(resultTime.Add(-time.Minute * 60)) {
|
|
|
|
+ signupStatus = "Overtime"
|
|
|
|
+ resp.SignupType = signupType
|
|
|
|
+ resp.SignupStatus = signupStatus
|
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = ""
|
|
|
|
+ br.Data = resp
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
|
|
|
|
+ //如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
|
|
|
|
+ if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
|
|
|
|
+ //判断优先级:总人数限制→单机构2人限制→爽约3次限制
|
|
|
|
+ totalRestrict, err := models.GetUserRestrictCount(user.Mobile)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //人数已满:FullStarffed、单机构超过两人:TwoPeople、爽约次数过多:BreakPromise、超时:Overtime 、成功:Success"`
|
|
|
|
- //如果是下面几种情况则对报名信息做判断限制 (公司调研电话会(限制人数)、公司线下调研、专家/分析师线下沙龙)
|
|
|
|
- if (activityInfo.ActivityTypeId == 3 && activityInfo.IsLimitPeople == 1) || activityInfo.ActivityTypeId > 3 {
|
|
|
|
- //判断优先级:总人数限制→单机构2人限制→爽约3次限制
|
|
|
|
- totalRestrict, err := models.GetUserRestrictCount(user.Mobile)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取信息失败"
|
|
|
|
- br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if totalRestrict >= 1 {
|
|
|
|
- signupStatus = "BreakPromise"
|
|
|
|
- item.FailType = 3
|
|
|
|
- }
|
|
|
|
- totalSignupCompany, err := models.GetActivitySignupCompanyCount(activityId, user.CompanyId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取信息失败"
|
|
|
|
- br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
|
|
+ if totalRestrict >= 1 {
|
|
|
|
+ signupStatus = "BreakPromise"
|
|
|
|
+ item.FailType = 3
|
|
|
|
+ }
|
|
|
|
+ totalSignupCompany, err := models.GetActivitySignupCompanyCount(activityId, user.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if totalSignupCompany >= 2 {
|
|
|
|
+ signupStatus = "TwoPeople"
|
|
|
|
+ item.FailType = 2
|
|
|
|
+ }
|
|
|
|
+ totaSignupPeopleNum, err := models.GetActivitySignupSuccessCount(activityId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if totaSignupPeopleNum >= activityInfo.LimitPeopleNum {
|
|
|
|
+ signupStatus = "FullStarffed"
|
|
|
|
+ item.FailType = 1
|
|
|
|
+ }
|
|
|
|
+ totalUserRestrictCount, err := models.GetActivitySignupByUserRestrictCount(uid, activityId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ //解除报名限制之后二次报名相同活动
|
|
|
|
+ if totalUserRestrictCount > 0 && totalRestrict == 0 {
|
|
|
|
+ item.UserId = uid
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ item.Mobile = user.Mobile
|
|
|
|
+ item.Email = user.Email
|
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
|
+ item.SignupType = signupType
|
|
|
|
+ item.FailType = 0
|
|
|
|
+ item.DoFailType = 0
|
|
|
|
+ _, errSignup := models.AddActivitySignupByRestrict(item)
|
|
|
|
+ if errSignup != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if totalSignupCompany >= 2 {
|
|
|
|
- signupStatus = "TwoPeople"
|
|
|
|
- item.FailType = 2
|
|
|
|
- }
|
|
|
|
- totaSignupPeopleNum, err := models.GetActivitySignupSuccessCount(activityId)
|
|
|
|
|
|
+ resp.HaqveJurisdiction = true
|
|
|
|
+ resp.SignupType = signupType
|
|
|
|
+ resp.SignupStatus = "Success"
|
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
|
+ resp.ActivityId = activityId
|
|
|
|
+ total, err = models.GetUserMeetingReminderCount(user.UserId)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|
|
- br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if totaSignupPeopleNum >= activityInfo.LimitPeopleNum {
|
|
|
|
- signupStatus = "FullStarffed"
|
|
|
|
- item.FailType = 1
|
|
|
|
- }
|
|
|
|
- totalUserRestrictCount, err := models.GetActivitySignupByUserRestrictCount(uid, activityId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取失败"
|
|
|
|
- br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
|
|
|
+ br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //解除报名限制之后二次报名相同活动
|
|
|
|
- if totalUserRestrictCount > 0 && totalRestrict == 0 {
|
|
|
|
- item.UserId = uid
|
|
|
|
- item.ActivityId = activityId
|
|
|
|
- item.CreateTime = time.Now()
|
|
|
|
- item.Mobile = user.Mobile
|
|
|
|
- item.Email = user.Email
|
|
|
|
- item.CompanyId = user.CompanyId
|
|
|
|
- item.CompanyName = user.CompanyName
|
|
|
|
- item.SignupType = signupType
|
|
|
|
- item.FailType = 0
|
|
|
|
- item.DoFailType = 0
|
|
|
|
- _, errSignup := models.AddActivitySignupByRestrict(item)
|
|
|
|
- if errSignup != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- resp.HaqveJurisdiction = true
|
|
|
|
- resp.SignupType = signupType
|
|
|
|
- resp.SignupStatus = "Success"
|
|
|
|
- resp.HasPermission = hasPermission
|
|
|
|
- resp.ActivityId = activityId
|
|
|
|
- total, err = models.GetUserMeetingReminderCount(user.UserId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取信息失败"
|
|
|
|
- br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if total == 0 {
|
|
|
|
- resp.GoFollow = true
|
|
|
|
- }
|
|
|
|
- br.Ret = 200
|
|
|
|
- br.Success = true
|
|
|
|
- br.Msg = "操作成功"
|
|
|
|
- br.Data = resp
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- totalMy, err := models.GetActivitySignupByUserCount(uid, activityId)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取失败"
|
|
|
|
- br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if signupStatus != "Success" && totalMy == 0 {
|
|
|
|
- item.UserId = uid
|
|
|
|
- item.ActivityId = activityId
|
|
|
|
- item.CreateTime = time.Now()
|
|
|
|
- item.Mobile = user.Mobile
|
|
|
|
- item.Email = user.Email
|
|
|
|
- item.CompanyId = user.CompanyId
|
|
|
|
- item.CompanyName = user.CompanyName
|
|
|
|
- item.SignupType = signupType
|
|
|
|
- item.DoFailType = item.FailType
|
|
|
|
- //添加报名信息,但是不加入日程
|
|
|
|
- _, errSignup := models.AddActivitySignupNoSchedule(item)
|
|
|
|
- if errSignup != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ if total == 0 {
|
|
|
|
+ resp.GoFollow = true
|
|
}
|
|
}
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "操作成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- totalMySuccess, err := models.GetActivitySignupCount(uid, activityId)
|
|
|
|
|
|
+ totalMy, err := models.GetActivitySignupByUserCount(uid, activityId)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if totalMySuccess > 0 {
|
|
|
|
- br.Msg = "您已报名这个活动"
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if signupStatus == "Success" {
|
|
|
|
|
|
+ if signupStatus != "Success" && totalMy == 0 {
|
|
item.UserId = uid
|
|
item.UserId = uid
|
|
item.ActivityId = activityId
|
|
item.ActivityId = activityId
|
|
item.CreateTime = time.Now()
|
|
item.CreateTime = time.Now()
|
|
@@ -717,23 +733,59 @@ func (this *ActivityCoAntroller) SignupAdd() {
|
|
item.CompanyId = user.CompanyId
|
|
item.CompanyId = user.CompanyId
|
|
item.CompanyName = user.CompanyName
|
|
item.CompanyName = user.CompanyName
|
|
item.SignupType = signupType
|
|
item.SignupType = signupType
|
|
- item.FailType = 0
|
|
|
|
- item.DoFailType = 0
|
|
|
|
- _, errSignup := models.AddActivitySignup(item)
|
|
|
|
|
|
+ item.DoFailType = item.FailType
|
|
|
|
+ //添加报名信息,但是不加入日程
|
|
|
|
+ _, errSignup := models.AddActivitySignupNoSchedule(item)
|
|
if errSignup != nil {
|
|
if errSignup != nil {
|
|
br.Msg = "操作失败"
|
|
br.Msg = "操作失败"
|
|
br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- resp.HaqveJurisdiction = true
|
|
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ totalMySuccess, err := models.GetActivitySignupCount(uid, activityId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if totalMySuccess > 0 {
|
|
|
|
+ br.Msg = "您已报名这个活动"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if signupStatus == "Success" {
|
|
|
|
+ item.UserId = uid
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ item.Mobile = user.Mobile
|
|
|
|
+ item.Email = user.Email
|
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
|
+ item.SignupType = signupType
|
|
|
|
+ item.FailType = 0
|
|
|
|
+ item.DoFailType = 0
|
|
|
|
+ _, errSignup := models.AddActivitySignup(item)
|
|
|
|
+ if errSignup != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.HaqveJurisdiction = true
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ hasPermission = 2
|
|
|
|
+ resp.SellerMobile = companyItem.Mobile
|
|
|
|
+ resp.SellerName = companyItem.SellerName
|
|
|
|
+ resp.MsgType = "Type"
|
|
|
|
+ resp.OperationMode = "Call"
|
|
|
|
+ if permissionStr == "专家" {
|
|
|
|
+ resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
|
|
+ resp.MsgType = "Type"
|
|
|
|
+ } else if strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
|
|
resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
- resp.SellerMobile = companyItem.Mobile
|
|
|
|
- resp.SellerName = companyItem.SellerName
|
|
|
|
resp.MsgType = "Industry"
|
|
resp.MsgType = "Industry"
|
|
- resp.OperationMode = "Call"
|
|
|
|
- hasPermission = 2
|
|
|
|
|
|
+ } else {
|
|
|
|
+ resp.PopupMsg = "您暂无权限参加该活动"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else { //潜在客户
|
|
} else { //潜在客户
|
|
@@ -745,20 +797,25 @@ func (this *ActivityCoAntroller) SignupAdd() {
|
|
resp.OperationMode = "Apply"
|
|
resp.OperationMode = "Apply"
|
|
resp.PopupMsg = "您暂无权限参加 【" + activityInfo.ChartPermissionName + "】行业活动,若想参加可以申请开通哦"
|
|
resp.PopupMsg = "您暂无权限参加 【" + activityInfo.ChartPermissionName + "】行业活动,若想参加可以申请开通哦"
|
|
}
|
|
}
|
|
-
|
|
|
|
resp.SignupType = signupType
|
|
resp.SignupType = signupType
|
|
resp.SignupStatus = signupStatus
|
|
resp.SignupStatus = signupStatus
|
|
resp.HasPermission = hasPermission
|
|
resp.HasPermission = hasPermission
|
|
if signupStatus == "Success" {
|
|
if signupStatus == "Success" {
|
|
resp.ActivityId = activityId
|
|
resp.ActivityId = activityId
|
|
}
|
|
}
|
|
- total, err = models.GetUserMeetingReminderCount(user.UserId)
|
|
|
|
|
|
+ var signupTypeStr string
|
|
|
|
+ if signupType == 3 {
|
|
|
|
+ signupTypeStr = "3"
|
|
|
|
+ } else {
|
|
|
|
+ signupTypeStr = "1,2"
|
|
|
|
+ }
|
|
|
|
+ total, err = models.GetUserSignupCount(user.UserId, signupTypeStr)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|
|
br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if total == 0 {
|
|
|
|
|
|
+ if total <= 1 {
|
|
resp.GoFollow = true
|
|
resp.GoFollow = true
|
|
}
|
|
}
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
@@ -795,10 +852,6 @@ func (this *ActivityCoAntroller) SignupCancel() {
|
|
}
|
|
}
|
|
activityId := req.ActivityId
|
|
activityId := req.ActivityId
|
|
signupType := req.SignupType
|
|
signupType := req.SignupType
|
|
- //if signupType != 1 && signupType != 2 {
|
|
|
|
- // br.Msg = "请选择正确的报名方式!"
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
item := new(models.CygxActivitySignup)
|
|
item := new(models.CygxActivitySignup)
|
|
activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
|
|
activityInfo, errInfo := models.GetAddActivityInfoById(activityId)
|
|
if activityInfo == nil {
|
|
if activityInfo == nil {
|
|
@@ -1022,7 +1075,42 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
|
|
}
|
|
}
|
|
companyDetailStatus = companyDetail.Status
|
|
companyDetailStatus = companyDetail.Status
|
|
}
|
|
}
|
|
- fmt.Println(companyDetailStatus)
|
|
|
|
|
|
+ var userType int
|
|
|
|
+ var permissionStr string
|
|
|
|
+ if user.CompanyId <= 1 {
|
|
|
|
+ userType = 0
|
|
|
|
+ } else {
|
|
|
|
+ companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败!"
|
|
|
|
+ br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if companyDetail == nil {
|
|
|
|
+ br.Msg = "获取信息失败!"
|
|
|
|
+ br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId) + "CompanyId:" + strconv.Itoa(user.CompanyId)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if companyDetail.Status == "永续" {
|
|
|
|
+ userType = 1
|
|
|
|
+ } else if companyDetail.Status == "试用" {
|
|
|
|
+ userType = 5
|
|
|
|
+ } else if companyDetail.Status == "正式" {
|
|
|
|
+ permissionStr, err = models.GetCompanyPermission(user.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if permissionStr == "专家" {
|
|
|
|
+ userType = 4
|
|
|
|
+ } else if strings.Contains(permissionStr, "医药") && strings.Contains(permissionStr, "消费") && strings.Contains(permissionStr, "科技") && strings.Contains(permissionStr, "智造") {
|
|
|
|
+ userType = 2
|
|
|
|
+ } else {
|
|
|
|
+ userType = 3
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//判断是否已经申请过
|
|
//判断是否已经申请过
|
|
applyCount, err := models.GetApplyRecordCount(uid)
|
|
applyCount, err := models.GetApplyRecordCount(uid)
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1071,48 +1159,58 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if activityInfo.ActivityTypeId != 1 && activityInfo.ActivityTypeId != 3 && permissionStr == "专家" {
|
|
|
|
- resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
|
|
|
|
+
|
|
|
|
+ var havePower bool
|
|
|
|
+ if (activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式" {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if companyDetailStatus == "正式" && strings.Contains(permissionStr, "专家") && strings.Contains(activityInfo.CustomerTypeIds, "4") {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
|
|
|
|
+ havePower = true
|
|
|
|
+ } else if strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(userType)) {
|
|
|
|
+ havePower = true
|
|
|
|
+ }
|
|
|
|
+ if havePower {
|
|
|
|
+ hasPermission = 1
|
|
|
|
+ signupStatus = "Success"
|
|
|
|
+ totalMeeting, errMeeting := models.GetActivityMeetingReminderCount(uid, activityId)
|
|
|
|
+ if errMeeting != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if totalMeeting > 0 {
|
|
|
|
+ br.Msg = "您已预约,请勿重复预约"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item.UserId = uid
|
|
|
|
+ item.ActivityId = activityId
|
|
|
|
+ item.CreateTime = time.Now()
|
|
|
|
+ item.Mobile = user.Mobile
|
|
|
|
+ item.Email = user.Email
|
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
|
+ _, errSignup := models.AddActivityMeetingReminder(item)
|
|
|
|
+ if errSignup != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.HaqveJurisdiction = true
|
|
|
|
+ } else {
|
|
|
|
+ hasPermission = 2
|
|
resp.SellerMobile = companyItem.Mobile
|
|
resp.SellerMobile = companyItem.Mobile
|
|
resp.SellerName = companyItem.SellerName
|
|
resp.SellerName = companyItem.SellerName
|
|
resp.MsgType = "Type"
|
|
resp.MsgType = "Type"
|
|
resp.OperationMode = "Call"
|
|
resp.OperationMode = "Call"
|
|
- hasPermission = 2
|
|
|
|
- } else {
|
|
|
|
- if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || ((activityInfo.ActivityTypeId == 1 || activityInfo.ActivityTypeId == 3) && strings.Contains(permissionStr, "专家") && companyDetailStatus == "正式") {
|
|
|
|
- hasPermission = 1
|
|
|
|
- signupStatus = "Success"
|
|
|
|
- totalMeeting, errMeeting := models.GetActivityMeetingReminderCount(uid, activityId)
|
|
|
|
- if errMeeting != nil {
|
|
|
|
- br.Msg = "获取失败"
|
|
|
|
- br.ErrMsg = "获取失败,Err:" + errMeeting.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if totalMeeting > 0 {
|
|
|
|
- br.Msg = "您已预约,请勿重复预约"
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- item.UserId = uid
|
|
|
|
- item.ActivityId = activityId
|
|
|
|
- item.CreateTime = time.Now()
|
|
|
|
- item.Mobile = user.Mobile
|
|
|
|
- item.Email = user.Email
|
|
|
|
- item.CompanyId = user.CompanyId
|
|
|
|
- item.CompanyName = user.CompanyName
|
|
|
|
- _, errSignup := models.AddActivityMeetingReminder(item)
|
|
|
|
- if errSignup != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "操作失败,Err:" + errSignup.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- resp.HaqveJurisdiction = true
|
|
|
|
- } else {
|
|
|
|
|
|
+ if permissionStr == "专家" {
|
|
|
|
+ resp.PopupMsg = "您暂无权限参加" + activityInfo.ActivityTypeName + "类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
|
|
+ resp.MsgType = "Type"
|
|
|
|
+ } else if strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
|
|
resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
resp.PopupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
- resp.SellerMobile = companyItem.Mobile
|
|
|
|
- resp.SellerName = companyItem.SellerName
|
|
|
|
resp.MsgType = "Industry"
|
|
resp.MsgType = "Industry"
|
|
- resp.OperationMode = "Call"
|
|
|
|
- hasPermission = 2
|
|
|
|
|
|
+ } else {
|
|
|
|
+ resp.PopupMsg = "您暂无权限参加该活动"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else { //潜在客户
|
|
} else { //潜在客户
|
|
@@ -1128,13 +1226,13 @@ func (this *ActivityCoAntroller) MeetingReminderAdd() {
|
|
resp.SignupStatus = signupStatus
|
|
resp.SignupStatus = signupStatus
|
|
resp.ActivityId = activityId
|
|
resp.ActivityId = activityId
|
|
var total int
|
|
var total int
|
|
- total, err = models.GetUserMeetingReminderCount(user.UserId)
|
|
|
|
|
|
+ total, err = models.GetUserActivityMeetingReminderCount(user.UserId)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|
|
br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if total == 0 {
|
|
|
|
|
|
+ if total <= 1 {
|
|
resp.GoFollow = true
|
|
resp.GoFollow = true
|
|
}
|
|
}
|
|
br.Ret = 200
|
|
br.Ret = 200
|