diff --git a/api/handler/api/common_service.go b/api/handler/api/common_service.go index 636b423f..c4ea6e76 100644 --- a/api/handler/api/common_service.go +++ b/api/handler/api/common_service.go @@ -130,3 +130,24 @@ func GetTerm(ctx context.Context, c *app.RequestContext) { pack.RespData(c, resp.TermInfo) } + +// GetNotice . +// @router /api/v1/common/notice [GET] +func GetNotice(ctx context.Context, c *app.RequestContext) { + var err error + var req api.GetNoticeRequst + err = c.BindAndValidate(&req) + if err != nil { + pack.RespError(c, errno.ParamError.WithError(err)) + return + } + resp := new(api.GetNoticeResponse) + notices, total, err := rpc.GetNoticesRPC(ctx, &common.NoticeRequest{PageNum: req.PageNum}) + if err != nil { + pack.RespError(c, err) + return + } + resp.Notices = pack.BuildNotices(notices) + resp.Total = total + pack.RespList(c, resp) +} diff --git a/api/model/api/api.go b/api/model/api/api.go index 4b7c84dd..6c8ea460 100644 --- a/api/model/api/api.go +++ b/api/model/api/api.go @@ -15657,811 +15657,1145 @@ func (p *TermResponse) String() string { } -type ClassRoomService interface { - GetEmptyClassrooms(ctx context.Context, request *EmptyClassroomRequest) (r *EmptyClassroomResponse, err error) - - GetExamRoomInfo(ctx context.Context, request *ExamRoomInfoRequest) (r *ExamRoomInfoResponse, err error) -} - -type ClassRoomServiceClient struct { - c thrift.TClient +type GetNoticeRequst struct { + PageNum int64 `thrift:"pageNum,1,required" form:"pageNum,required" json:"pageNum,required" query:"pageNum,required"` } -func NewClassRoomServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ClassRoomServiceClient { - return &ClassRoomServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } -} - -func NewClassRoomServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ClassRoomServiceClient { - return &ClassRoomServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } +func NewGetNoticeRequst() *GetNoticeRequst { + return &GetNoticeRequst{} } -func NewClassRoomServiceClient(c thrift.TClient) *ClassRoomServiceClient { - return &ClassRoomServiceClient{ - c: c, - } +func (p *GetNoticeRequst) InitDefault() { } -func (p *ClassRoomServiceClient) Client_() thrift.TClient { - return p.c +func (p *GetNoticeRequst) GetPageNum() (v int64) { + return p.PageNum } -func (p *ClassRoomServiceClient) GetEmptyClassrooms(ctx context.Context, request *EmptyClassroomRequest) (r *EmptyClassroomResponse, err error) { - var _args ClassRoomServiceGetEmptyClassroomsArgs - _args.Request = request - var _result ClassRoomServiceGetEmptyClassroomsResult - if err = p.Client_().Call(ctx, "GetEmptyClassrooms", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil -} -func (p *ClassRoomServiceClient) GetExamRoomInfo(ctx context.Context, request *ExamRoomInfoRequest) (r *ExamRoomInfoResponse, err error) { - var _args ClassRoomServiceGetExamRoomInfoArgs - _args.Request = request - var _result ClassRoomServiceGetExamRoomInfoResult - if err = p.Client_().Call(ctx, "GetExamRoomInfo", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil +var fieldIDToName_GetNoticeRequst = map[int16]string{ + 1: "pageNum", } -type UserService interface { - GetLoginData(ctx context.Context, request *GetLoginDataRequest) (r *GetLoginDataResponse, err error) +func (p *GetNoticeRequst) Read(iprot thrift.TProtocol) (err error) { - ValidateCode(ctx context.Context, request *ValidateCodeRequest) (r *ValidateCodeResponse, err error) + var fieldTypeId thrift.TType + var fieldId int16 + var issetPageNum bool = false - ValidateCodeForAndroid(ctx context.Context, request *ValidateCodeForAndroidRequest) (r *ValidateCodeForAndroidResponse, err error) + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } - GetToken(ctx context.Context, request *GetAccessTokenRequest) (r *GetAccessTokenResponse, err error) + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } - RefreshToken(ctx context.Context, request *RefreshTokenRequest) (r *RefreshTokenResponse, err error) + switch fieldId { + case 1: + if fieldTypeId == thrift.I64 { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetPageNum = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } - TestAuth(ctx context.Context, request *TestAuthRequest) (r *TestAuthResponse, err error) + if !issetPageNum { + fieldId = 1 + goto RequiredFieldNotSetError + } + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetNoticeRequst[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) - GetUserInfo(ctx context.Context, request *GetUserInfoRequest) (r *GetUserInfoResponse, err error) +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetNoticeRequst[fieldId])) } -type UserServiceClient struct { - c thrift.TClient -} +func (p *GetNoticeRequst) ReadField1(iprot thrift.TProtocol) error { -func NewUserServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *UserServiceClient { - return &UserServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v } + p.PageNum = _field + return nil } -func NewUserServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *UserServiceClient { - return &UserServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} +func (p *GetNoticeRequst) Write(oprot thrift.TProtocol) (err error) { -func NewUserServiceClient(c thrift.TClient) *UserServiceClient { - return &UserServiceClient{ - c: c, + var fieldId int16 + if err = oprot.WriteStructBegin("GetNoticeRequst"); err != nil { + goto WriteStructBeginError } -} - -func (p *UserServiceClient) Client_() thrift.TClient { - return p.c -} - -func (p *UserServiceClient) GetLoginData(ctx context.Context, request *GetLoginDataRequest) (r *GetLoginDataResponse, err error) { - var _args UserServiceGetLoginDataArgs - _args.Request = request - var _result UserServiceGetLoginDataResult - if err = p.Client_().Call(ctx, "GetLoginData", &_args, &_result); err != nil { - return + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } } - return _result.GetSuccess(), nil -} -func (p *UserServiceClient) ValidateCode(ctx context.Context, request *ValidateCodeRequest) (r *ValidateCodeResponse, err error) { - var _args UserServiceValidateCodeArgs - _args.Request = request - var _result UserServiceValidateCodeResult - if err = p.Client_().Call(ctx, "ValidateCode", &_args, &_result); err != nil { - return + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - return _result.GetSuccess(), nil -} -func (p *UserServiceClient) ValidateCodeForAndroid(ctx context.Context, request *ValidateCodeForAndroidRequest) (r *ValidateCodeForAndroidResponse, err error) { - var _args UserServiceValidateCodeForAndroidArgs - _args.Request = request - var _result UserServiceValidateCodeForAndroidResult - if err = p.Client_().Call(ctx, "ValidateCodeForAndroid", &_args, &_result); err != nil { - return + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError } - return _result.GetSuccess(), nil + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserServiceClient) GetToken(ctx context.Context, request *GetAccessTokenRequest) (r *GetAccessTokenResponse, err error) { - var _args UserServiceGetTokenArgs - _args.Request = request - var _result UserServiceGetTokenResult - if err = p.Client_().Call(ctx, "GetToken", &_args, &_result); err != nil { - return + +func (p *GetNoticeRequst) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("pageNum", thrift.I64, 1); err != nil { + goto WriteFieldBeginError } - return _result.GetSuccess(), nil -} -func (p *UserServiceClient) RefreshToken(ctx context.Context, request *RefreshTokenRequest) (r *RefreshTokenResponse, err error) { - var _args UserServiceRefreshTokenArgs - _args.Request = request - var _result UserServiceRefreshTokenResult - if err = p.Client_().Call(ctx, "RefreshToken", &_args, &_result); err != nil { - return + if err := oprot.WriteI64(p.PageNum); err != nil { + return err } - return _result.GetSuccess(), nil -} -func (p *UserServiceClient) TestAuth(ctx context.Context, request *TestAuthRequest) (r *TestAuthResponse, err error) { - var _args UserServiceTestAuthArgs - _args.Request = request - var _result UserServiceTestAuthResult - if err = p.Client_().Call(ctx, "TestAuth", &_args, &_result); err != nil { - return + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError } - return _result.GetSuccess(), nil + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *UserServiceClient) GetUserInfo(ctx context.Context, request *GetUserInfoRequest) (r *GetUserInfoResponse, err error) { - var _args UserServiceGetUserInfoArgs - _args.Request = request - var _result UserServiceGetUserInfoResult - if err = p.Client_().Call(ctx, "GetUserInfo", &_args, &_result); err != nil { - return + +func (p *GetNoticeRequst) String() string { + if p == nil { + return "" } - return _result.GetSuccess(), nil -} + return fmt.Sprintf("GetNoticeRequst(%+v)", *p) -type CourseService interface { - GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) } -type CourseServiceClient struct { - c thrift.TClient +type GetNoticeResponse struct { + Notices []*model.NoticeInfo `thrift:"notices,1,required" form:"notices,required" json:"notices,required" query:"notices,required"` + Total int64 `thrift:"total,2,required" form:"total,required" json:"total,required" query:"total,required"` } -func NewCourseServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CourseServiceClient { - return &CourseServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } +func NewGetNoticeResponse() *GetNoticeResponse { + return &GetNoticeResponse{} } -func NewCourseServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CourseServiceClient { - return &CourseServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } +func (p *GetNoticeResponse) InitDefault() { } -func NewCourseServiceClient(c thrift.TClient) *CourseServiceClient { - return &CourseServiceClient{ - c: c, - } +func (p *GetNoticeResponse) GetNotices() (v []*model.NoticeInfo) { + return p.Notices } -func (p *CourseServiceClient) Client_() thrift.TClient { - return p.c +func (p *GetNoticeResponse) GetTotal() (v int64) { + return p.Total } -func (p *CourseServiceClient) GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) { - var _args CourseServiceGetCourseListArgs - _args.Req = req - var _result CourseServiceGetCourseListResult - if err = p.Client_().Call(ctx, "GetCourseList", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil +var fieldIDToName_GetNoticeResponse = map[int16]string{ + 1: "notices", + 2: "total", } -type LaunchScreenService interface { - CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) +func (p *GetNoticeResponse) Read(iprot thrift.TProtocol) (err error) { - GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) + var fieldTypeId thrift.TType + var fieldId int16 + var issetNotices bool = false + var issetTotal bool = false - ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } - ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, err error) + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } - DeleteImage(ctx context.Context, req *DeleteImageRequest) (r *DeleteImageResponse, err error) + switch fieldId { + case 1: + if fieldTypeId == thrift.LIST { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetNotices = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.I64 { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + issetTotal = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } - MobileGetImage(ctx context.Context, req *MobileGetImageRequest) (r *MobileGetImageResponse, err error) + if !issetNotices { + fieldId = 1 + goto RequiredFieldNotSetError + } - AddImagePointTime(ctx context.Context, req *AddImagePointTimeRequest) (r *AddImagePointTimeResponse, err error) -} + if !issetTotal { + fieldId = 2 + goto RequiredFieldNotSetError + } + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetNoticeResponse[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) -type LaunchScreenServiceClient struct { - c thrift.TClient +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetNoticeResponse[fieldId])) } -func NewLaunchScreenServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *LaunchScreenServiceClient { - return &LaunchScreenServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), +func (p *GetNoticeResponse) ReadField1(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err } -} + _field := make([]*model.NoticeInfo, 0, size) + values := make([]model.NoticeInfo, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() -func NewLaunchScreenServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *LaunchScreenServiceClient { - return &LaunchScreenServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), + if err := _elem.Read(iprot); err != nil { + return err + } + + _field = append(_field, _elem) } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Notices = _field + return nil } +func (p *GetNoticeResponse) ReadField2(iprot thrift.TProtocol) error { -func NewLaunchScreenServiceClient(c thrift.TClient) *LaunchScreenServiceClient { - return &LaunchScreenServiceClient{ - c: c, + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v } + p.Total = _field + return nil } -func (p *LaunchScreenServiceClient) Client_() thrift.TClient { - return p.c -} +func (p *GetNoticeResponse) Write(oprot thrift.TProtocol) (err error) { -func (p *LaunchScreenServiceClient) CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) { - var _args LaunchScreenServiceCreateImageArgs - _args.Req = req - var _result LaunchScreenServiceCreateImageResult - if err = p.Client_().Call(ctx, "CreateImage", &_args, &_result); err != nil { - return + var fieldId int16 + if err = oprot.WriteStructBegin("GetNoticeResponse"); err != nil { + goto WriteStructBeginError } - return _result.GetSuccess(), nil -} -func (p *LaunchScreenServiceClient) GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) { - var _args LaunchScreenServiceGetImageArgs - _args.Req = req - var _result LaunchScreenServiceGetImageResult - if err = p.Client_().Call(ctx, "GetImage", &_args, &_result); err != nil { - return + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } } - return _result.GetSuccess(), nil -} -func (p *LaunchScreenServiceClient) ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) { - var _args LaunchScreenServiceChangeImagePropertyArgs - _args.Req = req - var _result LaunchScreenServiceChangeImagePropertyResult - if err = p.Client_().Call(ctx, "ChangeImageProperty", &_args, &_result); err != nil { - return + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - return _result.GetSuccess(), nil -} -func (p *LaunchScreenServiceClient) ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, err error) { - var _args LaunchScreenServiceChangeImageArgs - _args.Req = req - var _result LaunchScreenServiceChangeImageResult - if err = p.Client_().Call(ctx, "ChangeImage", &_args, &_result); err != nil { - return + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError } - return _result.GetSuccess(), nil + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceClient) DeleteImage(ctx context.Context, req *DeleteImageRequest) (r *DeleteImageResponse, err error) { - var _args LaunchScreenServiceDeleteImageArgs - _args.Req = req - var _result LaunchScreenServiceDeleteImageResult - if err = p.Client_().Call(ctx, "DeleteImage", &_args, &_result); err != nil { - return + +func (p *GetNoticeResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("notices", thrift.LIST, 1); err != nil { + goto WriteFieldBeginError } - return _result.GetSuccess(), nil -} -func (p *LaunchScreenServiceClient) MobileGetImage(ctx context.Context, req *MobileGetImageRequest) (r *MobileGetImageResponse, err error) { - var _args LaunchScreenServiceMobileGetImageArgs - _args.Req = req - var _result LaunchScreenServiceMobileGetImageResult - if err = p.Client_().Call(ctx, "MobileGetImage", &_args, &_result); err != nil { - return + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Notices)); err != nil { + return err } - return _result.GetSuccess(), nil + for _, v := range p.Notices { + if err := v.Write(oprot); err != nil { + return err + } + } + if err := oprot.WriteListEnd(); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceClient) AddImagePointTime(ctx context.Context, req *AddImagePointTimeRequest) (r *AddImagePointTimeResponse, err error) { - var _args LaunchScreenServiceAddImagePointTimeArgs - _args.Req = req - var _result LaunchScreenServiceAddImagePointTimeResult - if err = p.Client_().Call(ctx, "AddImagePointTime", &_args, &_result); err != nil { - return + +func (p *GetNoticeResponse) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("total", thrift.I64, 2); err != nil { + goto WriteFieldBeginError } - return _result.GetSuccess(), nil + if err := oprot.WriteI64(p.Total); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) } -type PaperService interface { - ListDirFiles(ctx context.Context, req *ListDirFilesRequest) (r *ListDirFilesResponse, err error) +func (p *GetNoticeResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetNoticeResponse(%+v)", *p) - GetDownloadUrl(ctx context.Context, req *GetDownloadUrlRequest) (r *GetDownloadUrlResponse, err error) - // 兼容安卓 - ListDirFilesForAndroid(ctx context.Context, req *ListDirFilesForAndroidRequest) (r *ListDirFilesForAndroidResponse, err error) +} - GetDownloadUrlForAndroid(ctx context.Context, req *GetDownloadUrlForAndroidRequest) (r *GetDownloadUrlForAndroidResponse, err error) +type ClassRoomService interface { + GetEmptyClassrooms(ctx context.Context, request *EmptyClassroomRequest) (r *EmptyClassroomResponse, err error) + + GetExamRoomInfo(ctx context.Context, request *ExamRoomInfoRequest) (r *ExamRoomInfoResponse, err error) } -type PaperServiceClient struct { +type ClassRoomServiceClient struct { c thrift.TClient } -func NewPaperServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *PaperServiceClient { - return &PaperServiceClient{ +func NewClassRoomServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ClassRoomServiceClient { + return &ClassRoomServiceClient{ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } } -func NewPaperServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PaperServiceClient { - return &PaperServiceClient{ +func NewClassRoomServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ClassRoomServiceClient { + return &ClassRoomServiceClient{ c: thrift.NewTStandardClient(iprot, oprot), } } -func NewPaperServiceClient(c thrift.TClient) *PaperServiceClient { - return &PaperServiceClient{ +func NewClassRoomServiceClient(c thrift.TClient) *ClassRoomServiceClient { + return &ClassRoomServiceClient{ c: c, } } -func (p *PaperServiceClient) Client_() thrift.TClient { +func (p *ClassRoomServiceClient) Client_() thrift.TClient { return p.c } -func (p *PaperServiceClient) ListDirFiles(ctx context.Context, req *ListDirFilesRequest) (r *ListDirFilesResponse, err error) { - var _args PaperServiceListDirFilesArgs - _args.Req = req - var _result PaperServiceListDirFilesResult - if err = p.Client_().Call(ctx, "ListDirFiles", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil -} -func (p *PaperServiceClient) GetDownloadUrl(ctx context.Context, req *GetDownloadUrlRequest) (r *GetDownloadUrlResponse, err error) { - var _args PaperServiceGetDownloadUrlArgs - _args.Req = req - var _result PaperServiceGetDownloadUrlResult - if err = p.Client_().Call(ctx, "GetDownloadUrl", &_args, &_result); err != nil { +func (p *ClassRoomServiceClient) GetEmptyClassrooms(ctx context.Context, request *EmptyClassroomRequest) (r *EmptyClassroomResponse, err error) { + var _args ClassRoomServiceGetEmptyClassroomsArgs + _args.Request = request + var _result ClassRoomServiceGetEmptyClassroomsResult + if err = p.Client_().Call(ctx, "GetEmptyClassrooms", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *PaperServiceClient) ListDirFilesForAndroid(ctx context.Context, req *ListDirFilesForAndroidRequest) (r *ListDirFilesForAndroidResponse, err error) { - var _args PaperServiceListDirFilesForAndroidArgs - _args.Req = req - var _result PaperServiceListDirFilesForAndroidResult - if err = p.Client_().Call(ctx, "ListDirFilesForAndroid", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil -} -func (p *PaperServiceClient) GetDownloadUrlForAndroid(ctx context.Context, req *GetDownloadUrlForAndroidRequest) (r *GetDownloadUrlForAndroidResponse, err error) { - var _args PaperServiceGetDownloadUrlForAndroidArgs - _args.Req = req - var _result PaperServiceGetDownloadUrlForAndroidResult - if err = p.Client_().Call(ctx, "GetDownloadUrlForAndroid", &_args, &_result); err != nil { +func (p *ClassRoomServiceClient) GetExamRoomInfo(ctx context.Context, request *ExamRoomInfoRequest) (r *ExamRoomInfoResponse, err error) { + var _args ClassRoomServiceGetExamRoomInfoArgs + _args.Request = request + var _result ClassRoomServiceGetExamRoomInfoResult + if err = p.Client_().Call(ctx, "GetExamRoomInfo", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -type AcademicService interface { - GetScores(ctx context.Context, req *GetScoresRequest) (r *GetScoresResponse, err error) +type UserService interface { + GetLoginData(ctx context.Context, request *GetLoginDataRequest) (r *GetLoginDataResponse, err error) - GetGPA(ctx context.Context, req *GetGPARequest) (r *GetGPAResponse, err error) + ValidateCode(ctx context.Context, request *ValidateCodeRequest) (r *ValidateCodeResponse, err error) - GetCredit(ctx context.Context, req *GetCreditRequest) (r *GetCreditResponse, err error) + ValidateCodeForAndroid(ctx context.Context, request *ValidateCodeForAndroidRequest) (r *ValidateCodeForAndroidResponse, err error) - GetUnifiedExam(ctx context.Context, req *GetUnifiedExamRequest) (r *GetUnifiedExamResponse, err error) + GetToken(ctx context.Context, request *GetAccessTokenRequest) (r *GetAccessTokenResponse, err error) - GetPlan(ctx context.Context, req *GetPlanRequest) (r *GetPlanResponse, err error) + RefreshToken(ctx context.Context, request *RefreshTokenRequest) (r *RefreshTokenResponse, err error) + + TestAuth(ctx context.Context, request *TestAuthRequest) (r *TestAuthResponse, err error) + + GetUserInfo(ctx context.Context, request *GetUserInfoRequest) (r *GetUserInfoResponse, err error) } -type AcademicServiceClient struct { +type UserServiceClient struct { c thrift.TClient } -func NewAcademicServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AcademicServiceClient { - return &AcademicServiceClient{ +func NewUserServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *UserServiceClient { + return &UserServiceClient{ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } } -func NewAcademicServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AcademicServiceClient { - return &AcademicServiceClient{ +func NewUserServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *UserServiceClient { + return &UserServiceClient{ c: thrift.NewTStandardClient(iprot, oprot), } } -func NewAcademicServiceClient(c thrift.TClient) *AcademicServiceClient { - return &AcademicServiceClient{ +func NewUserServiceClient(c thrift.TClient) *UserServiceClient { + return &UserServiceClient{ c: c, } } -func (p *AcademicServiceClient) Client_() thrift.TClient { +func (p *UserServiceClient) Client_() thrift.TClient { return p.c } -func (p *AcademicServiceClient) GetScores(ctx context.Context, req *GetScoresRequest) (r *GetScoresResponse, err error) { - var _args AcademicServiceGetScoresArgs - _args.Req = req - var _result AcademicServiceGetScoresResult - if err = p.Client_().Call(ctx, "GetScores", &_args, &_result); err != nil { +func (p *UserServiceClient) GetLoginData(ctx context.Context, request *GetLoginDataRequest) (r *GetLoginDataResponse, err error) { + var _args UserServiceGetLoginDataArgs + _args.Request = request + var _result UserServiceGetLoginDataResult + if err = p.Client_().Call(ctx, "GetLoginData", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *AcademicServiceClient) GetGPA(ctx context.Context, req *GetGPARequest) (r *GetGPAResponse, err error) { - var _args AcademicServiceGetGPAArgs - _args.Req = req - var _result AcademicServiceGetGPAResult - if err = p.Client_().Call(ctx, "GetGPA", &_args, &_result); err != nil { +func (p *UserServiceClient) ValidateCode(ctx context.Context, request *ValidateCodeRequest) (r *ValidateCodeResponse, err error) { + var _args UserServiceValidateCodeArgs + _args.Request = request + var _result UserServiceValidateCodeResult + if err = p.Client_().Call(ctx, "ValidateCode", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *AcademicServiceClient) GetCredit(ctx context.Context, req *GetCreditRequest) (r *GetCreditResponse, err error) { - var _args AcademicServiceGetCreditArgs - _args.Req = req - var _result AcademicServiceGetCreditResult - if err = p.Client_().Call(ctx, "GetCredit", &_args, &_result); err != nil { +func (p *UserServiceClient) ValidateCodeForAndroid(ctx context.Context, request *ValidateCodeForAndroidRequest) (r *ValidateCodeForAndroidResponse, err error) { + var _args UserServiceValidateCodeForAndroidArgs + _args.Request = request + var _result UserServiceValidateCodeForAndroidResult + if err = p.Client_().Call(ctx, "ValidateCodeForAndroid", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *AcademicServiceClient) GetUnifiedExam(ctx context.Context, req *GetUnifiedExamRequest) (r *GetUnifiedExamResponse, err error) { - var _args AcademicServiceGetUnifiedExamArgs - _args.Req = req - var _result AcademicServiceGetUnifiedExamResult - if err = p.Client_().Call(ctx, "GetUnifiedExam", &_args, &_result); err != nil { +func (p *UserServiceClient) GetToken(ctx context.Context, request *GetAccessTokenRequest) (r *GetAccessTokenResponse, err error) { + var _args UserServiceGetTokenArgs + _args.Request = request + var _result UserServiceGetTokenResult + if err = p.Client_().Call(ctx, "GetToken", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *AcademicServiceClient) GetPlan(ctx context.Context, req *GetPlanRequest) (r *GetPlanResponse, err error) { - var _args AcademicServiceGetPlanArgs - _args.Req = req - var _result AcademicServiceGetPlanResult - if err = p.Client_().Call(ctx, "GetPlan", &_args, &_result); err != nil { +func (p *UserServiceClient) RefreshToken(ctx context.Context, request *RefreshTokenRequest) (r *RefreshTokenResponse, err error) { + var _args UserServiceRefreshTokenArgs + _args.Request = request + var _result UserServiceRefreshTokenResult + if err = p.Client_().Call(ctx, "RefreshToken", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UserServiceClient) TestAuth(ctx context.Context, request *TestAuthRequest) (r *TestAuthResponse, err error) { + var _args UserServiceTestAuthArgs + _args.Request = request + var _result UserServiceTestAuthResult + if err = p.Client_().Call(ctx, "TestAuth", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UserServiceClient) GetUserInfo(ctx context.Context, request *GetUserInfoRequest) (r *GetUserInfoResponse, err error) { + var _args UserServiceGetUserInfoArgs + _args.Request = request + var _result UserServiceGetUserInfoResult + if err = p.Client_().Call(ctx, "GetUserInfo", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -type VersionService interface { - Login(ctx context.Context, req *LoginRequest) (r *LoginResponse, err error) +type CourseService interface { + GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) +} - UploadVersion(ctx context.Context, req *UploadRequest) (r *UploadResponse, err error) +type CourseServiceClient struct { + c thrift.TClient +} - UploadParams(ctx context.Context, req *UploadParamsRequest) (r *UploadParamsResponse, err error) +func NewCourseServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CourseServiceClient { + return &CourseServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} - DownloadReleaseApk(ctx context.Context, req *DownloadReleaseApkRequest) (r *DownloadReleaseApkResponse, err error) +func NewCourseServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CourseServiceClient { + return &CourseServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} - DownloadBetaApk(ctx context.Context, req *DownloadBetaApkRequest) (r *DownloadBetaApkResponse, err error) +func NewCourseServiceClient(c thrift.TClient) *CourseServiceClient { + return &CourseServiceClient{ + c: c, + } +} - GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) +func (p *CourseServiceClient) Client_() thrift.TClient { + return p.c +} - GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) +func (p *CourseServiceClient) GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) { + var _args CourseServiceGetCourseListArgs + _args.Req = req + var _result CourseServiceGetCourseListResult + if err = p.Client_().Call(ctx, "GetCourseList", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} - GetSetting(ctx context.Context, req *GetSettingRequest) (r *GetSettingResponse, err error) +type LaunchScreenService interface { + CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) - GetTest(ctx context.Context, req *GetTestRequest) (r *GetTestResponse, err error) + GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) - GetCloud(ctx context.Context, req *GetCloudRequest) (r *GetCloudResponse, err error) + ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) - SetCloud(ctx context.Context, req *SetCloudRequest) (r *SetCloudResponse, err error) + ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, err error) - GetDump(ctx context.Context, req *GetDumpRequest) (r *GetDumpResponse, err error) + DeleteImage(ctx context.Context, req *DeleteImageRequest) (r *DeleteImageResponse, err error) + + MobileGetImage(ctx context.Context, req *MobileGetImageRequest) (r *MobileGetImageResponse, err error) + + AddImagePointTime(ctx context.Context, req *AddImagePointTimeRequest) (r *AddImagePointTimeResponse, err error) } -type VersionServiceClient struct { +type LaunchScreenServiceClient struct { c thrift.TClient } -func NewVersionServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *VersionServiceClient { - return &VersionServiceClient{ +func NewLaunchScreenServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *LaunchScreenServiceClient { + return &LaunchScreenServiceClient{ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } } -func NewVersionServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *VersionServiceClient { - return &VersionServiceClient{ +func NewLaunchScreenServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *LaunchScreenServiceClient { + return &LaunchScreenServiceClient{ c: thrift.NewTStandardClient(iprot, oprot), } } -func NewVersionServiceClient(c thrift.TClient) *VersionServiceClient { - return &VersionServiceClient{ +func NewLaunchScreenServiceClient(c thrift.TClient) *LaunchScreenServiceClient { + return &LaunchScreenServiceClient{ c: c, } } -func (p *VersionServiceClient) Client_() thrift.TClient { +func (p *LaunchScreenServiceClient) Client_() thrift.TClient { return p.c } -func (p *VersionServiceClient) Login(ctx context.Context, req *LoginRequest) (r *LoginResponse, err error) { - var _args VersionServiceLoginArgs +func (p *LaunchScreenServiceClient) CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) { + var _args LaunchScreenServiceCreateImageArgs _args.Req = req - var _result VersionServiceLoginResult - if err = p.Client_().Call(ctx, "Login", &_args, &_result); err != nil { + var _result LaunchScreenServiceCreateImageResult + if err = p.Client_().Call(ctx, "CreateImage", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) UploadVersion(ctx context.Context, req *UploadRequest) (r *UploadResponse, err error) { - var _args VersionServiceUploadVersionArgs +func (p *LaunchScreenServiceClient) GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) { + var _args LaunchScreenServiceGetImageArgs _args.Req = req - var _result VersionServiceUploadVersionResult - if err = p.Client_().Call(ctx, "UploadVersion", &_args, &_result); err != nil { + var _result LaunchScreenServiceGetImageResult + if err = p.Client_().Call(ctx, "GetImage", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) UploadParams(ctx context.Context, req *UploadParamsRequest) (r *UploadParamsResponse, err error) { - var _args VersionServiceUploadParamsArgs +func (p *LaunchScreenServiceClient) ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) { + var _args LaunchScreenServiceChangeImagePropertyArgs _args.Req = req - var _result VersionServiceUploadParamsResult - if err = p.Client_().Call(ctx, "UploadParams", &_args, &_result); err != nil { + var _result LaunchScreenServiceChangeImagePropertyResult + if err = p.Client_().Call(ctx, "ChangeImageProperty", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) DownloadReleaseApk(ctx context.Context, req *DownloadReleaseApkRequest) (r *DownloadReleaseApkResponse, err error) { - var _args VersionServiceDownloadReleaseApkArgs +func (p *LaunchScreenServiceClient) ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, err error) { + var _args LaunchScreenServiceChangeImageArgs _args.Req = req - var _result VersionServiceDownloadReleaseApkResult - if err = p.Client_().Call(ctx, "DownloadReleaseApk", &_args, &_result); err != nil { + var _result LaunchScreenServiceChangeImageResult + if err = p.Client_().Call(ctx, "ChangeImage", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) DownloadBetaApk(ctx context.Context, req *DownloadBetaApkRequest) (r *DownloadBetaApkResponse, err error) { - var _args VersionServiceDownloadBetaApkArgs +func (p *LaunchScreenServiceClient) DeleteImage(ctx context.Context, req *DeleteImageRequest) (r *DeleteImageResponse, err error) { + var _args LaunchScreenServiceDeleteImageArgs _args.Req = req - var _result VersionServiceDownloadBetaApkResult - if err = p.Client_().Call(ctx, "DownloadBetaApk", &_args, &_result); err != nil { + var _result LaunchScreenServiceDeleteImageResult + if err = p.Client_().Call(ctx, "DeleteImage", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) { - var _args VersionServiceGetReleaseVersionArgs +func (p *LaunchScreenServiceClient) MobileGetImage(ctx context.Context, req *MobileGetImageRequest) (r *MobileGetImageResponse, err error) { + var _args LaunchScreenServiceMobileGetImageArgs _args.Req = req - var _result VersionServiceGetReleaseVersionResult - if err = p.Client_().Call(ctx, "GetReleaseVersion", &_args, &_result); err != nil { + var _result LaunchScreenServiceMobileGetImageResult + if err = p.Client_().Call(ctx, "MobileGetImage", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) { - var _args VersionServiceGetBetaVersionArgs +func (p *LaunchScreenServiceClient) AddImagePointTime(ctx context.Context, req *AddImagePointTimeRequest) (r *AddImagePointTimeResponse, err error) { + var _args LaunchScreenServiceAddImagePointTimeArgs _args.Req = req - var _result VersionServiceGetBetaVersionResult - if err = p.Client_().Call(ctx, "GetBetaVersion", &_args, &_result); err != nil { + var _result LaunchScreenServiceAddImagePointTimeResult + if err = p.Client_().Call(ctx, "AddImagePointTime", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) GetSetting(ctx context.Context, req *GetSettingRequest) (r *GetSettingResponse, err error) { - var _args VersionServiceGetSettingArgs - _args.Req = req - var _result VersionServiceGetSettingResult - if err = p.Client_().Call(ctx, "GetSetting", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil + +type PaperService interface { + ListDirFiles(ctx context.Context, req *ListDirFilesRequest) (r *ListDirFilesResponse, err error) + + GetDownloadUrl(ctx context.Context, req *GetDownloadUrlRequest) (r *GetDownloadUrlResponse, err error) + // 兼容安卓 + ListDirFilesForAndroid(ctx context.Context, req *ListDirFilesForAndroidRequest) (r *ListDirFilesForAndroidResponse, err error) + + GetDownloadUrlForAndroid(ctx context.Context, req *GetDownloadUrlForAndroidRequest) (r *GetDownloadUrlForAndroidResponse, err error) } -func (p *VersionServiceClient) GetTest(ctx context.Context, req *GetTestRequest) (r *GetTestResponse, err error) { - var _args VersionServiceGetTestArgs - _args.Req = req - var _result VersionServiceGetTestResult - if err = p.Client_().Call(ctx, "GetTest", &_args, &_result); err != nil { + +type PaperServiceClient struct { + c thrift.TClient +} + +func NewPaperServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *PaperServiceClient { + return &PaperServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewPaperServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PaperServiceClient { + return &PaperServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewPaperServiceClient(c thrift.TClient) *PaperServiceClient { + return &PaperServiceClient{ + c: c, + } +} + +func (p *PaperServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *PaperServiceClient) ListDirFiles(ctx context.Context, req *ListDirFilesRequest) (r *ListDirFilesResponse, err error) { + var _args PaperServiceListDirFilesArgs + _args.Req = req + var _result PaperServiceListDirFilesResult + if err = p.Client_().Call(ctx, "ListDirFiles", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) GetCloud(ctx context.Context, req *GetCloudRequest) (r *GetCloudResponse, err error) { - var _args VersionServiceGetCloudArgs +func (p *PaperServiceClient) GetDownloadUrl(ctx context.Context, req *GetDownloadUrlRequest) (r *GetDownloadUrlResponse, err error) { + var _args PaperServiceGetDownloadUrlArgs _args.Req = req - var _result VersionServiceGetCloudResult - if err = p.Client_().Call(ctx, "GetCloud", &_args, &_result); err != nil { + var _result PaperServiceGetDownloadUrlResult + if err = p.Client_().Call(ctx, "GetDownloadUrl", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) SetCloud(ctx context.Context, req *SetCloudRequest) (r *SetCloudResponse, err error) { - var _args VersionServiceSetCloudArgs +func (p *PaperServiceClient) ListDirFilesForAndroid(ctx context.Context, req *ListDirFilesForAndroidRequest) (r *ListDirFilesForAndroidResponse, err error) { + var _args PaperServiceListDirFilesForAndroidArgs _args.Req = req - var _result VersionServiceSetCloudResult - if err = p.Client_().Call(ctx, "SetCloud", &_args, &_result); err != nil { + var _result PaperServiceListDirFilesForAndroidResult + if err = p.Client_().Call(ctx, "ListDirFilesForAndroid", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *VersionServiceClient) GetDump(ctx context.Context, req *GetDumpRequest) (r *GetDumpResponse, err error) { - var _args VersionServiceGetDumpArgs +func (p *PaperServiceClient) GetDownloadUrlForAndroid(ctx context.Context, req *GetDownloadUrlForAndroidRequest) (r *GetDownloadUrlForAndroidResponse, err error) { + var _args PaperServiceGetDownloadUrlForAndroidArgs _args.Req = req - var _result VersionServiceGetDumpResult - if err = p.Client_().Call(ctx, "GetDump", &_args, &_result); err != nil { + var _result PaperServiceGetDownloadUrlForAndroidResult + if err = p.Client_().Call(ctx, "GetDownloadUrlForAndroid", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -type CommonService interface { - GetCSS(ctx context.Context, req *GetCSSRequest) (r *GetCSSResponse, err error) +type AcademicService interface { + GetScores(ctx context.Context, req *GetScoresRequest) (r *GetScoresResponse, err error) - GetHtml(ctx context.Context, req *GetHtmlRequest) (r *GetHtmlResponse, err error) + GetGPA(ctx context.Context, req *GetGPARequest) (r *GetGPAResponse, err error) - GetUserAgreement(ctx context.Context, req *GetUserAgreementRequest) (r *GetUserAgreementResponse, err error) - // 学期信息:学期列表 - GetTermsList(ctx context.Context, req *TermListRequest) (r *TermListResponse, err error) - // 学期信息:学期详情 - GetTerm(ctx context.Context, req *TermRequest) (r *TermResponse, err error) + GetCredit(ctx context.Context, req *GetCreditRequest) (r *GetCreditResponse, err error) + + GetUnifiedExam(ctx context.Context, req *GetUnifiedExamRequest) (r *GetUnifiedExamResponse, err error) + + GetPlan(ctx context.Context, req *GetPlanRequest) (r *GetPlanResponse, err error) } -type CommonServiceClient struct { +type AcademicServiceClient struct { c thrift.TClient } -func NewCommonServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CommonServiceClient { - return &CommonServiceClient{ +func NewAcademicServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AcademicServiceClient { + return &AcademicServiceClient{ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } } -func NewCommonServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CommonServiceClient { - return &CommonServiceClient{ +func NewAcademicServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AcademicServiceClient { + return &AcademicServiceClient{ c: thrift.NewTStandardClient(iprot, oprot), } } -func NewCommonServiceClient(c thrift.TClient) *CommonServiceClient { - return &CommonServiceClient{ +func NewAcademicServiceClient(c thrift.TClient) *AcademicServiceClient { + return &AcademicServiceClient{ c: c, } } -func (p *CommonServiceClient) Client_() thrift.TClient { +func (p *AcademicServiceClient) Client_() thrift.TClient { return p.c } -func (p *CommonServiceClient) GetCSS(ctx context.Context, req *GetCSSRequest) (r *GetCSSResponse, err error) { - var _args CommonServiceGetCSSArgs +func (p *AcademicServiceClient) GetScores(ctx context.Context, req *GetScoresRequest) (r *GetScoresResponse, err error) { + var _args AcademicServiceGetScoresArgs _args.Req = req - var _result CommonServiceGetCSSResult - if err = p.Client_().Call(ctx, "GetCSS", &_args, &_result); err != nil { + var _result AcademicServiceGetScoresResult + if err = p.Client_().Call(ctx, "GetScores", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *CommonServiceClient) GetHtml(ctx context.Context, req *GetHtmlRequest) (r *GetHtmlResponse, err error) { - var _args CommonServiceGetHtmlArgs +func (p *AcademicServiceClient) GetGPA(ctx context.Context, req *GetGPARequest) (r *GetGPAResponse, err error) { + var _args AcademicServiceGetGPAArgs _args.Req = req - var _result CommonServiceGetHtmlResult - if err = p.Client_().Call(ctx, "GetHtml", &_args, &_result); err != nil { + var _result AcademicServiceGetGPAResult + if err = p.Client_().Call(ctx, "GetGPA", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *CommonServiceClient) GetUserAgreement(ctx context.Context, req *GetUserAgreementRequest) (r *GetUserAgreementResponse, err error) { - var _args CommonServiceGetUserAgreementArgs +func (p *AcademicServiceClient) GetCredit(ctx context.Context, req *GetCreditRequest) (r *GetCreditResponse, err error) { + var _args AcademicServiceGetCreditArgs _args.Req = req - var _result CommonServiceGetUserAgreementResult - if err = p.Client_().Call(ctx, "GetUserAgreement", &_args, &_result); err != nil { + var _result AcademicServiceGetCreditResult + if err = p.Client_().Call(ctx, "GetCredit", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *CommonServiceClient) GetTermsList(ctx context.Context, req *TermListRequest) (r *TermListResponse, err error) { - var _args CommonServiceGetTermsListArgs +func (p *AcademicServiceClient) GetUnifiedExam(ctx context.Context, req *GetUnifiedExamRequest) (r *GetUnifiedExamResponse, err error) { + var _args AcademicServiceGetUnifiedExamArgs _args.Req = req - var _result CommonServiceGetTermsListResult - if err = p.Client_().Call(ctx, "GetTermsList", &_args, &_result); err != nil { + var _result AcademicServiceGetUnifiedExamResult + if err = p.Client_().Call(ctx, "GetUnifiedExam", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *CommonServiceClient) GetTerm(ctx context.Context, req *TermRequest) (r *TermResponse, err error) { - var _args CommonServiceGetTermArgs +func (p *AcademicServiceClient) GetPlan(ctx context.Context, req *GetPlanRequest) (r *GetPlanResponse, err error) { + var _args AcademicServiceGetPlanArgs _args.Req = req - var _result CommonServiceGetTermResult - if err = p.Client_().Call(ctx, "GetTerm", &_args, &_result); err != nil { + var _result AcademicServiceGetPlanResult + if err = p.Client_().Call(ctx, "GetPlan", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -type ClassRoomServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler ClassRoomService -} +type VersionService interface { + Login(ctx context.Context, req *LoginRequest) (r *LoginResponse, err error) -func (p *ClassRoomServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} + UploadVersion(ctx context.Context, req *UploadRequest) (r *UploadResponse, err error) -func (p *ClassRoomServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} + UploadParams(ctx context.Context, req *UploadParamsRequest) (r *UploadParamsResponse, err error) -func (p *ClassRoomServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap + DownloadReleaseApk(ctx context.Context, req *DownloadReleaseApkRequest) (r *DownloadReleaseApkResponse, err error) + + DownloadBetaApk(ctx context.Context, req *DownloadBetaApkRequest) (r *DownloadBetaApkResponse, err error) + + GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) + + GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) + + GetSetting(ctx context.Context, req *GetSettingRequest) (r *GetSettingResponse, err error) + + GetTest(ctx context.Context, req *GetTestRequest) (r *GetTestResponse, err error) + + GetCloud(ctx context.Context, req *GetCloudRequest) (r *GetCloudResponse, err error) + + SetCloud(ctx context.Context, req *SetCloudRequest) (r *SetCloudResponse, err error) + + GetDump(ctx context.Context, req *GetDumpRequest) (r *GetDumpResponse, err error) } -func NewClassRoomServiceProcessor(handler ClassRoomService) *ClassRoomServiceProcessor { - self := &ClassRoomServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("GetEmptyClassrooms", &classRoomServiceProcessorGetEmptyClassrooms{handler: handler}) - self.AddToProcessorMap("GetExamRoomInfo", &classRoomServiceProcessorGetExamRoomInfo{handler: handler}) - return self +type VersionServiceClient struct { + c thrift.TClient } -func (p *ClassRoomServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return false, err - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) + +func NewVersionServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *VersionServiceClient { + return &VersionServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, x } -type classRoomServiceProcessorGetEmptyClassrooms struct { - handler ClassRoomService +func NewVersionServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *VersionServiceClient { + return &VersionServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } } -func (p *classRoomServiceProcessorGetEmptyClassrooms) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ClassRoomServiceGetEmptyClassroomsArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err +func NewVersionServiceClient(c thrift.TClient) *VersionServiceClient { + return &VersionServiceClient{ + c: c, } +} - iprot.ReadMessageEnd() - var err2 error - result := ClassRoomServiceGetEmptyClassroomsResult{} - var retval *EmptyClassroomResponse - if retval, err2 = p.handler.GetEmptyClassrooms(ctx, args.Request); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetEmptyClassrooms: "+err2.Error()) - oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 +func (p *VersionServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *VersionServiceClient) Login(ctx context.Context, req *LoginRequest) (r *LoginResponse, err error) { + var _args VersionServiceLoginArgs + _args.Req = req + var _result VersionServiceLoginResult + if err = p.Client_().Call(ctx, "Login", &_args, &_result); err != nil { + return } - if err != nil { + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) UploadVersion(ctx context.Context, req *UploadRequest) (r *UploadResponse, err error) { + var _args VersionServiceUploadVersionArgs + _args.Req = req + var _result VersionServiceUploadVersionResult + if err = p.Client_().Call(ctx, "UploadVersion", &_args, &_result); err != nil { return } - return true, err + return _result.GetSuccess(), nil } - -type classRoomServiceProcessorGetExamRoomInfo struct { +func (p *VersionServiceClient) UploadParams(ctx context.Context, req *UploadParamsRequest) (r *UploadParamsResponse, err error) { + var _args VersionServiceUploadParamsArgs + _args.Req = req + var _result VersionServiceUploadParamsResult + if err = p.Client_().Call(ctx, "UploadParams", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) DownloadReleaseApk(ctx context.Context, req *DownloadReleaseApkRequest) (r *DownloadReleaseApkResponse, err error) { + var _args VersionServiceDownloadReleaseApkArgs + _args.Req = req + var _result VersionServiceDownloadReleaseApkResult + if err = p.Client_().Call(ctx, "DownloadReleaseApk", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) DownloadBetaApk(ctx context.Context, req *DownloadBetaApkRequest) (r *DownloadBetaApkResponse, err error) { + var _args VersionServiceDownloadBetaApkArgs + _args.Req = req + var _result VersionServiceDownloadBetaApkResult + if err = p.Client_().Call(ctx, "DownloadBetaApk", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) { + var _args VersionServiceGetReleaseVersionArgs + _args.Req = req + var _result VersionServiceGetReleaseVersionResult + if err = p.Client_().Call(ctx, "GetReleaseVersion", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) { + var _args VersionServiceGetBetaVersionArgs + _args.Req = req + var _result VersionServiceGetBetaVersionResult + if err = p.Client_().Call(ctx, "GetBetaVersion", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) GetSetting(ctx context.Context, req *GetSettingRequest) (r *GetSettingResponse, err error) { + var _args VersionServiceGetSettingArgs + _args.Req = req + var _result VersionServiceGetSettingResult + if err = p.Client_().Call(ctx, "GetSetting", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) GetTest(ctx context.Context, req *GetTestRequest) (r *GetTestResponse, err error) { + var _args VersionServiceGetTestArgs + _args.Req = req + var _result VersionServiceGetTestResult + if err = p.Client_().Call(ctx, "GetTest", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) GetCloud(ctx context.Context, req *GetCloudRequest) (r *GetCloudResponse, err error) { + var _args VersionServiceGetCloudArgs + _args.Req = req + var _result VersionServiceGetCloudResult + if err = p.Client_().Call(ctx, "GetCloud", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) SetCloud(ctx context.Context, req *SetCloudRequest) (r *SetCloudResponse, err error) { + var _args VersionServiceSetCloudArgs + _args.Req = req + var _result VersionServiceSetCloudResult + if err = p.Client_().Call(ctx, "SetCloud", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *VersionServiceClient) GetDump(ctx context.Context, req *GetDumpRequest) (r *GetDumpResponse, err error) { + var _args VersionServiceGetDumpArgs + _args.Req = req + var _result VersionServiceGetDumpResult + if err = p.Client_().Call(ctx, "GetDump", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +type CommonService interface { + GetCSS(ctx context.Context, req *GetCSSRequest) (r *GetCSSResponse, err error) + + GetHtml(ctx context.Context, req *GetHtmlRequest) (r *GetHtmlResponse, err error) + + GetUserAgreement(ctx context.Context, req *GetUserAgreementRequest) (r *GetUserAgreementResponse, err error) + // 学期信息:学期列表 + GetTermsList(ctx context.Context, req *TermListRequest) (r *TermListResponse, err error) + // 学期信息:学期详情 + GetTerm(ctx context.Context, req *TermRequest) (r *TermResponse, err error) + + GetNotice(ctx context.Context, req *GetNoticeRequst) (r *GetNoticeResponse, err error) +} + +type CommonServiceClient struct { + c thrift.TClient +} + +func NewCommonServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CommonServiceClient { + return &CommonServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewCommonServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CommonServiceClient { + return &CommonServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewCommonServiceClient(c thrift.TClient) *CommonServiceClient { + return &CommonServiceClient{ + c: c, + } +} + +func (p *CommonServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *CommonServiceClient) GetCSS(ctx context.Context, req *GetCSSRequest) (r *GetCSSResponse, err error) { + var _args CommonServiceGetCSSArgs + _args.Req = req + var _result CommonServiceGetCSSResult + if err = p.Client_().Call(ctx, "GetCSS", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *CommonServiceClient) GetHtml(ctx context.Context, req *GetHtmlRequest) (r *GetHtmlResponse, err error) { + var _args CommonServiceGetHtmlArgs + _args.Req = req + var _result CommonServiceGetHtmlResult + if err = p.Client_().Call(ctx, "GetHtml", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *CommonServiceClient) GetUserAgreement(ctx context.Context, req *GetUserAgreementRequest) (r *GetUserAgreementResponse, err error) { + var _args CommonServiceGetUserAgreementArgs + _args.Req = req + var _result CommonServiceGetUserAgreementResult + if err = p.Client_().Call(ctx, "GetUserAgreement", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *CommonServiceClient) GetTermsList(ctx context.Context, req *TermListRequest) (r *TermListResponse, err error) { + var _args CommonServiceGetTermsListArgs + _args.Req = req + var _result CommonServiceGetTermsListResult + if err = p.Client_().Call(ctx, "GetTermsList", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *CommonServiceClient) GetTerm(ctx context.Context, req *TermRequest) (r *TermResponse, err error) { + var _args CommonServiceGetTermArgs + _args.Req = req + var _result CommonServiceGetTermResult + if err = p.Client_().Call(ctx, "GetTerm", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *CommonServiceClient) GetNotice(ctx context.Context, req *GetNoticeRequst) (r *GetNoticeResponse, err error) { + var _args CommonServiceGetNoticeArgs + _args.Req = req + var _result CommonServiceGetNoticeResult + if err = p.Client_().Call(ctx, "GetNotice", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +type ClassRoomServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler ClassRoomService +} + +func (p *ClassRoomServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *ClassRoomServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *ClassRoomServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewClassRoomServiceProcessor(handler ClassRoomService) *ClassRoomServiceProcessor { + self := &ClassRoomServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetEmptyClassrooms", &classRoomServiceProcessorGetEmptyClassrooms{handler: handler}) + self.AddToProcessorMap("GetExamRoomInfo", &classRoomServiceProcessorGetExamRoomInfo{handler: handler}) + return self +} +func (p *ClassRoomServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return false, err + } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(ctx, seqId, iprot, oprot) + } + iprot.Skip(thrift.STRUCT) + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) + oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, x +} + +type classRoomServiceProcessorGetEmptyClassrooms struct { handler ClassRoomService } -func (p *classRoomServiceProcessorGetExamRoomInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := ClassRoomServiceGetExamRoomInfoArgs{} +func (p *classRoomServiceProcessorGetEmptyClassrooms) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ClassRoomServiceGetEmptyClassroomsArgs{} if err = args.Read(iprot); err != nil { iprot.ReadMessageEnd() x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetExamRoomInfo", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush(ctx) @@ -16470,11 +16804,11 @@ func (p *classRoomServiceProcessorGetExamRoomInfo) Process(ctx context.Context, iprot.ReadMessageEnd() var err2 error - result := ClassRoomServiceGetExamRoomInfoResult{} - var retval *ExamRoomInfoResponse - if retval, err2 = p.handler.GetExamRoomInfo(ctx, args.Request); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetExamRoomInfo: "+err2.Error()) - oprot.WriteMessageBegin("GetExamRoomInfo", thrift.EXCEPTION, seqId) + result := ClassRoomServiceGetEmptyClassroomsResult{} + var retval *EmptyClassroomResponse + if retval, err2 = p.handler.GetEmptyClassrooms(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetEmptyClassrooms: "+err2.Error()) + oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush(ctx) @@ -16482,7 +16816,7 @@ func (p *classRoomServiceProcessorGetExamRoomInfo) Process(ctx context.Context, } else { result.Success = retval } - if err2 = oprot.WriteMessageBegin("GetExamRoomInfo", thrift.REPLY, seqId); err2 != nil { + if err2 = oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.REPLY, seqId); err2 != nil { err = err2 } if err2 = result.Write(oprot); err == nil && err2 != nil { @@ -16500,20 +16834,68 @@ func (p *classRoomServiceProcessorGetExamRoomInfo) Process(ctx context.Context, return true, err } -type ClassRoomServiceGetEmptyClassroomsArgs struct { - Request *EmptyClassroomRequest `thrift:"request,1"` -} - -func NewClassRoomServiceGetEmptyClassroomsArgs() *ClassRoomServiceGetEmptyClassroomsArgs { - return &ClassRoomServiceGetEmptyClassroomsArgs{} -} - -func (p *ClassRoomServiceGetEmptyClassroomsArgs) InitDefault() { +type classRoomServiceProcessorGetExamRoomInfo struct { + handler ClassRoomService } -var ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT *EmptyClassroomRequest - -func (p *ClassRoomServiceGetEmptyClassroomsArgs) GetRequest() (v *EmptyClassroomRequest) { +func (p *classRoomServiceProcessorGetExamRoomInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := ClassRoomServiceGetExamRoomInfoArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetExamRoomInfo", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := ClassRoomServiceGetExamRoomInfoResult{} + var retval *ExamRoomInfoResponse + if retval, err2 = p.handler.GetExamRoomInfo(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetExamRoomInfo: "+err2.Error()) + oprot.WriteMessageBegin("GetExamRoomInfo", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetExamRoomInfo", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type ClassRoomServiceGetEmptyClassroomsArgs struct { + Request *EmptyClassroomRequest `thrift:"request,1"` +} + +func NewClassRoomServiceGetEmptyClassroomsArgs() *ClassRoomServiceGetEmptyClassroomsArgs { + return &ClassRoomServiceGetEmptyClassroomsArgs{} +} + +func (p *ClassRoomServiceGetEmptyClassroomsArgs) InitDefault() { +} + +var ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT *EmptyClassroomRequest + +func (p *ClassRoomServiceGetEmptyClassroomsArgs) GetRequest() (v *EmptyClassroomRequest) { if !p.IsSetRequest() { return ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT } @@ -29616,22 +29998,505 @@ func (p *VersionServiceGetDumpResult) InitDefault() { var VersionServiceGetDumpResult_Success_DEFAULT *GetDumpResponse -func (p *VersionServiceGetDumpResult) GetSuccess() (v *GetDumpResponse) { - if !p.IsSetSuccess() { - return VersionServiceGetDumpResult_Success_DEFAULT +func (p *VersionServiceGetDumpResult) GetSuccess() (v *GetDumpResponse) { + if !p.IsSetSuccess() { + return VersionServiceGetDumpResult_Success_DEFAULT + } + return p.Success +} + +var fieldIDToName_VersionServiceGetDumpResult = map[int16]string{ + 0: "success", +} + +func (p *VersionServiceGetDumpResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *VersionServiceGetDumpResult) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_VersionServiceGetDumpResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *VersionServiceGetDumpResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetDumpResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *VersionServiceGetDumpResult) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("GetDump_result"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *VersionServiceGetDumpResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) +} + +func (p *VersionServiceGetDumpResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("VersionServiceGetDumpResult(%+v)", *p) + +} + +type CommonServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler CommonService +} + +func (p *CommonServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *CommonServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *CommonServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewCommonServiceProcessor(handler CommonService) *CommonServiceProcessor { + self := &CommonServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetCSS", &commonServiceProcessorGetCSS{handler: handler}) + self.AddToProcessorMap("GetHtml", &commonServiceProcessorGetHtml{handler: handler}) + self.AddToProcessorMap("GetUserAgreement", &commonServiceProcessorGetUserAgreement{handler: handler}) + self.AddToProcessorMap("GetTermsList", &commonServiceProcessorGetTermsList{handler: handler}) + self.AddToProcessorMap("GetTerm", &commonServiceProcessorGetTerm{handler: handler}) + self.AddToProcessorMap("GetNotice", &commonServiceProcessorGetNotice{handler: handler}) + return self +} +func (p *CommonServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + name, _, seqId, err := iprot.ReadMessageBegin() + if err != nil { + return false, err + } + if processor, ok := p.GetProcessorFunction(name); ok { + return processor.Process(ctx, seqId, iprot, oprot) + } + iprot.Skip(thrift.STRUCT) + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) + oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, x +} + +type commonServiceProcessorGetCSS struct { + handler CommonService +} + +func (p *commonServiceProcessorGetCSS) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CommonServiceGetCSSArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetCSS", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CommonServiceGetCSSResult{} + var retval *GetCSSResponse + if retval, err2 = p.handler.GetCSS(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetCSS: "+err2.Error()) + oprot.WriteMessageBegin("GetCSS", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetCSS", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type commonServiceProcessorGetHtml struct { + handler CommonService +} + +func (p *commonServiceProcessorGetHtml) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CommonServiceGetHtmlArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetHtml", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CommonServiceGetHtmlResult{} + var retval *GetHtmlResponse + if retval, err2 = p.handler.GetHtml(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetHtml: "+err2.Error()) + oprot.WriteMessageBegin("GetHtml", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetHtml", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type commonServiceProcessorGetUserAgreement struct { + handler CommonService +} + +func (p *commonServiceProcessorGetUserAgreement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CommonServiceGetUserAgreementArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetUserAgreement", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CommonServiceGetUserAgreementResult{} + var retval *GetUserAgreementResponse + if retval, err2 = p.handler.GetUserAgreement(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetUserAgreement: "+err2.Error()) + oprot.WriteMessageBegin("GetUserAgreement", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetUserAgreement", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type commonServiceProcessorGetTermsList struct { + handler CommonService +} + +func (p *commonServiceProcessorGetTermsList) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CommonServiceGetTermsListArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetTermsList", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CommonServiceGetTermsListResult{} + var retval *TermListResponse + if retval, err2 = p.handler.GetTermsList(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetTermsList: "+err2.Error()) + oprot.WriteMessageBegin("GetTermsList", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetTermsList", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type commonServiceProcessorGetTerm struct { + handler CommonService +} + +func (p *commonServiceProcessorGetTerm) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CommonServiceGetTermArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetTerm", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CommonServiceGetTermResult{} + var retval *TermResponse + if retval, err2 = p.handler.GetTerm(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetTerm: "+err2.Error()) + oprot.WriteMessageBegin("GetTerm", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetTerm", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type commonServiceProcessorGetNotice struct { + handler CommonService +} + +func (p *commonServiceProcessorGetNotice) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CommonServiceGetNoticeArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetNotice", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CommonServiceGetNoticeResult{} + var retval *GetNoticeResponse + if retval, err2 = p.handler.GetNotice(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetNotice: "+err2.Error()) + oprot.WriteMessageBegin("GetNotice", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetNotice", thrift.REPLY, seqId); err2 != nil { + err = err2 + } + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 + } + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type CommonServiceGetCSSArgs struct { + Req *GetCSSRequest `thrift:"req,1"` +} + +func NewCommonServiceGetCSSArgs() *CommonServiceGetCSSArgs { + return &CommonServiceGetCSSArgs{} +} + +func (p *CommonServiceGetCSSArgs) InitDefault() { +} + +var CommonServiceGetCSSArgs_Req_DEFAULT *GetCSSRequest + +func (p *CommonServiceGetCSSArgs) GetReq() (v *GetCSSRequest) { + if !p.IsSetReq() { + return CommonServiceGetCSSArgs_Req_DEFAULT } - return p.Success + return p.Req } -var fieldIDToName_VersionServiceGetDumpResult = map[int16]string{ - 0: "success", +var fieldIDToName_CommonServiceGetCSSArgs = map[int16]string{ + 1: "req", } -func (p *VersionServiceGetDumpResult) IsSetSuccess() bool { - return p.Success != nil +func (p *CommonServiceGetCSSArgs) IsSetReq() bool { + return p.Req != nil } -func (p *VersionServiceGetDumpResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetCSSArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -29650,9 +30515,9 @@ func (p *VersionServiceGetDumpResult) Read(iprot thrift.TProtocol) (err error) { } switch fieldId { - case 0: + case 1: if fieldTypeId == thrift.STRUCT { - if err = p.ReadField0(iprot); err != nil { + if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } } else if err = iprot.Skip(fieldTypeId); err != nil { @@ -29677,7 +30542,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_VersionServiceGetDumpResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -29687,24 +30552,24 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *VersionServiceGetDumpResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetDumpResponse() +func (p *CommonServiceGetCSSArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetCSSRequest() if err := _field.Read(iprot); err != nil { return err } - p.Success = _field + p.Req = _field return nil } -func (p *VersionServiceGetDumpResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetCSSArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetDump_result"); err != nil { + if err = oprot.WriteStructBegin("GetCSS_args"); err != nil { goto WriteStructBeginError } if p != nil { - if err = p.writeField0(oprot); err != nil { - fieldId = 0 + if err = p.writeField1(oprot); err != nil { + fieldId = 1 goto WriteFieldError } } @@ -29725,347 +30590,209 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *VersionServiceGetDumpResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { - goto WriteFieldBeginError - } - if err := p.Success.Write(oprot); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } +func (p *CommonServiceGetCSSArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Req.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError } return nil WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *VersionServiceGetDumpResult) String() string { +func (p *CommonServiceGetCSSArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("VersionServiceGetDumpResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetCSSArgs(%+v)", *p) } -type CommonServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler CommonService +type CommonServiceGetCSSResult struct { + Success *GetCSSResponse `thrift:"success,0,optional"` } -func (p *CommonServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor +func NewCommonServiceGetCSSResult() *CommonServiceGetCSSResult { + return &CommonServiceGetCSSResult{} } -func (p *CommonServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok +func (p *CommonServiceGetCSSResult) InitDefault() { } -func (p *CommonServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} +var CommonServiceGetCSSResult_Success_DEFAULT *GetCSSResponse -func NewCommonServiceProcessor(handler CommonService) *CommonServiceProcessor { - self := &CommonServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("GetCSS", &commonServiceProcessorGetCSS{handler: handler}) - self.AddToProcessorMap("GetHtml", &commonServiceProcessorGetHtml{handler: handler}) - self.AddToProcessorMap("GetUserAgreement", &commonServiceProcessorGetUserAgreement{handler: handler}) - self.AddToProcessorMap("GetTermsList", &commonServiceProcessorGetTermsList{handler: handler}) - self.AddToProcessorMap("GetTerm", &commonServiceProcessorGetTerm{handler: handler}) - return self -} -func (p *CommonServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - name, _, seqId, err := iprot.ReadMessageBegin() - if err != nil { - return false, err - } - if processor, ok := p.GetProcessorFunction(name); ok { - return processor.Process(ctx, seqId, iprot, oprot) +func (p *CommonServiceGetCSSResult) GetSuccess() (v *GetCSSResponse) { + if !p.IsSetSuccess() { + return CommonServiceGetCSSResult_Success_DEFAULT } - iprot.Skip(thrift.STRUCT) - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name) - oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, x -} - -type commonServiceProcessorGetCSS struct { - handler CommonService + return p.Success } -func (p *commonServiceProcessorGetCSS) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CommonServiceGetCSSArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetCSS", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } - - iprot.ReadMessageEnd() - var err2 error - result := CommonServiceGetCSSResult{} - var retval *GetCSSResponse - if retval, err2 = p.handler.GetCSS(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetCSS: "+err2.Error()) - oprot.WriteMessageBegin("GetCSS", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetCSS", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err +var fieldIDToName_CommonServiceGetCSSResult = map[int16]string{ + 0: "success", } -type commonServiceProcessorGetHtml struct { - handler CommonService +func (p *CommonServiceGetCSSResult) IsSetSuccess() bool { + return p.Success != nil } -func (p *commonServiceProcessorGetHtml) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CommonServiceGetHtmlArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetHtml", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } - - iprot.ReadMessageEnd() - var err2 error - result := CommonServiceGetHtmlResult{} - var retval *GetHtmlResponse - if retval, err2 = p.handler.GetHtml(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetHtml: "+err2.Error()) - oprot.WriteMessageBegin("GetHtml", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetHtml", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err -} +func (p *CommonServiceGetCSSResult) Read(iprot thrift.TProtocol) (err error) { -type commonServiceProcessorGetUserAgreement struct { - handler CommonService -} + var fieldTypeId thrift.TType + var fieldId int16 -func (p *commonServiceProcessorGetUserAgreement) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CommonServiceGetUserAgreementArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetUserAgreement", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } - iprot.ReadMessageEnd() - var err2 error - result := CommonServiceGetUserAgreementResult{} - var retval *GetUserAgreementResponse - if retval, err2 = p.handler.GetUserAgreement(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetUserAgreement: "+err2.Error()) - oprot.WriteMessageBegin("GetUserAgreement", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetUserAgreement", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } } - if err != nil { - return + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } - return true, err -} -type commonServiceProcessorGetTermsList struct { - handler CommonService + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *commonServiceProcessorGetTermsList) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CommonServiceGetTermsListArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetTermsList", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err +func (p *CommonServiceGetCSSResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetCSSResponse() + if err := _field.Read(iprot); err != nil { + return err } + p.Success = _field + return nil +} - iprot.ReadMessageEnd() - var err2 error - result := CommonServiceGetTermsListResult{} - var retval *TermListResponse - if retval, err2 = p.handler.GetTermsList(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetTermsList: "+err2.Error()) - oprot.WriteMessageBegin("GetTermsList", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetTermsList", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 +func (p *CommonServiceGetCSSResult) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("GetCSS_result"); err != nil { + goto WriteStructBeginError } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - if err != nil { - return + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError } - return true, err + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -type commonServiceProcessorGetTerm struct { - handler CommonService +func (p *CommonServiceGetCSSResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *commonServiceProcessorGetTerm) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CommonServiceGetTermArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetTerm", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err +func (p *CommonServiceGetCSSResult) String() string { + if p == nil { + return "" } + return fmt.Sprintf("CommonServiceGetCSSResult(%+v)", *p) - iprot.ReadMessageEnd() - var err2 error - result := CommonServiceGetTermResult{} - var retval *TermResponse - if retval, err2 = p.handler.GetTerm(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetTerm: "+err2.Error()) - oprot.WriteMessageBegin("GetTerm", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetTerm", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 - } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 - } - if err != nil { - return - } - return true, err } -type CommonServiceGetCSSArgs struct { - Req *GetCSSRequest `thrift:"req,1"` +type CommonServiceGetHtmlArgs struct { + Req *GetHtmlRequest `thrift:"req,1"` } -func NewCommonServiceGetCSSArgs() *CommonServiceGetCSSArgs { - return &CommonServiceGetCSSArgs{} +func NewCommonServiceGetHtmlArgs() *CommonServiceGetHtmlArgs { + return &CommonServiceGetHtmlArgs{} } -func (p *CommonServiceGetCSSArgs) InitDefault() { +func (p *CommonServiceGetHtmlArgs) InitDefault() { } -var CommonServiceGetCSSArgs_Req_DEFAULT *GetCSSRequest +var CommonServiceGetHtmlArgs_Req_DEFAULT *GetHtmlRequest -func (p *CommonServiceGetCSSArgs) GetReq() (v *GetCSSRequest) { +func (p *CommonServiceGetHtmlArgs) GetReq() (v *GetHtmlRequest) { if !p.IsSetReq() { - return CommonServiceGetCSSArgs_Req_DEFAULT + return CommonServiceGetHtmlArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_CommonServiceGetCSSArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetHtmlArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetCSSArgs) IsSetReq() bool { +func (p *CommonServiceGetHtmlArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetCSSArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetHtmlArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30111,7 +30838,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -30121,8 +30848,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetCSSArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetCSSRequest() +func (p *CommonServiceGetHtmlArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetHtmlRequest() if err := _field.Read(iprot); err != nil { return err } @@ -30130,10 +30857,10 @@ func (p *CommonServiceGetCSSArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetCSSArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetHtmlArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetCSS_args"); err != nil { + if err = oprot.WriteStructBegin("GetHtml_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -30159,7 +30886,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetCSSArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetHtmlArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -30176,43 +30903,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetCSSArgs) String() string { +func (p *CommonServiceGetHtmlArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetCSSArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetHtmlArgs(%+v)", *p) } -type CommonServiceGetCSSResult struct { - Success *GetCSSResponse `thrift:"success,0,optional"` +type CommonServiceGetHtmlResult struct { + Success *GetHtmlResponse `thrift:"success,0,optional"` } -func NewCommonServiceGetCSSResult() *CommonServiceGetCSSResult { - return &CommonServiceGetCSSResult{} +func NewCommonServiceGetHtmlResult() *CommonServiceGetHtmlResult { + return &CommonServiceGetHtmlResult{} } -func (p *CommonServiceGetCSSResult) InitDefault() { +func (p *CommonServiceGetHtmlResult) InitDefault() { } -var CommonServiceGetCSSResult_Success_DEFAULT *GetCSSResponse +var CommonServiceGetHtmlResult_Success_DEFAULT *GetHtmlResponse -func (p *CommonServiceGetCSSResult) GetSuccess() (v *GetCSSResponse) { +func (p *CommonServiceGetHtmlResult) GetSuccess() (v *GetHtmlResponse) { if !p.IsSetSuccess() { - return CommonServiceGetCSSResult_Success_DEFAULT + return CommonServiceGetHtmlResult_Success_DEFAULT } return p.Success } -var fieldIDToName_CommonServiceGetCSSResult = map[int16]string{ +var fieldIDToName_CommonServiceGetHtmlResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetCSSResult) IsSetSuccess() bool { +func (p *CommonServiceGetHtmlResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetCSSResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetHtmlResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30258,7 +30985,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -30268,8 +30995,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetCSSResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetCSSResponse() +func (p *CommonServiceGetHtmlResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetHtmlResponse() if err := _field.Read(iprot); err != nil { return err } @@ -30277,10 +31004,10 @@ func (p *CommonServiceGetCSSResult) ReadField0(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetCSSResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetHtmlResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetCSS_result"); err != nil { + if err = oprot.WriteStructBegin("GetHtml_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -30306,7 +31033,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetCSSResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetHtmlResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -30325,43 +31052,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetCSSResult) String() string { +func (p *CommonServiceGetHtmlResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetCSSResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetHtmlResult(%+v)", *p) } -type CommonServiceGetHtmlArgs struct { - Req *GetHtmlRequest `thrift:"req,1"` +type CommonServiceGetUserAgreementArgs struct { + Req *GetUserAgreementRequest `thrift:"req,1"` } -func NewCommonServiceGetHtmlArgs() *CommonServiceGetHtmlArgs { - return &CommonServiceGetHtmlArgs{} +func NewCommonServiceGetUserAgreementArgs() *CommonServiceGetUserAgreementArgs { + return &CommonServiceGetUserAgreementArgs{} } -func (p *CommonServiceGetHtmlArgs) InitDefault() { +func (p *CommonServiceGetUserAgreementArgs) InitDefault() { } -var CommonServiceGetHtmlArgs_Req_DEFAULT *GetHtmlRequest +var CommonServiceGetUserAgreementArgs_Req_DEFAULT *GetUserAgreementRequest -func (p *CommonServiceGetHtmlArgs) GetReq() (v *GetHtmlRequest) { +func (p *CommonServiceGetUserAgreementArgs) GetReq() (v *GetUserAgreementRequest) { if !p.IsSetReq() { - return CommonServiceGetHtmlArgs_Req_DEFAULT + return CommonServiceGetUserAgreementArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_CommonServiceGetHtmlArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetUserAgreementArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetHtmlArgs) IsSetReq() bool { +func (p *CommonServiceGetUserAgreementArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetHtmlArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30407,7 +31134,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -30417,8 +31144,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetHtmlArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetHtmlRequest() +func (p *CommonServiceGetUserAgreementArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetUserAgreementRequest() if err := _field.Read(iprot); err != nil { return err } @@ -30426,10 +31153,10 @@ func (p *CommonServiceGetHtmlArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetHtmlArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetHtml_args"); err != nil { + if err = oprot.WriteStructBegin("GetUserAgreement_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -30455,7 +31182,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetHtmlArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -30472,43 +31199,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetHtmlArgs) String() string { +func (p *CommonServiceGetUserAgreementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetHtmlArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetUserAgreementArgs(%+v)", *p) } -type CommonServiceGetHtmlResult struct { - Success *GetHtmlResponse `thrift:"success,0,optional"` +type CommonServiceGetUserAgreementResult struct { + Success *GetUserAgreementResponse `thrift:"success,0,optional"` } -func NewCommonServiceGetHtmlResult() *CommonServiceGetHtmlResult { - return &CommonServiceGetHtmlResult{} +func NewCommonServiceGetUserAgreementResult() *CommonServiceGetUserAgreementResult { + return &CommonServiceGetUserAgreementResult{} } -func (p *CommonServiceGetHtmlResult) InitDefault() { +func (p *CommonServiceGetUserAgreementResult) InitDefault() { } -var CommonServiceGetHtmlResult_Success_DEFAULT *GetHtmlResponse +var CommonServiceGetUserAgreementResult_Success_DEFAULT *GetUserAgreementResponse -func (p *CommonServiceGetHtmlResult) GetSuccess() (v *GetHtmlResponse) { +func (p *CommonServiceGetUserAgreementResult) GetSuccess() (v *GetUserAgreementResponse) { if !p.IsSetSuccess() { - return CommonServiceGetHtmlResult_Success_DEFAULT + return CommonServiceGetUserAgreementResult_Success_DEFAULT } return p.Success } -var fieldIDToName_CommonServiceGetHtmlResult = map[int16]string{ +var fieldIDToName_CommonServiceGetUserAgreementResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetHtmlResult) IsSetSuccess() bool { +func (p *CommonServiceGetUserAgreementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetHtmlResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30554,7 +31281,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -30564,8 +31291,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetHtmlResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetHtmlResponse() +func (p *CommonServiceGetUserAgreementResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetUserAgreementResponse() if err := _field.Read(iprot); err != nil { return err } @@ -30573,10 +31300,10 @@ func (p *CommonServiceGetHtmlResult) ReadField0(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetHtmlResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetHtml_result"); err != nil { + if err = oprot.WriteStructBegin("GetUserAgreement_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -30602,7 +31329,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetHtmlResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -30621,43 +31348,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetHtmlResult) String() string { +func (p *CommonServiceGetUserAgreementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetHtmlResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetUserAgreementResult(%+v)", *p) } -type CommonServiceGetUserAgreementArgs struct { - Req *GetUserAgreementRequest `thrift:"req,1"` +type CommonServiceGetTermsListArgs struct { + Req *TermListRequest `thrift:"req,1"` } -func NewCommonServiceGetUserAgreementArgs() *CommonServiceGetUserAgreementArgs { - return &CommonServiceGetUserAgreementArgs{} +func NewCommonServiceGetTermsListArgs() *CommonServiceGetTermsListArgs { + return &CommonServiceGetTermsListArgs{} } -func (p *CommonServiceGetUserAgreementArgs) InitDefault() { +func (p *CommonServiceGetTermsListArgs) InitDefault() { } -var CommonServiceGetUserAgreementArgs_Req_DEFAULT *GetUserAgreementRequest +var CommonServiceGetTermsListArgs_Req_DEFAULT *TermListRequest -func (p *CommonServiceGetUserAgreementArgs) GetReq() (v *GetUserAgreementRequest) { +func (p *CommonServiceGetTermsListArgs) GetReq() (v *TermListRequest) { if !p.IsSetReq() { - return CommonServiceGetUserAgreementArgs_Req_DEFAULT + return CommonServiceGetTermsListArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_CommonServiceGetUserAgreementArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetTermsListArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetUserAgreementArgs) IsSetReq() bool { +func (p *CommonServiceGetTermsListArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetUserAgreementArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30703,7 +31430,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -30713,8 +31440,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetUserAgreementRequest() +func (p *CommonServiceGetTermsListArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewTermListRequest() if err := _field.Read(iprot); err != nil { return err } @@ -30722,10 +31449,10 @@ func (p *CommonServiceGetUserAgreementArgs) ReadField1(iprot thrift.TProtocol) e return nil } -func (p *CommonServiceGetUserAgreementArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetUserAgreement_args"); err != nil { + if err = oprot.WriteStructBegin("GetTermsList_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -30751,7 +31478,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -30768,43 +31495,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetUserAgreementArgs) String() string { +func (p *CommonServiceGetTermsListArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetUserAgreementArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermsListArgs(%+v)", *p) } -type CommonServiceGetUserAgreementResult struct { - Success *GetUserAgreementResponse `thrift:"success,0,optional"` +type CommonServiceGetTermsListResult struct { + Success *TermListResponse `thrift:"success,0,optional"` } -func NewCommonServiceGetUserAgreementResult() *CommonServiceGetUserAgreementResult { - return &CommonServiceGetUserAgreementResult{} +func NewCommonServiceGetTermsListResult() *CommonServiceGetTermsListResult { + return &CommonServiceGetTermsListResult{} } -func (p *CommonServiceGetUserAgreementResult) InitDefault() { +func (p *CommonServiceGetTermsListResult) InitDefault() { } -var CommonServiceGetUserAgreementResult_Success_DEFAULT *GetUserAgreementResponse +var CommonServiceGetTermsListResult_Success_DEFAULT *TermListResponse -func (p *CommonServiceGetUserAgreementResult) GetSuccess() (v *GetUserAgreementResponse) { +func (p *CommonServiceGetTermsListResult) GetSuccess() (v *TermListResponse) { if !p.IsSetSuccess() { - return CommonServiceGetUserAgreementResult_Success_DEFAULT + return CommonServiceGetTermsListResult_Success_DEFAULT } return p.Success } -var fieldIDToName_CommonServiceGetUserAgreementResult = map[int16]string{ +var fieldIDToName_CommonServiceGetTermsListResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetUserAgreementResult) IsSetSuccess() bool { +func (p *CommonServiceGetTermsListResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetUserAgreementResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30850,7 +31577,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -30860,8 +31587,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetUserAgreementResponse() +func (p *CommonServiceGetTermsListResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewTermListResponse() if err := _field.Read(iprot); err != nil { return err } @@ -30869,10 +31596,10 @@ func (p *CommonServiceGetUserAgreementResult) ReadField0(iprot thrift.TProtocol) return nil } -func (p *CommonServiceGetUserAgreementResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetUserAgreement_result"); err != nil { + if err = oprot.WriteStructBegin("GetTermsList_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -30898,7 +31625,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -30917,43 +31644,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetUserAgreementResult) String() string { +func (p *CommonServiceGetTermsListResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetUserAgreementResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermsListResult(%+v)", *p) } -type CommonServiceGetTermsListArgs struct { - Req *TermListRequest `thrift:"req,1"` +type CommonServiceGetTermArgs struct { + Req *TermRequest `thrift:"req,1"` } -func NewCommonServiceGetTermsListArgs() *CommonServiceGetTermsListArgs { - return &CommonServiceGetTermsListArgs{} +func NewCommonServiceGetTermArgs() *CommonServiceGetTermArgs { + return &CommonServiceGetTermArgs{} } -func (p *CommonServiceGetTermsListArgs) InitDefault() { +func (p *CommonServiceGetTermArgs) InitDefault() { } -var CommonServiceGetTermsListArgs_Req_DEFAULT *TermListRequest +var CommonServiceGetTermArgs_Req_DEFAULT *TermRequest -func (p *CommonServiceGetTermsListArgs) GetReq() (v *TermListRequest) { +func (p *CommonServiceGetTermArgs) GetReq() (v *TermRequest) { if !p.IsSetReq() { - return CommonServiceGetTermsListArgs_Req_DEFAULT + return CommonServiceGetTermArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_CommonServiceGetTermsListArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetTermArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetTermsListArgs) IsSetReq() bool { +func (p *CommonServiceGetTermArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetTermsListArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -30999,7 +31726,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -31009,8 +31736,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermsListArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewTermListRequest() +func (p *CommonServiceGetTermArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewTermRequest() if err := _field.Read(iprot); err != nil { return err } @@ -31018,10 +31745,10 @@ func (p *CommonServiceGetTermsListArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *CommonServiceGetTermsListArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetTermsList_args"); err != nil { + if err = oprot.WriteStructBegin("GetTerm_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -31047,7 +31774,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermsListArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -31064,43 +31791,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetTermsListArgs) String() string { +func (p *CommonServiceGetTermArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermsListArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermArgs(%+v)", *p) } -type CommonServiceGetTermsListResult struct { - Success *TermListResponse `thrift:"success,0,optional"` +type CommonServiceGetTermResult struct { + Success *TermResponse `thrift:"success,0,optional"` } -func NewCommonServiceGetTermsListResult() *CommonServiceGetTermsListResult { - return &CommonServiceGetTermsListResult{} +func NewCommonServiceGetTermResult() *CommonServiceGetTermResult { + return &CommonServiceGetTermResult{} } -func (p *CommonServiceGetTermsListResult) InitDefault() { +func (p *CommonServiceGetTermResult) InitDefault() { } -var CommonServiceGetTermsListResult_Success_DEFAULT *TermListResponse +var CommonServiceGetTermResult_Success_DEFAULT *TermResponse -func (p *CommonServiceGetTermsListResult) GetSuccess() (v *TermListResponse) { +func (p *CommonServiceGetTermResult) GetSuccess() (v *TermResponse) { if !p.IsSetSuccess() { - return CommonServiceGetTermsListResult_Success_DEFAULT + return CommonServiceGetTermResult_Success_DEFAULT } return p.Success } -var fieldIDToName_CommonServiceGetTermsListResult = map[int16]string{ +var fieldIDToName_CommonServiceGetTermResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetTermsListResult) IsSetSuccess() bool { +func (p *CommonServiceGetTermResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetTermsListResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -31146,7 +31873,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -31156,8 +31883,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermsListResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewTermListResponse() +func (p *CommonServiceGetTermResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewTermResponse() if err := _field.Read(iprot); err != nil { return err } @@ -31165,10 +31892,10 @@ func (p *CommonServiceGetTermsListResult) ReadField0(iprot thrift.TProtocol) err return nil } -func (p *CommonServiceGetTermsListResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetTermsList_result"); err != nil { + if err = oprot.WriteStructBegin("GetTerm_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -31194,7 +31921,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermsListResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -31213,43 +31940,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetTermsListResult) String() string { +func (p *CommonServiceGetTermResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermsListResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermResult(%+v)", *p) } -type CommonServiceGetTermArgs struct { - Req *TermRequest `thrift:"req,1"` +type CommonServiceGetNoticeArgs struct { + Req *GetNoticeRequst `thrift:"req,1"` } -func NewCommonServiceGetTermArgs() *CommonServiceGetTermArgs { - return &CommonServiceGetTermArgs{} +func NewCommonServiceGetNoticeArgs() *CommonServiceGetNoticeArgs { + return &CommonServiceGetNoticeArgs{} } -func (p *CommonServiceGetTermArgs) InitDefault() { +func (p *CommonServiceGetNoticeArgs) InitDefault() { } -var CommonServiceGetTermArgs_Req_DEFAULT *TermRequest +var CommonServiceGetNoticeArgs_Req_DEFAULT *GetNoticeRequst -func (p *CommonServiceGetTermArgs) GetReq() (v *TermRequest) { +func (p *CommonServiceGetNoticeArgs) GetReq() (v *GetNoticeRequst) { if !p.IsSetReq() { - return CommonServiceGetTermArgs_Req_DEFAULT + return CommonServiceGetNoticeArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_CommonServiceGetTermArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetNoticeArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetTermArgs) IsSetReq() bool { +func (p *CommonServiceGetNoticeArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetTermArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticeArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -31295,7 +32022,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetNoticeArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -31305,8 +32032,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewTermRequest() +func (p *CommonServiceGetNoticeArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetNoticeRequst() if err := _field.Read(iprot); err != nil { return err } @@ -31314,10 +32041,10 @@ func (p *CommonServiceGetTermArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetTermArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticeArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetTerm_args"); err != nil { + if err = oprot.WriteStructBegin("GetNotice_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -31343,7 +32070,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticeArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -31360,43 +32087,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetTermArgs) String() string { +func (p *CommonServiceGetNoticeArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetNoticeArgs(%+v)", *p) } -type CommonServiceGetTermResult struct { - Success *TermResponse `thrift:"success,0,optional"` +type CommonServiceGetNoticeResult struct { + Success *GetNoticeResponse `thrift:"success,0,optional"` } -func NewCommonServiceGetTermResult() *CommonServiceGetTermResult { - return &CommonServiceGetTermResult{} +func NewCommonServiceGetNoticeResult() *CommonServiceGetNoticeResult { + return &CommonServiceGetNoticeResult{} } -func (p *CommonServiceGetTermResult) InitDefault() { +func (p *CommonServiceGetNoticeResult) InitDefault() { } -var CommonServiceGetTermResult_Success_DEFAULT *TermResponse +var CommonServiceGetNoticeResult_Success_DEFAULT *GetNoticeResponse -func (p *CommonServiceGetTermResult) GetSuccess() (v *TermResponse) { +func (p *CommonServiceGetNoticeResult) GetSuccess() (v *GetNoticeResponse) { if !p.IsSetSuccess() { - return CommonServiceGetTermResult_Success_DEFAULT + return CommonServiceGetNoticeResult_Success_DEFAULT } return p.Success } -var fieldIDToName_CommonServiceGetTermResult = map[int16]string{ +var fieldIDToName_CommonServiceGetNoticeResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetTermResult) IsSetSuccess() bool { +func (p *CommonServiceGetNoticeResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetTermResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticeResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -31442,7 +32169,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetNoticeResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -31452,8 +32179,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewTermResponse() +func (p *CommonServiceGetNoticeResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetNoticeResponse() if err := _field.Read(iprot); err != nil { return err } @@ -31461,10 +32188,10 @@ func (p *CommonServiceGetTermResult) ReadField0(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetTermResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticeResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetTerm_result"); err != nil { + if err = oprot.WriteStructBegin("GetNotice_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -31490,7 +32217,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticeResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -31509,10 +32236,10 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetTermResult) String() string { +func (p *CommonServiceGetNoticeResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetNoticeResult(%+v)", *p) } diff --git a/api/model/model/model.go b/api/model/model/model.go index 06852f3b..caf80da4 100644 --- a/api/model/model/model.go +++ b/api/model/model/model.go @@ -6921,3 +6921,269 @@ func (p *TermInfo) String() string { return fmt.Sprintf("TermInfo(%+v)", *p) } + +type NoticeInfo struct { + Title *string `thrift:"title,1,optional" form:"title" json:"title,omitempty" query:"title"` + URL *string `thrift:"url,2,optional" form:"url" json:"url,omitempty" query:"url"` + Date *string `thrift:"date,3,optional" form:"date" json:"date,omitempty" query:"date"` +} + +func NewNoticeInfo() *NoticeInfo { + return &NoticeInfo{} +} + +func (p *NoticeInfo) InitDefault() { +} + +var NoticeInfo_Title_DEFAULT string + +func (p *NoticeInfo) GetTitle() (v string) { + if !p.IsSetTitle() { + return NoticeInfo_Title_DEFAULT + } + return *p.Title +} + +var NoticeInfo_URL_DEFAULT string + +func (p *NoticeInfo) GetURL() (v string) { + if !p.IsSetURL() { + return NoticeInfo_URL_DEFAULT + } + return *p.URL +} + +var NoticeInfo_Date_DEFAULT string + +func (p *NoticeInfo) GetDate() (v string) { + if !p.IsSetDate() { + return NoticeInfo_Date_DEFAULT + } + return *p.Date +} + +var fieldIDToName_NoticeInfo = map[int16]string{ + 1: "title", + 2: "url", + 3: "date", +} + +func (p *NoticeInfo) IsSetTitle() bool { + return p.Title != nil +} + +func (p *NoticeInfo) IsSetURL() bool { + return p.URL != nil +} + +func (p *NoticeInfo) IsSetDate() bool { + return p.Date != nil +} + +func (p *NoticeInfo) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.STRING { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeInfo[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *NoticeInfo) ReadField1(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Title = _field + return nil +} +func (p *NoticeInfo) ReadField2(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.URL = _field + return nil +} +func (p *NoticeInfo) ReadField3(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Date = _field + return nil +} + +func (p *NoticeInfo) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("NoticeInfo"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *NoticeInfo) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetTitle() { + if err = oprot.WriteFieldBegin("title", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Title); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *NoticeInfo) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetURL() { + if err = oprot.WriteFieldBegin("url", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.URL); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} + +func (p *NoticeInfo) writeField3(oprot thrift.TProtocol) (err error) { + if p.IsSetDate() { + if err = oprot.WriteFieldBegin("date", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Date); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *NoticeInfo) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("NoticeInfo(%+v)", *p) + +} diff --git a/api/pack/notice.go b/api/pack/notice.go new file mode 100644 index 00000000..f05c25df --- /dev/null +++ b/api/pack/notice.go @@ -0,0 +1,34 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pack + +import ( + api "github.com/west2-online/fzuhelper-server/api/model/model" + "github.com/west2-online/fzuhelper-server/kitex_gen/model" +) + +func BuildNotices(notices []*model.NoticeInfo) []*api.NoticeInfo { + list := make([]*api.NoticeInfo, len(notices)) + for i, notice := range notices { + list[i] = &api.NoticeInfo{ + Title: notice.Title, + Date: notice.Date, + URL: notice.Url, + } + } + return list +} diff --git a/api/router/api/api.go b/api/router/api/api.go index 484d631f..544609df 100644 --- a/api/router/api/api.go +++ b/api/router/api/api.go @@ -46,6 +46,7 @@ func Register(r *server.Hertz) { _v1.GET("/list", append(_listdirfilesforandroidMw(), api.ListDirFilesForAndroid)...) { _common := _v1.Group("/common", _commonMw()...) + _common.GET("/notice", append(_getnoticeMw(), api.GetNotice)...) { _classroom := _common.Group("/classroom", _classroomMw()...) _classroom.GET("/empty", append(_getemptyclassroomsMw(), api.GetEmptyClassrooms)...) diff --git a/api/router/api/middleware.go b/api/router/api/middleware.go index a25ea2cf..83ce7947 100644 --- a/api/router/api/middleware.go +++ b/api/router/api/middleware.go @@ -419,6 +419,10 @@ func _gettermslistMw() []app.HandlerFunc { return nil } +func _getnoticeMw() []app.HandlerFunc { + // your code... + return nil +} func _getuserinfoMw() []app.HandlerFunc { // your code... return nil diff --git a/api/rpc/common.go b/api/rpc/common.go index b2e96a47..849568bb 100644 --- a/api/rpc/common.go +++ b/api/rpc/common.go @@ -97,3 +97,15 @@ func GetTermRPC(ctx context.Context, req *common.TermRequest) (*model.TermInfo, return resp.TermInfo, nil } + +func GetNoticesRPC(ctx context.Context, req *common.NoticeRequest) ([]*model.NoticeInfo, int64, error) { + resp, err := commonClient.GetNotices(ctx, req) + if err != nil { + logger.Errorf("GetNoticesRPC: RPC called failed: %v", err.Error()) + return nil, 0, errno.InternalServiceError.WithMessage(err.Error()) + } + if err = utils.HandleBaseRespWithCookie(resp.Base); err != nil { + return nil, 0, err + } + return resp.Notices, resp.Total, nil +} diff --git a/cmd/common/main.go b/cmd/common/main.go index 4fca3155..13feedb5 100644 --- a/cmd/common/main.go +++ b/cmd/common/main.go @@ -26,6 +26,7 @@ import ( "github.com/west2-online/fzuhelper-server/config" "github.com/west2-online/fzuhelper-server/internal/common" + "github.com/west2-online/fzuhelper-server/internal/common/syncer" "github.com/west2-online/fzuhelper-server/kitex_gen/common/commonservice" "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/constants" @@ -34,15 +35,17 @@ import ( ) var ( - serviceName = constants.CommonServiceName - clientSet *base.ClientSet + serviceName = constants.CommonServiceName + clientSet *base.ClientSet + noticeSyncer *syncer.NoticeSyncer ) func init() { config.Init(serviceName) logger.Init(serviceName, config.GetLoggerLevel()) // eshook.InitLoggerWithHook(serviceName) - clientSet = base.NewClientSet() + clientSet = base.NewClientSet(base.WithDBClient(constants.NoticeTableName)) + noticeSyncer = syncer.InitNoticeSyncer(clientSet.DBClient) } func main() { @@ -72,6 +75,9 @@ func main() { MaxQPS: constants.MaxQPS, }), ) + // 启动 syncer + noticeSyncer.Add("update") + noticeSyncer.Start() if err = svr.Run(); err != nil { logger.Fatalf("Common: server run failed: %v", err) diff --git a/config/sql/init.sql b/config/sql/init.sql index 81bbe55f..705dc4b9 100644 --- a/config/sql/init.sql +++ b/config/sql/init.sql @@ -94,4 +94,18 @@ CREATE TABLE `fzu-helper`.`course`( key `term` (`term`), constraint `id` primary key (`id`) -) +)engine=InnoDB default charset=utf8mb4; + +CREATE TABLE `fzu-helper`.`notice`( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID', + `title` varchar(255) NOT NULL COMMENT '标题', + `url` varchar(255) NOT NULL COMMENT '链接', + `published_at` varchar(10) NOT NULL COMMENT '发布时间', + `created_at` timestamp NOT NULL DEFAULT current_timestamp, + `updated_at` timestamp NOT NULL DEFAULT current_timestamp ON UPDATE current_timestamp, + `deleted_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `unique_url` UNIQUE (`url`) +)engine=InnoDB default charset=utf8mb4; +/* 建立发布时间的索引 */ +CREATE INDEX idx_published_at ON `fzu-helper`.`notice`(`published_at`); diff --git a/go.mod b/go.mod index 761933fb..05aaa7e6 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/segmentio/kafka-go v0.4.47 github.com/spf13/viper v1.19.0 github.com/upyun/go-sdk/v3 v3.0.4 - github.com/west2-online/jwch v0.2.2 + github.com/west2-online/jwch v0.2.4 gorm.io/driver/mysql v1.5.7 gorm.io/gorm v1.25.12 k8s.io/client-go v0.32.0 diff --git a/go.sum b/go.sum index ff40f123..8e0fa51a 100644 --- a/go.sum +++ b/go.sum @@ -653,8 +653,8 @@ github.com/upyun/go-sdk/v3 v3.0.4 h1:2DCJa/Yi7/3ZybT9UCPATSzvU3wpPPxhXinNlb1Hi8Q github.com/upyun/go-sdk/v3 v3.0.4/go.mod h1:P/SnuuwhrIgAVRd/ZpzDWqCsBAf/oHg7UggbAxyZa0E= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/west2-online/jwch v0.2.2 h1:xY5p+ULZO4Mpdm9u9iWaNRqVfWzieC+K9/WKwyWw1n8= -github.com/west2-online/jwch v0.2.2/go.mod h1:WI6YUgXuLMt+5A1X4HKuxhZRzhxRvxNyXT4BQzeAr9s= +github.com/west2-online/jwch v0.2.4 h1:1UviWHDb01Nd3xA026z9VcYL98T163F9aEfCXd72lvk= +github.com/west2-online/jwch v0.2.4/go.mod h1:WI6YUgXuLMt+5A1X4HKuxhZRzhxRvxNyXT4BQzeAr9s= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= diff --git a/hack/docker-run.sh b/hack/docker-run.sh index 47c6dc08..8937cce1 100644 --- a/hack/docker-run.sh +++ b/hack/docker-run.sh @@ -43,7 +43,7 @@ DIR=$(cd "$(dirname "$0")" && pwd) # 可用服务的列表。在真实场景中,这应该是服务名称的数组。 # 例如:SERVICES=("service1" "service2" "service3") -SERVICES=(api user classroom course launch_screen paper academic) +SERVICES=(api user classroom course launch_screen paper academic version common) # 1. 编译镜像时将多个服务打包为单一镜像(当然不建议这么做,不过镜像小的且不需要频繁更新这么做很方便) # 2. 启动时根据SERVICE_TO_START在SERVICES中查找对应服务名 # 3. 如果查找的到,则启动容器,查找不到则抛出错误 diff --git a/idl/api.thrift b/idl/api.thrift index 69e50c19..1c6bf474 100644 --- a/idl/api.thrift +++ b/idl/api.thrift @@ -479,6 +479,15 @@ struct TermResponse { 2: required model.TermInfo term_info } +struct GetNoticeRequst { + 1: required i64 pageNum +} + +struct GetNoticeResponse { + 1: required list notices + 2: required i64 total +} + service CommonService { GetCSSResponse GetCSS(1:GetCSSRequest req)(api.get="/api/v2/common/fzu-helper.css"), GetHtmlResponse GetHtml(1:GetHtmlRequest req)(api.get="/api/v2/common/fzu-helper.html"), @@ -487,6 +496,8 @@ service CommonService { TermListResponse GetTermsList(1: TermListRequest req) (api.get="/api/v1/terms/list") // 学期信息:学期详情 TermResponse GetTerm(1: TermRequest req) (api.get="/api/v1/terms/info") + + GetNoticeResponse GetNotice(1: GetNoticeRequst req) (api.get="/api/v1/common/notice") } diff --git a/idl/common.thrift b/idl/common.thrift index 77ae2ee3..1db549b2 100644 --- a/idl/common.thrift +++ b/idl/common.thrift @@ -43,6 +43,17 @@ struct TermListResponse { 2: required model.TermList term_lists } +// 教务处教学通知 +struct NoticeRequest { + 1: required i64 pageNum +} + +struct NoticeResponse { + 1: required model.BaseResp base + 2: optional list notices + 3: required i64 total +} + service CommonService { GetCSSResponse GetCSS(1:GetCSSRequest req)(api.get="/api/v1/url/onekey/FZUHelper.css"), GetHtmlResponse GetHtml(1:GetHtmlRequest req)(api.get="/api/v1/url/onekey/FZUHelper.html"), @@ -51,4 +62,6 @@ service CommonService { TermListResponse GetTermsList(1: TermListRequest req) // 学期信息:学期详情 TermResponse GetTerm(1: TermRequest req) + // 教务处教学通知 + NoticeResponse GetNotices(1: NoticeRequest req) } diff --git a/idl/model.thrift b/idl/model.thrift index 4030c704..cd181990 100644 --- a/idl/model.thrift +++ b/idl/model.thrift @@ -163,4 +163,10 @@ struct TermInfo { 3: optional string school_year 4: optional list events } + +struct NoticeInfo { + 1: optional string title + 2: optional string url + 3: optional string date +} // ====== END Common ====== diff --git a/internal/common/handler.go b/internal/common/handler.go index f7293614..e95eb9a9 100644 --- a/internal/common/handler.go +++ b/internal/common/handler.go @@ -103,3 +103,16 @@ func (s *CommonServiceImpl) GetTerm(ctx context.Context, req *common.TermRequest resp.TermInfo = pack.BuildTermInfo(res) return } + +func (s *CommonServiceImpl) GetNotices(ctx context.Context, req *common.NoticeRequest) (resp *common.NoticeResponse, err error) { + resp = new(common.NoticeResponse) + res, total, err := service.NewCommonService(ctx, s.ClientSet).GetNotice(int(req.PageNum)) + if err != nil { + resp.Base = base.BuildBaseResp(err) + return resp, nil + } + resp.Base = base.BuildSuccessResp() + resp.Notices = pack.BuildNoticeList(res) + resp.Total = int64(total) + return +} diff --git a/internal/common/pack/notice.go b/internal/common/pack/notice.go new file mode 100644 index 00000000..15554561 --- /dev/null +++ b/internal/common/pack/notice.go @@ -0,0 +1,34 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package pack + +import ( + "github.com/west2-online/fzuhelper-server/kitex_gen/model" + db "github.com/west2-online/fzuhelper-server/pkg/db/model" +) + +func BuildNoticeList(notices []db.Notice) []*model.NoticeInfo { + list := make([]*model.NoticeInfo, len(notices)) + for i, notice := range notices { + list[i] = &model.NoticeInfo{ + Title: ¬ice.Title, + Url: ¬ice.URL, + Date: ¬ice.PublishedAt, + } + } + return list +} diff --git a/internal/common/service/get_notice.go b/internal/common/service/get_notice.go new file mode 100644 index 00000000..37d1cd4e --- /dev/null +++ b/internal/common/service/get_notice.go @@ -0,0 +1,38 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package service + +import ( + "fmt" + + "github.com/west2-online/fzuhelper-server/pkg/db/model" + "github.com/west2-online/fzuhelper-server/pkg/errno" + "github.com/west2-online/jwch" +) + +func (s *CommonService) GetNotice(pageNum int) (list []model.Notice, total int, err error) { + list, err = s.db.Notice.GetNoticeByPage(s.ctx, pageNum) + if err != nil { + return nil, 0, fmt.Errorf("CommonService.GetNotice get notice from database:%w", err) + } + // 爬取总页数 + _, total, err = jwch.NewStudent().GetNoticeInfo(&jwch.NoticeInfoReq{PageNum: 1}) + if err != nil { + return nil, 0, errno.Errorf(errno.BizJwchCookieExceptionCode, "dal.GetNoticeByPage error: %s", err) + } + return list, total, nil +} diff --git a/internal/common/service/service.go b/internal/common/service/service.go index c2f60ede..a36a3121 100644 --- a/internal/common/service/service.go +++ b/internal/common/service/service.go @@ -20,6 +20,7 @@ import ( "context" "github.com/west2-online/fzuhelper-server/pkg/base" + "github.com/west2-online/fzuhelper-server/pkg/db" ) const ( @@ -30,10 +31,12 @@ const ( type CommonService struct { ctx context.Context + db *db.Database } func NewCommonService(ctx context.Context, clientset *base.ClientSet) *CommonService { return &CommonService{ ctx: ctx, + db: clientset.DBClient, } } diff --git a/internal/common/syncer/init.go b/internal/common/syncer/init.go new file mode 100644 index 00000000..9ef67482 --- /dev/null +++ b/internal/common/syncer/init.go @@ -0,0 +1,56 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package syncer + +import ( + "context" + + "github.com/west2-online/fzuhelper-server/config" + "github.com/west2-online/fzuhelper-server/pkg/db/model" + "github.com/west2-online/fzuhelper-server/pkg/logger" + "github.com/west2-online/jwch" +) + +// Init 当包被导入时,默认执行一次全局爬取 需要显式调用 +// TODO: 失败后的重试机制 +func (ns *NoticeSyncer) initNoticeSyncer() { + stu := jwch.NewStudent().WithUser(config.DefaultUser.Account, config.DefaultUser.Password) + _, totalPage, err := stu.GetNoticeInfo(&jwch.NoticeInfoReq{PageNum: 1}) + if err != nil { + logger.Errorf("syncer init: failed to get notice info: %v", err) + } + // 初始化数据库 + for i := 1; i <= totalPage; i++ { + content, _, err := stu.GetNoticeInfo(&jwch.NoticeInfoReq{PageNum: i}) + if err != nil { + logger.Errorf("syncer init: failed to get notice info in page %d: %v", i, err) + } + for _, row := range content { + ctx := context.Background() + info := &model.Notice{ + Title: row.Title, + PublishedAt: row.Date, + URL: row.URL, + } + err = ns.db.Notice.CreateNotice(ctx, info) + if err != nil { + logger.Errorf("syncer init: failed to create notice in page %d: %v", i, err) + } + } + } + logger.Infof("syncer init: notice syncer init success") +} diff --git a/internal/common/syncer/update.go b/internal/common/syncer/update.go new file mode 100644 index 00000000..1f375a84 --- /dev/null +++ b/internal/common/syncer/update.go @@ -0,0 +1,58 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package syncer + +import ( + "context" + "fmt" + + "github.com/west2-online/fzuhelper-server/config" + "github.com/west2-online/fzuhelper-server/pkg/db/model" + "github.com/west2-online/fzuhelper-server/pkg/logger" + "github.com/west2-online/jwch" +) + +// update 定期爬取教务处教学通知,并进行 diff 操作 +func (ns *NoticeSyncer) update() (err error) { + // 默认爬取第一页的内容(教务处不太可能一次性更新出一页的数据),然后和数据库做 diff 操作 + content, _, err := jwch.NewStudent().WithUser(config.DefaultUser.Account, config.DefaultUser.Password).GetNoticeInfo(&jwch.NoticeInfoReq{PageNum: 1}) + if err != nil { + logger.Errorf("syncer update: failed to get notice info: %v", err) + } + for _, row := range content { + // 判断是否已存在 + ctx := context.Background() + ok, err := ns.db.Notice.IsURLExists(ctx, row.URL) + if err != nil { + return fmt.Errorf("syncer update: failed to check url exists: %w", err) + } + // 数据库已存在,无需处理 + if ok { + continue + } + // TODO: SDK 进行消息推送等操作 + info := &model.Notice{ + Title: row.Title, + URL: row.URL, + PublishedAt: row.Date, + } + if err = ns.db.Notice.CreateNotice(ctx, info); err != nil { + return fmt.Errorf("syncer update: failed to create notice: %w", err) + } + } + return nil +} diff --git a/internal/common/syncer/workqueue.go b/internal/common/syncer/workqueue.go new file mode 100644 index 00000000..6a652712 --- /dev/null +++ b/internal/common/syncer/workqueue.go @@ -0,0 +1,97 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package syncer + +import ( + "time" + + "golang.org/x/time/rate" + "k8s.io/client-go/util/workqueue" + + "github.com/west2-online/fzuhelper-server/pkg/constants" + "github.com/west2-online/fzuhelper-server/pkg/db" + "github.com/west2-online/fzuhelper-server/pkg/logger" +) + +const ( + baseDelay = 2 + maxDelay = 1000 + maxTokens = 100 + maxRate = rate.Limit(10) + + FailureRateLimiterBaseDelay = time.Minute + FailureRateLimiterMaxDelay = 30 * time.Minute +) + +// NoticeSyncer 教务处通知同步 +type NoticeSyncer struct { + workQueue workqueue.TypedRateLimitingInterface[string] + db *db.Database +} + +// InitNoticeSyncer will init a worker queue +func InitNoticeSyncer(db *db.Database) *NoticeSyncer { + ns := &NoticeSyncer{ + db: db, + workQueue: workqueue.NewTypedRateLimitingQueue[string]( + workqueue.NewTypedMaxOfRateLimiter( + // For syncRec failures(i.e. doRecommend return err), the retry time is (2*minutes)*2^ + // The maximum retry time is 24 hours + workqueue.NewTypedItemExponentialFailureRateLimiter[string](FailureRateLimiterBaseDelay, FailureRateLimiterMaxDelay), + // 10 qps, 100 bucket size. This is only for retry speed, it's only the overall factor (not per item) + // 每秒最多产生 10 个令牌(允许处理 10 个任务)。 + // 100:令牌桶最多存储 100 个令牌,允许积累的最大任务数量 + workqueue.NewTypedMaxOfRateLimiter[string](workqueue.NewTypedItemExponentialFailureRateLimiter[string](baseDelay, maxDelay), + &workqueue.TypedBucketRateLimiter[string]{Limiter: rate.NewLimiter(maxRate, maxTokens)}), + ), + ), + } + return ns +} + +func (ns *NoticeSyncer) Start() { + ns.initNoticeSyncer() + for i := 0; i < constants.NoticeWorker; i++ { + go ns.worker() + } +} + +func (ns *NoticeSyncer) Add(key string) { + ns.workQueue.Add(key) +} + +// worker 将每 8 小时对 jwc 的通知进行同步存储 template from classroom.syncer +func (ns *NoticeSyncer) worker() { + for { + item, shutdown := ns.workQueue.Get() + if shutdown { + logger.Info("Notice.worker shutdown") + return + } + // do update + if err := ns.update(); err != nil { + // 失败后采取重试策略 + logger.Errorf("Notice.worker: failed to update: %v", err) + ns.workQueue.AddRateLimited(item) + } else { + ns.workQueue.AddAfter(item, constants.NoticeUpdateTime) + ns.workQueue.Forget(item) + } + ns.workQueue.Done(item) + logger.Info("Notice.worker update complete") + } +} diff --git a/kitex_gen/common/common.go b/kitex_gen/common/common.go index 21ed11cc..e388c698 100644 --- a/kitex_gen/common/common.go +++ b/kitex_gen/common/common.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by thriftgo (0.3.17). DO NOT EDIT. +// Code generated by thriftgo (0.3.18). DO NOT EDIT. package common @@ -84,6 +84,7 @@ ReadStructEndError: } func (p *GetCSSRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetCSSRequest"); err != nil { goto WriteStructBeginError } @@ -212,6 +213,7 @@ func (p *GetCSSResponse) ReadField1(iprot thrift.TProtocol) error { } func (p *GetCSSResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetCSSResponse"); err != nil { goto WriteStructBeginError @@ -339,6 +341,7 @@ ReadStructEndError: } func (p *GetHtmlRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetHtmlRequest"); err != nil { goto WriteStructBeginError } @@ -467,6 +470,7 @@ func (p *GetHtmlResponse) ReadField1(iprot thrift.TProtocol) error { } func (p *GetHtmlResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetHtmlResponse"); err != nil { goto WriteStructBeginError @@ -594,6 +598,7 @@ ReadStructEndError: } func (p *GetUserAgreementRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetUserAgreementRequest"); err != nil { goto WriteStructBeginError } @@ -722,6 +727,7 @@ func (p *GetUserAgreementResponse) ReadField1(iprot thrift.TProtocol) error { } func (p *GetUserAgreementResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetUserAgreementResponse"); err != nil { goto WriteStructBeginError @@ -893,6 +899,7 @@ func (p *TermRequest) ReadField1(iprot thrift.TProtocol) error { } func (p *TermRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("TermRequest"); err != nil { goto WriteStructBeginError @@ -1111,6 +1118,7 @@ func (p *TermResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *TermResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("TermResponse"); err != nil { goto WriteStructBeginError @@ -1269,6 +1277,7 @@ ReadStructEndError: } func (p *TermListRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("TermListRequest"); err != nil { goto WriteStructBeginError } @@ -1452,6 +1461,7 @@ func (p *TermListResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *TermListResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("TermListResponse"); err != nil { goto WriteStructBeginError @@ -1555,53 +1565,33 @@ func (p *TermListResponse) Field2DeepEqual(src *model.TermList) bool { return true } -type CommonService interface { - GetCSS(ctx context.Context, req *GetCSSRequest) (r *GetCSSResponse, err error) - - GetHtml(ctx context.Context, req *GetHtmlRequest) (r *GetHtmlResponse, err error) - - GetUserAgreement(ctx context.Context, req *GetUserAgreementRequest) (r *GetUserAgreementResponse, err error) - - GetTermsList(ctx context.Context, req *TermListRequest) (r *TermListResponse, err error) - - GetTerm(ctx context.Context, req *TermRequest) (r *TermResponse, err error) -} - -type CommonServiceGetCSSArgs struct { - Req *GetCSSRequest `thrift:"req,1" frugal:"1,default,GetCSSRequest" json:"req"` +type NoticeRequest struct { + PageNum int64 `thrift:"pageNum,1,required" frugal:"1,required,i64" json:"pageNum"` } -func NewCommonServiceGetCSSArgs() *CommonServiceGetCSSArgs { - return &CommonServiceGetCSSArgs{} +func NewNoticeRequest() *NoticeRequest { + return &NoticeRequest{} } -func (p *CommonServiceGetCSSArgs) InitDefault() { +func (p *NoticeRequest) InitDefault() { } -var CommonServiceGetCSSArgs_Req_DEFAULT *GetCSSRequest - -func (p *CommonServiceGetCSSArgs) GetReq() (v *GetCSSRequest) { - if !p.IsSetReq() { - return CommonServiceGetCSSArgs_Req_DEFAULT - } - return p.Req -} -func (p *CommonServiceGetCSSArgs) SetReq(val *GetCSSRequest) { - p.Req = val +func (p *NoticeRequest) GetPageNum() (v int64) { + return p.PageNum } - -var fieldIDToName_CommonServiceGetCSSArgs = map[int16]string{ - 1: "req", +func (p *NoticeRequest) SetPageNum(val int64) { + p.PageNum = val } -func (p *CommonServiceGetCSSArgs) IsSetReq() bool { - return p.Req != nil +var fieldIDToName_NoticeRequest = map[int16]string{ + 1: "pageNum", } -func (p *CommonServiceGetCSSArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *NoticeRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetPageNum bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -1618,10 +1608,11 @@ func (p *CommonServiceGetCSSArgs) Read(iprot thrift.TProtocol) (err error) { switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.I64 { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } + issetPageNum = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -1638,13 +1629,17 @@ func (p *CommonServiceGetCSSArgs) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } + if !issetPageNum { + fieldId = 1 + goto RequiredFieldNotSetError + } return nil ReadStructBeginError: return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeRequest[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -1652,20 +1647,26 @@ ReadFieldEndError: return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_NoticeRequest[fieldId])) } -func (p *CommonServiceGetCSSArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetCSSRequest() - if err := _field.Read(iprot); err != nil { +func (p *NoticeRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field int64 + if v, err := iprot.ReadI64(); err != nil { return err + } else { + _field = v } - p.Req = _field + p.PageNum = _field return nil } -func (p *CommonServiceGetCSSArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *NoticeRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetCSS_args"); err != nil { + if err = oprot.WriteStructBegin("NoticeRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -1691,11 +1692,11 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetCSSArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { +func (p *NoticeRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("pageNum", thrift.I64, 1); err != nil { goto WriteFieldBeginError } - if err := p.Req.Write(oprot); err != nil { + if err := oprot.WriteI64(p.PageNum); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -1708,69 +1709,98 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetCSSArgs) String() string { +func (p *NoticeRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetCSSArgs(%+v)", *p) + return fmt.Sprintf("NoticeRequest(%+v)", *p) } -func (p *CommonServiceGetCSSArgs) DeepEqual(ano *CommonServiceGetCSSArgs) bool { +func (p *NoticeRequest) DeepEqual(ano *NoticeRequest) bool { if p == ano { return true } else if p == nil || ano == nil { return false } - if !p.Field1DeepEqual(ano.Req) { + if !p.Field1DeepEqual(ano.PageNum) { return false } return true } -func (p *CommonServiceGetCSSArgs) Field1DeepEqual(src *GetCSSRequest) bool { +func (p *NoticeRequest) Field1DeepEqual(src int64) bool { - if !p.Req.DeepEqual(src) { + if p.PageNum != src { return false } return true } -type CommonServiceGetCSSResult struct { - Success *GetCSSResponse `thrift:"success,0,optional" frugal:"0,optional,GetCSSResponse" json:"success,omitempty"` +type NoticeResponse struct { + Base *model.BaseResp `thrift:"base,1,required" frugal:"1,required,model.BaseResp" json:"base"` + Notices []*model.NoticeInfo `thrift:"notices,2,optional" frugal:"2,optional,list" json:"notices,omitempty"` + Total int64 `thrift:"total,3,required" frugal:"3,required,i64" json:"total"` } -func NewCommonServiceGetCSSResult() *CommonServiceGetCSSResult { - return &CommonServiceGetCSSResult{} +func NewNoticeResponse() *NoticeResponse { + return &NoticeResponse{} } -func (p *CommonServiceGetCSSResult) InitDefault() { +func (p *NoticeResponse) InitDefault() { } -var CommonServiceGetCSSResult_Success_DEFAULT *GetCSSResponse +var NoticeResponse_Base_DEFAULT *model.BaseResp -func (p *CommonServiceGetCSSResult) GetSuccess() (v *GetCSSResponse) { - if !p.IsSetSuccess() { - return CommonServiceGetCSSResult_Success_DEFAULT +func (p *NoticeResponse) GetBase() (v *model.BaseResp) { + if !p.IsSetBase() { + return NoticeResponse_Base_DEFAULT } - return p.Success + return p.Base } -func (p *CommonServiceGetCSSResult) SetSuccess(x interface{}) { - p.Success = x.(*GetCSSResponse) + +var NoticeResponse_Notices_DEFAULT []*model.NoticeInfo + +func (p *NoticeResponse) GetNotices() (v []*model.NoticeInfo) { + if !p.IsSetNotices() { + return NoticeResponse_Notices_DEFAULT + } + return p.Notices } -var fieldIDToName_CommonServiceGetCSSResult = map[int16]string{ - 0: "success", +func (p *NoticeResponse) GetTotal() (v int64) { + return p.Total +} +func (p *NoticeResponse) SetBase(val *model.BaseResp) { + p.Base = val +} +func (p *NoticeResponse) SetNotices(val []*model.NoticeInfo) { + p.Notices = val +} +func (p *NoticeResponse) SetTotal(val int64) { + p.Total = val } -func (p *CommonServiceGetCSSResult) IsSetSuccess() bool { - return p.Success != nil +var fieldIDToName_NoticeResponse = map[int16]string{ + 1: "base", + 2: "notices", + 3: "total", } -func (p *CommonServiceGetCSSResult) Read(iprot thrift.TProtocol) (err error) { +func (p *NoticeResponse) IsSetBase() bool { + return p.Base != nil +} + +func (p *NoticeResponse) IsSetNotices() bool { + return p.Notices != nil +} + +func (p *NoticeResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetBase bool = false + var issetTotal bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -1786,11 +1816,29 @@ func (p *CommonServiceGetCSSResult) Read(iprot thrift.TProtocol) (err error) { } switch fieldId { - case 0: + case 1: if fieldTypeId == thrift.STRUCT { - if err = p.ReadField0(iprot); err != nil { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetBase = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.LIST { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.I64 { + if err = p.ReadField3(iprot); err != nil { goto ReadFieldError } + issetTotal = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -1807,13 +1855,22 @@ func (p *CommonServiceGetCSSResult) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } + if !issetBase { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetTotal { + fieldId = 3 + goto RequiredFieldNotSetError + } return nil ReadStructBeginError: return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeResponse[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -1821,25 +1878,70 @@ ReadFieldEndError: return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_NoticeResponse[fieldId])) } -func (p *CommonServiceGetCSSResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetCSSResponse() +func (p *NoticeResponse) ReadField1(iprot thrift.TProtocol) error { + _field := model.NewBaseResp() if err := _field.Read(iprot); err != nil { return err } - p.Success = _field + p.Base = _field return nil } +func (p *NoticeResponse) ReadField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]*model.NoticeInfo, 0, size) + values := make([]model.NoticeInfo, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() + + if err := _elem.Read(iprot); err != nil { + return err + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Notices = _field + return nil +} +func (p *NoticeResponse) ReadField3(iprot thrift.TProtocol) error { + + var _field int64 + if v, err := iprot.ReadI64(); err != nil { + return err + } else { + _field = v + } + p.Total = _field + return nil +} + +func (p *NoticeResponse) Write(oprot thrift.TProtocol) (err error) { -func (p *CommonServiceGetCSSResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetCSS_result"); err != nil { + if err = oprot.WriteStructBegin("NoticeResponse"); err != nil { goto WriteStructBeginError } if p != nil { - if err = p.writeField0(oprot); err != nil { - fieldId = 0 + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 goto WriteFieldError } } @@ -1860,12 +1962,37 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetCSSResult) writeField0(oprot thrift.TProtocol) (err error) { - if p.IsSetSuccess() { - if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { +func (p *NoticeResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("base", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Base.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *NoticeResponse) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetNotices() { + if err = oprot.WriteFieldBegin("notices", thrift.LIST, 2); err != nil { goto WriteFieldBeginError } - if err := p.Success.Write(oprot); err != nil { + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Notices)); err != nil { + return err + } + for _, v := range p.Notices { + if err := v.Write(oprot); err != nil { + return err + } + } + if err := oprot.WriteListEnd(); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -1874,68 +2001,467 @@ func (p *CommonServiceGetCSSResult) writeField0(oprot thrift.TProtocol) (err err } return nil WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) } -func (p *CommonServiceGetCSSResult) String() string { +func (p *NoticeResponse) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("total", thrift.I64, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteI64(p.Total); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *NoticeResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetCSSResult(%+v)", *p) + return fmt.Sprintf("NoticeResponse(%+v)", *p) } -func (p *CommonServiceGetCSSResult) DeepEqual(ano *CommonServiceGetCSSResult) bool { +func (p *NoticeResponse) DeepEqual(ano *NoticeResponse) bool { if p == ano { return true } else if p == nil || ano == nil { return false } - if !p.Field0DeepEqual(ano.Success) { + if !p.Field1DeepEqual(ano.Base) { + return false + } + if !p.Field2DeepEqual(ano.Notices) { + return false + } + if !p.Field3DeepEqual(ano.Total) { return false } return true } -func (p *CommonServiceGetCSSResult) Field0DeepEqual(src *GetCSSResponse) bool { +func (p *NoticeResponse) Field1DeepEqual(src *model.BaseResp) bool { - if !p.Success.DeepEqual(src) { + if !p.Base.DeepEqual(src) { return false } return true } +func (p *NoticeResponse) Field2DeepEqual(src []*model.NoticeInfo) bool { -type CommonServiceGetHtmlArgs struct { - Req *GetHtmlRequest `thrift:"req,1" frugal:"1,default,GetHtmlRequest" json:"req"` + if len(p.Notices) != len(src) { + return false + } + for i, v := range p.Notices { + _src := src[i] + if !v.DeepEqual(_src) { + return false + } + } + return true } +func (p *NoticeResponse) Field3DeepEqual(src int64) bool { -func NewCommonServiceGetHtmlArgs() *CommonServiceGetHtmlArgs { - return &CommonServiceGetHtmlArgs{} + if p.Total != src { + return false + } + return true } -func (p *CommonServiceGetHtmlArgs) InitDefault() { -} +type CommonService interface { + GetCSS(ctx context.Context, req *GetCSSRequest) (r *GetCSSResponse, err error) -var CommonServiceGetHtmlArgs_Req_DEFAULT *GetHtmlRequest + GetHtml(ctx context.Context, req *GetHtmlRequest) (r *GetHtmlResponse, err error) -func (p *CommonServiceGetHtmlArgs) GetReq() (v *GetHtmlRequest) { - if !p.IsSetReq() { - return CommonServiceGetHtmlArgs_Req_DEFAULT - } - return p.Req + GetUserAgreement(ctx context.Context, req *GetUserAgreementRequest) (r *GetUserAgreementResponse, err error) + + GetTermsList(ctx context.Context, req *TermListRequest) (r *TermListResponse, err error) + + GetTerm(ctx context.Context, req *TermRequest) (r *TermResponse, err error) + + GetNotices(ctx context.Context, req *NoticeRequest) (r *NoticeResponse, err error) } -func (p *CommonServiceGetHtmlArgs) SetReq(val *GetHtmlRequest) { - p.Req = val + +type CommonServiceGetCSSArgs struct { + Req *GetCSSRequest `thrift:"req,1" frugal:"1,default,GetCSSRequest" json:"req"` } -var fieldIDToName_CommonServiceGetHtmlArgs = map[int16]string{ - 1: "req", +func NewCommonServiceGetCSSArgs() *CommonServiceGetCSSArgs { + return &CommonServiceGetCSSArgs{} } -func (p *CommonServiceGetHtmlArgs) IsSetReq() bool { - return p.Req != nil +func (p *CommonServiceGetCSSArgs) InitDefault() { +} + +var CommonServiceGetCSSArgs_Req_DEFAULT *GetCSSRequest + +func (p *CommonServiceGetCSSArgs) GetReq() (v *GetCSSRequest) { + if !p.IsSetReq() { + return CommonServiceGetCSSArgs_Req_DEFAULT + } + return p.Req +} +func (p *CommonServiceGetCSSArgs) SetReq(val *GetCSSRequest) { + p.Req = val +} + +var fieldIDToName_CommonServiceGetCSSArgs = map[int16]string{ + 1: "req", +} + +func (p *CommonServiceGetCSSArgs) IsSetReq() bool { + return p.Req != nil +} + +func (p *CommonServiceGetCSSArgs) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSArgs[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CommonServiceGetCSSArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetCSSRequest() + if err := _field.Read(iprot); err != nil { + return err + } + p.Req = _field + return nil +} + +func (p *CommonServiceGetCSSArgs) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("GetCSS_args"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CommonServiceGetCSSArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Req.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *CommonServiceGetCSSArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CommonServiceGetCSSArgs(%+v)", *p) + +} + +func (p *CommonServiceGetCSSArgs) DeepEqual(ano *CommonServiceGetCSSArgs) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field1DeepEqual(ano.Req) { + return false + } + return true +} + +func (p *CommonServiceGetCSSArgs) Field1DeepEqual(src *GetCSSRequest) bool { + + if !p.Req.DeepEqual(src) { + return false + } + return true +} + +type CommonServiceGetCSSResult struct { + Success *GetCSSResponse `thrift:"success,0,optional" frugal:"0,optional,GetCSSResponse" json:"success,omitempty"` +} + +func NewCommonServiceGetCSSResult() *CommonServiceGetCSSResult { + return &CommonServiceGetCSSResult{} +} + +func (p *CommonServiceGetCSSResult) InitDefault() { +} + +var CommonServiceGetCSSResult_Success_DEFAULT *GetCSSResponse + +func (p *CommonServiceGetCSSResult) GetSuccess() (v *GetCSSResponse) { + if !p.IsSetSuccess() { + return CommonServiceGetCSSResult_Success_DEFAULT + } + return p.Success +} +func (p *CommonServiceGetCSSResult) SetSuccess(x interface{}) { + p.Success = x.(*GetCSSResponse) +} + +var fieldIDToName_CommonServiceGetCSSResult = map[int16]string{ + 0: "success", +} + +func (p *CommonServiceGetCSSResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *CommonServiceGetCSSResult) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetCSSResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CommonServiceGetCSSResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetCSSResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *CommonServiceGetCSSResult) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("GetCSS_result"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CommonServiceGetCSSResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) +} + +func (p *CommonServiceGetCSSResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CommonServiceGetCSSResult(%+v)", *p) + +} + +func (p *CommonServiceGetCSSResult) DeepEqual(ano *CommonServiceGetCSSResult) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field0DeepEqual(ano.Success) { + return false + } + return true +} + +func (p *CommonServiceGetCSSResult) Field0DeepEqual(src *GetCSSResponse) bool { + + if !p.Success.DeepEqual(src) { + return false + } + return true +} + +type CommonServiceGetHtmlArgs struct { + Req *GetHtmlRequest `thrift:"req,1" frugal:"1,default,GetHtmlRequest" json:"req"` +} + +func NewCommonServiceGetHtmlArgs() *CommonServiceGetHtmlArgs { + return &CommonServiceGetHtmlArgs{} +} + +func (p *CommonServiceGetHtmlArgs) InitDefault() { +} + +var CommonServiceGetHtmlArgs_Req_DEFAULT *GetHtmlRequest + +func (p *CommonServiceGetHtmlArgs) GetReq() (v *GetHtmlRequest) { + if !p.IsSetReq() { + return CommonServiceGetHtmlArgs_Req_DEFAULT + } + return p.Req +} +func (p *CommonServiceGetHtmlArgs) SetReq(val *GetHtmlRequest) { + p.Req = val +} + +var fieldIDToName_CommonServiceGetHtmlArgs = map[int16]string{ + 1: "req", +} + +func (p *CommonServiceGetHtmlArgs) IsSetReq() bool { + return p.Req != nil } func (p *CommonServiceGetHtmlArgs) Read(iprot thrift.TProtocol) (err error) { @@ -1984,7 +2510,349 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlArgs[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CommonServiceGetHtmlArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetHtmlRequest() + if err := _field.Read(iprot); err != nil { + return err + } + p.Req = _field + return nil +} + +func (p *CommonServiceGetHtmlArgs) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("GetHtml_args"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CommonServiceGetHtmlArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError + } + if err := p.Req.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *CommonServiceGetHtmlArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CommonServiceGetHtmlArgs(%+v)", *p) + +} + +func (p *CommonServiceGetHtmlArgs) DeepEqual(ano *CommonServiceGetHtmlArgs) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field1DeepEqual(ano.Req) { + return false + } + return true +} + +func (p *CommonServiceGetHtmlArgs) Field1DeepEqual(src *GetHtmlRequest) bool { + + if !p.Req.DeepEqual(src) { + return false + } + return true +} + +type CommonServiceGetHtmlResult struct { + Success *GetHtmlResponse `thrift:"success,0,optional" frugal:"0,optional,GetHtmlResponse" json:"success,omitempty"` +} + +func NewCommonServiceGetHtmlResult() *CommonServiceGetHtmlResult { + return &CommonServiceGetHtmlResult{} +} + +func (p *CommonServiceGetHtmlResult) InitDefault() { +} + +var CommonServiceGetHtmlResult_Success_DEFAULT *GetHtmlResponse + +func (p *CommonServiceGetHtmlResult) GetSuccess() (v *GetHtmlResponse) { + if !p.IsSetSuccess() { + return CommonServiceGetHtmlResult_Success_DEFAULT + } + return p.Success +} +func (p *CommonServiceGetHtmlResult) SetSuccess(x interface{}) { + p.Success = x.(*GetHtmlResponse) +} + +var fieldIDToName_CommonServiceGetHtmlResult = map[int16]string{ + 0: "success", +} + +func (p *CommonServiceGetHtmlResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *CommonServiceGetHtmlResult) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField0(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlResult[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *CommonServiceGetHtmlResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetHtmlResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *CommonServiceGetHtmlResult) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("GetHtml_result"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *CommonServiceGetHtmlResult) writeField0(oprot thrift.TProtocol) (err error) { + if p.IsSetSuccess() { + if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { + goto WriteFieldBeginError + } + if err := p.Success.Write(oprot); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) +} + +func (p *CommonServiceGetHtmlResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CommonServiceGetHtmlResult(%+v)", *p) + +} + +func (p *CommonServiceGetHtmlResult) DeepEqual(ano *CommonServiceGetHtmlResult) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field0DeepEqual(ano.Success) { + return false + } + return true +} + +func (p *CommonServiceGetHtmlResult) Field0DeepEqual(src *GetHtmlResponse) bool { + + if !p.Success.DeepEqual(src) { + return false + } + return true +} + +type CommonServiceGetUserAgreementArgs struct { + Req *GetUserAgreementRequest `thrift:"req,1" frugal:"1,default,GetUserAgreementRequest" json:"req"` +} + +func NewCommonServiceGetUserAgreementArgs() *CommonServiceGetUserAgreementArgs { + return &CommonServiceGetUserAgreementArgs{} +} + +func (p *CommonServiceGetUserAgreementArgs) InitDefault() { +} + +var CommonServiceGetUserAgreementArgs_Req_DEFAULT *GetUserAgreementRequest + +func (p *CommonServiceGetUserAgreementArgs) GetReq() (v *GetUserAgreementRequest) { + if !p.IsSetReq() { + return CommonServiceGetUserAgreementArgs_Req_DEFAULT + } + return p.Req +} +func (p *CommonServiceGetUserAgreementArgs) SetReq(val *GetUserAgreementRequest) { + p.Req = val +} + +var fieldIDToName_CommonServiceGetUserAgreementArgs = map[int16]string{ + 1: "req", +} + +func (p *CommonServiceGetUserAgreementArgs) IsSetReq() bool { + return p.Req != nil +} + +func (p *CommonServiceGetUserAgreementArgs) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -1994,8 +2862,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetHtmlArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetHtmlRequest() +func (p *CommonServiceGetUserAgreementArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetUserAgreementRequest() if err := _field.Read(iprot); err != nil { return err } @@ -2003,9 +2871,10 @@ func (p *CommonServiceGetHtmlArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetHtmlArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetHtml_args"); err != nil { + if err = oprot.WriteStructBegin("GetUserAgreement_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -2031,7 +2900,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetHtmlArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -2048,15 +2917,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetHtmlArgs) String() string { +func (p *CommonServiceGetUserAgreementArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetHtmlArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetUserAgreementArgs(%+v)", *p) } -func (p *CommonServiceGetHtmlArgs) DeepEqual(ano *CommonServiceGetHtmlArgs) bool { +func (p *CommonServiceGetUserAgreementArgs) DeepEqual(ano *CommonServiceGetUserAgreementArgs) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -2068,7 +2937,7 @@ func (p *CommonServiceGetHtmlArgs) DeepEqual(ano *CommonServiceGetHtmlArgs) bool return true } -func (p *CommonServiceGetHtmlArgs) Field1DeepEqual(src *GetHtmlRequest) bool { +func (p *CommonServiceGetUserAgreementArgs) Field1DeepEqual(src *GetUserAgreementRequest) bool { if !p.Req.DeepEqual(src) { return false @@ -2076,38 +2945,38 @@ func (p *CommonServiceGetHtmlArgs) Field1DeepEqual(src *GetHtmlRequest) bool { return true } -type CommonServiceGetHtmlResult struct { - Success *GetHtmlResponse `thrift:"success,0,optional" frugal:"0,optional,GetHtmlResponse" json:"success,omitempty"` +type CommonServiceGetUserAgreementResult struct { + Success *GetUserAgreementResponse `thrift:"success,0,optional" frugal:"0,optional,GetUserAgreementResponse" json:"success,omitempty"` } -func NewCommonServiceGetHtmlResult() *CommonServiceGetHtmlResult { - return &CommonServiceGetHtmlResult{} +func NewCommonServiceGetUserAgreementResult() *CommonServiceGetUserAgreementResult { + return &CommonServiceGetUserAgreementResult{} } -func (p *CommonServiceGetHtmlResult) InitDefault() { +func (p *CommonServiceGetUserAgreementResult) InitDefault() { } -var CommonServiceGetHtmlResult_Success_DEFAULT *GetHtmlResponse +var CommonServiceGetUserAgreementResult_Success_DEFAULT *GetUserAgreementResponse -func (p *CommonServiceGetHtmlResult) GetSuccess() (v *GetHtmlResponse) { +func (p *CommonServiceGetUserAgreementResult) GetSuccess() (v *GetUserAgreementResponse) { if !p.IsSetSuccess() { - return CommonServiceGetHtmlResult_Success_DEFAULT + return CommonServiceGetUserAgreementResult_Success_DEFAULT } return p.Success } -func (p *CommonServiceGetHtmlResult) SetSuccess(x interface{}) { - p.Success = x.(*GetHtmlResponse) +func (p *CommonServiceGetUserAgreementResult) SetSuccess(x interface{}) { + p.Success = x.(*GetUserAgreementResponse) } -var fieldIDToName_CommonServiceGetHtmlResult = map[int16]string{ +var fieldIDToName_CommonServiceGetUserAgreementResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetHtmlResult) IsSetSuccess() bool { +func (p *CommonServiceGetUserAgreementResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetHtmlResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -2153,7 +3022,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetHtmlResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -2163,8 +3032,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetHtmlResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetHtmlResponse() +func (p *CommonServiceGetUserAgreementResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetUserAgreementResponse() if err := _field.Read(iprot); err != nil { return err } @@ -2172,9 +3041,10 @@ func (p *CommonServiceGetHtmlResult) ReadField0(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetHtmlResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetHtml_result"); err != nil { + if err = oprot.WriteStructBegin("GetUserAgreement_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -2200,7 +3070,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetHtmlResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetUserAgreementResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -2219,15 +3089,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetHtmlResult) String() string { +func (p *CommonServiceGetUserAgreementResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetHtmlResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetUserAgreementResult(%+v)", *p) } -func (p *CommonServiceGetHtmlResult) DeepEqual(ano *CommonServiceGetHtmlResult) bool { +func (p *CommonServiceGetUserAgreementResult) DeepEqual(ano *CommonServiceGetUserAgreementResult) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -2239,7 +3109,7 @@ func (p *CommonServiceGetHtmlResult) DeepEqual(ano *CommonServiceGetHtmlResult) return true } -func (p *CommonServiceGetHtmlResult) Field0DeepEqual(src *GetHtmlResponse) bool { +func (p *CommonServiceGetUserAgreementResult) Field0DeepEqual(src *GetUserAgreementResponse) bool { if !p.Success.DeepEqual(src) { return false @@ -2247,38 +3117,38 @@ func (p *CommonServiceGetHtmlResult) Field0DeepEqual(src *GetHtmlResponse) bool return true } -type CommonServiceGetUserAgreementArgs struct { - Req *GetUserAgreementRequest `thrift:"req,1" frugal:"1,default,GetUserAgreementRequest" json:"req"` +type CommonServiceGetTermsListArgs struct { + Req *TermListRequest `thrift:"req,1" frugal:"1,default,TermListRequest" json:"req"` } -func NewCommonServiceGetUserAgreementArgs() *CommonServiceGetUserAgreementArgs { - return &CommonServiceGetUserAgreementArgs{} +func NewCommonServiceGetTermsListArgs() *CommonServiceGetTermsListArgs { + return &CommonServiceGetTermsListArgs{} } -func (p *CommonServiceGetUserAgreementArgs) InitDefault() { +func (p *CommonServiceGetTermsListArgs) InitDefault() { } -var CommonServiceGetUserAgreementArgs_Req_DEFAULT *GetUserAgreementRequest +var CommonServiceGetTermsListArgs_Req_DEFAULT *TermListRequest -func (p *CommonServiceGetUserAgreementArgs) GetReq() (v *GetUserAgreementRequest) { +func (p *CommonServiceGetTermsListArgs) GetReq() (v *TermListRequest) { if !p.IsSetReq() { - return CommonServiceGetUserAgreementArgs_Req_DEFAULT + return CommonServiceGetTermsListArgs_Req_DEFAULT } return p.Req } -func (p *CommonServiceGetUserAgreementArgs) SetReq(val *GetUserAgreementRequest) { +func (p *CommonServiceGetTermsListArgs) SetReq(val *TermListRequest) { p.Req = val } -var fieldIDToName_CommonServiceGetUserAgreementArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetTermsListArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetUserAgreementArgs) IsSetReq() bool { +func (p *CommonServiceGetTermsListArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetUserAgreementArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -2324,7 +3194,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -2334,8 +3204,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetUserAgreementRequest() +func (p *CommonServiceGetTermsListArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewTermListRequest() if err := _field.Read(iprot); err != nil { return err } @@ -2343,9 +3213,10 @@ func (p *CommonServiceGetUserAgreementArgs) ReadField1(iprot thrift.TProtocol) e return nil } -func (p *CommonServiceGetUserAgreementArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetUserAgreement_args"); err != nil { + if err = oprot.WriteStructBegin("GetTermsList_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -2371,7 +3242,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -2388,15 +3259,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetUserAgreementArgs) String() string { +func (p *CommonServiceGetTermsListArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetUserAgreementArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermsListArgs(%+v)", *p) } -func (p *CommonServiceGetUserAgreementArgs) DeepEqual(ano *CommonServiceGetUserAgreementArgs) bool { +func (p *CommonServiceGetTermsListArgs) DeepEqual(ano *CommonServiceGetTermsListArgs) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -2408,7 +3279,7 @@ func (p *CommonServiceGetUserAgreementArgs) DeepEqual(ano *CommonServiceGetUserA return true } -func (p *CommonServiceGetUserAgreementArgs) Field1DeepEqual(src *GetUserAgreementRequest) bool { +func (p *CommonServiceGetTermsListArgs) Field1DeepEqual(src *TermListRequest) bool { if !p.Req.DeepEqual(src) { return false @@ -2416,38 +3287,38 @@ func (p *CommonServiceGetUserAgreementArgs) Field1DeepEqual(src *GetUserAgreemen return true } -type CommonServiceGetUserAgreementResult struct { - Success *GetUserAgreementResponse `thrift:"success,0,optional" frugal:"0,optional,GetUserAgreementResponse" json:"success,omitempty"` +type CommonServiceGetTermsListResult struct { + Success *TermListResponse `thrift:"success,0,optional" frugal:"0,optional,TermListResponse" json:"success,omitempty"` } -func NewCommonServiceGetUserAgreementResult() *CommonServiceGetUserAgreementResult { - return &CommonServiceGetUserAgreementResult{} +func NewCommonServiceGetTermsListResult() *CommonServiceGetTermsListResult { + return &CommonServiceGetTermsListResult{} } -func (p *CommonServiceGetUserAgreementResult) InitDefault() { +func (p *CommonServiceGetTermsListResult) InitDefault() { } -var CommonServiceGetUserAgreementResult_Success_DEFAULT *GetUserAgreementResponse +var CommonServiceGetTermsListResult_Success_DEFAULT *TermListResponse -func (p *CommonServiceGetUserAgreementResult) GetSuccess() (v *GetUserAgreementResponse) { +func (p *CommonServiceGetTermsListResult) GetSuccess() (v *TermListResponse) { if !p.IsSetSuccess() { - return CommonServiceGetUserAgreementResult_Success_DEFAULT + return CommonServiceGetTermsListResult_Success_DEFAULT } return p.Success } -func (p *CommonServiceGetUserAgreementResult) SetSuccess(x interface{}) { - p.Success = x.(*GetUserAgreementResponse) +func (p *CommonServiceGetTermsListResult) SetSuccess(x interface{}) { + p.Success = x.(*TermListResponse) } -var fieldIDToName_CommonServiceGetUserAgreementResult = map[int16]string{ +var fieldIDToName_CommonServiceGetTermsListResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetUserAgreementResult) IsSetSuccess() bool { +func (p *CommonServiceGetTermsListResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetUserAgreementResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -2493,7 +3364,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetUserAgreementResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -2503,8 +3374,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetUserAgreementResponse() +func (p *CommonServiceGetTermsListResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewTermListResponse() if err := _field.Read(iprot); err != nil { return err } @@ -2512,9 +3383,10 @@ func (p *CommonServiceGetUserAgreementResult) ReadField0(iprot thrift.TProtocol) return nil } -func (p *CommonServiceGetUserAgreementResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetUserAgreement_result"); err != nil { + if err = oprot.WriteStructBegin("GetTermsList_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -2540,7 +3412,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetUserAgreementResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermsListResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -2559,15 +3431,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetUserAgreementResult) String() string { +func (p *CommonServiceGetTermsListResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetUserAgreementResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermsListResult(%+v)", *p) } -func (p *CommonServiceGetUserAgreementResult) DeepEqual(ano *CommonServiceGetUserAgreementResult) bool { +func (p *CommonServiceGetTermsListResult) DeepEqual(ano *CommonServiceGetTermsListResult) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -2579,7 +3451,7 @@ func (p *CommonServiceGetUserAgreementResult) DeepEqual(ano *CommonServiceGetUse return true } -func (p *CommonServiceGetUserAgreementResult) Field0DeepEqual(src *GetUserAgreementResponse) bool { +func (p *CommonServiceGetTermsListResult) Field0DeepEqual(src *TermListResponse) bool { if !p.Success.DeepEqual(src) { return false @@ -2587,38 +3459,38 @@ func (p *CommonServiceGetUserAgreementResult) Field0DeepEqual(src *GetUserAgreem return true } -type CommonServiceGetTermsListArgs struct { - Req *TermListRequest `thrift:"req,1" frugal:"1,default,TermListRequest" json:"req"` +type CommonServiceGetTermArgs struct { + Req *TermRequest `thrift:"req,1" frugal:"1,default,TermRequest" json:"req"` } -func NewCommonServiceGetTermsListArgs() *CommonServiceGetTermsListArgs { - return &CommonServiceGetTermsListArgs{} +func NewCommonServiceGetTermArgs() *CommonServiceGetTermArgs { + return &CommonServiceGetTermArgs{} } -func (p *CommonServiceGetTermsListArgs) InitDefault() { +func (p *CommonServiceGetTermArgs) InitDefault() { } -var CommonServiceGetTermsListArgs_Req_DEFAULT *TermListRequest +var CommonServiceGetTermArgs_Req_DEFAULT *TermRequest -func (p *CommonServiceGetTermsListArgs) GetReq() (v *TermListRequest) { +func (p *CommonServiceGetTermArgs) GetReq() (v *TermRequest) { if !p.IsSetReq() { - return CommonServiceGetTermsListArgs_Req_DEFAULT + return CommonServiceGetTermArgs_Req_DEFAULT } return p.Req } -func (p *CommonServiceGetTermsListArgs) SetReq(val *TermListRequest) { +func (p *CommonServiceGetTermArgs) SetReq(val *TermRequest) { p.Req = val } -var fieldIDToName_CommonServiceGetTermsListArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetTermArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetTermsListArgs) IsSetReq() bool { +func (p *CommonServiceGetTermArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetTermsListArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -2664,7 +3536,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -2674,8 +3546,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermsListArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewTermListRequest() +func (p *CommonServiceGetTermArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewTermRequest() if err := _field.Read(iprot); err != nil { return err } @@ -2683,9 +3555,10 @@ func (p *CommonServiceGetTermsListArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *CommonServiceGetTermsListArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetTermsList_args"); err != nil { + if err = oprot.WriteStructBegin("GetTerm_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -2711,7 +3584,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermsListArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -2728,15 +3601,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetTermsListArgs) String() string { +func (p *CommonServiceGetTermArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermsListArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermArgs(%+v)", *p) } -func (p *CommonServiceGetTermsListArgs) DeepEqual(ano *CommonServiceGetTermsListArgs) bool { +func (p *CommonServiceGetTermArgs) DeepEqual(ano *CommonServiceGetTermArgs) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -2748,7 +3621,7 @@ func (p *CommonServiceGetTermsListArgs) DeepEqual(ano *CommonServiceGetTermsList return true } -func (p *CommonServiceGetTermsListArgs) Field1DeepEqual(src *TermListRequest) bool { +func (p *CommonServiceGetTermArgs) Field1DeepEqual(src *TermRequest) bool { if !p.Req.DeepEqual(src) { return false @@ -2756,38 +3629,38 @@ func (p *CommonServiceGetTermsListArgs) Field1DeepEqual(src *TermListRequest) bo return true } -type CommonServiceGetTermsListResult struct { - Success *TermListResponse `thrift:"success,0,optional" frugal:"0,optional,TermListResponse" json:"success,omitempty"` +type CommonServiceGetTermResult struct { + Success *TermResponse `thrift:"success,0,optional" frugal:"0,optional,TermResponse" json:"success,omitempty"` } -func NewCommonServiceGetTermsListResult() *CommonServiceGetTermsListResult { - return &CommonServiceGetTermsListResult{} +func NewCommonServiceGetTermResult() *CommonServiceGetTermResult { + return &CommonServiceGetTermResult{} } -func (p *CommonServiceGetTermsListResult) InitDefault() { +func (p *CommonServiceGetTermResult) InitDefault() { } -var CommonServiceGetTermsListResult_Success_DEFAULT *TermListResponse +var CommonServiceGetTermResult_Success_DEFAULT *TermResponse -func (p *CommonServiceGetTermsListResult) GetSuccess() (v *TermListResponse) { +func (p *CommonServiceGetTermResult) GetSuccess() (v *TermResponse) { if !p.IsSetSuccess() { - return CommonServiceGetTermsListResult_Success_DEFAULT + return CommonServiceGetTermResult_Success_DEFAULT } return p.Success } -func (p *CommonServiceGetTermsListResult) SetSuccess(x interface{}) { - p.Success = x.(*TermListResponse) +func (p *CommonServiceGetTermResult) SetSuccess(x interface{}) { + p.Success = x.(*TermResponse) } -var fieldIDToName_CommonServiceGetTermsListResult = map[int16]string{ +var fieldIDToName_CommonServiceGetTermResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetTermsListResult) IsSetSuccess() bool { +func (p *CommonServiceGetTermResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetTermsListResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -2833,7 +3706,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermsListResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -2843,8 +3716,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermsListResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewTermListResponse() +func (p *CommonServiceGetTermResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewTermResponse() if err := _field.Read(iprot); err != nil { return err } @@ -2852,9 +3725,10 @@ func (p *CommonServiceGetTermsListResult) ReadField0(iprot thrift.TProtocol) err return nil } -func (p *CommonServiceGetTermsListResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetTermsList_result"); err != nil { + if err = oprot.WriteStructBegin("GetTerm_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -2880,7 +3754,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermsListResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetTermResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -2899,15 +3773,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetTermsListResult) String() string { +func (p *CommonServiceGetTermResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermsListResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetTermResult(%+v)", *p) } -func (p *CommonServiceGetTermsListResult) DeepEqual(ano *CommonServiceGetTermsListResult) bool { +func (p *CommonServiceGetTermResult) DeepEqual(ano *CommonServiceGetTermResult) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -2919,7 +3793,7 @@ func (p *CommonServiceGetTermsListResult) DeepEqual(ano *CommonServiceGetTermsLi return true } -func (p *CommonServiceGetTermsListResult) Field0DeepEqual(src *TermListResponse) bool { +func (p *CommonServiceGetTermResult) Field0DeepEqual(src *TermResponse) bool { if !p.Success.DeepEqual(src) { return false @@ -2927,38 +3801,38 @@ func (p *CommonServiceGetTermsListResult) Field0DeepEqual(src *TermListResponse) return true } -type CommonServiceGetTermArgs struct { - Req *TermRequest `thrift:"req,1" frugal:"1,default,TermRequest" json:"req"` +type CommonServiceGetNoticesArgs struct { + Req *NoticeRequest `thrift:"req,1" frugal:"1,default,NoticeRequest" json:"req"` } -func NewCommonServiceGetTermArgs() *CommonServiceGetTermArgs { - return &CommonServiceGetTermArgs{} +func NewCommonServiceGetNoticesArgs() *CommonServiceGetNoticesArgs { + return &CommonServiceGetNoticesArgs{} } -func (p *CommonServiceGetTermArgs) InitDefault() { +func (p *CommonServiceGetNoticesArgs) InitDefault() { } -var CommonServiceGetTermArgs_Req_DEFAULT *TermRequest +var CommonServiceGetNoticesArgs_Req_DEFAULT *NoticeRequest -func (p *CommonServiceGetTermArgs) GetReq() (v *TermRequest) { +func (p *CommonServiceGetNoticesArgs) GetReq() (v *NoticeRequest) { if !p.IsSetReq() { - return CommonServiceGetTermArgs_Req_DEFAULT + return CommonServiceGetNoticesArgs_Req_DEFAULT } return p.Req } -func (p *CommonServiceGetTermArgs) SetReq(val *TermRequest) { +func (p *CommonServiceGetNoticesArgs) SetReq(val *NoticeRequest) { p.Req = val } -var fieldIDToName_CommonServiceGetTermArgs = map[int16]string{ +var fieldIDToName_CommonServiceGetNoticesArgs = map[int16]string{ 1: "req", } -func (p *CommonServiceGetTermArgs) IsSetReq() bool { +func (p *CommonServiceGetNoticesArgs) IsSetReq() bool { return p.Req != nil } -func (p *CommonServiceGetTermArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticesArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -3004,7 +3878,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetNoticesArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -3014,8 +3888,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewTermRequest() +func (p *CommonServiceGetNoticesArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewNoticeRequest() if err := _field.Read(iprot); err != nil { return err } @@ -3023,9 +3897,10 @@ func (p *CommonServiceGetTermArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetTermArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticesArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetTerm_args"); err != nil { + if err = oprot.WriteStructBegin("GetNotices_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -3051,7 +3926,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticesArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -3068,15 +3943,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CommonServiceGetTermArgs) String() string { +func (p *CommonServiceGetNoticesArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermArgs(%+v)", *p) + return fmt.Sprintf("CommonServiceGetNoticesArgs(%+v)", *p) } -func (p *CommonServiceGetTermArgs) DeepEqual(ano *CommonServiceGetTermArgs) bool { +func (p *CommonServiceGetNoticesArgs) DeepEqual(ano *CommonServiceGetNoticesArgs) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -3088,7 +3963,7 @@ func (p *CommonServiceGetTermArgs) DeepEqual(ano *CommonServiceGetTermArgs) bool return true } -func (p *CommonServiceGetTermArgs) Field1DeepEqual(src *TermRequest) bool { +func (p *CommonServiceGetNoticesArgs) Field1DeepEqual(src *NoticeRequest) bool { if !p.Req.DeepEqual(src) { return false @@ -3096,38 +3971,38 @@ func (p *CommonServiceGetTermArgs) Field1DeepEqual(src *TermRequest) bool { return true } -type CommonServiceGetTermResult struct { - Success *TermResponse `thrift:"success,0,optional" frugal:"0,optional,TermResponse" json:"success,omitempty"` +type CommonServiceGetNoticesResult struct { + Success *NoticeResponse `thrift:"success,0,optional" frugal:"0,optional,NoticeResponse" json:"success,omitempty"` } -func NewCommonServiceGetTermResult() *CommonServiceGetTermResult { - return &CommonServiceGetTermResult{} +func NewCommonServiceGetNoticesResult() *CommonServiceGetNoticesResult { + return &CommonServiceGetNoticesResult{} } -func (p *CommonServiceGetTermResult) InitDefault() { +func (p *CommonServiceGetNoticesResult) InitDefault() { } -var CommonServiceGetTermResult_Success_DEFAULT *TermResponse +var CommonServiceGetNoticesResult_Success_DEFAULT *NoticeResponse -func (p *CommonServiceGetTermResult) GetSuccess() (v *TermResponse) { +func (p *CommonServiceGetNoticesResult) GetSuccess() (v *NoticeResponse) { if !p.IsSetSuccess() { - return CommonServiceGetTermResult_Success_DEFAULT + return CommonServiceGetNoticesResult_Success_DEFAULT } return p.Success } -func (p *CommonServiceGetTermResult) SetSuccess(x interface{}) { - p.Success = x.(*TermResponse) +func (p *CommonServiceGetNoticesResult) SetSuccess(x interface{}) { + p.Success = x.(*NoticeResponse) } -var fieldIDToName_CommonServiceGetTermResult = map[int16]string{ +var fieldIDToName_CommonServiceGetNoticesResult = map[int16]string{ 0: "success", } -func (p *CommonServiceGetTermResult) IsSetSuccess() bool { +func (p *CommonServiceGetNoticesResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CommonServiceGetTermResult) Read(iprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticesResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -3173,7 +4048,7 @@ ReadStructBeginError: ReadFieldBeginError: return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) ReadFieldError: - return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetTermResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetNoticesResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -3183,8 +4058,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CommonServiceGetTermResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewTermResponse() +func (p *CommonServiceGetNoticesResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewNoticeResponse() if err := _field.Read(iprot); err != nil { return err } @@ -3192,9 +4067,10 @@ func (p *CommonServiceGetTermResult) ReadField0(iprot thrift.TProtocol) error { return nil } -func (p *CommonServiceGetTermResult) Write(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticesResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 - if err = oprot.WriteStructBegin("GetTerm_result"); err != nil { + if err = oprot.WriteStructBegin("GetNotices_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -3220,7 +4096,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CommonServiceGetTermResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *CommonServiceGetNoticesResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -3239,15 +4115,15 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CommonServiceGetTermResult) String() string { +func (p *CommonServiceGetNoticesResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CommonServiceGetTermResult(%+v)", *p) + return fmt.Sprintf("CommonServiceGetNoticesResult(%+v)", *p) } -func (p *CommonServiceGetTermResult) DeepEqual(ano *CommonServiceGetTermResult) bool { +func (p *CommonServiceGetNoticesResult) DeepEqual(ano *CommonServiceGetNoticesResult) bool { if p == ano { return true } else if p == nil || ano == nil { @@ -3259,7 +4135,7 @@ func (p *CommonServiceGetTermResult) DeepEqual(ano *CommonServiceGetTermResult) return true } -func (p *CommonServiceGetTermResult) Field0DeepEqual(src *TermResponse) bool { +func (p *CommonServiceGetNoticesResult) Field0DeepEqual(src *NoticeResponse) bool { if !p.Success.DeepEqual(src) { return false diff --git a/kitex_gen/common/commonservice/client.go b/kitex_gen/common/commonservice/client.go index 7cbac5cb..581d2461 100644 --- a/kitex_gen/common/commonservice/client.go +++ b/kitex_gen/common/commonservice/client.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by Kitex v0.11.3. DO NOT EDIT. +// Code generated by Kitex v0.12.1. DO NOT EDIT. package commonservice @@ -34,6 +34,7 @@ type Client interface { GetUserAgreement(ctx context.Context, req *common.GetUserAgreementRequest, callOptions ...callopt.Option) (r *common.GetUserAgreementResponse, err error) GetTermsList(ctx context.Context, req *common.TermListRequest, callOptions ...callopt.Option) (r *common.TermListResponse, err error) GetTerm(ctx context.Context, req *common.TermRequest, callOptions ...callopt.Option) (r *common.TermResponse, err error) + GetNotices(ctx context.Context, req *common.NoticeRequest, callOptions ...callopt.Option) (r *common.NoticeResponse, err error) } // NewClient creates a client for the service defined in IDL. @@ -89,3 +90,8 @@ func (p *kCommonServiceClient) GetTerm(ctx context.Context, req *common.TermRequ ctx = client.NewCtxWithCallOptions(ctx, callOptions) return p.kClient.GetTerm(ctx, req) } + +func (p *kCommonServiceClient) GetNotices(ctx context.Context, req *common.NoticeRequest, callOptions ...callopt.Option) (r *common.NoticeResponse, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.GetNotices(ctx, req) +} diff --git a/kitex_gen/common/commonservice/commonservice.go b/kitex_gen/common/commonservice/commonservice.go index 1bcbf189..90ac80cd 100644 --- a/kitex_gen/common/commonservice/commonservice.go +++ b/kitex_gen/common/commonservice/commonservice.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by Kitex v0.11.3. DO NOT EDIT. +// Code generated by Kitex v0.12.1. DO NOT EDIT. package commonservice @@ -66,6 +66,13 @@ var serviceMethods = map[string]kitex.MethodInfo{ false, kitex.WithStreamingMode(kitex.StreamingNone), ), + "GetNotices": kitex.NewMethodInfo( + getNoticesHandler, + newCommonServiceGetNoticesArgs, + newCommonServiceGetNoticesResult, + false, + kitex.WithStreamingMode(kitex.StreamingNone), + ), } var ( @@ -126,7 +133,7 @@ func newServiceInfo(hasStreaming bool, keepStreamingMethods bool, keepNonStreami HandlerType: handlerType, Methods: methods, PayloadCodec: kitex.Thrift, - KiteXGenVersion: "v0.11.3", + KiteXGenVersion: "v0.12.1", Extra: extra, } return svcInfo @@ -222,6 +229,24 @@ func newCommonServiceGetTermResult() interface{} { return common.NewCommonServiceGetTermResult() } +func getNoticesHandler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*common.CommonServiceGetNoticesArgs) + realResult := result.(*common.CommonServiceGetNoticesResult) + success, err := handler.(common.CommonService).GetNotices(ctx, realArg.Req) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newCommonServiceGetNoticesArgs() interface{} { + return common.NewCommonServiceGetNoticesArgs() +} + +func newCommonServiceGetNoticesResult() interface{} { + return common.NewCommonServiceGetNoticesResult() +} + type kClient struct { c client.Client } @@ -281,3 +306,13 @@ func (p *kClient) GetTerm(ctx context.Context, req *common.TermRequest) (r *comm } return _result.GetSuccess(), nil } + +func (p *kClient) GetNotices(ctx context.Context, req *common.NoticeRequest) (r *common.NoticeResponse, err error) { + var _args common.CommonServiceGetNoticesArgs + _args.Req = req + var _result common.CommonServiceGetNoticesResult + if err = p.c.Call(ctx, "GetNotices", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} diff --git a/kitex_gen/common/commonservice/server.go b/kitex_gen/common/commonservice/server.go index db4c3e91..5662ef07 100644 --- a/kitex_gen/common/commonservice/server.go +++ b/kitex_gen/common/commonservice/server.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by Kitex v0.11.3. DO NOT EDIT. +// Code generated by Kitex v0.12.1. DO NOT EDIT. package commonservice import ( diff --git a/kitex_gen/common/k-common.go b/kitex_gen/common/k-common.go index 8abd2bbd..9b18367c 100644 --- a/kitex_gen/common/k-common.go +++ b/kitex_gen/common/k-common.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by Kitex v0.11.3. DO NOT EDIT. +// Code generated by Kitex v0.12.1. DO NOT EDIT. package common @@ -43,6 +43,7 @@ var ( ) func (p *GetCSSRequest) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -71,9 +72,8 @@ SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) } -// for compatibility func (p *GetCSSRequest) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *GetCSSRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -93,6 +93,7 @@ func (p *GetCSSRequest) BLength() int { } func (p *GetCSSResponse) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -155,9 +156,8 @@ func (p *GetCSSResponse) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *GetCSSResponse) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *GetCSSResponse) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -193,6 +193,7 @@ func (p *GetCSSResponse) field1Length() int { } func (p *GetHtmlRequest) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -221,9 +222,8 @@ SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) } -// for compatibility func (p *GetHtmlRequest) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *GetHtmlRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -243,6 +243,7 @@ func (p *GetHtmlRequest) BLength() int { } func (p *GetHtmlResponse) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -305,9 +306,8 @@ func (p *GetHtmlResponse) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *GetHtmlResponse) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *GetHtmlResponse) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -343,6 +343,7 @@ func (p *GetHtmlResponse) field1Length() int { } func (p *GetUserAgreementRequest) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -371,9 +372,8 @@ SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) } -// for compatibility func (p *GetUserAgreementRequest) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *GetUserAgreementRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -393,6 +393,7 @@ func (p *GetUserAgreementRequest) BLength() int { } func (p *GetUserAgreementResponse) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -455,9 +456,8 @@ func (p *GetUserAgreementResponse) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *GetUserAgreementResponse) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *GetUserAgreementResponse) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -493,6 +493,7 @@ func (p *GetUserAgreementResponse) field1Length() int { } func (p *TermRequest) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -562,9 +563,8 @@ func (p *TermRequest) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *TermRequest) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *TermRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -600,6 +600,7 @@ func (p *TermRequest) field1Length() int { } func (p *TermResponse) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -700,9 +701,8 @@ func (p *TermResponse) FastReadField2(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *TermResponse) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *TermResponse) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -754,6 +754,7 @@ func (p *TermResponse) field2Length() int { } func (p *TermListRequest) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -782,9 +783,8 @@ SkipFieldError: return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) } -// for compatibility func (p *TermListRequest) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *TermListRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -804,6 +804,7 @@ func (p *TermListRequest) BLength() int { } func (p *TermListResponse) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -904,9 +905,8 @@ func (p *TermListResponse) FastReadField2(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *TermListResponse) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *TermListResponse) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -957,7 +957,341 @@ func (p *TermListResponse) field2Length() int { return l } +func (p *NoticeRequest) FastRead(buf []byte) (int, error) { + + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + var issetPageNum bool = false + for { + fieldTypeId, fieldId, l, err = thrift.Binary.ReadFieldBegin(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if fieldTypeId == thrift.I64 { + l, err = p.FastReadField1(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + issetPageNum = true + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + default: + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + } + + if !issetPageNum { + fieldId = 1 + goto RequiredFieldNotSetError + } + return offset, nil +ReadFieldBeginError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeRequest[fieldId]), err) +SkipFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +RequiredFieldNotSetError: + return offset, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_NoticeRequest[fieldId])) +} + +func (p *NoticeRequest) FastReadField1(buf []byte) (int, error) { + offset := 0 + + var _field int64 + if v, l, err := thrift.Binary.ReadI64(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _field = v + } + p.PageNum = _field + return offset, nil +} + +func (p *NoticeRequest) FastWrite(buf []byte) int { + return p.FastWriteNocopy(buf, nil) +} + +func (p *NoticeRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p != nil { + offset += p.fastWriteField1(buf[offset:], w) + } + offset += thrift.Binary.WriteFieldStop(buf[offset:]) + return offset +} + +func (p *NoticeRequest) BLength() int { + l := 0 + if p != nil { + l += p.field1Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *NoticeRequest) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.I64, 1) + offset += thrift.Binary.WriteI64(buf[offset:], p.PageNum) + return offset +} + +func (p *NoticeRequest) field1Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.I64Length() + return l +} + +func (p *NoticeResponse) FastRead(buf []byte) (int, error) { + + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + var issetBase bool = false + var issetTotal bool = false + for { + fieldTypeId, fieldId, l, err = thrift.Binary.ReadFieldBegin(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + l, err = p.FastReadField1(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + issetBase = true + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + case 2: + if fieldTypeId == thrift.LIST { + l, err = p.FastReadField2(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + case 3: + if fieldTypeId == thrift.I64 { + l, err = p.FastReadField3(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + issetTotal = true + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + default: + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + } + + if !issetBase { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetTotal { + fieldId = 3 + goto RequiredFieldNotSetError + } + return offset, nil +ReadFieldBeginError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeResponse[fieldId]), err) +SkipFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +RequiredFieldNotSetError: + return offset, thrift.NewProtocolException(thrift.INVALID_DATA, fmt.Sprintf("required field %s is not set", fieldIDToName_NoticeResponse[fieldId])) +} + +func (p *NoticeResponse) FastReadField1(buf []byte) (int, error) { + offset := 0 + _field := model.NewBaseResp() + if l, err := _field.FastRead(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + } + p.Base = _field + return offset, nil +} + +func (p *NoticeResponse) FastReadField2(buf []byte) (int, error) { + offset := 0 + + _, size, l, err := thrift.Binary.ReadListBegin(buf[offset:]) + offset += l + if err != nil { + return offset, err + } + _field := make([]*model.NoticeInfo, 0, size) + values := make([]model.NoticeInfo, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() + if l, err := _elem.FastRead(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + } + + _field = append(_field, _elem) + } + p.Notices = _field + return offset, nil +} + +func (p *NoticeResponse) FastReadField3(buf []byte) (int, error) { + offset := 0 + + var _field int64 + if v, l, err := thrift.Binary.ReadI64(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _field = v + } + p.Total = _field + return offset, nil +} + +func (p *NoticeResponse) FastWrite(buf []byte) int { + return p.FastWriteNocopy(buf, nil) +} + +func (p *NoticeResponse) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p != nil { + offset += p.fastWriteField3(buf[offset:], w) + offset += p.fastWriteField1(buf[offset:], w) + offset += p.fastWriteField2(buf[offset:], w) + } + offset += thrift.Binary.WriteFieldStop(buf[offset:]) + return offset +} + +func (p *NoticeResponse) BLength() int { + l := 0 + if p != nil { + l += p.field1Length() + l += p.field2Length() + l += p.field3Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *NoticeResponse) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRUCT, 1) + offset += p.Base.FastWriteNocopy(buf[offset:], w) + return offset +} + +func (p *NoticeResponse) fastWriteField2(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p.IsSetNotices() { + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.LIST, 2) + listBeginOffset := offset + offset += thrift.Binary.ListBeginLength() + var length int + for _, v := range p.Notices { + length++ + offset += v.FastWriteNocopy(buf[offset:], w) + } + thrift.Binary.WriteListBegin(buf[listBeginOffset:], thrift.STRUCT, length) + } + return offset +} + +func (p *NoticeResponse) fastWriteField3(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.I64, 3) + offset += thrift.Binary.WriteI64(buf[offset:], p.Total) + return offset +} + +func (p *NoticeResponse) field1Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += p.Base.BLength() + return l +} + +func (p *NoticeResponse) field2Length() int { + l := 0 + if p.IsSetNotices() { + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.ListBeginLength() + for _, v := range p.Notices { + _ = v + l += v.BLength() + } + } + return l +} + +func (p *NoticeResponse) field3Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.I64Length() + return l +} + func (p *CommonServiceGetCSSArgs) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1017,9 +1351,8 @@ func (p *CommonServiceGetCSSArgs) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *CommonServiceGetCSSArgs) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetCSSArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1055,6 +1388,7 @@ func (p *CommonServiceGetCSSArgs) field1Length() int { } func (p *CommonServiceGetCSSResult) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1114,9 +1448,8 @@ func (p *CommonServiceGetCSSResult) FastReadField0(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *CommonServiceGetCSSResult) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetCSSResult) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1156,6 +1489,7 @@ func (p *CommonServiceGetCSSResult) field0Length() int { } func (p *CommonServiceGetHtmlArgs) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1215,9 +1549,8 @@ func (p *CommonServiceGetHtmlArgs) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *CommonServiceGetHtmlArgs) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetHtmlArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1253,6 +1586,7 @@ func (p *CommonServiceGetHtmlArgs) field1Length() int { } func (p *CommonServiceGetHtmlResult) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1312,9 +1646,8 @@ func (p *CommonServiceGetHtmlResult) FastReadField0(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *CommonServiceGetHtmlResult) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetHtmlResult) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1354,6 +1687,7 @@ func (p *CommonServiceGetHtmlResult) field0Length() int { } func (p *CommonServiceGetUserAgreementArgs) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1413,9 +1747,8 @@ func (p *CommonServiceGetUserAgreementArgs) FastReadField1(buf []byte) (int, err return offset, nil } -// for compatibility func (p *CommonServiceGetUserAgreementArgs) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetUserAgreementArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1451,6 +1784,7 @@ func (p *CommonServiceGetUserAgreementArgs) field1Length() int { } func (p *CommonServiceGetUserAgreementResult) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1510,9 +1844,8 @@ func (p *CommonServiceGetUserAgreementResult) FastReadField0(buf []byte) (int, e return offset, nil } -// for compatibility func (p *CommonServiceGetUserAgreementResult) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetUserAgreementResult) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1552,6 +1885,7 @@ func (p *CommonServiceGetUserAgreementResult) field0Length() int { } func (p *CommonServiceGetTermsListArgs) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1611,9 +1945,8 @@ func (p *CommonServiceGetTermsListArgs) FastReadField1(buf []byte) (int, error) return offset, nil } -// for compatibility func (p *CommonServiceGetTermsListArgs) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetTermsListArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1649,6 +1982,7 @@ func (p *CommonServiceGetTermsListArgs) field1Length() int { } func (p *CommonServiceGetTermsListResult) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1708,9 +2042,8 @@ func (p *CommonServiceGetTermsListResult) FastReadField0(buf []byte) (int, error return offset, nil } -// for compatibility func (p *CommonServiceGetTermsListResult) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetTermsListResult) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1750,6 +2083,7 @@ func (p *CommonServiceGetTermsListResult) field0Length() int { } func (p *CommonServiceGetTermArgs) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1809,9 +2143,8 @@ func (p *CommonServiceGetTermArgs) FastReadField1(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *CommonServiceGetTermArgs) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetTermArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1847,6 +2180,7 @@ func (p *CommonServiceGetTermArgs) field1Length() int { } func (p *CommonServiceGetTermResult) FastRead(buf []byte) (int, error) { + var err error var offset int var l int @@ -1906,9 +2240,8 @@ func (p *CommonServiceGetTermResult) FastReadField0(buf []byte) (int, error) { return offset, nil } -// for compatibility func (p *CommonServiceGetTermResult) FastWrite(buf []byte) int { - return 0 + return p.FastWriteNocopy(buf, nil) } func (p *CommonServiceGetTermResult) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { @@ -1947,6 +2280,204 @@ func (p *CommonServiceGetTermResult) field0Length() int { return l } +func (p *CommonServiceGetNoticesArgs) FastRead(buf []byte) (int, error) { + + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + for { + fieldTypeId, fieldId, l, err = thrift.Binary.ReadFieldBegin(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + l, err = p.FastReadField1(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + default: + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + } + + return offset, nil +ReadFieldBeginError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetNoticesArgs[fieldId]), err) +SkipFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +} + +func (p *CommonServiceGetNoticesArgs) FastReadField1(buf []byte) (int, error) { + offset := 0 + _field := NewNoticeRequest() + if l, err := _field.FastRead(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + } + p.Req = _field + return offset, nil +} + +func (p *CommonServiceGetNoticesArgs) FastWrite(buf []byte) int { + return p.FastWriteNocopy(buf, nil) +} + +func (p *CommonServiceGetNoticesArgs) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p != nil { + offset += p.fastWriteField1(buf[offset:], w) + } + offset += thrift.Binary.WriteFieldStop(buf[offset:]) + return offset +} + +func (p *CommonServiceGetNoticesArgs) BLength() int { + l := 0 + if p != nil { + l += p.field1Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *CommonServiceGetNoticesArgs) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRUCT, 1) + offset += p.Req.FastWriteNocopy(buf[offset:], w) + return offset +} + +func (p *CommonServiceGetNoticesArgs) field1Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += p.Req.BLength() + return l +} + +func (p *CommonServiceGetNoticesResult) FastRead(buf []byte) (int, error) { + + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + for { + fieldTypeId, fieldId, l, err = thrift.Binary.ReadFieldBegin(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 0: + if fieldTypeId == thrift.STRUCT { + l, err = p.FastReadField0(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + default: + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + } + + return offset, nil +ReadFieldBeginError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CommonServiceGetNoticesResult[fieldId]), err) +SkipFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +} + +func (p *CommonServiceGetNoticesResult) FastReadField0(buf []byte) (int, error) { + offset := 0 + _field := NewNoticeResponse() + if l, err := _field.FastRead(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + } + p.Success = _field + return offset, nil +} + +func (p *CommonServiceGetNoticesResult) FastWrite(buf []byte) int { + return p.FastWriteNocopy(buf, nil) +} + +func (p *CommonServiceGetNoticesResult) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p != nil { + offset += p.fastWriteField0(buf[offset:], w) + } + offset += thrift.Binary.WriteFieldStop(buf[offset:]) + return offset +} + +func (p *CommonServiceGetNoticesResult) BLength() int { + l := 0 + if p != nil { + l += p.field0Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *CommonServiceGetNoticesResult) fastWriteField0(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p.IsSetSuccess() { + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRUCT, 0) + offset += p.Success.FastWriteNocopy(buf[offset:], w) + } + return offset +} + +func (p *CommonServiceGetNoticesResult) field0Length() int { + l := 0 + if p.IsSetSuccess() { + l += thrift.Binary.FieldBeginLength() + l += p.Success.BLength() + } + return l +} + func (p *CommonServiceGetCSSArgs) GetFirstArgument() interface{} { return p.Req } @@ -1986,3 +2517,11 @@ func (p *CommonServiceGetTermArgs) GetFirstArgument() interface{} { func (p *CommonServiceGetTermResult) GetResult() interface{} { return p.Success } + +func (p *CommonServiceGetNoticesArgs) GetFirstArgument() interface{} { + return p.Req +} + +func (p *CommonServiceGetNoticesResult) GetResult() interface{} { + return p.Success +} diff --git a/kitex_gen/model/k-model.go b/kitex_gen/model/k-model.go index bae8bce8..8555066c 100644 --- a/kitex_gen/model/k-model.go +++ b/kitex_gen/model/k-model.go @@ -5756,3 +5756,202 @@ func (p *TermInfo) field4Length() int { } return l } + +func (p *NoticeInfo) FastRead(buf []byte) (int, error) { + + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + for { + fieldTypeId, fieldId, l, err = thrift.Binary.ReadFieldBegin(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + l, err = p.FastReadField1(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + case 2: + if fieldTypeId == thrift.STRING { + l, err = p.FastReadField2(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + case 3: + if fieldTypeId == thrift.STRING { + l, err = p.FastReadField3(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + default: + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + } + + return offset, nil +ReadFieldBeginError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeInfo[fieldId]), err) +SkipFieldError: + return offset, thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +} + +func (p *NoticeInfo) FastReadField1(buf []byte) (int, error) { + offset := 0 + + var _field *string + if v, l, err := thrift.Binary.ReadString(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _field = &v + } + p.Title = _field + return offset, nil +} + +func (p *NoticeInfo) FastReadField2(buf []byte) (int, error) { + offset := 0 + + var _field *string + if v, l, err := thrift.Binary.ReadString(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _field = &v + } + p.Url = _field + return offset, nil +} + +func (p *NoticeInfo) FastReadField3(buf []byte) (int, error) { + offset := 0 + + var _field *string + if v, l, err := thrift.Binary.ReadString(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _field = &v + } + p.Date = _field + return offset, nil +} + +func (p *NoticeInfo) FastWrite(buf []byte) int { + return p.FastWriteNocopy(buf, nil) +} + +func (p *NoticeInfo) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p != nil { + offset += p.fastWriteField1(buf[offset:], w) + offset += p.fastWriteField2(buf[offset:], w) + offset += p.fastWriteField3(buf[offset:], w) + } + offset += thrift.Binary.WriteFieldStop(buf[offset:]) + return offset +} + +func (p *NoticeInfo) BLength() int { + l := 0 + if p != nil { + l += p.field1Length() + l += p.field2Length() + l += p.field3Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *NoticeInfo) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p.IsSetTitle() { + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 1) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, *p.Title) + } + return offset +} + +func (p *NoticeInfo) fastWriteField2(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p.IsSetUrl() { + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 2) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, *p.Url) + } + return offset +} + +func (p *NoticeInfo) fastWriteField3(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + if p.IsSetDate() { + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 3) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, *p.Date) + } + return offset +} + +func (p *NoticeInfo) field1Length() int { + l := 0 + if p.IsSetTitle() { + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(*p.Title) + } + return l +} + +func (p *NoticeInfo) field2Length() int { + l := 0 + if p.IsSetUrl() { + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(*p.Url) + } + return l +} + +func (p *NoticeInfo) field3Length() int { + l := 0 + if p.IsSetDate() { + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(*p.Date) + } + return l +} diff --git a/kitex_gen/model/model.go b/kitex_gen/model/model.go index 185b000c..454ab95b 100644 --- a/kitex_gen/model/model.go +++ b/kitex_gen/model/model.go @@ -8349,3 +8349,333 @@ func (p *TermInfo) Field4DeepEqual(src []*TermEvent) bool { } return true } + +type NoticeInfo struct { + Title *string `thrift:"title,1,optional" frugal:"1,optional,string" json:"title,omitempty"` + Url *string `thrift:"url,2,optional" frugal:"2,optional,string" json:"url,omitempty"` + Date *string `thrift:"date,3,optional" frugal:"3,optional,string" json:"date,omitempty"` +} + +func NewNoticeInfo() *NoticeInfo { + return &NoticeInfo{} +} + +func (p *NoticeInfo) InitDefault() { +} + +var NoticeInfo_Title_DEFAULT string + +func (p *NoticeInfo) GetTitle() (v string) { + if !p.IsSetTitle() { + return NoticeInfo_Title_DEFAULT + } + return *p.Title +} + +var NoticeInfo_Url_DEFAULT string + +func (p *NoticeInfo) GetUrl() (v string) { + if !p.IsSetUrl() { + return NoticeInfo_Url_DEFAULT + } + return *p.Url +} + +var NoticeInfo_Date_DEFAULT string + +func (p *NoticeInfo) GetDate() (v string) { + if !p.IsSetDate() { + return NoticeInfo_Date_DEFAULT + } + return *p.Date +} +func (p *NoticeInfo) SetTitle(val *string) { + p.Title = val +} +func (p *NoticeInfo) SetUrl(val *string) { + p.Url = val +} +func (p *NoticeInfo) SetDate(val *string) { + p.Date = val +} + +var fieldIDToName_NoticeInfo = map[int16]string{ + 1: "title", + 2: "url", + 3: "date", +} + +func (p *NoticeInfo) IsSetTitle() bool { + return p.Title != nil +} + +func (p *NoticeInfo) IsSetUrl() bool { + return p.Url != nil +} + +func (p *NoticeInfo) IsSetDate() bool { + return p.Date != nil +} + +func (p *NoticeInfo) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } + + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 2: + if fieldTypeId == thrift.STRING { + if err = p.ReadField2(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.STRING { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + default: + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } + + return nil +ReadStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err) +ReadFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_NoticeInfo[fieldId]), err) +SkipFieldError: + return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + +ReadFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) +ReadStructEndError: + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) +} + +func (p *NoticeInfo) ReadField1(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Title = _field + return nil +} +func (p *NoticeInfo) ReadField2(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Url = _field + return nil +} +func (p *NoticeInfo) ReadField3(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Date = _field + return nil +} + +func (p *NoticeInfo) Write(oprot thrift.TProtocol) (err error) { + + var fieldId int16 + if err = oprot.WriteStructBegin("NoticeInfo"); err != nil { + goto WriteStructBeginError + } + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError + } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + } + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError + } + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError + } + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) +WriteFieldError: + return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err) +WriteFieldStopError: + return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err) +WriteStructEndError: + return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) +} + +func (p *NoticeInfo) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetTitle() { + if err = oprot.WriteFieldBegin("title", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Title); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *NoticeInfo) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetUrl() { + if err = oprot.WriteFieldBegin("url", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Url); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} + +func (p *NoticeInfo) writeField3(oprot thrift.TProtocol) (err error) { + if p.IsSetDate() { + if err = oprot.WriteFieldBegin("date", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Date); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *NoticeInfo) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("NoticeInfo(%+v)", *p) + +} + +func (p *NoticeInfo) DeepEqual(ano *NoticeInfo) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field1DeepEqual(ano.Title) { + return false + } + if !p.Field2DeepEqual(ano.Url) { + return false + } + if !p.Field3DeepEqual(ano.Date) { + return false + } + return true +} + +func (p *NoticeInfo) Field1DeepEqual(src *string) bool { + + if p.Title == src { + return true + } else if p.Title == nil || src == nil { + return false + } + if strings.Compare(*p.Title, *src) != 0 { + return false + } + return true +} +func (p *NoticeInfo) Field2DeepEqual(src *string) bool { + + if p.Url == src { + return true + } else if p.Url == nil || src == nil { + return false + } + if strings.Compare(*p.Url, *src) != 0 { + return false + } + return true +} +func (p *NoticeInfo) Field3DeepEqual(src *string) bool { + + if p.Date == src { + return true + } else if p.Date == nil || src == nil { + return false + } + if strings.Compare(*p.Date, *src) != 0 { + return false + } + return true +} diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 4a7af68d..83b5f61e 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -28,6 +28,10 @@ const ( ClassroomScheduledTime = 24 * time.Hour // (class_room) 空教室非当天同步时间 ClassroomUpdatedTime = 6 * time.Hour // (class_room) 当天空教室更新间隔 + NoticeWorker = 1 + NoticeUpdateTime = 8 * time.Hour // (notice) 通知更新间隔 + NoticePageSize = 20 // 教务处教学通知一页大小固定 20 + CacheFileDir = "UssFileDir" // (paper) 文件缓存目录 // ValidateCodeURL 获取验证码结果的本地python服务url,需要保证 login-verify 和 api 处于同一个 dokcer 网络中 diff --git a/pkg/constants/db.go b/pkg/constants/db.go index c9452772..23e56f37 100644 --- a/pkg/constants/db.go +++ b/pkg/constants/db.go @@ -29,4 +29,5 @@ const ( UserTableName = "student" CourseTableName = "course" LaunchScreenTableName = "launch_screen" + NoticeTableName = "notice" ) diff --git a/pkg/db/db.go b/pkg/db/db.go index bb07d280..97da4ae6 100644 --- a/pkg/db/db.go +++ b/pkg/db/db.go @@ -21,6 +21,7 @@ import ( "github.com/west2-online/fzuhelper-server/pkg/db/course" "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/db/notice" "github.com/west2-online/fzuhelper-server/pkg/db/user" "github.com/west2-online/fzuhelper-server/pkg/utils" ) @@ -30,6 +31,7 @@ type Database struct { sf *utils.Snowflake Course *course.DBCourse LaunchScreen *launch_screen.DBLaunchScreen + Notice *notice.DBNotice User *user.DBUser } @@ -39,6 +41,7 @@ func NewDatabase(client *gorm.DB, sf *utils.Snowflake) *Database { sf: sf, Course: course.NewDBCourse(client, sf), LaunchScreen: launch_screen.NewDBLaunchScreen(client, sf), + Notice: notice.NewDBNotice(client, sf), User: user.NewDBUser(client, sf), } } diff --git a/pkg/db/model/notice.go b/pkg/db/model/notice.go new file mode 100644 index 00000000..2ecf74fe --- /dev/null +++ b/pkg/db/model/notice.go @@ -0,0 +1,33 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package model + +import ( + "time" + + "gorm.io/gorm" +) + +type Notice struct { + Id int64 + Title string `gorm:"type:varchar(255);not null"` + URL string `gorm:"type:text;not null"` + PublishedAt string `gorm:"type:varchar(10);not null"` + CreatedAt time.Time + UpdatedAt time.Time + DeletedAt gorm.DeletedAt `gorm:"index"` +} diff --git a/pkg/db/notice/create_notice.go b/pkg/db/notice/create_notice.go new file mode 100644 index 00000000..5d7055f9 --- /dev/null +++ b/pkg/db/notice/create_notice.go @@ -0,0 +1,38 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notice + +import ( + "context" + "errors" + + "gorm.io/gorm" + + "github.com/west2-online/fzuhelper-server/pkg/db/model" + "github.com/west2-online/fzuhelper-server/pkg/errno" +) + +func (d *DBNotice) CreateNotice(ctx context.Context, notice *model.Notice) (err error) { + notice.Id, err = d.sf.NextVal() + if err != nil { + return errno.Errorf(errno.InternalDatabaseErrorCode, "dal.CreateNotice: NextVal error: %s", err) + } + if err := d.client.WithContext(ctx).Create(notice).Error; err != nil && !errors.Is(err, gorm.ErrDuplicatedKey) { + return errno.Errorf(errno.InternalDatabaseErrorCode, "dal.CreateNotice error: %s", err) + } + return nil +} diff --git a/pkg/db/notice/get_notice.go b/pkg/db/notice/get_notice.go new file mode 100644 index 00000000..16ab6eb2 --- /dev/null +++ b/pkg/db/notice/get_notice.go @@ -0,0 +1,34 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notice + +import ( + "context" + + "github.com/west2-online/fzuhelper-server/pkg/constants" + "github.com/west2-online/fzuhelper-server/pkg/db/model" + "github.com/west2-online/fzuhelper-server/pkg/errno" +) + +func (d *DBNotice) GetNoticeByPage(ctx context.Context, pageNum int) (list []model.Notice, err error) { + // 不使用[]*的原因:Find 返回多个结果时,只能使用[] + offset := (pageNum - 1) * constants.NoticePageSize + if err := d.client.WithContext(ctx).Limit(constants.NoticePageSize).Offset(offset).Find(&list).Error; err != nil { + return nil, errno.Errorf(errno.InternalDatabaseErrorCode, "dal.GetNoticeByPage error: %s", err) + } + return list, nil +} diff --git a/pkg/db/notice/is_url_exists.go b/pkg/db/notice/is_url_exists.go new file mode 100644 index 00000000..f0b2f919 --- /dev/null +++ b/pkg/db/notice/is_url_exists.go @@ -0,0 +1,37 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notice + +import ( + "context" + "errors" + + "gorm.io/gorm" + + "github.com/west2-online/fzuhelper-server/pkg/errno" +) + +func (d *DBNotice) IsURLExists(ctx context.Context, url string) (ok bool, err error) { + err = d.client.WithContext(ctx).Where("url = ?", url).Error + if err != nil { + return false, errno.Errorf(errno.InternalDatabaseErrorCode, "dal.IsURLExists error: %s", err) + } + if errors.Is(err, gorm.ErrRecordNotFound) { + return false, nil + } + return true, nil +} diff --git a/pkg/db/notice/notice.go b/pkg/db/notice/notice.go new file mode 100644 index 00000000..9ff09619 --- /dev/null +++ b/pkg/db/notice/notice.go @@ -0,0 +1,35 @@ +/* +Copyright 2024 The west2-online Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package notice + +import ( + "gorm.io/gorm" + + "github.com/west2-online/fzuhelper-server/pkg/utils" +) + +type DBNotice struct { + client *gorm.DB + sf *utils.Snowflake +} + +func NewDBNotice(client *gorm.DB, sf *utils.Snowflake) *DBNotice { + return &DBNotice{ + client: client, + sf: sf, + } +}