公告字符长度校验

This commit is contained in:
wh_zcy 2023-06-12 16:50:13 +08:00
parent ee0bc82fbd
commit 1b205d6486
3 changed files with 58 additions and 52 deletions

View File

@ -9,7 +9,12 @@ import (
// 公会设置
func (this *apiComp) SettingCheck(session comm.IUserSession, req *pb.SociatySettingReq) (errdata *pb.ErrorData) {
if len(req.Notice) > 150 || req.ApplyLv == 0 || req.Icon == "" {
if len(req.Notice) > 150 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_SociatyNoticeTextLen,
Title: pb.ErrorCode_SociatyNoticeTextLen.ToString(),
}
} else if req.ApplyLv == 0 || req.Icon == "" {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),

View File

@ -5,7 +5,7 @@ import (
"go_dreamfactory/pb"
)
func (this *apiComp) TestCheck(session comm.IUserSession, req *pb.WorldtaskTestReq) (errdata *pb.ErrorData) {
func (this *apiComp) TriggerCheck(session comm.IUserSession, req *pb.WorldtaskTriggerReq) (errdata *pb.ErrorData) {
if len(req.Params) < 1 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
@ -15,11 +15,11 @@ func (this *apiComp) TestCheck(session comm.IUserSession, req *pb.WorldtaskTestR
return
}
func (this *apiComp) Test(session comm.IUserSession, req *pb.WorldtaskTestReq) (errdata *pb.ErrorData) {
if errdata = this.TestCheck(session, req); errdata != nil {
func (this *apiComp) Trigger(session comm.IUserSession, req *pb.WorldtaskTriggerReq) (errdata *pb.ErrorData) {
if errdata = this.TriggerCheck(session, req); errdata != nil {
return
}
rsp := &pb.WorldtaskTestResp{Flag: true, RtaskType: req.RtaskType}
rsp := &pb.WorldtaskTriggerResp{Flag: true, RtaskType: req.RtaskType}
// 校验
if req.CondiId != 0 {
condIds, err := this.module.ModuleBuried.CheckCondition(session.GetUserId(), req.CondiId)
@ -50,6 +50,6 @@ func (this *apiComp) Test(session comm.IUserSession, req *pb.WorldtaskTestReq) (
rsp.Flag = true
}
session.SendMsg(string(this.module.GetType()), "test", rsp)
session.SendMsg(string(this.module.GetType()), "trigger", rsp)
return
}

View File

@ -940,7 +940,7 @@ func (x *WorldtaskChapterrewardResp) GetGroupId() int32 {
}
// 测试使用
type WorldtaskTestReq struct {
type WorldtaskTriggerReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -952,8 +952,8 @@ type WorldtaskTestReq struct {
RtaskIds string `protobuf:"bytes,5,opt,name=rtaskIds,proto3" json:"rtaskIds"` //已完成的任务ids
}
func (x *WorldtaskTestReq) Reset() {
*x = WorldtaskTestReq{}
func (x *WorldtaskTriggerReq) Reset() {
*x = WorldtaskTriggerReq{}
if protoimpl.UnsafeEnabled {
mi := &file_worldtask_worldtask_msg_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -961,13 +961,13 @@ func (x *WorldtaskTestReq) Reset() {
}
}
func (x *WorldtaskTestReq) String() string {
func (x *WorldtaskTriggerReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WorldtaskTestReq) ProtoMessage() {}
func (*WorldtaskTriggerReq) ProtoMessage() {}
func (x *WorldtaskTestReq) ProtoReflect() protoreflect.Message {
func (x *WorldtaskTriggerReq) ProtoReflect() protoreflect.Message {
mi := &file_worldtask_worldtask_msg_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -979,47 +979,47 @@ func (x *WorldtaskTestReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use WorldtaskTestReq.ProtoReflect.Descriptor instead.
func (*WorldtaskTestReq) Descriptor() ([]byte, []int) {
// Deprecated: Use WorldtaskTriggerReq.ProtoReflect.Descriptor instead.
func (*WorldtaskTriggerReq) Descriptor() ([]byte, []int) {
return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{18}
}
func (x *WorldtaskTestReq) GetRtaskType() int32 {
func (x *WorldtaskTriggerReq) GetRtaskType() int32 {
if x != nil {
return x.RtaskType
}
return 0
}
func (x *WorldtaskTestReq) GetParams() []int32 {
func (x *WorldtaskTriggerReq) GetParams() []int32 {
if x != nil {
return x.Params
}
return nil
}
func (x *WorldtaskTestReq) GetCondiId() int32 {
func (x *WorldtaskTriggerReq) GetCondiId() int32 {
if x != nil {
return x.CondiId
}
return 0
}
func (x *WorldtaskTestReq) GetGroupId() int32 {
func (x *WorldtaskTriggerReq) GetGroupId() int32 {
if x != nil {
return x.GroupId
}
return 0
}
func (x *WorldtaskTestReq) GetRtaskIds() string {
func (x *WorldtaskTriggerReq) GetRtaskIds() string {
if x != nil {
return x.RtaskIds
}
return ""
}
type WorldtaskTestResp struct {
type WorldtaskTriggerResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -1029,8 +1029,8 @@ type WorldtaskTestResp struct {
RtaskType int32 `protobuf:"varint,3,opt,name=rtaskType,proto3" json:"rtaskType"`
}
func (x *WorldtaskTestResp) Reset() {
*x = WorldtaskTestResp{}
func (x *WorldtaskTriggerResp) Reset() {
*x = WorldtaskTriggerResp{}
if protoimpl.UnsafeEnabled {
mi := &file_worldtask_worldtask_msg_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1038,13 +1038,13 @@ func (x *WorldtaskTestResp) Reset() {
}
}
func (x *WorldtaskTestResp) String() string {
func (x *WorldtaskTriggerResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*WorldtaskTestResp) ProtoMessage() {}
func (*WorldtaskTriggerResp) ProtoMessage() {}
func (x *WorldtaskTestResp) ProtoReflect() protoreflect.Message {
func (x *WorldtaskTriggerResp) ProtoReflect() protoreflect.Message {
mi := &file_worldtask_worldtask_msg_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1056,26 +1056,26 @@ func (x *WorldtaskTestResp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use WorldtaskTestResp.ProtoReflect.Descriptor instead.
func (*WorldtaskTestResp) Descriptor() ([]byte, []int) {
// Deprecated: Use WorldtaskTriggerResp.ProtoReflect.Descriptor instead.
func (*WorldtaskTriggerResp) Descriptor() ([]byte, []int) {
return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{19}
}
func (x *WorldtaskTestResp) GetFlag() bool {
func (x *WorldtaskTriggerResp) GetFlag() bool {
if x != nil {
return x.Flag
}
return false
}
func (x *WorldtaskTestResp) GetRtaskIds() []int32 {
func (x *WorldtaskTriggerResp) GetRtaskIds() []int32 {
if x != nil {
return x.RtaskIds
}
return nil
}
func (x *WorldtaskTestResp) GetRtaskType() int32 {
func (x *WorldtaskTriggerResp) GetRtaskType() int32 {
if x != nil {
return x.RtaskType
}
@ -1176,24 +1176,25 @@ var file_worldtask_worldtask_msg_proto_rawDesc = []byte{
0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x1a, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74,
0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64,
0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x98,
0x01, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74,
0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
0x05, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e,
0x64, 0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64,
0x69, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a,
0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x61, 0x0a, 0x11, 0x57, 0x6f, 0x72,
0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12,
0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c,
0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x12, 0x1c,
0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x9b,
0x01, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x72, 0x69, 0x67,
0x67, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54,
0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b,
0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07,
0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63,
0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49,
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64,
0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x64, 0x0a, 0x14,
0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79,
0x70, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
@ -1228,8 +1229,8 @@ var file_worldtask_worldtask_msg_proto_goTypes = []interface{}{
(*WorldtaskFinishIdsPush)(nil), // 15: WorldtaskFinishIdsPush
(*WorldtaskChapterrewardReq)(nil), // 16: WorldtaskChapterrewardReq
(*WorldtaskChapterrewardResp)(nil), // 17: WorldtaskChapterrewardResp
(*WorldtaskTestReq)(nil), // 18: WorldtaskTestReq
(*WorldtaskTestResp)(nil), // 19: WorldtaskTestResp
(*WorldtaskTriggerReq)(nil), // 18: WorldtaskTriggerReq
(*WorldtaskTriggerResp)(nil), // 19: WorldtaskTriggerResp
nil, // 20: WorldtaskNexttaskPush.NextTaskEntry
(*DBWorldtask)(nil), // 21: DBWorldtask
(*ConIProgress)(nil), // 22: ConIProgress
@ -1483,7 +1484,7 @@ func file_worldtask_worldtask_msg_proto_init() {
}
}
file_worldtask_worldtask_msg_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorldtaskTestReq); i {
switch v := v.(*WorldtaskTriggerReq); i {
case 0:
return &v.state
case 1:
@ -1495,7 +1496,7 @@ func file_worldtask_worldtask_msg_proto_init() {
}
}
file_worldtask_worldtask_msg_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorldtaskTestResp); i {
switch v := v.(*WorldtaskTriggerResp); i {
case 0:
return &v.state
case 1: