|
@@ -121,6 +121,95 @@ func GetUserHasPermissionArticle(user *models.WxUserItem) (hasPermission int, se
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// 获取用户对应的权限申请状态 活动详情
|
|
|
+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、无权益"`
|
|
|
+ uid := user.UserId
|
|
|
+ applyCount, e := models.GetApplyRecordCount(uid)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetApplyRecordCount, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ activityPointsByUserAllMap := GetActivityPointsByUserAllMap() // 获取对用户进行研选扣点的活动
|
|
|
+
|
|
|
+ if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
|
+ if activityPointsByUserAllMap[activityInfo.ActivityId] {
|
|
|
+ popupMsg = "签约买方研选套餐才可参与此活动,请联系对口销售"
|
|
|
+ } else {
|
|
|
+ popupMsg = "暂无<b>买方研选</b>权限<br/>您可申请开通试用"
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
|
|
|
+ }
|
|
|
+ if user.CompanyId == 1 {
|
|
|
+ if applyCount > 0 {
|
|
|
+ hasPermission = 5
|
|
|
+ } else {
|
|
|
+ hasPermission = 4
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ companyItem, err := models.GetCompanyDetailById(user.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ if applyCount > 0 {
|
|
|
+ hasPermission = 3
|
|
|
+ } 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ err = nil
|
|
|
+ hasPermission = hasPermission
|
|
|
+ if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
|
+ popupMsg = "暂无<b>买方研选</b>权限<br/>您可申请开通试用"
|
|
|
+ } else {
|
|
|
+ popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if companyItem.ProductId == 2 {
|
|
|
+ hasPermission = 3
|
|
|
+ sellerMobile = companyItem.Mobile
|
|
|
+ sellerName = companyItem.SellerName
|
|
|
+ companyPermission, e := models.GetCompanyPermission(user.CompanyId)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetCompanyPermission, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if strings.Contains(activityInfo.ChartPermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
|
|
|
+ //popupMsg = "暂无<b>买方研选</b>权限<br/>点击提交申请,提醒对口销售为你开通试用"
|
|
|
+ if !strings.Contains(companyPermission, utils.CHART_PERMISSION_NAME_YANXUAN) && (activityInfo.ActivityTypeId == 3 || activityInfo.ActivityTypeId == 5) {
|
|
|
+ popupMsg = "暂无<b>买方研选</b>权限<br/>点击提交申请,提醒对口销售为你开通试用"
|
|
|
+ } else {
|
|
|
+ popupMsg = "签约买方研选套餐才可参与此活动,请联系对口销售"
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if companyPermission == "专家" {
|
|
|
+ popupMsg = "您暂无权限参加【" + activityInfo.ActivityTypeName + "】类型活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
|
+
|
|
|
+ } else {
|
|
|
+ popupMsg = "您暂无权限参加【" + activityInfo.ChartPermissionName + "】行业活动,若想参加请联系对口销售--" + companyItem.SellerName + ":" + companyItem.Mobile
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ hasPermission = 5
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// 获取用户对应的权限简单版
|
|
|
func GetUserHasPermissionSimple(user *models.WxUserItem) (hasPermission int, err error) {
|
|
|
//HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下(ficc),3:无该品类权限,已提交过申请,4:无该品类权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
|