|
@@ -241,9 +241,9 @@ func GetMonthDisc(monthCount int) float64 {
|
|
|
|
|
|
func DiyBigMember(ctx context.Context, createType, count int, month int, serversId, supServersId []string, isEnt bool) int64 {
|
|
func DiyBigMember(ctx context.Context, createType, count int, month int, serversId, supServersId []string, isEnt bool) int64 {
|
|
var (
|
|
var (
|
|
- price float64
|
|
|
|
- subAccountPrice, packPrice, primaryAccountPrice int
|
|
|
|
- monthDiscount = GetMonthDisc(month)
|
|
|
|
|
|
+ price float64
|
|
|
|
+ subAccountPrice, packPrice, primaryAccountPrice, entAnalysisView int
|
|
|
|
+ monthDiscount = GetMonthDisc(month)
|
|
)
|
|
)
|
|
|
|
|
|
bigService := map[int]map[string]interface{}{}
|
|
bigService := map[int]map[string]interface{}{}
|
|
@@ -251,31 +251,16 @@ func DiyBigMember(ctx context.Context, createType, count int, month int, servers
|
|
serviceList, _ := g.DB().Query(ctx, "SELECT * FROM bigmember_service WHERE 1=1")
|
|
serviceList, _ := g.DB().Query(ctx, "SELECT * FROM bigmember_service WHERE 1=1")
|
|
if !serviceList.IsEmpty() {
|
|
if !serviceList.IsEmpty() {
|
|
for _, val := range serviceList.List() {
|
|
for _, val := range serviceList.List() {
|
|
|
|
+ if common.IntAll(val["id"]) == 4 {
|
|
|
|
+ entAnalysisView = common.IntAll(val["i_price_year"])
|
|
|
|
+ }
|
|
bigService[common.IntAll(val["id"])] = val
|
|
bigService[common.IntAll(val["id"])] = val
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
idArr := map[int]bool{}
|
|
idArr := map[int]bool{}
|
|
var dataService int
|
|
var dataService int
|
|
- switch createType {
|
|
|
|
- case 1, 3:
|
|
|
|
- pMap := make(map[int]bool)
|
|
|
|
- pService, _ := g.DB().Query(context.Background(), fmt.Sprintf(`SELECT id,i_price_year,s_new_name FROM bigmember_service WHERE id in ('%s')`, strings.Join(supServersId, `','`)))
|
|
|
|
- for _, value := range pService.List() {
|
|
|
|
- if gconv.Int(value["i_pid"]) > 0 {
|
|
|
|
- pMap[gconv.Int(value["i_pid"])] = true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- var newServiceList []string
|
|
|
|
- for _, s := range supServersId {
|
|
|
|
- if pMap[gconv.Int(s)] { //存在相同服务id计费过滤
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- newServiceList = append(newServiceList, s)
|
|
|
|
- }
|
|
|
|
- supServersId = newServiceList
|
|
|
|
-
|
|
|
|
- case 2:
|
|
|
|
|
|
+ if createType == 2 {
|
|
serOneData, _ := g.DB().GetOne(context.Background(), fmt.Sprintf(`SELECT id,i_price_year,s_new_name FROM bigmember_service WHERE i_class=4 and id in ('%s') order by i_price_year desc limit 1`, strings.Join(serversId, `','`)))
|
|
serOneData, _ := g.DB().GetOne(context.Background(), fmt.Sprintf(`SELECT id,i_price_year,s_new_name FROM bigmember_service WHERE i_class=4 and id in ('%s') order by i_price_year desc limit 1`, strings.Join(serversId, `','`)))
|
|
if !serOneData.IsEmpty() {
|
|
if !serOneData.IsEmpty() {
|
|
dataService = gconv.Int(serOneData.Map()["i_price_year"])
|
|
dataService = gconv.Int(serOneData.Map()["i_price_year"])
|
|
@@ -307,26 +292,19 @@ func DiyBigMember(ctx context.Context, createType, count int, month int, servers
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- var isView, isAnalysis bool
|
|
|
|
//套餐类型企业全景分析计费特殊处理
|
|
//套餐类型企业全景分析计费特殊处理
|
|
- entAnalysisView := g.Cfg().MustGet(ctx, "entAnalysisView").Int()
|
|
|
|
- entAnalysis500 := g.Cfg().MustGet(ctx, "entAnalysis500").Int()
|
|
|
|
for _, s := range supServersId {
|
|
for _, s := range supServersId {
|
|
- if s == "4" {
|
|
|
|
- isView = true
|
|
|
|
- }
|
|
|
|
- if s == "19" {
|
|
|
|
- isAnalysis = true
|
|
|
|
|
|
+ if s == "4" || s == "19" {
|
|
|
|
+ log.Println("企业全景分析", entAnalysisView)
|
|
|
|
+ primaryAccountPrice += entAnalysisView
|
|
|
|
+ break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- switch {
|
|
|
|
- case isView && !isAnalysis: //包含企业分析500条 计算全景分析查看费用
|
|
|
|
- primaryAccountPrice += entAnalysis500
|
|
|
|
- case !isView && isAnalysis: //企业全景分析100条费用 无查看费用
|
|
|
|
- primaryAccountPrice += entAnalysisView
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
for _, v := range supServersId {
|
|
for _, v := range supServersId {
|
|
- if common.IntAll(v) == 3 || common.IntAll(v) == 13 || common.IntAll(v) == 21 {
|
|
|
|
|
|
+ if common.IntAll(v) == 3 || common.IntAll(v) == 13 ||
|
|
|
|
+ common.IntAll(v) == 21 || common.IntAll(v) == 4 ||
|
|
|
|
+ common.IntAll(v) == 19 {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
if idArr[common.IntAll(v)] {
|
|
if idArr[common.IntAll(v)] {
|