|
@@ -345,7 +345,7 @@ func (s *globalLimitService) AddGlobalLimit(ctx context.Context, req v1.GlobalLi
|
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- if oldData.Id != 0 {
|
|
|
|
|
|
+ if oldData!= nil && oldData.Id != 0 {
|
|
err = s.globalLimitRepository.UpdateGlobalLimitByHostId(ctx, &model.GlobalLimit{
|
|
err = s.globalLimitRepository.UpdateGlobalLimitByHostId(ctx, &model.GlobalLimit{
|
|
HostId: req.HostId,
|
|
HostId: req.HostId,
|
|
Uid: req.Uid,
|
|
Uid: req.Uid,
|
|
@@ -376,6 +376,7 @@ func (s *globalLimitService) AddGlobalLimit(ctx context.Context, req v1.GlobalLi
|
|
GatewayGroupId: gatewayGroupId,
|
|
GatewayGroupId: gatewayGroupId,
|
|
CdnUid: int(userId),
|
|
CdnUid: int(userId),
|
|
Comment: req.Comment,
|
|
Comment: req.Comment,
|
|
|
|
+ State: 1,
|
|
ExpiredAt: expiredAt,
|
|
ExpiredAt: expiredAt,
|
|
})
|
|
})
|
|
if err != nil {
|
|
if err != nil {
|