|
@@ -134,13 +134,20 @@ func GetUserHasPermissionArticle(user *models.WxUserItem) (hasPermission int, se
|
|
// 获取用户对应的权限申请状态 活动详情
|
|
// 获取用户对应的权限申请状态 活动详情
|
|
func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.ActivityDetail) (hasPermission int, sellerName, sellerMobile, popupMsg string, err error) {
|
|
func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.ActivityDetail) (hasPermission int, sellerName, sellerMobile, popupMsg string, err error) {
|
|
//HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请,5:有IFCC、无权益"`
|
|
//HasPermission int `description:"操作方式,1:有该行业权限,正常展示,2:无该行业权限,3:潜在客户,未提交过申请,4:潜在客户,已提交过申请,5:有IFCC、无权益"`
|
|
- uid := user.UserId
|
|
|
|
- applyCount, e := models.GetApplyRecordCount(uid)
|
|
|
|
|
|
+ //uid := user.UserId
|
|
|
|
+ //applyCount, e := models.GetApplyRecordCount(uid)
|
|
|
|
+ //if e != nil {
|
|
|
|
+ // err = errors.New("GetApplyRecordCount, Err: " + e.Error())
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ var e error
|
|
|
|
+ activityPointsByUserAllMap := GetActivityPointsByUserAllMap() // 获取对用户进行研选扣点的活动
|
|
|
|
+
|
|
|
|
+ hasPermission, e = GetUserPermissionCode(user.UserId, user.CompanyId)
|
|
if e != nil {
|
|
if e != nil {
|
|
- err = errors.New("GetApplyRecordCount, Err: " + e.Error())
|
|
|
|
|
|
+ err = errors.New("GetUserDetailPermissionCode, Err: " + e.Error())
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- activityPointsByUserAllMap := GetActivityPointsByUserAllMap() // 获取对用户进行研选扣点的活动
|
|
|
|
|
|
|
|
if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
if activityPointsByUserAllMap[activityInfo.ActivityId] {
|
|
if activityPointsByUserAllMap[activityInfo.ActivityId] {
|
|
@@ -152,32 +159,27 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
|
|
popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
|
|
popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
|
|
}
|
|
}
|
|
if user.CompanyId == 1 {
|
|
if user.CompanyId == 1 {
|
|
- if applyCount > 0 {
|
|
|
|
- hasPermission = 4
|
|
|
|
- } else {
|
|
|
|
- hasPermission = 3
|
|
|
|
- }
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
companyItem, err := models.GetCompanyDetailById(user.CompanyId)
|
|
companyItem, err := models.GetCompanyDetailById(user.CompanyId)
|
|
if err != nil {
|
|
if err != nil {
|
|
if err.Error() == utils.ErrNoRow() {
|
|
if err.Error() == utils.ErrNoRow() {
|
|
- if applyCount > 0 {
|
|
|
|
- hasPermission = 4
|
|
|
|
- } else {
|
|
|
|
- //获取FICC销售信息
|
|
|
|
- sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
|
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
- err = e
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if sellerItem != nil {
|
|
|
|
- hasPermission = 5
|
|
|
|
- } else {
|
|
|
|
- hasPermission = 3
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- hasPermission = hasPermission
|
|
|
|
|
|
+ //if applyCount > 0 {
|
|
|
|
+ // hasPermission = 4
|
|
|
|
+ //} else {
|
|
|
|
+ // //获取FICC销售信息
|
|
|
|
+ // sellerItem, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 1)
|
|
|
|
+ // if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ // err = e
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // if sellerItem != nil {
|
|
|
|
+ // hasPermission = 5
|
|
|
|
+ // } else {
|
|
|
|
+ // hasPermission = 3
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ //hasPermission = hasPermission
|
|
if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
//popupMsg = "暂无<b>研选</b>权限<br/>您可申请开通试用"
|
|
//popupMsg = "暂无<b>研选</b>权限<br/>您可申请开通试用"
|
|
popupMsg = "暂无权限<br/>您可申请开通试用"
|
|
popupMsg = "暂无权限<br/>您可申请开通试用"
|
|
@@ -191,7 +193,7 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if companyItem.ProductId == 2 {
|
|
if companyItem.ProductId == 2 {
|
|
- hasPermission = 2
|
|
|
|
|
|
+ //hasPermission = 2
|
|
sellerMobile = companyItem.Mobile
|
|
sellerMobile = companyItem.Mobile
|
|
sellerName = companyItem.SellerName
|
|
sellerName = companyItem.SellerName
|
|
companyPermission, e := models.GetCompanyPermission(user.CompanyId)
|
|
companyPermission, e := models.GetCompanyPermission(user.CompanyId)
|
|
@@ -215,15 +217,8 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
|
|
popupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
popupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- hasPermission = 5
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- hasPermission, e = GetUserPermissionCode(user.UserId, user.CompanyId)
|
|
|
|
- if e != nil {
|
|
|
|
- err = errors.New("GetUserDetailPermissionCode, Err: " + e.Error())
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|