diff --git a/api/v1/punishment.pb.go b/api/v1/punishment.pb.go
index e93b8ad..cd26448 100644
--- a/api/v1/punishment.pb.go
+++ b/api/v1/punishment.pb.go
@@ -354,6 +354,106 @@ func (m *ListPunishmentRequest) GetUserId() []int64 {
return nil
}
+type CreatePunishmentRequest struct {
+ StartTime *time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time,omitempty"`
+ EndTime *time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time,omitempty"`
+ Id int64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"`
+ UserId []int64 `protobuf:"varint,4,rep,packed,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ Type []int32 `protobuf:"varint,5,rep,packed,name=type,proto3" json:"type,omitempty"`
+ Enable bool `protobuf:"varint,6,opt,name=enable,proto3" json:"enable,omitempty"`
+ Remark string `protobuf:"bytes,7,opt,name=remark,proto3" json:"remark,omitempty"`
+ Reason string `protobuf:"bytes,8,opt,name=reason,proto3" json:"reason,omitempty"`
+}
+
+func (m *CreatePunishmentRequest) Reset() { *m = CreatePunishmentRequest{} }
+func (m *CreatePunishmentRequest) String() string { return proto.CompactTextString(m) }
+func (*CreatePunishmentRequest) ProtoMessage() {}
+func (*CreatePunishmentRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_165d39e292001fbd, []int{4}
+}
+func (m *CreatePunishmentRequest) XXX_Unmarshal(b []byte) error {
+ return m.Unmarshal(b)
+}
+func (m *CreatePunishmentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ if deterministic {
+ return xxx_messageInfo_CreatePunishmentRequest.Marshal(b, m, deterministic)
+ } else {
+ b = b[:cap(b)]
+ n, err := m.MarshalToSizedBuffer(b)
+ if err != nil {
+ return nil, err
+ }
+ return b[:n], nil
+ }
+}
+func (m *CreatePunishmentRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_CreatePunishmentRequest.Merge(m, src)
+}
+func (m *CreatePunishmentRequest) XXX_Size() int {
+ return m.Size()
+}
+func (m *CreatePunishmentRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_CreatePunishmentRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_CreatePunishmentRequest proto.InternalMessageInfo
+
+func (m *CreatePunishmentRequest) GetStartTime() *time.Time {
+ if m != nil {
+ return m.StartTime
+ }
+ return nil
+}
+
+func (m *CreatePunishmentRequest) GetEndTime() *time.Time {
+ if m != nil {
+ return m.EndTime
+ }
+ return nil
+}
+
+func (m *CreatePunishmentRequest) GetId() int64 {
+ if m != nil {
+ return m.Id
+ }
+ return 0
+}
+
+func (m *CreatePunishmentRequest) GetUserId() []int64 {
+ if m != nil {
+ return m.UserId
+ }
+ return nil
+}
+
+func (m *CreatePunishmentRequest) GetType() []int32 {
+ if m != nil {
+ return m.Type
+ }
+ return nil
+}
+
+func (m *CreatePunishmentRequest) GetEnable() bool {
+ if m != nil {
+ return m.Enable
+ }
+ return false
+}
+
+func (m *CreatePunishmentRequest) GetRemark() string {
+ if m != nil {
+ return m.Remark
+ }
+ return ""
+}
+
+func (m *CreatePunishmentRequest) GetReason() string {
+ if m != nil {
+ return m.Reason
+ }
+ return ""
+}
+
type ListPunishmentReply struct {
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
Punishment []*Punishment `protobuf:"bytes,2,rep,name=punishment,proto3" json:"punishment,omitempty"`
@@ -363,7 +463,7 @@ func (m *ListPunishmentReply) Reset() { *m = ListPunishmentReply{} }
func (m *ListPunishmentReply) String() string { return proto.CompactTextString(m) }
func (*ListPunishmentReply) ProtoMessage() {}
func (*ListPunishmentReply) Descriptor() ([]byte, []int) {
- return fileDescriptor_165d39e292001fbd, []int{4}
+ return fileDescriptor_165d39e292001fbd, []int{5}
}
func (m *ListPunishmentReply) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -411,56 +511,61 @@ func init() {
proto.RegisterType((*CancelPunishmentRequest)(nil), "api.v1.CancelPunishmentRequest")
proto.RegisterType((*GetPunishmentRequest)(nil), "api.v1.GetPunishmentRequest")
proto.RegisterType((*ListPunishmentRequest)(nil), "api.v1.ListPunishmentRequest")
+ proto.RegisterType((*CreatePunishmentRequest)(nil), "api.v1.CreatePunishmentRequest")
proto.RegisterType((*ListPunishmentReply)(nil), "api.v1.ListPunishmentReply")
}
func init() { proto.RegisterFile("api/v1/punishment.proto", fileDescriptor_165d39e292001fbd) }
var fileDescriptor_165d39e292001fbd = []byte{
- // 683 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x4f, 0xd4, 0x40,
- 0x14, 0xa6, 0xdb, 0x65, 0x7f, 0x3c, 0x84, 0xe0, 0xb8, 0xb2, 0xa5, 0xc0, 0x6e, 0xed, 0xc1, 0x54,
- 0x0f, 0x6d, 0x58, 0xe3, 0x45, 0x0e, 0x04, 0x88, 0x31, 0x24, 0x1e, 0x48, 0xa3, 0x07, 0x4d, 0xcc,
- 0x66, 0xd8, 0x19, 0xd6, 0xc6, 0xb6, 0x53, 0xdb, 0x59, 0xc8, 0x7a, 0xf4, 0xe2, 0x95, 0xc4, 0x7f,
- 0xc8, 0xa3, 0x89, 0x17, 0x12, 0x2f, 0xde, 0x34, 0xe0, 0x1f, 0x62, 0x66, 0x3a, 0x65, 0x17, 0xe8,
- 0x46, 0x6e, 0xf3, 0xbe, 0xf7, 0xde, 0xf7, 0xcd, 0x7b, 0xf3, 0xde, 0x40, 0x1b, 0x27, 0x81, 0x77,
- 0xbc, 0xe9, 0x25, 0xa3, 0x38, 0xc8, 0xde, 0x47, 0x34, 0xe6, 0x6e, 0x92, 0x32, 0xce, 0x50, 0x0d,
- 0x27, 0x81, 0x7b, 0xbc, 0x69, 0x76, 0x87, 0x8c, 0x0d, 0x43, 0xea, 0x49, 0xf4, 0x70, 0x74, 0xe4,
- 0xf1, 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x6a, 0x0b, 0x3f, 0x6e, 0x6a, 0x0b, 0x20, 0xff,
+ 0x8a, 0xc7, 0xe8, 0xd5, 0x5d, 0x8f, 0x85, 0xd4, 0x66, 0x5d, 0x09, 0xb4, 0x7b, 0xbe, 0x7d, 0x52,
+ 0x10, 0x64, 0x8f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x70, 0x53, 0x08, 0x46, 0x54, 0x07, 0x00,
+ 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -475,7 +580,7 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type PunishmentAPIClient interface {
- CreatePunishment(ctx context.Context, in *Punishment, opts ...grpc.CallOption) (*Punishment, error)
+ CreatePunishment(ctx context.Context, in *CreatePunishmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
UpdatePunishment(ctx context.Context, in *Punishment, opts ...grpc.CallOption) (*emptypb.Empty, error)
GetPunishment(ctx context.Context, in *GetPunishmentRequest, opts ...grpc.CallOption) (*Punishment, error)
ListPunishment(ctx context.Context, in *ListPunishmentRequest, opts ...grpc.CallOption) (*ListPunishmentReply, error)
@@ -491,8 +596,8 @@ func NewPunishmentAPIClient(cc *grpc.ClientConn) PunishmentAPIClient {
return &punishmentAPIClient{cc}
}
-func (c *punishmentAPIClient) CreatePunishment(ctx context.Context, in *Punishment, opts ...grpc.CallOption) (*Punishment, error) {
- out := new(Punishment)
+func (c *punishmentAPIClient) CreatePunishment(ctx context.Context, in *CreatePunishmentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, "/api.v1.PunishmentAPI/CreatePunishment", in, out, opts...)
if err != nil {
return nil, err
@@ -538,7 +643,7 @@ func (c *punishmentAPIClient) CancelPunishment(ctx context.Context, in *CancelPu
// PunishmentAPIServer is the server API for PunishmentAPI service.
type PunishmentAPIServer interface {
- CreatePunishment(context.Context, *Punishment) (*Punishment, error)
+ CreatePunishment(context.Context, *CreatePunishmentRequest) (*emptypb.Empty, error)
UpdatePunishment(context.Context, *Punishment) (*emptypb.Empty, error)
GetPunishment(context.Context, *GetPunishmentRequest) (*Punishment, error)
ListPunishment(context.Context, *ListPunishmentRequest) (*ListPunishmentReply, error)
@@ -550,7 +655,7 @@ type PunishmentAPIServer interface {
type UnimplementedPunishmentAPIServer struct {
}
-func (*UnimplementedPunishmentAPIServer) CreatePunishment(ctx context.Context, req *Punishment) (*Punishment, error) {
+func (*UnimplementedPunishmentAPIServer) CreatePunishment(ctx context.Context, req *CreatePunishmentRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreatePunishment not implemented")
}
func (*UnimplementedPunishmentAPIServer) UpdatePunishment(ctx context.Context, req *Punishment) (*emptypb.Empty, error) {
@@ -571,7 +676,7 @@ func RegisterPunishmentAPIServer(s *grpc.Server, srv PunishmentAPIServer) {
}
func _PunishmentAPI_CreatePunishment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(Punishment)
+ in := new(CreatePunishmentRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -583,7 +688,7 @@ func _PunishmentAPI_CreatePunishment_Handler(srv interface{}, ctx context.Contex
FullMethod: "/api.v1.PunishmentAPI/CreatePunishment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PunishmentAPIServer).CreatePunishment(ctx, req.(*Punishment))
+ return srv.(PunishmentAPIServer).CreatePunishment(ctx, req.(*CreatePunishmentRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -988,6 +1093,116 @@ func (m *ListPunishmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
+func (m *CreatePunishmentRequest) Marshal() (dAtA []byte, err error) {
+ size := m.Size()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBuffer(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *CreatePunishmentRequest) MarshalTo(dAtA []byte) (int, error) {
+ size := m.Size()
+ return m.MarshalToSizedBuffer(dAtA[:size])
+}
+
+func (m *CreatePunishmentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if len(m.Reason) > 0 {
+ i -= len(m.Reason)
+ copy(dAtA[i:], m.Reason)
+ i = encodeVarintPunishment(dAtA, i, uint64(len(m.Reason)))
+ i--
+ dAtA[i] = 0x42
+ }
+ if len(m.Remark) > 0 {
+ i -= len(m.Remark)
+ copy(dAtA[i:], m.Remark)
+ i = encodeVarintPunishment(dAtA, i, uint64(len(m.Remark)))
+ i--
+ dAtA[i] = 0x3a
+ }
+ if m.Enable {
+ i--
+ if m.Enable {
+ dAtA[i] = 1
+ } else {
+ dAtA[i] = 0
+ }
+ i--
+ dAtA[i] = 0x30
+ }
+ if len(m.Type) > 0 {
+ dAtA14 := make([]byte, len(m.Type)*10)
+ var j13 int
+ for _, num1 := range m.Type {
+ num := uint64(num1)
+ for num >= 1<<7 {
+ dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80)
+ num >>= 7
+ j13++
+ }
+ dAtA14[j13] = uint8(num)
+ j13++
+ }
+ i -= j13
+ copy(dAtA[i:], dAtA14[:j13])
+ i = encodeVarintPunishment(dAtA, i, uint64(j13))
+ i--
+ dAtA[i] = 0x2a
+ }
+ if len(m.UserId) > 0 {
+ dAtA16 := make([]byte, len(m.UserId)*10)
+ var j15 int
+ for _, num1 := range m.UserId {
+ num := uint64(num1)
+ for num >= 1<<7 {
+ dAtA16[j15] = uint8(uint64(num)&0x7f | 0x80)
+ num >>= 7
+ j15++
+ }
+ dAtA16[j15] = uint8(num)
+ j15++
+ }
+ i -= j15
+ copy(dAtA[i:], dAtA16[:j15])
+ i = encodeVarintPunishment(dAtA, i, uint64(j15))
+ i--
+ dAtA[i] = 0x22
+ }
+ if m.Id != 0 {
+ i = encodeVarintPunishment(dAtA, i, uint64(m.Id))
+ i--
+ dAtA[i] = 0x18
+ }
+ if m.EndTime != nil {
+ n17, err17 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime):])
+ if err17 != nil {
+ return 0, err17
+ }
+ i -= n17
+ i = encodeVarintPunishment(dAtA, i, uint64(n17))
+ i--
+ dAtA[i] = 0x12
+ }
+ if m.StartTime != nil {
+ n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime):])
+ if err18 != nil {
+ return 0, err18
+ }
+ i -= n18
+ i = encodeVarintPunishment(dAtA, i, uint64(n18))
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
func (m *ListPunishmentReply) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@@ -1172,6 +1387,51 @@ func (m *ListPunishmentRequest) Size() (n int) {
return n
}
+func (m *CreatePunishmentRequest) Size() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.StartTime != nil {
+ l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime)
+ n += 1 + l + sovPunishment(uint64(l))
+ }
+ if m.EndTime != nil {
+ l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime)
+ n += 1 + l + sovPunishment(uint64(l))
+ }
+ if m.Id != 0 {
+ n += 1 + sovPunishment(uint64(m.Id))
+ }
+ if len(m.UserId) > 0 {
+ l = 0
+ for _, e := range m.UserId {
+ l += sovPunishment(uint64(e))
+ }
+ n += 1 + sovPunishment(uint64(l)) + l
+ }
+ if len(m.Type) > 0 {
+ l = 0
+ for _, e := range m.Type {
+ l += sovPunishment(uint64(e))
+ }
+ n += 1 + sovPunishment(uint64(l)) + l
+ }
+ if m.Enable {
+ n += 2
+ }
+ l = len(m.Remark)
+ if l > 0 {
+ n += 1 + l + sovPunishment(uint64(l))
+ }
+ l = len(m.Reason)
+ if l > 0 {
+ n += 1 + l + sovPunishment(uint64(l))
+ }
+ return n
+}
+
func (m *ListPunishmentReply) Size() (n int) {
if m == nil {
return 0
@@ -2202,6 +2462,383 @@ func (m *ListPunishmentRequest) Unmarshal(dAtA []byte) error {
}
return nil
}
+func (m *CreatePunishmentRequest) Unmarshal(dAtA []byte) error {
+ l := len(dAtA)
+ iNdEx := 0
+ for iNdEx < l {
+ preIndex := iNdEx
+ var wire uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ wire |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ fieldNum := int32(wire >> 3)
+ wireType := int(wire & 0x7)
+ if wireType == 4 {
+ return fmt.Errorf("proto: CreatePunishmentRequest: wiretype end group for non-group")
+ }
+ if fieldNum <= 0 {
+ return fmt.Errorf("proto: CreatePunishmentRequest: illegal tag %d (wire type %d)", fieldNum, wire)
+ }
+ switch fieldNum {
+ case 1:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.StartTime == nil {
+ m.StartTime = new(time.Time)
+ }
+ if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.StartTime, dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 2:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType)
+ }
+ var msglen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ msglen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if msglen < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ postIndex := iNdEx + msglen
+ if postIndex < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ if m.EndTime == nil {
+ m.EndTime = new(time.Time)
+ }
+ if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.EndTime, dAtA[iNdEx:postIndex]); err != nil {
+ return err
+ }
+ iNdEx = postIndex
+ case 3:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
+ }
+ m.Id = 0
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ m.Id |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ case 4:
+ if wireType == 0 {
+ var v int64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.UserId = append(m.UserId, v)
+ } else if wireType == 2 {
+ var packedLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ packedLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if packedLen < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ postIndex := iNdEx + packedLen
+ if postIndex < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ var elementCount int
+ var count int
+ for _, integer := range dAtA[iNdEx:postIndex] {
+ if integer < 128 {
+ count++
+ }
+ }
+ elementCount = count
+ if elementCount != 0 && len(m.UserId) == 0 {
+ m.UserId = make([]int64, 0, elementCount)
+ }
+ for iNdEx < postIndex {
+ var v int64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.UserId = append(m.UserId, v)
+ }
+ } else {
+ return fmt.Errorf("proto: wrong wireType = %d for field UserId", wireType)
+ }
+ case 5:
+ if wireType == 0 {
+ var v int32
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int32(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.Type = append(m.Type, v)
+ } else if wireType == 2 {
+ var packedLen int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ packedLen |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ if packedLen < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ postIndex := iNdEx + packedLen
+ if postIndex < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ var elementCount int
+ var count int
+ for _, integer := range dAtA[iNdEx:postIndex] {
+ if integer < 128 {
+ count++
+ }
+ }
+ elementCount = count
+ if elementCount != 0 && len(m.Type) == 0 {
+ m.Type = make([]int32, 0, elementCount)
+ }
+ for iNdEx < postIndex {
+ var v int32
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int32(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.Type = append(m.Type, v)
+ }
+ } else {
+ return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType)
+ }
+ case 6:
+ if wireType != 0 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Enable", wireType)
+ }
+ var v int
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ v |= int(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ m.Enable = bool(v != 0)
+ case 7:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Remark", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Remark = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ case 8:
+ if wireType != 2 {
+ return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType)
+ }
+ var stringLen uint64
+ for shift := uint(0); ; shift += 7 {
+ if shift >= 64 {
+ return ErrIntOverflowPunishment
+ }
+ if iNdEx >= l {
+ return io.ErrUnexpectedEOF
+ }
+ b := dAtA[iNdEx]
+ iNdEx++
+ stringLen |= uint64(b&0x7F) << shift
+ if b < 0x80 {
+ break
+ }
+ }
+ intStringLen := int(stringLen)
+ if intStringLen < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ postIndex := iNdEx + intStringLen
+ if postIndex < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if postIndex > l {
+ return io.ErrUnexpectedEOF
+ }
+ m.Reason = string(dAtA[iNdEx:postIndex])
+ iNdEx = postIndex
+ default:
+ iNdEx = preIndex
+ skippy, err := skipPunishment(dAtA[iNdEx:])
+ if err != nil {
+ return err
+ }
+ if (skippy < 0) || (iNdEx+skippy) < 0 {
+ return ErrInvalidLengthPunishment
+ }
+ if (iNdEx + skippy) > l {
+ return io.ErrUnexpectedEOF
+ }
+ iNdEx += skippy
+ }
+ }
+
+ if iNdEx > l {
+ return io.ErrUnexpectedEOF
+ }
+ return nil
+}
func (m *ListPunishmentReply) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
diff --git a/api/v1/punishment.pb.gw.go b/api/v1/punishment.pb.gw.go
index 4cb7f2f..90aa112 100644
--- a/api/v1/punishment.pb.gw.go
+++ b/api/v1/punishment.pb.gw.go
@@ -34,7 +34,7 @@ var _ = descriptor.ForMessage
var _ = metadata.Join
func request_PunishmentAPI_CreatePunishment_0(ctx context.Context, marshaler runtime.Marshaler, client PunishmentAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Punishment
+ var protoReq CreatePunishmentRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
@@ -51,7 +51,7 @@ func request_PunishmentAPI_CreatePunishment_0(ctx context.Context, marshaler run
}
func local_request_PunishmentAPI_CreatePunishment_0(ctx context.Context, marshaler runtime.Marshaler, server PunishmentAPIServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
- var protoReq Punishment
+ var protoReq CreatePunishmentRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
@@ -173,18 +173,15 @@ func local_request_PunishmentAPI_ListPunishment_0(ctx context.Context, marshaler
}
-var (
- filter_PunishmentAPI_CancelPunishment_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
-)
-
func request_PunishmentAPI_CancelPunishment_0(ctx context.Context, marshaler runtime.Marshaler, client PunishmentAPIClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CancelPunishmentRequest
var metadata runtime.ServerMetadata
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PunishmentAPI_CancelPunishment_0); err != nil {
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -197,10 +194,11 @@ func local_request_PunishmentAPI_CancelPunishment_0(ctx context.Context, marshal
var protoReq CancelPunishmentRequest
var metadata runtime.ServerMetadata
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PunishmentAPI_CancelPunishment_0); err != nil {
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
diff --git a/api/v1/punishment.proto b/api/v1/punishment.proto
index 051d4f6..119f357 100644
--- a/api/v1/punishment.proto
+++ b/api/v1/punishment.proto
@@ -43,13 +43,25 @@ message ListPunishmentRequest {
repeated int64 user_id = 8;
}
+message CreatePunishmentRequest {
+ google.protobuf.Timestamp start_time = 1 [ (gogoproto.stdtime) = true ];
+ google.protobuf.Timestamp end_time = 2 [ (gogoproto.stdtime) = true ];
+ int64 id = 3;
+ repeated int64 user_id = 4;
+ repeated int32 type = 5;
+ bool enable = 6;
+ string remark = 7;
+ string reason = 8;
+}
+
message ListPunishmentReply {
int64 total = 1;
repeated Punishment punishment = 2;
}
service PunishmentAPI {
- rpc CreatePunishment(Punishment) returns (Punishment) {
+ rpc CreatePunishment(CreatePunishmentRequest)
+ returns (google.protobuf.Empty) {
option (google.api.http) = {
post : '/api/v1/punishment',
body : '*',
@@ -80,6 +92,7 @@ service PunishmentAPI {
returns (google.protobuf.Empty) {
option (google.api.http) = {
put : '/api/v1/punishment/cancel',
+ body : '*',
};
}
}
\ No newline at end of file
diff --git a/biz/punishment.go b/biz/punishment.go
index 385acd5..4478d42 100644
--- a/biz/punishment.go
+++ b/biz/punishment.go
@@ -3,6 +3,7 @@ package biz
import (
"context"
"strings"
+ "time"
pb "moredoc/api/v1"
"moredoc/middleware/auth"
@@ -30,36 +31,49 @@ func (s *PunishmentAPIService) checkPermission(ctx context.Context) (userClaims
return checkGRPCPermission(s.dbModel, ctx)
}
-func (s *PunishmentAPIService) CreatePunishment(ctx context.Context, req *pb.Punishment) (*pb.Punishment, error) {
+func (s *PunishmentAPIService) CreatePunishment(ctx context.Context, req *pb.CreatePunishmentRequest) (*emptypb.Empty, error) {
userClaims, err := s.checkPermission(ctx)
if err != nil {
return nil, err
}
- punishment := &model.Punishment{}
- err = util.CopyStruct(req, punishment)
- if err != nil {
- s.logger.Error("CopyStruct", zap.Error(err))
- return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ if len(req.UserId) == 0 {
+ return nil, status.Errorf(codes.InvalidArgument, "请选择用户")
}
- s.logger.Debug("CreatePunishment", zap.Any("punishment", punishment), zap.Any("req", req))
- punishment.Operators = s.dbModel.MakePunishmentOperators(userClaims.UserId, req.Type)
-
- err = s.dbModel.CreatePunishment(punishment)
- if err != nil {
- s.logger.Error("CreatePunishment", zap.Error(err))
- return nil, status.Errorf(codes.Internal, err.Error())
+ if len(req.Type) == 0 {
+ return nil, status.Errorf(codes.InvalidArgument, "请选择处罚类型")
}
- res := &pb.Punishment{}
- err = util.CopyStruct(punishment, res)
- if err != nil {
- s.logger.Error("CopyStruct", zap.Error(err))
- return nil, status.Errorf(codes.Internal, err.Error())
+ now := time.Now()
+ startTime := &now
+ if req.StartTime != nil {
+ startTime = req.StartTime
}
-
- return res, nil
+ for _, userId := range req.UserId {
+ if userId == 1 {
+ continue
+ }
+ for _, typ := range req.Type {
+ punishment := &model.Punishment{
+ UserId: userId,
+ Type: int(typ),
+ Enable: req.Enable,
+ Reason: req.Reason,
+ Remark: req.Remark,
+ StartTime: startTime,
+ EndTime: req.EndTime,
+ }
+ s.logger.Debug("CreatePunishment", zap.Any("punishment", punishment), zap.Any("req", req))
+ punishment.Operators = s.dbModel.MakePunishmentOperators(userClaims.UserId, typ)
+ err = s.dbModel.CreatePunishment(punishment)
+ if err != nil {
+ s.logger.Error("CreatePunishment", zap.Error(err))
+ return nil, status.Errorf(codes.Internal, err.Error())
+ }
+ }
+ }
+ return &emptypb.Empty{}, nil
}
func (s *PunishmentAPIService) UpdatePunishment(ctx context.Context, req *pb.Punishment) (*emptypb.Empty, error) {
@@ -109,6 +123,12 @@ func (s *PunishmentAPIService) GetPunishment(ctx context.Context, req *pb.GetPun
return nil, status.Errorf(codes.Internal, err.Error())
}
+ if punishment.UserId > 0 {
+ user, _ := s.dbModel.GetUser(punishment.UserId, "id", "username")
+ if user.Id > 0 {
+ res.Username = user.Username
+ }
+ }
return res, nil
}
@@ -205,6 +225,8 @@ func (s *PunishmentAPIService) CancelPunishment(ctx context.Context, req *pb.Can
return nil, err
}
+ s.logger.Debug("CancelPunishment", zap.Any("req", req))
+
data, _, err := s.dbModel.GetPunishmentList(&model.OptionGetPunishmentList{
Ids: req.Id,
})
diff --git a/model/init.go b/model/init.go
index 52617a3..a3a4896 100644
--- a/model/init.go
+++ b/model/init.go
@@ -162,6 +162,7 @@ func (m *DBModel) SyncDB() (err error) {
&Sign{},
&Report{},
&Navigation{},
+ &Punishment{},
}
if err = m.db.AutoMigrate(tableModels...); err != nil {
m.logger.Fatal("SyncDB", zap.Error(err))
diff --git a/model/punishment.go b/model/punishment.go
index f14e7e7..a4c52ab 100644
--- a/model/punishment.go
+++ b/model/punishment.go
@@ -31,9 +31,9 @@ type Punishment struct {
}
type PunishmentOperator struct {
- UserId int64 `json:"u"`
- Type int32 `json:"t"`
- CreatedAt time.Time `json:"c"`
+ UserId int64 `json:"u"`
+ Type int32 `json:"t"`
+ Timestamp int64 `json:"ts"`
}
func (Punishment) TableName() string {
@@ -54,7 +54,7 @@ func (m *DBModel) MakePunishmentOperators(userId int64, punishmentType int32, op
operators = append(operators, PunishmentOperator{
UserId: userId,
Type: punishmentType,
- CreatedAt: time.Now(),
+ Timestamp: time.Now().Unix(),
})
operatersByte, err := jsoniter.Marshal(operators)
diff --git a/web/components/FormPunishment.vue b/web/components/FormPunishment.vue
index 62a6b8d..df33990 100644
--- a/web/components/FormPunishment.vue
+++ b/web/components/FormPunishment.vue
@@ -7,47 +7,57 @@
:model="punishment"
>
-
+
+
+
+
+
-
-
+
+
+ {{ item.label }}
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
@@ -83,6 +120,8 @@