浏览代码

Merge branch 'crm_16.2.2' of http://8.136.199.33:3000/hongze/hongze_mobile_admin

zhangchuanxing 3 月之前
父节点
当前提交
862990e93f
共有 1 个文件被更改,包括 16 次插入18 次删除
  1. 16 18
      services/cygx/activity_special.go

+ 16 - 18
services/cygx/activity_special.go

@@ -4,6 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"hongze/hongze_mobile_admin/models/cygx"
+	company_contract2 "hongze/hongze_mobile_admin/models/response/company_contract"
 	"hongze/hongze_mobile_admin/models/tables/chart_permission"
 	"hongze/hongze_mobile_admin/models/tables/company_contract_permission"
 	"hongze/hongze_mobile_admin/utils"
@@ -118,13 +119,21 @@ import (
 //}
 
 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_contract2.GetCompanyContractById(companyContractId)
+	if e != nil {
+		err = errors.New("GetCompanyContractById, Err: " + e.Error())
+		return
+	}
+	packageType := companyContract.RaiPackageType
 	var items []*cygx.CygxActivitySpecialPermissionPoints
 
 	itemBill := new(cygx.CygxActivitySpecialTripBill)
@@ -134,12 +143,12 @@ func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyNam
 	itemBill.Source = 2
 	itemBill.DoType = 2
 	itemBill.Way = 3
-	if userType == 2 {
-		packageTypeMap := map[int]int{1: 16, 2: 10}
+	if packageType > 0 {
+		packageTypeMap := map[int]int{1: 16, 2: 12}
 		totalTrip := packageTypeMap[packageType]
 		itemBill.BillDetailed = totalTrip
 		itemBill.Total = strconv.Itoa(itemBill.BillDetailed) + "次"
-		if totalTrip == 10 {
+		if packageType == 2 {
 			itemBill.Content = "45w大套餐转正"
 		} else {
 			itemBill.Content = "70w大套餐转正"
@@ -155,13 +164,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{}
@@ -173,10 +175,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
@@ -210,12 +208,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)
@@ -243,4 +241,4 @@ func ActivitySpecialCompanyApproval(companyId, companyContractId int, companyNam
 		}
 	}
 	return
-}
+}