Browse Source

no message

zhangchuanxing 3 months ago
parent
commit
56593450e1
1 changed files with 12 additions and 15 deletions
  1. 12 15
      services/cygx/activity_special.go

+ 12 - 15
services/cygx/activity_special.go

@@ -557,13 +557,21 @@ func GetChartPermissionSpecialSurplusByCompany(companyId int) (userType int, tri
 
 // 审批通过的时候专项调研次数更新
 func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyName string) (err error) {
-	userType, packageType, _, _, _ := GetUserType(companyId)
+	//userType, packageType, _, _, _ := GetUserType(companyId)
 	// 获取继承点数
 	//inheritList, e := cygx.GetCygxActivitySpecialInheritPointsByCompanyId(companyId)
 	//if e != nil && e.Error() != utils.ErrNoRow() {
 	//	err = errors.New("GetCygxActivitySpecialInheritPointsByCompanyId, Err: " + e.Error())
 	//}
 	//chartNameMap := map[string]int{utils.YI_YAO_NAME: 0, utils.XIAO_FEI_NAME: 0, utils.KE_JI_NAME: 0, utils.ZHI_ZAO_NAME: 0}
+
+	// 获取合同信息-套餐信息
+	companyContract, e := company.GetCompanyContractById(companyContractId)
+	if e != nil {
+		err = errors.New("GetCompanyContractById, Err: " + e.Error())
+		return
+	}
+	packageType := companyContract.RaiPackageType
 	var items []*cygx.CygxActivitySpecialPermissionPoints
 
 	itemBill := new(cygx.CygxActivitySpecialTripBill)
@@ -573,7 +581,7 @@ func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyNam
 	itemBill.Source = 2
 	itemBill.DoType = 2
 	itemBill.Way = 3
-	if userType == 2 {
+	if packageType > 0 {
 		packageTypeMap := map[int]int{1: 16, 2: 12}
 		totalTrip := packageTypeMap[packageType]
 		itemBill.BillDetailed = totalTrip
@@ -594,13 +602,6 @@ func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyNam
 		items = append(items, item)
 
 	} else {
-		//list, e := company.GetCompanyReportPermissionByCompanyIdAndProductId(companyId, 2)
-		//if e != nil && e.Error() != utils.ErrNoRow() {
-		//	err = errors.New("GetCompanyReportPermissionUpgrade, Err: " + e.Error())
-		//}
-		//if len(list) == 0 {
-		//	return
-		//}
 
 		var condition string
 		var pars []interface{}
@@ -612,10 +613,6 @@ func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyNam
 			err = errors.New("GetCompanyContractPermissionList, Err: " + e.Error())
 			return
 		}
-		if e != nil && e.Error() != utils.ErrNoRow() {
-			err = errors.New("GetCygxAllocationCompanyContractPermissionListById, Err: " + e.Error())
-			return
-		}
 
 		if len(list) == 0 {
 			return
@@ -649,12 +646,12 @@ func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyNam
 		itemBill.Content = "行业升级套餐转正"
 	}
 
-	e := cygx.MultiAddCygxActivitySpecialPermissionPoints(items)
+	e = cygx.MultiAddCygxActivitySpecialPermissionPoints(items)
 	if e != nil {
 		err = errors.New("MultiAddCygxActivitySpecialPermissionPoints, Err:" + e.Error())
 		return
 	}
-	if userType != 2 && len(items) > 0 {
+	if packageType == 0 && len(items) > 0 {
 		var condition string
 		var pars []interface{}
 		pars = make([]interface{}, 0)