xingzai 1 yıl önce
ebeveyn
işleme
62b0705a52
2 değiştirilmiş dosya ile 65 ekleme ve 53 silme
  1. 64 53
      controllers/company_apply.go
  2. 1 0
      models/company/company_apply.go

+ 64 - 53
controllers/company_apply.go

@@ -137,65 +137,76 @@ func (this *CompanyApplyController) ApplyContractHistoryList() {
 
 			checkItems := make([]*company.PermissionLookItem, 0)
 
-			// PS:本来想把这个移到循环外面去优化一下...但是发现有指针引用变量被改掉的问题, BUG太多了改不完了先这样吧=_=!
-			raiPermissions, e := company.GetPermissionLookItemsExt("2", utils.COMPANY_PRODUCT_RAI_NAME)
-			if e != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取权益权限列表失败, Err: " + e.Error()
-				return
-			}
-
-			for _, n := range raiPermissions {
-				match := hasMap[n.ChartPermissionId]
-				if match == nil {
-					continue
+			//大套餐类型单独展示
+			if companyContract.RaiPackageType > 0 {
+				n := new(company.PermissionLookItem)
+				if companyContract.RaiPackageType == 1 {
+					n.PermissionName = "70W套餐"
+				} else if companyContract.RaiPackageType == 2 {
+					n.PermissionName = "45W套餐"
 				}
-				// 升级
-				if match.IsUpgrade == 1 {
-					n.IsUpgrade = 1
-					checkList = append(checkList, n.ChartPermissionId)
-					checkItems = append(checkItems, n)
-					continue
+				checkItems = append(checkItems, n)
+			} else {
+				// PS:本来想把这个移到循环外面去优化一下...但是发现有指针引用变量被改掉的问题, BUG太多了改不完了先这样吧=_=!
+				raiPermissions, e := company.GetPermissionLookItemsExt("2", utils.COMPANY_PRODUCT_RAI_NAME)
+				if e != nil {
+					br.Msg = "获取失败"
+					br.ErrMsg = "获取权益权限列表失败, Err: " + e.Error()
+					return
 				}
-				// 买方研选(3w/5w)
-				if n.PermissionName == utils.CHART_PERMISSION_NAME_MF_YANXUAN {
-					if expensiveYx == 1 {
-						n.PermissionName += "(5w)"
-					} else if expensiveYx == 2 {
-						n.PermissionName += "(10w)"
-					} else if expensiveYx == 0 {
-						n.PermissionName += "(3w)"
+
+				for _, n := range raiPermissions {
+					match := hasMap[n.ChartPermissionId]
+					if match == nil {
+						continue
+					}
+					// 升级
+					if match.IsUpgrade == 1 {
+						n.IsUpgrade = 1
+						checkList = append(checkList, n.ChartPermissionId)
+						checkItems = append(checkItems, n)
+						continue
+					}
+					// 买方研选(3w/5w)
+					if n.PermissionName == utils.CHART_PERMISSION_NAME_MF_YANXUAN {
+						if expensiveYx == 1 {
+							n.PermissionName += "(5w)"
+						} else if expensiveYx == 2 {
+							n.PermissionName += "(10w)"
+						} else if expensiveYx == 0 {
+							n.PermissionName += "(3w)"
+						}
+						//n.PermissionName += expMap[match.ExpensiveYx]
+						checkList = append(checkList, n.ChartPermissionId)
+						checkItems = append(checkItems, n)
+						continue
 					}
-					//n.PermissionName += expMap[match.ExpensiveYx]
 					checkList = append(checkList, n.ChartPermissionId)
 					checkItems = append(checkItems, n)
-					continue
-				}
-				checkList = append(checkList, n.ChartPermissionId)
-				checkItems = append(checkItems, n)
 
-				//count, err := company.GetCompanyContractUpgradePermissionCheckByContractId(companyId, companyContract.CompanyContractId, n.ChartPermissionId, 0)
-				//if err != nil {
-				//	br.Msg = "获取失败"
-				//	br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
-				//	return
-				//}
-				//if count > 0 {
-				//	checkList = append(checkList, n.ChartPermissionId)
-				//	checkItems = append(checkItems, n)
-				//} else {
-				//	count2, err := company.GetCompanyContractUpgradePermissionCheckByContractId(companyId, companyContract.CompanyContractId, n.ChartPermissionId, 1)
-				//	if err != nil {
-				//		br.Msg = "获取失败"
-				//		br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
-				//		return
-				//	}
-				//	if count2 > 0 {
-				//		n.IsUpgrade = 1
-				//		checkList = append(checkList, n.ChartPermissionId)
-				//		checkItems = append(checkItems, n)
-				//	}
-				//}
+					//count, err := company.GetCompanyContractUpgradePermissionCheckByContractId(companyId, companyContract.CompanyContractId, n.ChartPermissionId, 0)
+					//if err != nil {
+					//	br.Msg = "获取失败"
+					//	br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
+					//	return
+					//}
+					//if count > 0 {
+					//	checkList = append(checkList, n.ChartPermissionId)
+					//	checkItems = append(checkItems, n)
+					//} else {
+					//	count2, err := company.GetCompanyContractUpgradePermissionCheckByContractId(companyId, companyContract.CompanyContractId, n.ChartPermissionId, 1)
+					//	if err != nil {
+					//		br.Msg = "获取失败"
+					//		br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
+					//		return
+					//	}
+					//	if count2 > 0 {
+					//		n.IsUpgrade = 1
+					//		checkList = append(checkList, n.ChartPermissionId)
+					//		checkItems = append(checkItems, n)
+					//	}
+					//}
+				}
 			}
 			//合并主观客观
 			//mapPermissionNameList := make(map[string]int)

+ 1 - 0
models/company/company_apply.go

@@ -55,6 +55,7 @@ type CompanyContractHistory struct {
 	Status            int       `description:"状态"`
 	ProductId         int       `description:"产品id"`
 	ContractId        int       `description:"合同ID"`
+	RaiPackageType    int       `description:"权益套餐类型: 0-无; 1-70w套餐; 2-45w套餐"`
 	PermissionList    []*ContractPermissionList
 }