浏览代码

Merge branch 'cygx_9.3.1_0' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 年之前
父节点
当前提交
13ca8cd289
共有 2 个文件被更改,包括 42 次插入6 次删除
  1. 22 0
      models/company_user_type.go
  2. 20 6
      services/activity.go

+ 22 - 0
models/company_user_type.go

@@ -0,0 +1,22 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxCompanyUserType struct {
+	Id             int `orm:"column(id);pk" description:"分析师id"`
+	CompanyId      int
+	CustomerTypeId int       `description:"用户身份ID"`
+	CreateTime     time.Time `description:"创建时间"`
+	ModifyTime     time.Time `description:"创建时间"`
+}
+
+// 通过活动ID获取详情
+func GetCygxCompanyUserType(companyId int) (item *CygxCompanyUserType, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM cygx_company_user_type AS a WHERE a.company_id=?  `
+	err = o.Raw(sql, companyId).QueryRow(&item)
+	return
+}

+ 20 - 6
services/activity.go

@@ -335,6 +335,18 @@ func GetUserType(companyId int) (userType int, permissionStrnew string, err erro
 				err = errs
 				err = errs
 				return
 				return
 			}
 			}
+			//大套餐客户,数据库添加标识,
+			companyUserTypeDetail, errs := models.GetCygxCompanyUserType(companyId)
+			if errs != nil && errs.Error() != utils.ErrNoRow() {
+				err = errs
+				return
+			}
+			if companyUserTypeDetail != nil {
+				if companyUserTypeDetail.CustomerTypeId != 0 {
+					userType = companyUserTypeDetail.CustomerTypeId
+					return
+				}
+			}
 			permissionZhengShiStr, errs = models.GetCompanyPermissionByUserZhengShi(companyId)
 			permissionZhengShiStr, errs = models.GetCompanyPermissionByUserZhengShi(companyId)
 			if errs != nil {
 			if errs != nil {
 				err = errs
 				err = errs
@@ -372,9 +384,11 @@ func GetUserType(companyId int) (userType int, permissionStrnew string, err erro
 				if strings.Count(permissionZhengShiStr, "路演服务") == 1 {
 				if strings.Count(permissionZhengShiStr, "路演服务") == 1 {
 					permissionZhegnshiNum++
 					permissionZhegnshiNum++
 				}
 				}
-				if permissionZhegnshiNum == 6 {
-					userType = 2
-				} else if permissionZhegnshiNum == 4 || permissionZhegnshiNum == 5 {
+				//if permissionZhegnshiNum == 6 {
+				//	userType = 2
+				//} else
+				//大套餐客户,数据库添加标识,条件大于等于四的都是 30W套餐客户
+				if permissionZhegnshiNum >= 4 {
 					userType = 10
 					userType = 10
 				} else {
 				} else {
 					userType = 3
 					userType = 3
@@ -408,9 +422,9 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 		userTypeStr = mapUserType[userType]
 		userTypeStr = mapUserType[userType]
 		// 永续客户、大套餐客户、30W套餐客户可以查看行业升级套餐客户 权限
 		// 永续客户、大套餐客户、30W套餐客户可以查看行业升级套餐客户 权限
 		if userTypeStr == "1" || userTypeStr == "2" || userTypeStr == "AA" {
 		if userTypeStr == "1" || userTypeStr == "2" || userTypeStr == "AA" {
-			if !strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) && !strings.Contains(activityInfo.CustomerTypeIds, "8") {
+			if strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) && strings.Contains(activityInfo.CustomerTypeIds, "8") {
 				havePower = true
 				havePower = true
-				return
+				//return
 			}
 			}
 		}
 		}
 	}
 	}
@@ -462,7 +476,7 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 		havePower = true
 		havePower = true
 	}
 	}
 
 
-	permissionShengji, errs := models.GetCompanyPermissionByUserZhengShiTrip(user.CompanyId)
+	permissionShengji, errs := models.GetCompanyPermissionByUserTrip(user.CompanyId)
 	if errs != nil {
 	if errs != nil {
 		err = errs
 		err = errs
 		return
 		return