优化代码

This commit is contained in:
刘祥超
2022-07-22 15:05:30 +08:00
parent 876c631c85
commit fe511ae7e5
72 changed files with 675 additions and 628 deletions

View File

@@ -16,7 +16,7 @@ type IPListService struct {
// CreateIPList 创建IP列表
func (this *IPListService) CreateIPList(ctx context.Context, req *pb.CreateIPListRequest) (*pb.CreateIPListResponse, error) {
// 校验请求
_, userId, err := this.ValidateAdminAndUser(ctx, 0, 0)
_, userId, err := this.ValidateAdminAndUser(ctx)
if err != nil {
return nil, err
}
@@ -49,7 +49,7 @@ func (this *IPListService) UpdateIPList(ctx context.Context, req *pb.UpdateIPLis
return nil, err
}
tx := this.NullTx()
var tx = this.NullTx()
err = models.SharedIPListDAO.UpdateIPList(tx, req.IpListId, req.Name, req.Code, req.TimeoutJSON, req.Description)
if err != nil {
@@ -61,7 +61,7 @@ func (this *IPListService) UpdateIPList(ctx context.Context, req *pb.UpdateIPLis
// FindEnabledIPList 查找IP列表
func (this *IPListService) FindEnabledIPList(ctx context.Context, req *pb.FindEnabledIPListRequest) (*pb.FindEnabledIPListResponse, error) {
// 校验请求
_, userId, err := this.ValidateAdminAndUser(ctx, 0, 0)
_, userId, err := this.ValidateAdminAndUser(ctx)
if err != nil {
return nil, err
}