|
@@ -150,6 +150,8 @@ func (s *globalLimitService) GlobalLimitRequire(ctx context.Context, req v1.Glob
|
|
|
res.MaxBytesMonth = configCount.MaxBytesMonth
|
|
|
res.Operator = configCount.Operator
|
|
|
res.IpCount = configCount.IpCount
|
|
|
+ res.NodeArea = configCount.NodeArea
|
|
|
+ res.ConfigMaxProtection = configCount.ConfigMaxProtection
|
|
|
domain, err := s.hostRep.GetDomainById(ctx, req.HostId)
|
|
|
if err != nil {
|
|
|
return v1.GlobalLimitRequireResponse{}, err
|
|
@@ -258,9 +260,28 @@ func (s *globalLimitService) AddGlobalLimit(ctx context.Context, req v1.GlobalLi
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
+ // 获取套餐ID
|
|
|
+ maxProtection := strings.Split(require.ConfigMaxProtection, "G")
|
|
|
+ maxProtectionInt, err := strconv.Atoi(maxProtection[0])
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ var planId int64
|
|
|
+ if maxProtectionInt < 1000 {
|
|
|
+ NodeAreaName := fmt.Sprintf("%s-%dT",require.NodeArea, 1)
|
|
|
+ planId, err = s.globalLimitRepository.GetNodeArea(ctx, NodeAreaName)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if planId == 0 {
|
|
|
+ planId = 6
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
ruleId, err := s.cdnService.BindPlan(ctx, v1.Plan{
|
|
|
UserId: userId,
|
|
|
- PlanId: 4,
|
|
|
+ PlanId: planId,
|
|
|
DayTo: outputTimeStr,
|
|
|
Name: require.GlobalLimitName,
|
|
|
IsFree: true,
|