diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6d09b6bc..163288ab 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,8 +18,8 @@ jobs: name: Format runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.mod cache: false @@ -38,8 +38,8 @@ jobs: name: Vet runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version-file: go.mod cache: false @@ -62,6 +62,38 @@ jobs: with: version: latest args: --timeout=10m + test: + name: Unit Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + - name: Install dependencies + run: go mod tidy + - name: Run tests + run: make test # 使用我们自己的测试命令 + - name: Check the number of changed lines + run: | # 比较基础提交和最新提交的差别,新增代码行数不超过 10 行则不需要检查 + LINES_ADDED=$(git diff --numstat ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} pkg/ | awk '{ add += $1 } END { printf add }') + echo "lines added: $LINES_ADDED" + if [[ $LINES_ADDED -lt 10 ]]; then + echo "NEED_TO_CHECK=false" >> $GITHUB_ENV + else + echo "NEED_TO_CHECK=true" >> $GITHUB_ENV + fi + - name: Upload results to Codecov + if: ${{ (env.NEED_TO_CHECK == 'true') || (github.event_name != 'pull_request') }} + uses: codecov/codecov-action@v4 + with: + flags: unittest + token: ${{ secrets.CODECOV_TOKEN }} + file: coverage.txt + fail_ci_if_error: true + verbose: true license: name: License @@ -71,4 +103,4 @@ jobs: - name: Check license header run: | make license && git add pkg cmd && - git diff --cached --exit-code || (echo 'Please run "make license" to add license headers' && exit 1); \ No newline at end of file + git diff --cached --exit-code || (echo 'Please run "make license" to add license headers' && exit 1); diff --git a/.golangci.yml b/.golangci.yml index 929e6796..ac4c8d9d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -2,16 +2,12 @@ run: # default concurrency is the available CPU number concurrency: 16 - # timeout for analysis, e.g. 30s, 5m, default is 1m timeout: 10m - # exit code when at least one issue was found, default is 1 issues-exit-code: 1 - # include test files or not, default is true tests: true - # which dirs to skip: they won't be analyzed; # can use regexp here: generated.*, regexp is applied on full path; # default value is empty list, but next dirs are always skipped independently @@ -23,16 +19,16 @@ run: output: # print lines of code with issue, default is true print-issued-lines: true - # print linter name in the end of issue text, default is true print-linter-name: true # all available settings of specific linters linters-settings: - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 + nakedret: + # Make an issue if func has more lines of code than this setting, and it has naked returns. + # Default: 30 + max-func-lines: 31 gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true @@ -40,6 +36,64 @@ linters-settings: # put imports beginning with prefix after 3rd-party packages; # it's a comma-separated list of prefixes local-prefixes: github.com/west2-online + gci: + # Section configuration to compare against. + # Section names are case-insensitive and may contain parameters in (). + # The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`, + # If `custom-order` is `true`, it follows the order of `sections` option. + # Default: ["standard", "default"] + sections: + - standard # Standard section: captures all standard packages. + - default # Default section: contains all imports that could not be matched to another section type. + - prefix(github.com/west2-online) # Custom section: groups all imports with the specified Prefix. + # - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. + # - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. + # - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled. + # - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled. + # Skip generated files. + # Default: true + skip-generated: true + # Enable custom order of sections. + # If `true`, make the section order the same as the order of `sections`. + # Default: false + custom-order: true + # Drops lexical ordering for custom sections. + # Default: false + no-lex-order: true + nilnil: + # List of return types to check. + # Default: ["ptr", "func", "iface", "map", "chan", "uintptr", "unsafeptr"] + checked-types: + - ptr + - func + - iface + - map + - chan + - uintptr + - unsafeptr + errorlint: + # Check whether fmt.Errorf uses the %w verb for formatting errors. + # See the https://github.com/polyfloyd/go-errorlint for caveats. + errorf: true + # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true) + # Default: true + errorf-multi: true + # Check for plain type assertions and type switches. + # Default: true + asserts: true + # Check for plain error comparisons. + # Default: true + comparison: true + # Allowed errors. + # Default: [] + allowed-errors: + - err: "io.EOF" + fun: "example.com/pkg.Read" + # Allowed error "wildcards". + # Default: [] + allowed-errors-wildcard: + - err: "github.com/west2-online/fzuhelper-server/pkg/errno" + fun: "github.com/west2-online/fzuhelper-server/pkg/errno" misspell: # Correct spellings using locale preferences for US or UK. # Default is to use a neutral variety of English. @@ -49,22 +103,121 @@ linters-settings: checks: - all - -SA1019 + lll: + # Max line length, lines longer will be reported. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option. + # Default: 120. + line-length: 160 + # Tab width in spaces. + # Default: 1 + tab-width: 1 + mnd: + # List of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. + # Default: ["argument", "case", "condition", "operation", "return", "assign"] + checks: + - argument + - case + - condition + - operation + - return + - assign + # List of numbers to exclude from analysis. + # The numbers should be written as string. + # Values always ignored: "1", "1.0", "0" and "0.0" + # Default: [] + ignored-numbers: + - '0666' + - '0755' + - '42' + # List of file patterns to exclude from analysis. + # Values always ignored: `.+_test.go` + # Default: [] + ignored-files: + - 'magic1_.+\.go$' + # List of function patterns to exclude from analysis. + # Following functions are always ignored: `time.Date`, + # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, + # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. + # Default: [] + ignored-functions: + - '^math\.' + - '^http\.StatusText$' + makezero: + # Allow only slices initialized with a length of zero. + # Default: false + always: false + nestif: + # Minimal complexity of if statements to report. + # Default: 5 + min-complexity: 6 + tagalign: + # Align and sort can be used together or separately. + # + # Whether enable align. If true, the struct tags will be aligned. + # e.g.: + # type FooBar struct { + # Bar string `json:"bar" validate:"required"` + # FooFoo int8 `json:"foo_foo" validate:"required"` + # } + # will be formatted to: + # type FooBar struct { + # Bar string `json:"bar" validate:"required"` + # FooFoo int8 `json:"foo_foo" validate:"required"` + # } + # Default: true. + align: true + # Whether enable tags sort. + # If true, the tags will be sorted by name in ascending order. + # e.g.: `xml:"bar" json:"bar" validate:"required"` -> `json:"bar" validate:"required" xml:"bar"` + # Default: true + sort: true + # Specify the order of tags, the other tags will be sorted by name. + # This option will be ignored if `sort` is false. + # Default: [] + order: + - json + - yaml + - yml + - toml + - mapstructure + - binding + - validate + # Whether enable strict style. + # In this style, the tags will be sorted and aligned in the dictionary order, + # and the tags with the same name will be aligned together. + # Note: This option will be ignored if 'align' or 'sort' is false. + # Default: false + strict: true linters: fast: false disable-all: true enable: - - errcheck - - staticcheck - - typecheck - - unused - - misspell - - nolintlint - - goimports - - nakedret - - unconvert - - whitespace - - govet - - gosimple - - ineffassign - - gocritic \ No newline at end of file + - errcheck # 错误检查 + - staticcheck # 静态检查 + - unused # 检查未使用的变量、常量、函数和类型 + - misspell # 检查常见的拼写错误的英文单词 + - nolintlint # 报告不正确或不充分的 nolint 指令 + - goimports # 检查包导入是否按 goimport 命令格式化 + - nakedret # 检查具有裸返回(func with naked returns)的函数包体是否过大 + - unconvert # 删除不必要的类型转换 + - whitespace # 检查不必要的换行符 + - govet # 与 go vet 大致相同 + - gosimple # 简化代码 + - ineffassign # 检测现有变量的赋值何时未被使用 + - gocritic # 提供诊断功能,检查错误、性能和样式问题 + - importas # 强制使用一致的包导入别名 + - gci # 控制包导入顺序 + - errorlint # 检查错误处理代码合规性 + - nilerr # 检查当产生错误时仍然返回 nil 的情况 + - asciicheck # 检查非 ASCII 字符 + - copyloopvar # 检查循环变量是否在闭包中被复制 + - decorder # 检查类型、常量、变量和函数的声明顺序和数量 + - forcetypeassert # 查找强制类型断言 + - lll # 检查行的长度 + - mnd # 检查魔数,魔数应该尽量放置在常量中 + - inamedparam # 检查函数参数的命名 + - makezero # 检查是否存在非零长初始化的切片 + - mirror # 报告 bytes/strings 的错误 mirror 用法 + - nestif # 检查是否存在深度嵌套的 if + - tagalign # 检查结构体标签是否对齐,支持自动修正 diff --git a/Makefile b/Makefile index 7a5b2143..af8781f9 100644 --- a/Makefile +++ b/Makefile @@ -82,10 +82,16 @@ hertz-gen-api: hz update -idl ${IDL_PATH}/api.thrift # 单元测试 +# -gcflags="all=-l -N": -l 表示禁用内联优化,-N 表示禁用优化 +# -parallel=16: 可以并行运行的测试数量,这里设置为 16 +# -p=16: 指定并行构建的最大数量,这里设置为 16 +# -covermode=atomic: 设置覆模式为原子模式 +# -race: 启用竞态检测,检查并发代码中的数据竞争问题 +# 我们通过`go list`来列出所有的包,然后通过`grep`来过滤掉不需要测试的包 .PHONY: test test: go test -v -gcflags="all=-l -N" -coverprofile=coverage.txt -parallel=16 -p=16 -covermode=atomic -race -coverpkg=./... \ - `go list ./... | grep -E -v "kitex_gen|.github|idl|docs|config|deploy"` + `go list ./... | grep -E -v "kitex_gen|.github|idl|docs|config|deploy|docker"` # 构建指定对象,构建后在没有给 BUILD_ONLY 参的情况下会自动运行,需要熟悉 tmux 环境 # 用于本地调试 @@ -185,7 +191,7 @@ vet: # 代码格式校验 .PHONY: lint lint: - golangci-lint run --config=./.golangci.yml + golangci-lint run --config=./.golangci.yml --tests --allow-parallel-runners --sort-results --show-stats --print-resources-usage # 一键修正规范并执行代码检查 .PHONY: verify diff --git a/api/handler/api/launch_screen_service.go b/api/handler/api/launch_screen_service.go index 4e33d87f..de450ec1 100644 --- a/api/handler/api/launch_screen_service.go +++ b/api/handler/api/launch_screen_service.go @@ -68,7 +68,8 @@ func CreateImage(ctx context.Context, c *app.RequestContext) { resp := new(api.CreateImageResponse) - if !utils.IsAllowImageFile(imageFile) { + suffix, ok := utils.IsAllowImageFile(imageFile) + if !ok { pack.RespError(c, errno.SuffixError) return } @@ -92,6 +93,7 @@ func CreateImage(ctx context.Context, c *app.RequestContext) { Text: req.Text, Regex: req.Regex, BufferCount: int64(len(imageByte)), + Suffix: suffix, }, imageByte) if err != nil { pack.RespError(c, err) @@ -208,7 +210,8 @@ func ChangeImage(ctx context.Context, c *app.RequestContext) { } resp := new(api.ChangeImageResponse) - if !utils.IsAllowImageFile(imageFile) { + suffix, ok := utils.IsAllowImageFile(imageFile) + if !ok { pack.RespError(c, errno.SuffixError) return } @@ -222,6 +225,7 @@ func ChangeImage(ctx context.Context, c *app.RequestContext) { respImage, err := rpc.ChangeImageRPC(ctx, &launch_screen.ChangeImageRequest{ PictureId: req.PictureID, BufferCount: int64(len(imageByte)), + Suffix: suffix, }, imageByte) if err != nil { pack.RespError(c, err) diff --git a/api/handler/api/paper_service.go b/api/handler/api/paper_service.go index 797b2596..99b1910c 100644 --- a/api/handler/api/paper_service.go +++ b/api/handler/api/paper_service.go @@ -25,6 +25,7 @@ import ( "github.com/cloudwego/hertz/pkg/app" "github.com/west2-online/fzuhelper-server/api/model/api" + "github.com/west2-online/fzuhelper-server/api/model/model" "github.com/west2-online/fzuhelper-server/api/pack" "github.com/west2-online/fzuhelper-server/api/rpc" @@ -71,7 +72,7 @@ func GetDownloadUrl(ctx context.Context, c *app.RequestContext) { } url, err := rpc.GetDownloadUrlRPC(ctx, &paper.GetDownloadUrlRequest{ - Url: req.URL, + Filepath: req.Filepath, }) if err != nil { pack.RespError(c, err) @@ -83,3 +84,68 @@ func GetDownloadUrl(ctx context.Context, c *app.RequestContext) { pack.RespData(c, resp) } + +// ListDirFilesForAndroid . +// @Description 历年卷兼容,查询文件目录 +// @router /api/v1/list [GET] +func ListDirFilesForAndroid(ctx context.Context, c *app.RequestContext) { + var err error + var req api.ListDirFilesForAndroidRequest + + err = c.BindAndValidate(&req) + if err != nil { + logger.Errorf("api.ListDirFilesForAndroid: BindAndValidate error %v", err) + pack.RespErrorInPaper(c, errno.ParamError.WithError(err)) + return + } + + if req.GetPath() == "" { + logger.Errorf("api.ListDirFilesForAndroid: path is empty") + pack.RespErrorInPaper(c, errno.ParamError.WithError(errors.New("path is empty"))) + return + } + + res, err := rpc.GetDirFilesRPC(ctx, &paper.ListDirFilesRequest{ + Path: req.GetPath(), + }) + if err != nil { + pack.RespErrorInPaper(c, err) + return + } + + data := &model.PaperData{ + BasePath: res.BasePath, + Files: res.Files, + Folders: res.Folders, + } + + pack.RespDataInPaper(c, data) +} + +// GetDownloadUrlForAndroid . +// @Description 历年卷兼容,获取url以供下载 +// @router /api/v1/downloadUrl [GET] +func GetDownloadUrlForAndroid(ctx context.Context, c *app.RequestContext) { + var err error + var req api.GetDownloadUrlForAndroidRequest + err = c.BindAndValidate(&req) + if err != nil { + logger.Errorf("api.GetDownloadUrlForAndroid: BindAndValidate error %v", err) + pack.RespErrorInPaper(c, errno.ParamError.WithError(err)) + return + } + + url, err := rpc.GetDownloadUrlRPC(ctx, &paper.GetDownloadUrlRequest{ + Filepath: req.Filepath, + }) + if err != nil { + pack.RespErrorInPaper(c, err) + return + } + + data := &model.PaperUrlData{ + URL: url, + } + + pack.RespDataInPaper(c, data) +} diff --git a/api/handler/api/url_service.go b/api/handler/api/url_service.go index 15c694a5..22b1ac5a 100644 --- a/api/handler/api/url_service.go +++ b/api/handler/api/url_service.go @@ -20,7 +20,7 @@ package api import ( "context" - "net/http" + "fmt" "strings" "github.com/bytedance/sonic" @@ -32,6 +32,7 @@ import ( api "github.com/west2-online/fzuhelper-server/api/model/api" "github.com/west2-online/fzuhelper-server/api/pack" "github.com/west2-online/fzuhelper-server/pkg/base" + "github.com/west2-online/fzuhelper-server/pkg/constants" "github.com/west2-online/fzuhelper-server/pkg/errno" "github.com/west2-online/fzuhelper-server/pkg/logger" ) @@ -50,7 +51,7 @@ func APILogin(ctx context.Context, c *app.RequestContext) { return } - url := "http://127.0.0.1:5000/api/login" + url := fmt.Sprintf("http://%s:5000/api/login", constants.URLServiceName) request := new(protocol.Request) request.SetMethod(consts.MethodPost) @@ -68,7 +69,7 @@ func APILogin(ctx context.Context, c *app.RequestContext) { return } - c.String(http.StatusOK, res.BodyBuffer().String()) + c.String(consts.StatusOK, res.BodyBuffer().String()) } // UploadVersionInfo . @@ -83,7 +84,7 @@ func UploadVersionInfo(ctx context.Context, c *app.RequestContext) { return } - url := "http://127.0.0.1:5000/api/upload" + url := fmt.Sprintf("http://%s:5000/api/upload", constants.URLServiceName) request := new(protocol.Request) request.SetMethod(consts.MethodPost) @@ -121,7 +122,7 @@ func GetUploadParams(ctx context.Context, c *app.RequestContext) { return } - url := "http://127.0.0.1:5000/api/uploadparams" + url := fmt.Sprintf("http://%s:5000/api/uploadparams", constants.URLServiceName) resp := new(api.GetUploadParamsResponse) request := &protocol.Request{} @@ -157,19 +158,21 @@ func GetUploadParams(ctx context.Context, c *app.RequestContext) { // GetDownloadRelease . // @router /api/v1/url/release.apk [GET] func GetDownloadRelease(ctx context.Context, c *app.RequestContext) { - c.Redirect(http.StatusOK, []byte("http://127.0.0.1:5000/release.apk")) + url := fmt.Sprintf("http://%s:5000/release.apk", constants.URLServiceName) // 与apk无关,仅为一个路径 + c.Redirect(consts.StatusFound, []byte(url)) } // GetDownloadBeta . // @router /api/v1/url/beta.apk [GET] func GetDownloadBeta(ctx context.Context, c *app.RequestContext) { - c.Redirect(http.StatusOK, []byte("http://127.0.0.1:5000/beta.apk")) + url := fmt.Sprintf("http://%s:5000/beta.apk", constants.URLServiceName) // 与apk无关,仅为一个路径 + c.Redirect(consts.StatusFound, []byte(url)) } // GetReleaseVersion . // @router /api/v1/url/version.json [GET] func GetReleaseVersion(ctx context.Context, c *app.RequestContext) { - url := "http://127.0.0.1:5000/version.json" // 和json无关,仅为一个路径 + url := fmt.Sprintf("http://%s:5000/version.json", constants.URLServiceName) // 和json无关,仅为一个路径 request := &protocol.Request{} request.SetMethod(consts.MethodGet) @@ -195,7 +198,7 @@ func GetReleaseVersion(ctx context.Context, c *app.RequestContext) { // GetBetaVersion . // @router /api/v1/url/versionbeta.json [GET] func GetBetaVersion(ctx context.Context, c *app.RequestContext) { - url := "http://127.0.0.1:5000/versionbeta.json" // 和json无关,仅为一个路径 + url := fmt.Sprintf("http://%s:5000/versionbeta.json", constants.URLServiceName) // 和json无关,仅为一个路径 request := &protocol.Request{} request.SetMethod(consts.MethodGet) @@ -230,7 +233,7 @@ func GetCloudSetting(ctx context.Context, c *app.RequestContext) { isLogin := c.DefaultQuery("isLogin", "false") loginType := c.DefaultQuery("loginType", "0") - url := "http://127.0.0.1:5000/settings.php" // 和php无关,仅为一个路径 + url := fmt.Sprintf("http://%s:5000/settings.php", constants.URLServiceName) // 和php无关,仅为一个路径 queryParams := strings.Join( []string{ @@ -268,8 +271,7 @@ func GetCloudSetting(ctx context.Context, c *app.RequestContext) { func GetAllCloudSetting(ctx context.Context, c *app.RequestContext) { var err error - url := "http://127.0.0.1:5000/api/getcloud" - + url := fmt.Sprintf("http://%s:5000/api/getcloud", constants.URLServiceName) request := &protocol.Request{} request.SetMethod(consts.MethodGet) request.SetRequestURI(url) @@ -303,7 +305,7 @@ func SetAllCloudSetting(ctx context.Context, c *app.RequestContext) { return } - url := "127.0.0.1:5000/api/setcloud" + url := fmt.Sprintf("http://%s:5000/api/setcloud", constants.URLServiceName) request := &protocol.Request{} request.SetMethod(consts.MethodPost) @@ -331,8 +333,7 @@ func TestSetting(ctx context.Context, c *app.RequestContext) { return } - url := "http://127.0.0.1:5000/api/test" - + url := fmt.Sprintf("http://%s:5000/api/test", constants.URLServiceName) request := &protocol.Request{} request.SetMethod(consts.MethodPost) request.SetRequestURI(url) @@ -360,7 +361,8 @@ func TestSetting(ctx context.Context, c *app.RequestContext) { func DumpVisit(ctx context.Context, c *app.RequestContext) { var err error - url := "http://127.0.0.1:5000/upupdowndownleftleftrightrightbaba_dump_visit" + url := fmt.Sprintf("http://%s:5000/upupdowndownleftleftrightrightbaba_dump_visit", constants.URLServiceName) + request := &protocol.Request{} request.SetMethod(consts.MethodGet) request.SetRequestURI(url) @@ -387,7 +389,7 @@ func DumpVisit(ctx context.Context, c *app.RequestContext) { func FZUHelperCSS(ctx context.Context, c *app.RequestContext) { var err error - url := "http://127.0.0.1:5000/onekey/FZUHelper.css" // 和html无关,仅为一个路径 + url := fmt.Sprintf("http://%s:5000/onekey/FZUHelper.css", constants.URLServiceName) // 和css无关,仅为一个路径 request := &protocol.Request{} request.SetMethod(consts.MethodGet) @@ -408,7 +410,7 @@ func FZUHelperCSS(ctx context.Context, c *app.RequestContext) { func FZUHelperHTML(ctx context.Context, c *app.RequestContext) { var err error - url := "http://127.0.0.1:5000/onekey/FZUHelper.html" // 和html无关,仅为一个路径 + url := fmt.Sprintf("http://%s:5000/onekey/FZUHelper.html", constants.URLServiceName) // 和html无关,仅为一个路径 request := &protocol.Request{} request.SetMethod(consts.MethodGet) @@ -428,7 +430,7 @@ func FZUHelperHTML(ctx context.Context, c *app.RequestContext) { func UserAgreementHTML(ctx context.Context, c *app.RequestContext) { var err error - url := "http://127.0.0.1:5000/onekey/UserAgreement.html" // 和html无关,仅为一个路径 + url := fmt.Sprintf("http://%s:5000/onekey/UserAgreement.html", constants.URLServiceName) // 和html无关,仅为一个路径 request := &protocol.Request{} request.SetMethod(consts.MethodGet) diff --git a/api/handler/api/user_service.go b/api/handler/api/user_service.go index 523bfe27..06b27945 100644 --- a/api/handler/api/user_service.go +++ b/api/handler/api/user_service.go @@ -20,6 +20,7 @@ package api import ( "context" + "encoding/json" "net/http" "github.com/cloudwego/hertz/pkg/app" @@ -90,3 +91,51 @@ func ValidateCode(ctx context.Context, c *app.RequestContext) { c.String(http.StatusOK, res.BodyBuffer().String()) } + +// ValidateCodeForAndroid . +// @router /api/login/validateCode [POST] +func ValidateCodeForAndroid(ctx context.Context, c *app.RequestContext) { + var err error + var req api.ValidateCodeForAndroidRequest + err = c.BindAndValidate(&req) + if err != nil { + logger.Errorf("api.ValidateCodeForAndroid: BindAndValidate error %v", err) + pack.RespError(c, errno.ParamError.WithError(err)) + return + } + + request := new(protocol.Request) + request.SetMethod(consts.MethodPost) + request.SetRequestURI(constants.ValidateCodeURL) + request.SetFormData( + map[string]string{ + "image": req.ValidateCode, + }, + ) + + res := new(protocol.Response) + + if err = ClientSet.HzClient.Do(ctx, request, res); err != nil { + pack.RespError(c, err) + return + } + // 旧版 Android 使用 message 作为解析后的验证码结果 + var originalResponse struct { + Code string `json:"code"` + Data string `json:"data"` + Message string `json:"message"` + } + if err := json.Unmarshal(res.BodyBuffer().Bytes(), &originalResponse); err != nil { + logger.Errorf("api.ValidateCodeForAndroid: JSON unmarshal error %v", err) + pack.RespError(c, err) + return + } + + // 构建兼容格式的响应 + compatResponse := map[string]string{ + "code": originalResponse.Code, + "message": originalResponse.Data, // 将解析的验证码作为 message 返回 + } + + c.JSON(http.StatusOK, compatResponse) +} diff --git a/api/middleware/get_header.go b/api/middleware/get_header.go index d7ecdbac..bf3368b4 100644 --- a/api/middleware/get_header.go +++ b/api/middleware/get_header.go @@ -25,7 +25,6 @@ import ( "github.com/west2-online/fzuhelper-server/api/model/api" "github.com/west2-online/fzuhelper-server/api/pack" - "github.com/west2-online/fzuhelper-server/kitex_gen/model" "github.com/west2-online/fzuhelper-server/pkg/errno" ) diff --git a/api/middleware/jwt.go b/api/middleware/jwt.go new file mode 100644 index 00000000..bc0c4293 --- /dev/null +++ b/api/middleware/jwt.go @@ -0,0 +1,147 @@ +package middleware + +import ( + "context" + "github.com/cloudwego/hertz/pkg/app" + jwtgo "github.com/golang-jwt/jwt" + "github.com/hertz-contrib/jwt" + "github.com/west2-online/fzuhelper-server/api/model/api" + "github.com/west2-online/fzuhelper-server/api/pack" + "github.com/west2-online/fzuhelper-server/pkg/logger" + "time" +) + +var ( + JwtMiddleware *jwt.HertzJWTMiddleware + Identity = "identity" + RefreshTokenKey = []byte("refresh_secret_key") + AccessTokenKey = []byte("access_token_key") + RefreshTokenTTL = time.Minute * 15 // Access Token 有效期15分钟 + AccessTokenTTL = time.Hour * 24 * 7 // Refresh Token 有效期7天 +) + +func InitJwt() { + var err error + JwtMiddleware, err = jwt.New(&jwt.HertzJWTMiddleware{ + Realm: "fzuhelper-server jwt", + SigningAlgorithm: "HS256", + Key: AccessTokenKey, + MaxRefresh: RefreshTokenTTL, + TokenLookup: "header:Authorization", + TokenHeadName: "Bearer", + IdentityKey: Identity, + LoginResponse: loginResponse, + Authenticator: authenticator, + PayloadFunc: payloadFunc, + IdentityHandler: identityHandler, + Unauthorized: unauthorizedHandler, + HTTPStatusMessageFunc: httpStatusMessageFunc, + }) + if err != nil { + panic(err) + } +} + +// 用于设置登陆成功后为向 token 中添加自定义负载信息的函数 +func payloadFunc(data interface{}) jwt.MapClaims { + // 在 PayloadFunc 中添加过期时间 + claims := jwt.MapClaims{ + Identity: data, + "exp": time.Now().Add(AccessTokenTTL).Unix(), + } + return claims +} + +// 用于设置登录时认证用户信息的函数 +func authenticator(ctx context.Context, c *app.RequestContext) (interface{}, error) { + type VerifyInfoRequest struct { + } + var err error + var req VerifyInfoRequest + err = c.BindAndValidate(&req) + if err != nil { + logger.Errorf("VeryfyInfo: BindAndValidate err: %v", err) + return nil, err + } + loginData, err := api.GetLoginData(ctx) + if err != nil { + logger.Errorf("VeryfyInfo: GetLoginData err: %v", err) + return nil, err + } + return loginData, nil +} + +// 用于设置登录的响应函数 +func loginResponse(ctx context.Context, c *app.RequestContext, code int, token string, expire time.Time) { + refreshToken, refreshExpire, err := generateRefreshToken(ctx, c) + if err != nil { + logger.Errorf("Generate refresh token failed: %v", err) + pack.RespError(c, err) + return + } + pack.RespData(c, map[string]interface{}{ + "code": code, + "access_token": token, + "access_expire": expire, + "refresh_token": refreshToken, + "refresh_expire": refreshExpire, + }) +} + +// 从token提取用户信息的函数 +func identityHandler(ctx context.Context, c *app.RequestContext) interface{} { + claims := jwt.ExtractClaims(ctx, c) + return claims[Identity] +} + +// 用于设置 jwt 验证流程失败的响应函数 +func unauthorizedHandler(ctx context.Context, c *app.RequestContext, code int, message string) { + pack.RespData(c, map[string]interface{}{ + "code": code, + "message": message, + }) +} + +// 生成refresh_token +func generateRefreshToken(ctx context.Context, c *app.RequestContext) (string, time.Time, error) { + refreshExpire := time.Now().Add(RefreshTokenTTL) + claims := jwtgo.MapClaims{ + "exp": refreshExpire.Unix(), + Identity: c.Get(Identity), + } + token := jwtgo.NewWithClaims(jwtgo.SigningMethodHS256, claims) + RefreshToken, err := token.SignedString(RefreshTokenKey) + return RefreshToken, refreshExpire, err +} + +// 使用refresh_token刷新access_token +func refreshTokenHandler(ctx context.Context, c *app.RequestContext) { + var req struct { + RefreshToken string `json:"refresh_token" validate:"required"` + } + if err := c.BindAndValidate(&req); err != nil { + pack.RespError(c, err) + return + } + token, err := jwtgo.Parse(req.RefreshToken, func(token *jwtgo.Token) (interface{}, error) { + return RefreshTokenKey, nil + }) + if err != nil || !token.Valid { + pack.RespError(c, err) + return + } + identity := token.Claims.(jwtgo.MapClaims)[Identity] + newToken, expire, err := JwtMiddleware.TokenGenerator(identity) + if err != nil || token.Valid { + pack.RespError(c, err) + return + } + pack.RespData(c, map[string]interface{}{ + "access_token": newToken, + "access_expire": expire, + }) +} + +func httpStatusMessageFunc(e error, ctx context.Context, c *app.RequestContext) string { + return e.Error() +} diff --git a/api/model/api/api.go b/api/model/api/api.go index 8ea21e5e..30d0e908 100644 --- a/api/model/api/api.go +++ b/api/model/api/api.go @@ -1157,6 +1157,238 @@ func (p *ValidateCodeResponse) String() string { } +// Android兼容 +type ValidateCodeForAndroidRequest struct { + ValidateCode string `thrift:"validateCode,1,required" form:"validateCode,required" json:"validateCode,required" query:"validateCode,required"` +} + +func NewValidateCodeForAndroidRequest() *ValidateCodeForAndroidRequest { + return &ValidateCodeForAndroidRequest{} +} + +func (p *ValidateCodeForAndroidRequest) InitDefault() { +} + +func (p *ValidateCodeForAndroidRequest) GetValidateCode() (v string) { + return p.ValidateCode +} + +var fieldIDToName_ValidateCodeForAndroidRequest = map[int16]string{ + 1: "validateCode", +} + +func (p *ValidateCodeForAndroidRequest) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + var issetValidateCode bool = false + + 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 + } + issetValidateCode = 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 + } + + if !issetValidateCode { + 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_ValidateCodeForAndroidRequest[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_ValidateCodeForAndroidRequest[fieldId])) +} + +func (p *ValidateCodeForAndroidRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.ValidateCode = _field + return nil +} + +func (p *ValidateCodeForAndroidRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("ValidateCodeForAndroidRequest"); 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 *ValidateCodeForAndroidRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("validateCode", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.ValidateCode); 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 *ValidateCodeForAndroidRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ValidateCodeForAndroidRequest(%+v)", *p) + +} + +type ValidateCodeForAndroidResponse struct { +} + +func NewValidateCodeForAndroidResponse() *ValidateCodeForAndroidResponse { + return &ValidateCodeForAndroidResponse{} +} + +func (p *ValidateCodeForAndroidResponse) InitDefault() { +} + +var fieldIDToName_ValidateCodeForAndroidResponse = map[int16]string{} + +func (p *ValidateCodeForAndroidResponse) 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 + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *ValidateCodeForAndroidResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("ValidateCodeForAndroidResponse"); err != nil { + goto WriteStructBeginError + } + if p != nil { + } + 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) +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 *ValidateCodeForAndroidResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("ValidateCodeForAndroidResponse(%+v)", *p) + +} + // course type CourseListRequest struct { Term string `thrift:"term,1,required" form:"term,required" json:"term,required" query:"term,required"` @@ -5688,7 +5920,7 @@ func (p *ListDirFilesResponse) String() string { } type GetDownloadUrlRequest struct { - URL string `thrift:"url,1,required" form:"url,required" json:"url,required" query:"url,required"` + Filepath string `thrift:"filepath,1,required" form:"filepath,required" json:"filepath,required" query:"filepath,required"` } func NewGetDownloadUrlRequest() *GetDownloadUrlRequest { @@ -5698,19 +5930,19 @@ func NewGetDownloadUrlRequest() *GetDownloadUrlRequest { func (p *GetDownloadUrlRequest) InitDefault() { } -func (p *GetDownloadUrlRequest) GetURL() (v string) { - return p.URL +func (p *GetDownloadUrlRequest) GetFilepath() (v string) { + return p.Filepath } var fieldIDToName_GetDownloadUrlRequest = map[int16]string{ - 1: "url", + 1: "filepath", } func (p *GetDownloadUrlRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetURL bool = false + var issetFilepath bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -5731,7 +5963,7 @@ func (p *GetDownloadUrlRequest) Read(iprot thrift.TProtocol) (err error) { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetURL = true + issetFilepath = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -5748,7 +5980,7 @@ func (p *GetDownloadUrlRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetURL { + if !issetFilepath { fieldId = 1 goto RequiredFieldNotSetError } @@ -5778,7 +6010,7 @@ func (p *GetDownloadUrlRequest) ReadField1(iprot thrift.TProtocol) error { } else { _field = v } - p.URL = _field + p.Filepath = _field return nil } @@ -5811,10 +6043,10 @@ WriteStructEndError: } func (p *GetDownloadUrlRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("url", thrift.STRING, 1); err != nil { + if err = oprot.WriteFieldBegin("filepath", thrift.STRING, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteString(p.URL); err != nil { + if err := oprot.WriteString(p.Filepath); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -5983,23 +6215,31 @@ func (p *GetDownloadUrlResponse) String() string { } -// academic -type GetScoresRequest struct { +// 兼容 +type ListDirFilesForAndroidRequest struct { + Path string `thrift:"path,1,required" form:"path,required" json:"path,required" query:"path,required"` } -func NewGetScoresRequest() *GetScoresRequest { - return &GetScoresRequest{} +func NewListDirFilesForAndroidRequest() *ListDirFilesForAndroidRequest { + return &ListDirFilesForAndroidRequest{} } -func (p *GetScoresRequest) InitDefault() { +func (p *ListDirFilesForAndroidRequest) InitDefault() { } -var fieldIDToName_GetScoresRequest = map[int16]string{} +func (p *ListDirFilesForAndroidRequest) GetPath() (v string) { + return p.Path +} -func (p *GetScoresRequest) Read(iprot thrift.TProtocol) (err error) { +var fieldIDToName_ListDirFilesForAndroidRequest = map[int16]string{ + 1: "path", +} + +func (p *ListDirFilesForAndroidRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetPath bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -6013,8 +6253,21 @@ func (p *GetScoresRequest) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetPath = 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 @@ -6024,159 +6277,43 @@ func (p *GetScoresRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } + if !issetPath { + 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ListDirFilesForAndroidRequest[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_ListDirFilesForAndroidRequest[fieldId])) } -func (p *GetScoresRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetScoresRequest"); err != nil { - goto WriteStructBeginError +func (p *ListDirFilesForAndroidRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v } - if p != nil { - } - 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) -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 *GetScoresRequest) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetScoresRequest(%+v)", *p) - -} - -type GetScoresResponse struct { - Scores []*model.Score `thrift:"scores,1,required" form:"scores,required" json:"scores,required" query:"scores,required"` -} - -func NewGetScoresResponse() *GetScoresResponse { - return &GetScoresResponse{} -} - -func (p *GetScoresResponse) InitDefault() { -} - -func (p *GetScoresResponse) GetScores() (v []*model.Score) { - return p.Scores -} - -var fieldIDToName_GetScoresResponse = map[int16]string{ - 1: "scores", -} - -func (p *GetScoresResponse) Read(iprot thrift.TProtocol) (err error) { - - var fieldTypeId thrift.TType - var fieldId int16 - var issetScores bool = false - - 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.LIST { - if err = p.ReadField1(iprot); err != nil { - goto ReadFieldError - } - issetScores = 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 - } - - if !issetScores { - 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_GetScoresResponse[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) -RequiredFieldNotSetError: - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetScoresResponse[fieldId])) -} - -func (p *GetScoresResponse) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return err - } - _field := make([]*model.Score, 0, size) - values := make([]model.Score, 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.Scores = _field + p.Path = _field return nil } -func (p *GetScoresResponse) Write(oprot thrift.TProtocol) (err error) { +func (p *ListDirFilesForAndroidRequest) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetScoresResponse"); err != nil { + if err = oprot.WriteStructBegin("ListDirFilesForAndroidRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6202,19 +6339,11 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetScoresResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("scores", thrift.LIST, 1); err != nil { +func (p *ListDirFilesForAndroidRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("path", thrift.STRING, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Scores)); err != nil { - return err - } - for _, v := range p.Scores { - if err := v.Write(oprot); err != nil { - return err - } - } - if err := oprot.WriteListEnd(); err != nil { + if err := oprot.WriteString(p.Path); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -6227,27 +6356,27 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *GetScoresResponse) String() string { +func (p *ListDirFilesForAndroidRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetScoresResponse(%+v)", *p) + return fmt.Sprintf("ListDirFilesForAndroidRequest(%+v)", *p) } -type GetGPARequest struct { +type ListDirFilesForAndroidResponse struct { } -func NewGetGPARequest() *GetGPARequest { - return &GetGPARequest{} +func NewListDirFilesForAndroidResponse() *ListDirFilesForAndroidResponse { + return &ListDirFilesForAndroidResponse{} } -func (p *GetGPARequest) InitDefault() { +func (p *ListDirFilesForAndroidResponse) InitDefault() { } -var fieldIDToName_GetGPARequest = map[int16]string{} +var fieldIDToName_ListDirFilesForAndroidResponse = map[int16]string{} -func (p *GetGPARequest) Read(iprot thrift.TProtocol) (err error) { +func (p *ListDirFilesForAndroidResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -6289,8 +6418,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetGPARequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetGPARequest"); err != nil { +func (p *ListDirFilesForAndroidResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("ListDirFilesForAndroidResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6310,47 +6439,38 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetGPARequest) String() string { +func (p *ListDirFilesForAndroidResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetGPARequest(%+v)", *p) - -} + return fmt.Sprintf("ListDirFilesForAndroidResponse(%+v)", *p) -type GetGPAResponse struct { - Gpa *model.GPABean `thrift:"gpa,1,required" form:"gpa,required" json:"gpa,required" query:"gpa,required"` } -func NewGetGPAResponse() *GetGPAResponse { - return &GetGPAResponse{} +type GetDownloadUrlForAndroidRequest struct { + Filepath string `thrift:"filepath,1,required" form:"filepath,required" json:"filepath,required" query:"filepath,required"` } -func (p *GetGPAResponse) InitDefault() { +func NewGetDownloadUrlForAndroidRequest() *GetDownloadUrlForAndroidRequest { + return &GetDownloadUrlForAndroidRequest{} } -var GetGPAResponse_Gpa_DEFAULT *model.GPABean - -func (p *GetGPAResponse) GetGpa() (v *model.GPABean) { - if !p.IsSetGpa() { - return GetGPAResponse_Gpa_DEFAULT - } - return p.Gpa +func (p *GetDownloadUrlForAndroidRequest) InitDefault() { } -var fieldIDToName_GetGPAResponse = map[int16]string{ - 1: "gpa", +func (p *GetDownloadUrlForAndroidRequest) GetFilepath() (v string) { + return p.Filepath } -func (p *GetGPAResponse) IsSetGpa() bool { - return p.Gpa != nil +var fieldIDToName_GetDownloadUrlForAndroidRequest = map[int16]string{ + 1: "filepath", } -func (p *GetGPAResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetDownloadUrlForAndroidRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetGpa bool = false + var issetFilepath bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -6367,11 +6487,11 @@ func (p *GetGPAResponse) Read(iprot thrift.TProtocol) (err error) { switch fieldId { case 1: - if fieldTypeId == thrift.STRUCT { + if fieldTypeId == thrift.STRING { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetGpa = true + issetFilepath = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -6388,7 +6508,7 @@ func (p *GetGPAResponse) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetGpa { + if !issetFilepath { fieldId = 1 goto RequiredFieldNotSetError } @@ -6398,7 +6518,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_GetGPAResponse[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetDownloadUrlForAndroidRequest[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -6407,21 +6527,24 @@ ReadFieldEndError: 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_GetGPAResponse[fieldId])) + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetDownloadUrlForAndroidRequest[fieldId])) } -func (p *GetGPAResponse) ReadField1(iprot thrift.TProtocol) error { - _field := model.NewGPABean() - if err := _field.Read(iprot); err != nil { +func (p *GetDownloadUrlForAndroidRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { return err + } else { + _field = v } - p.Gpa = _field + p.Filepath = _field return nil } -func (p *GetGPAResponse) Write(oprot thrift.TProtocol) (err error) { +func (p *GetDownloadUrlForAndroidRequest) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetGPAResponse"); err != nil { + if err = oprot.WriteStructBegin("GetDownloadUrlForAndroidRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6447,11 +6570,11 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetGPAResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("gpa", thrift.STRUCT, 1); err != nil { +func (p *GetDownloadUrlForAndroidRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("filepath", thrift.STRING, 1); err != nil { goto WriteFieldBeginError } - if err := p.Gpa.Write(oprot); err != nil { + if err := oprot.WriteString(p.Filepath); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -6464,27 +6587,27 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *GetGPAResponse) String() string { +func (p *GetDownloadUrlForAndroidRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetGPAResponse(%+v)", *p) + return fmt.Sprintf("GetDownloadUrlForAndroidRequest(%+v)", *p) } -type GetCreditRequest struct { +type GetDownloadUrlForAndroidResponse struct { } -func NewGetCreditRequest() *GetCreditRequest { - return &GetCreditRequest{} +func NewGetDownloadUrlForAndroidResponse() *GetDownloadUrlForAndroidResponse { + return &GetDownloadUrlForAndroidResponse{} } -func (p *GetCreditRequest) InitDefault() { +func (p *GetDownloadUrlForAndroidResponse) InitDefault() { } -var fieldIDToName_GetCreditRequest = map[int16]string{} +var fieldIDToName_GetDownloadUrlForAndroidResponse = map[int16]string{} -func (p *GetCreditRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetDownloadUrlForAndroidResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -6526,8 +6649,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetCreditRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetCreditRequest"); err != nil { +func (p *GetDownloadUrlForAndroidResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetDownloadUrlForAndroidResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6547,38 +6670,31 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetCreditRequest) String() string { +func (p *GetDownloadUrlForAndroidResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetCreditRequest(%+v)", *p) - -} + return fmt.Sprintf("GetDownloadUrlForAndroidResponse(%+v)", *p) -type GetCreditResponse struct { - Major []*model.Credit `thrift:"major,1,required" form:"major,required" json:"major,required" query:"major,required"` } -func NewGetCreditResponse() *GetCreditResponse { - return &GetCreditResponse{} +// academic +type GetScoresRequest struct { } -func (p *GetCreditResponse) InitDefault() { +func NewGetScoresRequest() *GetScoresRequest { + return &GetScoresRequest{} } -func (p *GetCreditResponse) GetMajor() (v []*model.Credit) { - return p.Major +func (p *GetScoresRequest) InitDefault() { } -var fieldIDToName_GetCreditResponse = map[int16]string{ - 1: "major", -} +var fieldIDToName_GetScoresRequest = map[int16]string{} -func (p *GetCreditResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetScoresRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetMajor bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -6592,21 +6708,8 @@ func (p *GetCreditResponse) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - - switch fieldId { - case 1: - if fieldTypeId == thrift.LIST { - if err = p.ReadField1(iprot); err != nil { - goto ReadFieldError - } - issetMajor = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - default: - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError } if err = iprot.ReadFieldEnd(); err != nil { goto ReadFieldEndError @@ -6616,35 +6719,139 @@ func (p *GetCreditResponse) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetMajor { - 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_GetCreditResponse[fieldId]), err) -SkipFieldError: - return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) - +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *GetScoresRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetScoresRequest"); err != nil { + goto WriteStructBeginError + } + if p != nil { + } + 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) +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 *GetScoresRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetScoresRequest(%+v)", *p) + +} + +type GetScoresResponse struct { + Scores []*model.Score `thrift:"scores,1,required" form:"scores,required" json:"scores,required" query:"scores,required"` +} + +func NewGetScoresResponse() *GetScoresResponse { + return &GetScoresResponse{} +} + +func (p *GetScoresResponse) InitDefault() { +} + +func (p *GetScoresResponse) GetScores() (v []*model.Score) { + return p.Scores +} + +var fieldIDToName_GetScoresResponse = map[int16]string{ + 1: "scores", +} + +func (p *GetScoresResponse) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + var issetScores bool = false + + 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.LIST { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetScores = 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 + } + + if !issetScores { + 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_GetScoresResponse[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) RequiredFieldNotSetError: - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetCreditResponse[fieldId])) + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetScoresResponse[fieldId])) } -func (p *GetCreditResponse) ReadField1(iprot thrift.TProtocol) error { +func (p *GetScoresResponse) ReadField1(iprot thrift.TProtocol) error { _, size, err := iprot.ReadListBegin() if err != nil { return err } - _field := make([]*model.Credit, 0, size) - values := make([]model.Credit, size) + _field := make([]*model.Score, 0, size) + values := make([]model.Score, size) for i := 0; i < size; i++ { _elem := &values[i] _elem.InitDefault() @@ -6658,13 +6865,13 @@ func (p *GetCreditResponse) ReadField1(iprot thrift.TProtocol) error { if err := iprot.ReadListEnd(); err != nil { return err } - p.Major = _field + p.Scores = _field return nil } -func (p *GetCreditResponse) Write(oprot thrift.TProtocol) (err error) { +func (p *GetScoresResponse) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetCreditResponse"); err != nil { + if err = oprot.WriteStructBegin("GetScoresResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6690,14 +6897,14 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetCreditResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("major", thrift.LIST, 1); err != nil { +func (p *GetScoresResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("scores", thrift.LIST, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Major)); err != nil { + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Scores)); err != nil { return err } - for _, v := range p.Major { + for _, v := range p.Scores { if err := v.Write(oprot); err != nil { return err } @@ -6715,27 +6922,27 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *GetCreditResponse) String() string { +func (p *GetScoresResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetCreditResponse(%+v)", *p) + return fmt.Sprintf("GetScoresResponse(%+v)", *p) } -type GetUnifiedExamRequest struct { +type GetGPARequest struct { } -func NewGetUnifiedExamRequest() *GetUnifiedExamRequest { - return &GetUnifiedExamRequest{} +func NewGetGPARequest() *GetGPARequest { + return &GetGPARequest{} } -func (p *GetUnifiedExamRequest) InitDefault() { +func (p *GetGPARequest) InitDefault() { } -var fieldIDToName_GetUnifiedExamRequest = map[int16]string{} +var fieldIDToName_GetGPARequest = map[int16]string{} -func (p *GetUnifiedExamRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetGPARequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -6777,8 +6984,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetUnifiedExamRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetUnifiedExamRequest"); err != nil { +func (p *GetGPARequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetGPARequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6798,38 +7005,47 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetUnifiedExamRequest) String() string { +func (p *GetGPARequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetUnifiedExamRequest(%+v)", *p) + return fmt.Sprintf("GetGPARequest(%+v)", *p) } -type GetUnifiedExamResponse struct { - UnifiedExam []*model.UnifiedExam `thrift:"unifiedExam,1,required" form:"unifiedExam,required" json:"unifiedExam,required" query:"unifiedExam,required"` +type GetGPAResponse struct { + Gpa *model.GPABean `thrift:"gpa,1,required" form:"gpa,required" json:"gpa,required" query:"gpa,required"` } -func NewGetUnifiedExamResponse() *GetUnifiedExamResponse { - return &GetUnifiedExamResponse{} +func NewGetGPAResponse() *GetGPAResponse { + return &GetGPAResponse{} } -func (p *GetUnifiedExamResponse) InitDefault() { +func (p *GetGPAResponse) InitDefault() { } -func (p *GetUnifiedExamResponse) GetUnifiedExam() (v []*model.UnifiedExam) { - return p.UnifiedExam +var GetGPAResponse_Gpa_DEFAULT *model.GPABean + +func (p *GetGPAResponse) GetGpa() (v *model.GPABean) { + if !p.IsSetGpa() { + return GetGPAResponse_Gpa_DEFAULT + } + return p.Gpa } -var fieldIDToName_GetUnifiedExamResponse = map[int16]string{ - 1: "unifiedExam", +var fieldIDToName_GetGPAResponse = map[int16]string{ + 1: "gpa", } -func (p *GetUnifiedExamResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetGPAResponse) IsSetGpa() bool { + return p.Gpa != nil +} + +func (p *GetGPAResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetUnifiedExam bool = false + var issetGpa bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -6846,11 +7062,11 @@ func (p *GetUnifiedExamResponse) Read(iprot thrift.TProtocol) (err error) { switch fieldId { case 1: - if fieldTypeId == thrift.LIST { + if fieldTypeId == thrift.STRUCT { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetUnifiedExam = true + issetGpa = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -6867,7 +7083,7 @@ func (p *GetUnifiedExamResponse) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetUnifiedExam { + if !issetGpa { fieldId = 1 goto RequiredFieldNotSetError } @@ -6877,7 +7093,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_GetUnifiedExamResponse[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetGPAResponse[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -6886,36 +7102,21 @@ ReadFieldEndError: 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_GetUnifiedExamResponse[fieldId])) + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetGPAResponse[fieldId])) } -func (p *GetUnifiedExamResponse) ReadField1(iprot thrift.TProtocol) error { - _, size, err := iprot.ReadListBegin() - if err != nil { - return err - } - _field := make([]*model.UnifiedExam, 0, size) - values := make([]model.UnifiedExam, 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 { +func (p *GetGPAResponse) ReadField1(iprot thrift.TProtocol) error { + _field := model.NewGPABean() + if err := _field.Read(iprot); err != nil { return err } - p.UnifiedExam = _field + p.Gpa = _field return nil } -func (p *GetUnifiedExamResponse) Write(oprot thrift.TProtocol) (err error) { +func (p *GetGPAResponse) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetUnifiedExamResponse"); err != nil { + if err = oprot.WriteStructBegin("GetGPAResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -6941,19 +7142,11 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetUnifiedExamResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("unifiedExam", thrift.LIST, 1); err != nil { +func (p *GetGPAResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("gpa", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteListBegin(thrift.STRUCT, len(p.UnifiedExam)); err != nil { - return err - } - for _, v := range p.UnifiedExam { - if err := v.Write(oprot); err != nil { - return err - } - } - if err := oprot.WriteListEnd(); err != nil { + if err := p.Gpa.Write(oprot); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -6966,39 +7159,121 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *GetUnifiedExamResponse) String() string { +func (p *GetGPAResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetUnifiedExamResponse(%+v)", *p) + return fmt.Sprintf("GetGPAResponse(%+v)", *p) } -// url -type APILoginRequest struct { - Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` +type GetCreditRequest struct { } -func NewAPILoginRequest() *APILoginRequest { - return &APILoginRequest{} +func NewGetCreditRequest() *GetCreditRequest { + return &GetCreditRequest{} } -func (p *APILoginRequest) InitDefault() { +func (p *GetCreditRequest) InitDefault() { } -func (p *APILoginRequest) GetPassword() (v string) { - return p.Password +var fieldIDToName_GetCreditRequest = map[int16]string{} + +func (p *GetCreditRequest) 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 + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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) } -var fieldIDToName_APILoginRequest = map[int16]string{ - 1: "password", +func (p *GetCreditRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetCreditRequest"); err != nil { + goto WriteStructBeginError + } + if p != nil { + } + 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) +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 *APILoginRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetCreditRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetCreditRequest(%+v)", *p) + +} + +type GetCreditResponse struct { + Major []*model.Credit `thrift:"major,1,required" form:"major,required" json:"major,required" query:"major,required"` +} + +func NewGetCreditResponse() *GetCreditResponse { + return &GetCreditResponse{} +} + +func (p *GetCreditResponse) InitDefault() { +} + +func (p *GetCreditResponse) GetMajor() (v []*model.Credit) { + return p.Major +} + +var fieldIDToName_GetCreditResponse = map[int16]string{ + 1: "major", +} + +func (p *GetCreditResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetPassword bool = false + var issetMajor bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -7015,11 +7290,11 @@ func (p *APILoginRequest) Read(iprot thrift.TProtocol) (err error) { switch fieldId { case 1: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetPassword = true + issetMajor = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -7036,7 +7311,7 @@ func (p *APILoginRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetPassword { + if !issetMajor { fieldId = 1 goto RequiredFieldNotSetError } @@ -7046,7 +7321,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_APILoginRequest[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetCreditResponse[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -7055,24 +7330,36 @@ ReadFieldEndError: 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_APILoginRequest[fieldId])) + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetCreditResponse[fieldId])) } -func (p *APILoginRequest) ReadField1(iprot thrift.TProtocol) error { +func (p *GetCreditResponse) ReadField1(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]*model.Credit, 0, size) + values := make([]model.Credit, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() - var _field string - if v, err := iprot.ReadString(); err != nil { + if err := _elem.Read(iprot); err != nil { + return err + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { return err - } else { - _field = v } - p.Password = _field + p.Major = _field return nil } -func (p *APILoginRequest) Write(oprot thrift.TProtocol) (err error) { +func (p *GetCreditResponse) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("APILoginRequest"); err != nil { + if err = oprot.WriteStructBegin("GetCreditResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -7098,11 +7385,19 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *APILoginRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { +func (p *GetCreditResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("major", thrift.LIST, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteString(p.Password); err != nil { + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.Major)); err != nil { + return err + } + for _, v := range p.Major { + if err := v.Write(oprot); err != nil { + return err + } + } + if err := oprot.WriteListEnd(); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -7115,27 +7410,27 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *APILoginRequest) String() string { +func (p *GetCreditResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("APILoginRequest(%+v)", *p) + return fmt.Sprintf("GetCreditResponse(%+v)", *p) } -type APILoginResponse struct { +type GetUnifiedExamRequest struct { } -func NewAPILoginResponse() *APILoginResponse { - return &APILoginResponse{} +func NewGetUnifiedExamRequest() *GetUnifiedExamRequest { + return &GetUnifiedExamRequest{} } -func (p *APILoginResponse) InitDefault() { +func (p *GetUnifiedExamRequest) InitDefault() { } -var fieldIDToName_APILoginResponse = map[int16]string{} +var fieldIDToName_GetUnifiedExamRequest = map[int16]string{} -func (p *APILoginResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetUnifiedExamRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -7177,8 +7472,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *APILoginResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("APILoginResponse"); err != nil { +func (p *GetUnifiedExamRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetUnifiedExamRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -7198,73 +7493,38 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *APILoginResponse) String() string { +func (p *GetUnifiedExamRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("APILoginResponse(%+v)", *p) - -} - -type UploadVersionInfoRequest struct { - Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` - Type string `thrift:"type,2,required" form:"type,required" json:"type,required" query:"type,required"` - Version string `thrift:"version,3,required" form:"version,required" json:"version,required" query:"version,required"` - Code string `thrift:"code,4,required" form:"code,required" json:"code,required" query:"code,required"` - Feature string `thrift:"feature,5,required" form:"feature,required" json:"feature,required" query:"feature,required"` - URL string `thrift:"url,6,required" form:"url,required" json:"url,required" query:"url,required"` -} - -func NewUploadVersionInfoRequest() *UploadVersionInfoRequest { - return &UploadVersionInfoRequest{} -} - -func (p *UploadVersionInfoRequest) InitDefault() { -} - -func (p *UploadVersionInfoRequest) GetPassword() (v string) { - return p.Password -} + return fmt.Sprintf("GetUnifiedExamRequest(%+v)", *p) -func (p *UploadVersionInfoRequest) GetType() (v string) { - return p.Type } -func (p *UploadVersionInfoRequest) GetVersion() (v string) { - return p.Version +type GetUnifiedExamResponse struct { + UnifiedExam []*model.UnifiedExam `thrift:"unifiedExam,1,required" form:"unifiedExam,required" json:"unifiedExam,required" query:"unifiedExam,required"` } -func (p *UploadVersionInfoRequest) GetCode() (v string) { - return p.Code +func NewGetUnifiedExamResponse() *GetUnifiedExamResponse { + return &GetUnifiedExamResponse{} } -func (p *UploadVersionInfoRequest) GetFeature() (v string) { - return p.Feature +func (p *GetUnifiedExamResponse) InitDefault() { } -func (p *UploadVersionInfoRequest) GetURL() (v string) { - return p.URL +func (p *GetUnifiedExamResponse) GetUnifiedExam() (v []*model.UnifiedExam) { + return p.UnifiedExam } -var fieldIDToName_UploadVersionInfoRequest = map[int16]string{ - 1: "password", - 2: "type", - 3: "version", - 4: "code", - 5: "feature", - 6: "url", +var fieldIDToName_GetUnifiedExamResponse = map[int16]string{ + 1: "unifiedExam", } -func (p *UploadVersionInfoRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetUnifiedExamResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetPassword bool = false - var issetType bool = false - var issetVersion bool = false - var issetCode bool = false - var issetFeature bool = false - var issetURL bool = false + var issetUnifiedExam bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -7281,61 +7541,16 @@ func (p *UploadVersionInfoRequest) Read(iprot thrift.TProtocol) (err error) { switch fieldId { case 1: - if fieldTypeId == thrift.STRING { + if fieldTypeId == thrift.LIST { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetPassword = true - } 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 - } - issetType = true + issetUnifiedExam = true } 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 - } - issetVersion = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 4: - if fieldTypeId == thrift.STRING { - if err = p.ReadField4(iprot); err != nil { - goto ReadFieldError - } - issetCode = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 5: - if fieldTypeId == thrift.STRING { - if err = p.ReadField5(iprot); err != nil { - goto ReadFieldError - } - issetFeature = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 6: - if fieldTypeId == thrift.STRING { - if err = p.ReadField6(iprot); err != nil { - goto ReadFieldError - } - issetURL = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - default: - if err = iprot.Skip(fieldTypeId); err != nil { + default: + if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } } @@ -7347,42 +7562,17 @@ func (p *UploadVersionInfoRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetPassword { + if !issetUnifiedExam { fieldId = 1 goto RequiredFieldNotSetError } - - if !issetType { - fieldId = 2 - goto RequiredFieldNotSetError - } - - if !issetVersion { - fieldId = 3 - goto RequiredFieldNotSetError - } - - if !issetCode { - fieldId = 4 - goto RequiredFieldNotSetError - } - - if !issetFeature { - fieldId = 5 - goto RequiredFieldNotSetError - } - - if !issetURL { - fieldId = 6 - 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_UploadVersionInfoRequest[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetUnifiedExamResponse[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -7391,79 +7581,36 @@ ReadFieldEndError: 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_UploadVersionInfoRequest[fieldId])) -} - -func (p *UploadVersionInfoRequest) ReadField1(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Password = _field - return nil -} -func (p *UploadVersionInfoRequest) ReadField2(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Type = _field - return nil + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetUnifiedExamResponse[fieldId])) } -func (p *UploadVersionInfoRequest) ReadField3(iprot thrift.TProtocol) error { - var _field string - if v, err := iprot.ReadString(); err != nil { +func (p *GetUnifiedExamResponse) ReadField1(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { return err - } else { - _field = v } - p.Version = _field - return nil -} -func (p *UploadVersionInfoRequest) ReadField4(iprot thrift.TProtocol) error { + _field := make([]*model.UnifiedExam, 0, size) + values := make([]model.UnifiedExam, size) + for i := 0; i < size; i++ { + _elem := &values[i] + _elem.InitDefault() - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Code = _field - return nil -} -func (p *UploadVersionInfoRequest) ReadField5(iprot thrift.TProtocol) error { + if err := _elem.Read(iprot); err != nil { + return err + } - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v + _field = append(_field, _elem) } - p.Feature = _field - return nil -} -func (p *UploadVersionInfoRequest) ReadField6(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { + if err := iprot.ReadListEnd(); err != nil { return err - } else { - _field = v } - p.URL = _field + p.UnifiedExam = _field return nil } -func (p *UploadVersionInfoRequest) Write(oprot thrift.TProtocol) (err error) { +func (p *GetUnifiedExamResponse) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("UploadVersionInfoRequest"); err != nil { + if err = oprot.WriteStructBegin("GetUnifiedExamResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -7471,26 +7618,6 @@ func (p *UploadVersionInfoRequest) Write(oprot thrift.TProtocol) (err error) { 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 = p.writeField4(oprot); err != nil { - fieldId = 4 - goto WriteFieldError - } - if err = p.writeField5(oprot); err != nil { - fieldId = 5 - goto WriteFieldError - } - if err = p.writeField6(oprot); err != nil { - fieldId = 6 - goto WriteFieldError - } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -7509,28 +7636,19 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UploadVersionInfoRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { +func (p *GetUnifiedExamResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("unifiedExam", thrift.LIST, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteString(p.Password); err != nil { + if err := oprot.WriteListBegin(thrift.STRUCT, len(p.UnifiedExam)); 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 *UploadVersionInfoRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("type", thrift.STRING, 2); err != nil { - goto WriteFieldBeginError + for _, v := range p.UnifiedExam { + if err := v.Write(oprot); err != nil { + return err + } } - if err := oprot.WriteString(p.Type); err != nil { + if err := oprot.WriteListEnd(); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -7538,190 +7656,40 @@ func (p *UploadVersionInfoRequest) writeField2(oprot thrift.TProtocol) (err erro } return nil WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 2 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 2 end error: ", p), err) + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *UploadVersionInfoRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("version", thrift.STRING, 3); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Version); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError +func (p *GetUnifiedExamResponse) String() string { + if p == nil { + return "" } - 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) -} + return fmt.Sprintf("GetUnifiedExamResponse(%+v)", *p) -func (p *UploadVersionInfoRequest) writeField4(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("code", thrift.STRING, 4); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Code); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) } -func (p *UploadVersionInfoRequest) writeField5(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("feature", thrift.STRING, 5); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Feature); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +// url +type APILoginRequest struct { + Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` } -func (p *UploadVersionInfoRequest) writeField6(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("url", thrift.STRING, 6); 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 6 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) +func NewAPILoginRequest() *APILoginRequest { + return &APILoginRequest{} } -func (p *UploadVersionInfoRequest) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("UploadVersionInfoRequest(%+v)", *p) - +func (p *APILoginRequest) InitDefault() { } -type UploadVersionInfoResponse struct { -} - -func NewUploadVersionInfoResponse() *UploadVersionInfoResponse { - return &UploadVersionInfoResponse{} -} - -func (p *UploadVersionInfoResponse) InitDefault() { -} - -var fieldIDToName_UploadVersionInfoResponse = map[int16]string{} - -func (p *UploadVersionInfoResponse) 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 - } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError - } - 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *UploadVersionInfoResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("UploadVersionInfoResponse"); err != nil { - goto WriteStructBeginError - } - if p != nil { - } - 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) -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 *UploadVersionInfoResponse) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("UploadVersionInfoResponse(%+v)", *p) - -} - -type GetUploadParamsRequest struct { - Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` -} - -func NewGetUploadParamsRequest() *GetUploadParamsRequest { - return &GetUploadParamsRequest{} -} - -func (p *GetUploadParamsRequest) InitDefault() { -} - -func (p *GetUploadParamsRequest) GetPassword() (v string) { +func (p *APILoginRequest) GetPassword() (v string) { return p.Password } -var fieldIDToName_GetUploadParamsRequest = map[int16]string{ +var fieldIDToName_APILoginRequest = map[int16]string{ 1: "password", } -func (p *GetUploadParamsRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *APILoginRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -7773,7 +7741,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_GetUploadParamsRequest[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_APILoginRequest[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -7782,10 +7750,10 @@ ReadFieldEndError: 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_GetUploadParamsRequest[fieldId])) + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_APILoginRequest[fieldId])) } -func (p *GetUploadParamsRequest) ReadField1(iprot thrift.TProtocol) error { +func (p *APILoginRequest) ReadField1(iprot thrift.TProtocol) error { var _field string if v, err := iprot.ReadString(); err != nil { @@ -7797,9 +7765,9 @@ func (p *GetUploadParamsRequest) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *GetUploadParamsRequest) Write(oprot thrift.TProtocol) (err error) { +func (p *APILoginRequest) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetUploadParamsRequest"); err != nil { + if err = oprot.WriteStructBegin("APILoginRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -7825,7 +7793,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetUploadParamsRequest) writeField1(oprot thrift.TProtocol) (err error) { +func (p *APILoginRequest) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { goto WriteFieldBeginError } @@ -7842,45 +7810,30 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *GetUploadParamsRequest) String() string { +func (p *APILoginRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetUploadParamsRequest(%+v)", *p) - -} - -type GetUploadParamsResponse struct { - Policy string `thrift:"policy,1,required" form:"policy,required" json:"policy,required" query:"policy,required"` - Authorization string `thrift:"authorization,2,required" form:"authorization,required" json:"authorization,required" query:"authorization,required"` -} + return fmt.Sprintf("APILoginRequest(%+v)", *p) -func NewGetUploadParamsResponse() *GetUploadParamsResponse { - return &GetUploadParamsResponse{} } -func (p *GetUploadParamsResponse) InitDefault() { +type APILoginResponse struct { } -func (p *GetUploadParamsResponse) GetPolicy() (v string) { - return p.Policy +func NewAPILoginResponse() *APILoginResponse { + return &APILoginResponse{} } -func (p *GetUploadParamsResponse) GetAuthorization() (v string) { - return p.Authorization +func (p *APILoginResponse) InitDefault() { } -var fieldIDToName_GetUploadParamsResponse = map[int16]string{ - 1: "policy", - 2: "authorization", -} +var fieldIDToName_APILoginResponse = map[int16]string{} -func (p *GetUploadParamsResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *APILoginResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetPolicy bool = false - var issetAuthorization bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -7894,30 +7847,8 @@ func (p *GetUploadParamsResponse) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err = p.ReadField1(iprot); err != nil { - goto ReadFieldError - } - issetPolicy = true - } 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 - } - issetAuthorization = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - default: - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError } if err = iprot.ReadFieldEnd(); err != nil { goto ReadFieldEndError @@ -7927,70 +7858,25 @@ func (p *GetUploadParamsResponse) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetPolicy { - fieldId = 1 - goto RequiredFieldNotSetError - } - - if !issetAuthorization { - 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_GetUploadParamsResponse[fieldId]), err) -SkipFieldError: - return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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) -RequiredFieldNotSetError: - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetUploadParamsResponse[fieldId])) -} - -func (p *GetUploadParamsResponse) ReadField1(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Policy = _field - return nil -} -func (p *GetUploadParamsResponse) ReadField2(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Authorization = _field - return nil } -func (p *GetUploadParamsResponse) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("GetUploadParamsResponse"); err != nil { +func (p *APILoginResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("APILoginResponse"); 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 = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -8001,72 +7887,79 @@ func (p *GetUploadParamsResponse) Write(oprot thrift.TProtocol) (err error) { 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 *GetUploadParamsResponse) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("policy", thrift.STRING, 1); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Policy); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError +func (p *APILoginResponse) String() string { + if p == nil { + return "" } - 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) + return fmt.Sprintf("APILoginResponse(%+v)", *p) + } -func (p *GetUploadParamsResponse) writeField2(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("authorization", thrift.STRING, 2); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Authorization); 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 UploadVersionInfoRequest struct { + Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` + Type string `thrift:"type,2,required" form:"type,required" json:"type,required" query:"type,required"` + Version string `thrift:"version,3,required" form:"version,required" json:"version,required" query:"version,required"` + Code string `thrift:"code,4,required" form:"code,required" json:"code,required" query:"code,required"` + Feature string `thrift:"feature,5,required" form:"feature,required" json:"feature,required" query:"feature,required"` + URL string `thrift:"url,6,required" form:"url,required" json:"url,required" query:"url,required"` } -func (p *GetUploadParamsResponse) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("GetUploadParamsResponse(%+v)", *p) +func NewUploadVersionInfoRequest() *UploadVersionInfoRequest { + return &UploadVersionInfoRequest{} +} +func (p *UploadVersionInfoRequest) InitDefault() { } -type GetDownloadReleaseRequest struct { +func (p *UploadVersionInfoRequest) GetPassword() (v string) { + return p.Password } -func NewGetDownloadReleaseRequest() *GetDownloadReleaseRequest { - return &GetDownloadReleaseRequest{} +func (p *UploadVersionInfoRequest) GetType() (v string) { + return p.Type } -func (p *GetDownloadReleaseRequest) InitDefault() { +func (p *UploadVersionInfoRequest) GetVersion() (v string) { + return p.Version } -var fieldIDToName_GetDownloadReleaseRequest = map[int16]string{} +func (p *UploadVersionInfoRequest) GetCode() (v string) { + return p.Code +} -func (p *GetDownloadReleaseRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *UploadVersionInfoRequest) GetFeature() (v string) { + return p.Feature +} + +func (p *UploadVersionInfoRequest) GetURL() (v string) { + return p.URL +} + +var fieldIDToName_UploadVersionInfoRequest = map[int16]string{ + 1: "password", + 2: "type", + 3: "version", + 4: "code", + 5: "feature", + 6: "url", +} + +func (p *UploadVersionInfoRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetPassword bool = false + var issetType bool = false + var issetVersion bool = false + var issetCode bool = false + var issetFeature bool = false + var issetURL bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -8080,8 +7973,66 @@ func (p *GetDownloadReleaseRequest) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetPassword = true + } 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 + } + issetType = true + } 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 + } + issetVersion = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 4: + if fieldTypeId == thrift.STRING { + if err = p.ReadField4(iprot); err != nil { + goto ReadFieldError + } + issetCode = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 5: + if fieldTypeId == thrift.STRING { + if err = p.ReadField5(iprot); err != nil { + goto ReadFieldError + } + issetFeature = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 6: + if fieldTypeId == thrift.STRING { + if err = p.ReadField6(iprot); err != nil { + goto ReadFieldError + } + issetURL = 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 @@ -8091,25 +8042,150 @@ func (p *GetDownloadReleaseRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } + if !issetPassword { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetType { + fieldId = 2 + goto RequiredFieldNotSetError + } + + if !issetVersion { + fieldId = 3 + goto RequiredFieldNotSetError + } + + if !issetCode { + fieldId = 4 + goto RequiredFieldNotSetError + } + + if !issetFeature { + fieldId = 5 + goto RequiredFieldNotSetError + } + + if !issetURL { + fieldId = 6 + 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_UploadVersionInfoRequest[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_UploadVersionInfoRequest[fieldId])) } -func (p *GetDownloadReleaseRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetDownloadReleaseRequest"); err != nil { +func (p *UploadVersionInfoRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Password = _field + return nil +} +func (p *UploadVersionInfoRequest) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Type = _field + return nil +} +func (p *UploadVersionInfoRequest) ReadField3(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Version = _field + return nil +} +func (p *UploadVersionInfoRequest) ReadField4(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Code = _field + return nil +} +func (p *UploadVersionInfoRequest) ReadField5(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Feature = _field + return nil +} +func (p *UploadVersionInfoRequest) ReadField6(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 *UploadVersionInfoRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("UploadVersionInfoRequest"); 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 = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } + if err = p.writeField5(oprot); err != nil { + fieldId = 5 + goto WriteFieldError + } + if err = p.writeField6(oprot); err != nil { + fieldId = 6 + goto WriteFieldError + } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -8120,33 +8196,137 @@ func (p *GetDownloadReleaseRequest) Write(oprot thrift.TProtocol) (err error) { 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 *GetDownloadReleaseRequest) String() string { - if p == nil { +func (p *UploadVersionInfoRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Password); 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 *UploadVersionInfoRequest) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("type", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Type); 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 *UploadVersionInfoRequest) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("version", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Version); 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 *UploadVersionInfoRequest) writeField4(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("code", thrift.STRING, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Code); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) +} + +func (p *UploadVersionInfoRequest) writeField5(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("feature", thrift.STRING, 5); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Feature); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +} + +func (p *UploadVersionInfoRequest) writeField6(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("url", thrift.STRING, 6); 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 6 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) +} + +func (p *UploadVersionInfoRequest) String() string { + if p == nil { return "" } - return fmt.Sprintf("GetDownloadReleaseRequest(%+v)", *p) + return fmt.Sprintf("UploadVersionInfoRequest(%+v)", *p) } -type GetDownloadReleaseResponse struct { +type UploadVersionInfoResponse struct { } -func NewGetDownloadReleaseResponse() *GetDownloadReleaseResponse { - return &GetDownloadReleaseResponse{} +func NewUploadVersionInfoResponse() *UploadVersionInfoResponse { + return &UploadVersionInfoResponse{} } -func (p *GetDownloadReleaseResponse) InitDefault() { +func (p *UploadVersionInfoResponse) InitDefault() { } -var fieldIDToName_GetDownloadReleaseResponse = map[int16]string{} +var fieldIDToName_UploadVersionInfoResponse = map[int16]string{} -func (p *GetDownloadReleaseResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *UploadVersionInfoResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -8188,8 +8368,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetDownloadReleaseResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetDownloadReleaseResponse"); err != nil { +func (p *UploadVersionInfoResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("UploadVersionInfoResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -8209,30 +8389,38 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetDownloadReleaseResponse) String() string { +func (p *UploadVersionInfoResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetDownloadReleaseResponse(%+v)", *p) + return fmt.Sprintf("UploadVersionInfoResponse(%+v)", *p) } -type GetDownloadBetaRequest struct { +type GetUploadParamsRequest struct { + Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` } -func NewGetDownloadBetaRequest() *GetDownloadBetaRequest { - return &GetDownloadBetaRequest{} +func NewGetUploadParamsRequest() *GetUploadParamsRequest { + return &GetUploadParamsRequest{} } -func (p *GetDownloadBetaRequest) InitDefault() { +func (p *GetUploadParamsRequest) InitDefault() { } -var fieldIDToName_GetDownloadBetaRequest = map[int16]string{} +func (p *GetUploadParamsRequest) GetPassword() (v string) { + return p.Password +} -func (p *GetDownloadBetaRequest) Read(iprot thrift.TProtocol) (err error) { +var fieldIDToName_GetUploadParamsRequest = map[int16]string{ + 1: "password", +} + +func (p *GetUploadParamsRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetPassword bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -8246,8 +8434,21 @@ func (p *GetDownloadBetaRequest) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetPassword = 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 @@ -8257,25 +8458,50 @@ func (p *GetDownloadBetaRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } + if !issetPassword { + 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetUploadParamsRequest[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetUploadParamsRequest[fieldId])) } -func (p *GetDownloadBetaRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetDownloadBetaRequest"); err != nil { +func (p *GetUploadParamsRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Password = _field + return nil +} + +func (p *GetUploadParamsRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetUploadParamsRequest"); 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 @@ -8286,36 +8512,70 @@ func (p *GetDownloadBetaRequest) Write(oprot thrift.TProtocol) (err error) { 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 *GetDownloadBetaRequest) String() string { +func (p *GetUploadParamsRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Password); 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 *GetUploadParamsRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetDownloadBetaRequest(%+v)", *p) + return fmt.Sprintf("GetUploadParamsRequest(%+v)", *p) } -type GetDownloadBetaResponse struct { +type GetUploadParamsResponse struct { + Policy string `thrift:"policy,1,required" form:"policy,required" json:"policy,required" query:"policy,required"` + Authorization string `thrift:"authorization,2,required" form:"authorization,required" json:"authorization,required" query:"authorization,required"` } -func NewGetDownloadBetaResponse() *GetDownloadBetaResponse { - return &GetDownloadBetaResponse{} +func NewGetUploadParamsResponse() *GetUploadParamsResponse { + return &GetUploadParamsResponse{} } -func (p *GetDownloadBetaResponse) InitDefault() { +func (p *GetUploadParamsResponse) InitDefault() { } -var fieldIDToName_GetDownloadBetaResponse = map[int16]string{} +func (p *GetUploadParamsResponse) GetPolicy() (v string) { + return p.Policy +} -func (p *GetDownloadBetaResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetUploadParamsResponse) GetAuthorization() (v string) { + return p.Authorization +} + +var fieldIDToName_GetUploadParamsResponse = map[int16]string{ + 1: "policy", + 2: "authorization", +} + +func (p *GetUploadParamsResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetPolicy bool = false + var issetAuthorization bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -8329,36 +8589,103 @@ func (p *GetDownloadBetaResponse) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError - } - if err = iprot.ReadFieldEnd(); err != nil { - goto ReadFieldEndError - } - } - if err = iprot.ReadStructEnd(); err != nil { - goto ReadStructEndError - } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetPolicy = true + } 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 + } + issetAuthorization = 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 + } + + if !issetPolicy { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetAuthorization { + 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetUploadParamsResponse[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetUploadParamsResponse[fieldId])) } -func (p *GetDownloadBetaResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetDownloadBetaResponse"); err != nil { +func (p *GetUploadParamsResponse) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Policy = _field + return nil +} +func (p *GetUploadParamsResponse) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Authorization = _field + return nil +} + +func (p *GetUploadParamsResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetUploadParamsResponse"); 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 = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -8369,33 +8696,69 @@ func (p *GetDownloadBetaResponse) Write(oprot thrift.TProtocol) (err error) { 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 *GetDownloadBetaResponse) String() string { +func (p *GetUploadParamsResponse) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("policy", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Policy); 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 *GetUploadParamsResponse) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("authorization", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Authorization); 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 *GetUploadParamsResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetDownloadBetaResponse(%+v)", *p) + return fmt.Sprintf("GetUploadParamsResponse(%+v)", *p) } -type GetReleaseVersionRequest struct { +type GetDownloadReleaseRequest struct { } -func NewGetReleaseVersionRequest() *GetReleaseVersionRequest { - return &GetReleaseVersionRequest{} +func NewGetDownloadReleaseRequest() *GetDownloadReleaseRequest { + return &GetDownloadReleaseRequest{} } -func (p *GetReleaseVersionRequest) InitDefault() { +func (p *GetDownloadReleaseRequest) InitDefault() { } -var fieldIDToName_GetReleaseVersionRequest = map[int16]string{} +var fieldIDToName_GetDownloadReleaseRequest = map[int16]string{} -func (p *GetReleaseVersionRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetDownloadReleaseRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -8437,8 +8800,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetReleaseVersionRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetReleaseVersionRequest"); err != nil { +func (p *GetDownloadReleaseRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetDownloadReleaseRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -8458,27 +8821,27 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetReleaseVersionRequest) String() string { +func (p *GetDownloadReleaseRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetReleaseVersionRequest(%+v)", *p) + return fmt.Sprintf("GetDownloadReleaseRequest(%+v)", *p) } -type GetReleaseVersionResponse struct { +type GetDownloadReleaseResponse struct { } -func NewGetReleaseVersionResponse() *GetReleaseVersionResponse { - return &GetReleaseVersionResponse{} +func NewGetDownloadReleaseResponse() *GetDownloadReleaseResponse { + return &GetDownloadReleaseResponse{} } -func (p *GetReleaseVersionResponse) InitDefault() { +func (p *GetDownloadReleaseResponse) InitDefault() { } -var fieldIDToName_GetReleaseVersionResponse = map[int16]string{} +var fieldIDToName_GetDownloadReleaseResponse = map[int16]string{} -func (p *GetReleaseVersionResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetDownloadReleaseResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -8520,8 +8883,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetReleaseVersionResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetReleaseVersionResponse"); err != nil { +func (p *GetDownloadReleaseResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetDownloadReleaseResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -8541,27 +8904,27 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetReleaseVersionResponse) String() string { +func (p *GetDownloadReleaseResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetReleaseVersionResponse(%+v)", *p) + return fmt.Sprintf("GetDownloadReleaseResponse(%+v)", *p) } -type GetBetaVersionRequest struct { +type GetDownloadBetaRequest struct { } -func NewGetBetaVersionRequest() *GetBetaVersionRequest { - return &GetBetaVersionRequest{} +func NewGetDownloadBetaRequest() *GetDownloadBetaRequest { + return &GetDownloadBetaRequest{} } -func (p *GetBetaVersionRequest) InitDefault() { +func (p *GetDownloadBetaRequest) InitDefault() { } -var fieldIDToName_GetBetaVersionRequest = map[int16]string{} +var fieldIDToName_GetDownloadBetaRequest = map[int16]string{} -func (p *GetBetaVersionRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetDownloadBetaRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -8603,8 +8966,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetBetaVersionRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetBetaVersionRequest"); err != nil { +func (p *GetDownloadBetaRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetDownloadBetaRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -8624,27 +8987,27 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetBetaVersionRequest) String() string { +func (p *GetDownloadBetaRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetBetaVersionRequest(%+v)", *p) + return fmt.Sprintf("GetDownloadBetaRequest(%+v)", *p) } -type GetBetaVersionResponse struct { +type GetDownloadBetaResponse struct { } -func NewGetBetaVersionResponse() *GetBetaVersionResponse { - return &GetBetaVersionResponse{} +func NewGetDownloadBetaResponse() *GetDownloadBetaResponse { + return &GetDownloadBetaResponse{} } -func (p *GetBetaVersionResponse) InitDefault() { +func (p *GetDownloadBetaResponse) InitDefault() { } -var fieldIDToName_GetBetaVersionResponse = map[int16]string{} +var fieldIDToName_GetDownloadBetaResponse = map[int16]string{} -func (p *GetBetaVersionResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetDownloadBetaResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -8686,8 +9049,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetBetaVersionResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetBetaVersionResponse"); err != nil { +func (p *GetDownloadBetaResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetDownloadBetaResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -8707,118 +9070,110 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetBetaVersionResponse) String() string { +func (p *GetDownloadBetaResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetBetaVersionResponse(%+v)", *p) - -} - -type GetCloudSettingRequest struct { - Account *string `thrift:"account,1,optional" form:"account" json:"account,omitempty" query:"account"` - Version *string `thrift:"version,2,optional" form:"version" json:"version,omitempty" query:"version"` - Beta *string `thrift:"beta,3,optional" form:"beta" json:"beta,omitempty" query:"beta"` - Phone *string `thrift:"phone,4,optional" form:"phone" json:"phone,omitempty" query:"phone"` - IsLogin *string `thrift:"isLogin,5,optional" form:"isLogin" json:"isLogin,omitempty" query:"isLogin"` - LoginType *string `thrift:"loginType,6,optional" form:"loginType" json:"loginType,omitempty" query:"loginType"` -} + return fmt.Sprintf("GetDownloadBetaResponse(%+v)", *p) -func NewGetCloudSettingRequest() *GetCloudSettingRequest { - return &GetCloudSettingRequest{} } -func (p *GetCloudSettingRequest) InitDefault() { +type GetReleaseVersionRequest struct { } -var GetCloudSettingRequest_Account_DEFAULT string - -func (p *GetCloudSettingRequest) GetAccount() (v string) { - if !p.IsSetAccount() { - return GetCloudSettingRequest_Account_DEFAULT - } - return *p.Account +func NewGetReleaseVersionRequest() *GetReleaseVersionRequest { + return &GetReleaseVersionRequest{} } -var GetCloudSettingRequest_Version_DEFAULT string - -func (p *GetCloudSettingRequest) GetVersion() (v string) { - if !p.IsSetVersion() { - return GetCloudSettingRequest_Version_DEFAULT - } - return *p.Version +func (p *GetReleaseVersionRequest) InitDefault() { } -var GetCloudSettingRequest_Beta_DEFAULT string +var fieldIDToName_GetReleaseVersionRequest = map[int16]string{} -func (p *GetCloudSettingRequest) GetBeta() (v string) { - if !p.IsSetBeta() { - return GetCloudSettingRequest_Beta_DEFAULT - } - return *p.Beta -} +func (p *GetReleaseVersionRequest) Read(iprot thrift.TProtocol) (err error) { -var GetCloudSettingRequest_Phone_DEFAULT string + var fieldTypeId thrift.TType + var fieldId int16 -func (p *GetCloudSettingRequest) GetPhone() (v string) { - if !p.IsSetPhone() { - return GetCloudSettingRequest_Phone_DEFAULT + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } - return *p.Phone -} -var GetCloudSettingRequest_IsLogin_DEFAULT string - -func (p *GetCloudSettingRequest) GetIsLogin() (v string) { - if !p.IsSetIsLogin() { - return GetCloudSettingRequest_IsLogin_DEFAULT + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } - return *p.IsLogin -} -var GetCloudSettingRequest_LoginType_DEFAULT string + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) -func (p *GetCloudSettingRequest) GetLoginType() (v string) { - if !p.IsSetLoginType() { - return GetCloudSettingRequest_LoginType_DEFAULT - } - return *p.LoginType +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) } -var fieldIDToName_GetCloudSettingRequest = map[int16]string{ - 1: "account", - 2: "version", - 3: "beta", - 4: "phone", - 5: "isLogin", - 6: "loginType", +func (p *GetReleaseVersionRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetReleaseVersionRequest"); err != nil { + goto WriteStructBeginError + } + if p != nil { + } + 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) +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 *GetCloudSettingRequest) IsSetAccount() bool { - return p.Account != nil -} +func (p *GetReleaseVersionRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetReleaseVersionRequest(%+v)", *p) -func (p *GetCloudSettingRequest) IsSetVersion() bool { - return p.Version != nil } -func (p *GetCloudSettingRequest) IsSetBeta() bool { - return p.Beta != nil +type GetReleaseVersionResponse struct { } -func (p *GetCloudSettingRequest) IsSetPhone() bool { - return p.Phone != nil +func NewGetReleaseVersionResponse() *GetReleaseVersionResponse { + return &GetReleaseVersionResponse{} } -func (p *GetCloudSettingRequest) IsSetIsLogin() bool { - return p.IsLogin != nil +func (p *GetReleaseVersionResponse) InitDefault() { } -func (p *GetCloudSettingRequest) IsSetLoginType() bool { - return p.LoginType != nil -} +var fieldIDToName_GetReleaseVersionResponse = map[int16]string{} -func (p *GetCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetReleaseVersionResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -8835,60 +9190,8 @@ func (p *GetCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { 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 - } - case 4: - if fieldTypeId == thrift.STRING { - if err = p.ReadField4(iprot); err != nil { - goto ReadFieldError - } - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 5: - if fieldTypeId == thrift.STRING { - if err = p.ReadField5(iprot); err != nil { - goto ReadFieldError - } - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 6: - if fieldTypeId == thrift.STRING { - if err = p.ReadField6(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.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError } if err = iprot.ReadFieldEnd(); err != nil { goto ReadFieldEndError @@ -8903,10 +9206,8 @@ 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_GetCloudSettingRequest[fieldId]), err) -SkipFieldError: - return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) ReadFieldEndError: return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err) @@ -8914,103 +9215,11 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetCloudSettingRequest) ReadField1(iprot thrift.TProtocol) error { - - var _field *string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = &v - } - p.Account = _field - return nil -} -func (p *GetCloudSettingRequest) ReadField2(iprot thrift.TProtocol) error { - - var _field *string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = &v - } - p.Version = _field - return nil -} -func (p *GetCloudSettingRequest) ReadField3(iprot thrift.TProtocol) error { - - var _field *string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = &v - } - p.Beta = _field - return nil -} -func (p *GetCloudSettingRequest) ReadField4(iprot thrift.TProtocol) error { - - var _field *string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = &v - } - p.Phone = _field - return nil -} -func (p *GetCloudSettingRequest) ReadField5(iprot thrift.TProtocol) error { - - var _field *string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = &v - } - p.IsLogin = _field - return nil -} -func (p *GetCloudSettingRequest) ReadField6(iprot thrift.TProtocol) error { - - var _field *string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = &v - } - p.LoginType = _field - return nil -} - -func (p *GetCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("GetCloudSettingRequest"); err != nil { +func (p *GetReleaseVersionResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetReleaseVersionResponse"); 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 = p.writeField4(oprot); err != nil { - fieldId = 4 - goto WriteFieldError - } - if err = p.writeField5(oprot); err != nil { - fieldId = 5 - goto WriteFieldError - } - if err = p.writeField6(oprot); err != nil { - fieldId = 6 - goto WriteFieldError - } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -9021,149 +9230,33 @@ func (p *GetCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { 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 *GetCloudSettingRequest) writeField1(oprot thrift.TProtocol) (err error) { - if p.IsSetAccount() { - if err = oprot.WriteFieldBegin("account", thrift.STRING, 1); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(*p.Account); 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 *GetCloudSettingRequest) writeField2(oprot thrift.TProtocol) (err error) { - if p.IsSetVersion() { - if err = oprot.WriteFieldBegin("version", thrift.STRING, 2); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(*p.Version); 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 *GetCloudSettingRequest) writeField3(oprot thrift.TProtocol) (err error) { - if p.IsSetBeta() { - if err = oprot.WriteFieldBegin("beta", thrift.STRING, 3); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(*p.Beta); 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 *GetCloudSettingRequest) writeField4(oprot thrift.TProtocol) (err error) { - if p.IsSetPhone() { - if err = oprot.WriteFieldBegin("phone", thrift.STRING, 4); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(*p.Phone); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) -} - -func (p *GetCloudSettingRequest) writeField5(oprot thrift.TProtocol) (err error) { - if p.IsSetIsLogin() { - if err = oprot.WriteFieldBegin("isLogin", thrift.STRING, 5); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(*p.IsLogin); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) -} - -func (p *GetCloudSettingRequest) writeField6(oprot thrift.TProtocol) (err error) { - if p.IsSetLoginType() { - if err = oprot.WriteFieldBegin("loginType", thrift.STRING, 6); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(*p.LoginType); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) -} - -func (p *GetCloudSettingRequest) String() string { +func (p *GetReleaseVersionResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetCloudSettingRequest(%+v)", *p) + return fmt.Sprintf("GetReleaseVersionResponse(%+v)", *p) } -type GetCloudSettingResponse struct { +type GetBetaVersionRequest struct { } -func NewGetCloudSettingResponse() *GetCloudSettingResponse { - return &GetCloudSettingResponse{} +func NewGetBetaVersionRequest() *GetBetaVersionRequest { + return &GetBetaVersionRequest{} } -func (p *GetCloudSettingResponse) InitDefault() { +func (p *GetBetaVersionRequest) InitDefault() { } -var fieldIDToName_GetCloudSettingResponse = map[int16]string{} +var fieldIDToName_GetBetaVersionRequest = map[int16]string{} -func (p *GetCloudSettingResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetBetaVersionRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -9205,8 +9298,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetCloudSettingResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetCloudSettingResponse"); err != nil { +func (p *GetBetaVersionRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetBetaVersionRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -9226,27 +9319,27 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetCloudSettingResponse) String() string { +func (p *GetBetaVersionRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("GetCloudSettingResponse(%+v)", *p) + return fmt.Sprintf("GetBetaVersionRequest(%+v)", *p) } -type GetAllCloudSettingRequest struct { +type GetBetaVersionResponse struct { } -func NewGetAllCloudSettingRequest() *GetAllCloudSettingRequest { - return &GetAllCloudSettingRequest{} +func NewGetBetaVersionResponse() *GetBetaVersionResponse { + return &GetBetaVersionResponse{} } -func (p *GetAllCloudSettingRequest) InitDefault() { +func (p *GetBetaVersionResponse) InitDefault() { } -var fieldIDToName_GetAllCloudSettingRequest = map[int16]string{} +var fieldIDToName_GetBetaVersionResponse = map[int16]string{} -func (p *GetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetBetaVersionResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -9288,8 +9381,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *GetAllCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetAllCloudSettingRequest"); err != nil { +func (p *GetBetaVersionResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetBetaVersionResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -9309,128 +9402,121 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *GetAllCloudSettingRequest) String() string { +func (p *GetBetaVersionResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("GetAllCloudSettingRequest(%+v)", *p) + return fmt.Sprintf("GetBetaVersionResponse(%+v)", *p) } -type GetAllCloudSettingResponse struct { +type GetCloudSettingRequest struct { + Account *string `thrift:"account,1,optional" form:"account" json:"account,omitempty" query:"account"` + Version *string `thrift:"version,2,optional" form:"version" json:"version,omitempty" query:"version"` + Beta *string `thrift:"beta,3,optional" form:"beta" json:"beta,omitempty" query:"beta"` + Phone *string `thrift:"phone,4,optional" form:"phone" json:"phone,omitempty" query:"phone"` + IsLogin *string `thrift:"isLogin,5,optional" form:"isLogin" json:"isLogin,omitempty" query:"isLogin"` + LoginType *string `thrift:"loginType,6,optional" form:"loginType" json:"loginType,omitempty" query:"loginType"` } -func NewGetAllCloudSettingResponse() *GetAllCloudSettingResponse { - return &GetAllCloudSettingResponse{} +func NewGetCloudSettingRequest() *GetCloudSettingRequest { + return &GetCloudSettingRequest{} } -func (p *GetAllCloudSettingResponse) InitDefault() { +func (p *GetCloudSettingRequest) InitDefault() { } -var fieldIDToName_GetAllCloudSettingResponse = map[int16]string{} +var GetCloudSettingRequest_Account_DEFAULT string -func (p *GetAllCloudSettingResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetCloudSettingRequest) GetAccount() (v string) { + if !p.IsSetAccount() { + return GetCloudSettingRequest_Account_DEFAULT + } + return *p.Account +} - var fieldTypeId thrift.TType - var fieldId int16 +var GetCloudSettingRequest_Version_DEFAULT string - if _, err = iprot.ReadStructBegin(); err != nil { - goto ReadStructBeginError +func (p *GetCloudSettingRequest) GetVersion() (v string) { + if !p.IsSetVersion() { + return GetCloudSettingRequest_Version_DEFAULT } + return *p.Version +} - for { - _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() - if err != nil { - goto ReadFieldBeginError - } - if fieldTypeId == thrift.STOP { - break - } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError - } - if err = iprot.ReadFieldEnd(); err != nil { - goto ReadFieldEndError - } - } - if err = iprot.ReadStructEnd(); err != nil { - goto ReadStructEndError +var GetCloudSettingRequest_Beta_DEFAULT string + +func (p *GetCloudSettingRequest) GetBeta() (v string) { + if !p.IsSetBeta() { + return GetCloudSettingRequest_Beta_DEFAULT } + return *p.Beta +} - 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +var GetCloudSettingRequest_Phone_DEFAULT string -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 *GetCloudSettingRequest) GetPhone() (v string) { + if !p.IsSetPhone() { + return GetCloudSettingRequest_Phone_DEFAULT + } + return *p.Phone } -func (p *GetAllCloudSettingResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("GetAllCloudSettingResponse"); err != nil { - goto WriteStructBeginError - } - if p != nil { - } - if err = oprot.WriteFieldStop(); err != nil { - goto WriteFieldStopError - } - if err = oprot.WriteStructEnd(); err != nil { - goto WriteStructEndError +var GetCloudSettingRequest_IsLogin_DEFAULT string + +func (p *GetCloudSettingRequest) GetIsLogin() (v string) { + if !p.IsSetIsLogin() { + return GetCloudSettingRequest_IsLogin_DEFAULT } - return nil -WriteStructBeginError: - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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) + return *p.IsLogin } -func (p *GetAllCloudSettingResponse) String() string { - if p == nil { - return "" +var GetCloudSettingRequest_LoginType_DEFAULT string + +func (p *GetCloudSettingRequest) GetLoginType() (v string) { + if !p.IsSetLoginType() { + return GetCloudSettingRequest_LoginType_DEFAULT } - return fmt.Sprintf("GetAllCloudSettingResponse(%+v)", *p) + return *p.LoginType +} +var fieldIDToName_GetCloudSettingRequest = map[int16]string{ + 1: "account", + 2: "version", + 3: "beta", + 4: "phone", + 5: "isLogin", + 6: "loginType", } -type SetAllCloudSettingRequest struct { - Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` - Setting string `thrift:"setting,2,required" form:"setting,required" json:"setting,required" query:"setting,required"` +func (p *GetCloudSettingRequest) IsSetAccount() bool { + return p.Account != nil } -func NewSetAllCloudSettingRequest() *SetAllCloudSettingRequest { - return &SetAllCloudSettingRequest{} +func (p *GetCloudSettingRequest) IsSetVersion() bool { + return p.Version != nil } -func (p *SetAllCloudSettingRequest) InitDefault() { +func (p *GetCloudSettingRequest) IsSetBeta() bool { + return p.Beta != nil } -func (p *SetAllCloudSettingRequest) GetPassword() (v string) { - return p.Password +func (p *GetCloudSettingRequest) IsSetPhone() bool { + return p.Phone != nil } -func (p *SetAllCloudSettingRequest) GetSetting() (v string) { - return p.Setting +func (p *GetCloudSettingRequest) IsSetIsLogin() bool { + return p.IsLogin != nil } -var fieldIDToName_SetAllCloudSettingRequest = map[int16]string{ - 1: "password", - 2: "setting", +func (p *GetCloudSettingRequest) IsSetLoginType() bool { + return p.LoginType != nil } -func (p *SetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetPassword bool = false - var issetSetting bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -9451,7 +9537,6 @@ func (p *SetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetPassword = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -9460,7 +9545,38 @@ func (p *SetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { if err = p.ReadField2(iprot); err != nil { goto ReadFieldError } - issetSetting = true + } 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 + } + case 4: + if fieldTypeId == thrift.STRING { + if err = p.ReadField4(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 5: + if fieldTypeId == thrift.STRING { + if err = p.ReadField5(iprot); err != nil { + goto ReadFieldError + } + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 6: + if fieldTypeId == thrift.STRING { + if err = p.ReadField6(iprot); err != nil { + goto ReadFieldError + } } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -9477,22 +9593,13 @@ func (p *SetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetPassword { - fieldId = 1 - goto RequiredFieldNotSetError - } - - if !issetSetting { - 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_SetAllCloudSettingRequest[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetCloudSettingRequest[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -9500,36 +9607,78 @@ 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_SetAllCloudSettingRequest[fieldId])) } -func (p *SetAllCloudSettingRequest) ReadField1(iprot thrift.TProtocol) error { +func (p *GetCloudSettingRequest) ReadField1(iprot thrift.TProtocol) error { - var _field string + var _field *string if v, err := iprot.ReadString(); err != nil { return err } else { - _field = v + _field = &v } - p.Password = _field + p.Account = _field return nil } -func (p *SetAllCloudSettingRequest) ReadField2(iprot thrift.TProtocol) error { +func (p *GetCloudSettingRequest) ReadField2(iprot thrift.TProtocol) error { - var _field string + var _field *string if v, err := iprot.ReadString(); err != nil { return err } else { - _field = v + _field = &v } - p.Setting = _field + p.Version = _field return nil } +func (p *GetCloudSettingRequest) ReadField3(iprot thrift.TProtocol) error { -func (p *SetAllCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Beta = _field + return nil +} +func (p *GetCloudSettingRequest) ReadField4(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.Phone = _field + return nil +} +func (p *GetCloudSettingRequest) ReadField5(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.IsLogin = _field + return nil +} +func (p *GetCloudSettingRequest) ReadField6(iprot thrift.TProtocol) error { + + var _field *string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = &v + } + p.LoginType = _field + return nil +} + +func (p *GetCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("SetAllCloudSettingRequest"); err != nil { + if err = oprot.WriteStructBegin("GetCloudSettingRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -9541,6 +9690,22 @@ func (p *SetAllCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { fieldId = 2 goto WriteFieldError } + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError + } + if err = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } + if err = p.writeField5(oprot); err != nil { + fieldId = 5 + goto WriteFieldError + } + if err = p.writeField6(oprot); err != nil { + fieldId = 6 + goto WriteFieldError + } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -9559,15 +9724,17 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *SetAllCloudSettingRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Password); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError +func (p *GetCloudSettingRequest) writeField1(oprot thrift.TProtocol) (err error) { + if p.IsSetAccount() { + if err = oprot.WriteFieldBegin("account", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Account); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } } return nil WriteFieldBeginError: @@ -9576,15 +9743,17 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *SetAllCloudSettingRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("setting", thrift.STRING, 2); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Setting); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError +func (p *GetCloudSettingRequest) writeField2(oprot thrift.TProtocol) (err error) { + if p.IsSetVersion() { + if err = oprot.WriteFieldBegin("version", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Version); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } } return nil WriteFieldBeginError: @@ -9593,27 +9762,103 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) } -func (p *SetAllCloudSettingRequest) String() string { - if p == nil { - return "" +func (p *GetCloudSettingRequest) writeField3(oprot thrift.TProtocol) (err error) { + if p.IsSetBeta() { + if err = oprot.WriteFieldBegin("beta", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Beta); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } } - return fmt.Sprintf("SetAllCloudSettingRequest(%+v)", *p) - -} - -type SetAllCloudSettingResponse struct { + 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 NewSetAllCloudSettingResponse() *SetAllCloudSettingResponse { - return &SetAllCloudSettingResponse{} +func (p *GetCloudSettingRequest) writeField4(oprot thrift.TProtocol) (err error) { + if p.IsSetPhone() { + if err = oprot.WriteFieldBegin("phone", thrift.STRING, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.Phone); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) } -func (p *SetAllCloudSettingResponse) InitDefault() { -} +func (p *GetCloudSettingRequest) writeField5(oprot thrift.TProtocol) (err error) { + if p.IsSetIsLogin() { + if err = oprot.WriteFieldBegin("isLogin", thrift.STRING, 5); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.IsLogin); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +} -var fieldIDToName_SetAllCloudSettingResponse = map[int16]string{} +func (p *GetCloudSettingRequest) writeField6(oprot thrift.TProtocol) (err error) { + if p.IsSetLoginType() { + if err = oprot.WriteFieldBegin("loginType", thrift.STRING, 6); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(*p.LoginType); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) +} -func (p *SetAllCloudSettingResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetCloudSettingRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("GetCloudSettingRequest(%+v)", *p) + +} + +type GetCloudSettingResponse struct { +} + +func NewGetCloudSettingResponse() *GetCloudSettingResponse { + return &GetCloudSettingResponse{} +} + +func (p *GetCloudSettingResponse) InitDefault() { +} + +var fieldIDToName_GetCloudSettingResponse = map[int16]string{} + +func (p *GetCloudSettingResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -9655,8 +9900,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *SetAllCloudSettingResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("SetAllCloudSettingResponse"); err != nil { +func (p *GetCloudSettingResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetCloudSettingResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -9676,80 +9921,30 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *SetAllCloudSettingResponse) String() string { +func (p *GetCloudSettingResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("SetAllCloudSettingResponse(%+v)", *p) - -} - -type TestSettingRequest struct { - Setting string `thrift:"setting,1,required" form:"setting,required" json:"setting,required" query:"setting,required"` - Account string `thrift:"account,2,required" form:"account,required" json:"account,required" query:"account,required"` - Version string `thrift:"version,3,required" form:"version,required" json:"version,required" query:"version,required"` - Beta string `thrift:"beta,4,required" form:"beta,required" json:"beta,required" query:"beta,required"` - Phone string `thrift:"phone,5,required" form:"phone,required" json:"phone,required" query:"phone,required"` - IsLogin string `thrift:"isLogin,6,required" form:"isLogin,required" json:"isLogin,required" query:"isLogin,required"` - LoginType string `thrift:"loginType,7,required" form:"loginType,required" json:"loginType,required" query:"loginType,required"` -} - -func NewTestSettingRequest() *TestSettingRequest { - return &TestSettingRequest{} -} - -func (p *TestSettingRequest) InitDefault() { -} - -func (p *TestSettingRequest) GetSetting() (v string) { - return p.Setting -} - -func (p *TestSettingRequest) GetAccount() (v string) { - return p.Account -} - -func (p *TestSettingRequest) GetVersion() (v string) { - return p.Version -} + return fmt.Sprintf("GetCloudSettingResponse(%+v)", *p) -func (p *TestSettingRequest) GetBeta() (v string) { - return p.Beta } -func (p *TestSettingRequest) GetPhone() (v string) { - return p.Phone +type GetAllCloudSettingRequest struct { } -func (p *TestSettingRequest) GetIsLogin() (v string) { - return p.IsLogin +func NewGetAllCloudSettingRequest() *GetAllCloudSettingRequest { + return &GetAllCloudSettingRequest{} } -func (p *TestSettingRequest) GetLoginType() (v string) { - return p.LoginType +func (p *GetAllCloudSettingRequest) InitDefault() { } -var fieldIDToName_TestSettingRequest = map[int16]string{ - 1: "setting", - 2: "account", - 3: "version", - 4: "beta", - 5: "phone", - 6: "isLogin", - 7: "loginType", -} +var fieldIDToName_GetAllCloudSettingRequest = map[int16]string{} -func (p *TestSettingRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *GetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetSetting bool = false - var issetAccount bool = false - var issetVersion bool = false - var issetBeta bool = false - var issetPhone bool = false - var issetIsLogin bool = false - var issetLoginType bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -9763,75 +9958,8 @@ func (p *TestSettingRequest) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - - switch fieldId { - case 1: - if fieldTypeId == thrift.STRING { - if err = p.ReadField1(iprot); err != nil { - goto ReadFieldError - } - issetSetting = true - } 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 - } - issetAccount = true - } 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 - } - issetVersion = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 4: - if fieldTypeId == thrift.STRING { - if err = p.ReadField4(iprot); err != nil { - goto ReadFieldError - } - issetBeta = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 5: - if fieldTypeId == thrift.STRING { - if err = p.ReadField5(iprot); err != nil { - goto ReadFieldError - } - issetPhone = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 6: - if fieldTypeId == thrift.STRING { - if err = p.ReadField6(iprot); err != nil { - goto ReadFieldError - } - issetIsLogin = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - case 7: - if fieldTypeId == thrift.STRING { - if err = p.ReadField7(iprot); err != nil { - goto ReadFieldError - } - issetLoginType = true - } else if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } - default: - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldError - } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError } if err = iprot.ReadFieldEnd(); err != nil { goto ReadFieldEndError @@ -9841,170 +9969,25 @@ func (p *TestSettingRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetSetting { - fieldId = 1 - goto RequiredFieldNotSetError - } - - if !issetAccount { - fieldId = 2 - goto RequiredFieldNotSetError - } - - if !issetVersion { - fieldId = 3 - goto RequiredFieldNotSetError - } - - if !issetBeta { - fieldId = 4 - goto RequiredFieldNotSetError - } - - if !issetPhone { - fieldId = 5 - goto RequiredFieldNotSetError - } - - if !issetIsLogin { - fieldId = 6 - goto RequiredFieldNotSetError - } - - if !issetLoginType { - fieldId = 7 - 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_TestSettingRequest[fieldId]), err) -SkipFieldError: - return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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) -RequiredFieldNotSetError: - return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_TestSettingRequest[fieldId])) } -func (p *TestSettingRequest) ReadField1(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Setting = _field - return nil -} -func (p *TestSettingRequest) ReadField2(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Account = _field - return nil -} -func (p *TestSettingRequest) ReadField3(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Version = _field - return nil -} -func (p *TestSettingRequest) ReadField4(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Beta = _field - return nil -} -func (p *TestSettingRequest) ReadField5(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.Phone = _field - return nil -} -func (p *TestSettingRequest) ReadField6(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.IsLogin = _field - return nil -} -func (p *TestSettingRequest) ReadField7(iprot thrift.TProtocol) error { - - var _field string - if v, err := iprot.ReadString(); err != nil { - return err - } else { - _field = v - } - p.LoginType = _field - return nil -} - -func (p *TestSettingRequest) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("TestSettingRequest"); err != nil { - goto WriteStructBeginError +func (p *GetAllCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetAllCloudSettingRequest"); 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 = p.writeField4(oprot); err != nil { - fieldId = 4 - goto WriteFieldError - } - if err = p.writeField5(oprot); err != nil { - fieldId = 5 - goto WriteFieldError - } - if err = p.writeField6(oprot); err != nil { - fieldId = 6 - goto WriteFieldError - } - if err = p.writeField7(oprot); err != nil { - fieldId = 7 - goto WriteFieldError - } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -10015,154 +9998,33 @@ func (p *TestSettingRequest) Write(oprot thrift.TProtocol) (err error) { 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 *TestSettingRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("setting", thrift.STRING, 1); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Setting); 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 *TestSettingRequest) writeField2(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("account", thrift.STRING, 2); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Account); 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 *TestSettingRequest) writeField3(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("version", thrift.STRING, 3); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Version); 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 *TestSettingRequest) writeField4(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("beta", thrift.STRING, 4); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Beta); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) -} - -func (p *TestSettingRequest) writeField5(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("phone", thrift.STRING, 5); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.Phone); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) -} - -func (p *TestSettingRequest) writeField6(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("isLogin", thrift.STRING, 6); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.IsLogin); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) -} - -func (p *TestSettingRequest) writeField7(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("loginType", thrift.STRING, 7); err != nil { - goto WriteFieldBeginError - } - if err := oprot.WriteString(p.LoginType); err != nil { - return err - } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError - } - return nil -WriteFieldBeginError: - return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) -WriteFieldEndError: - return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) -} - -func (p *TestSettingRequest) String() string { +func (p *GetAllCloudSettingRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("TestSettingRequest(%+v)", *p) + return fmt.Sprintf("GetAllCloudSettingRequest(%+v)", *p) } -type TestSettingResponse struct { +type GetAllCloudSettingResponse struct { } -func NewTestSettingResponse() *TestSettingResponse { - return &TestSettingResponse{} +func NewGetAllCloudSettingResponse() *GetAllCloudSettingResponse { + return &GetAllCloudSettingResponse{} } -func (p *TestSettingResponse) InitDefault() { +func (p *GetAllCloudSettingResponse) InitDefault() { } -var fieldIDToName_TestSettingResponse = map[int16]string{} +var fieldIDToName_GetAllCloudSettingResponse = map[int16]string{} -func (p *TestSettingResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *GetAllCloudSettingResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -10204,8 +10066,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *TestSettingResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("TestSettingResponse"); err != nil { +func (p *GetAllCloudSettingResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("GetAllCloudSettingResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -10225,30 +10087,45 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *TestSettingResponse) String() string { +func (p *GetAllCloudSettingResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("TestSettingResponse(%+v)", *p) + return fmt.Sprintf("GetAllCloudSettingResponse(%+v)", *p) } -type DumpVisitRequest struct { +type SetAllCloudSettingRequest struct { + Password string `thrift:"password,1,required" form:"password,required" json:"password,required" query:"password,required"` + Setting string `thrift:"setting,2,required" form:"setting,required" json:"setting,required" query:"setting,required"` } -func NewDumpVisitRequest() *DumpVisitRequest { - return &DumpVisitRequest{} +func NewSetAllCloudSettingRequest() *SetAllCloudSettingRequest { + return &SetAllCloudSettingRequest{} } -func (p *DumpVisitRequest) InitDefault() { +func (p *SetAllCloudSettingRequest) InitDefault() { } -var fieldIDToName_DumpVisitRequest = map[int16]string{} - -func (p *DumpVisitRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *SetAllCloudSettingRequest) GetPassword() (v string) { + return p.Password +} + +func (p *SetAllCloudSettingRequest) GetSetting() (v string) { + return p.Setting +} + +var fieldIDToName_SetAllCloudSettingRequest = map[int16]string{ + 1: "password", + 2: "setting", +} + +func (p *SetAllCloudSettingRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetPassword bool = false + var issetSetting bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -10262,8 +10139,30 @@ func (p *DumpVisitRequest) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError + + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetPassword = true + } 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 + } + issetSetting = 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 @@ -10273,25 +10172,70 @@ func (p *DumpVisitRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } + if !issetPassword { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetSetting { + 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_SetAllCloudSettingRequest[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_SetAllCloudSettingRequest[fieldId])) } -func (p *DumpVisitRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("DumpVisitRequest"); err != nil { +func (p *SetAllCloudSettingRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Password = _field + return nil +} +func (p *SetAllCloudSettingRequest) ReadField2(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Setting = _field + return nil +} + +func (p *SetAllCloudSettingRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("SetAllCloudSettingRequest"); 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 = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -10302,33 +10246,69 @@ func (p *DumpVisitRequest) Write(oprot thrift.TProtocol) (err error) { 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 *DumpVisitRequest) String() string { +func (p *SetAllCloudSettingRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("password", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Password); 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 *SetAllCloudSettingRequest) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("setting", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Setting); 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 *SetAllCloudSettingRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("DumpVisitRequest(%+v)", *p) + return fmt.Sprintf("SetAllCloudSettingRequest(%+v)", *p) } -type DumpVisitResponse struct { +type SetAllCloudSettingResponse struct { } -func NewDumpVisitResponse() *DumpVisitResponse { - return &DumpVisitResponse{} +func NewSetAllCloudSettingResponse() *SetAllCloudSettingResponse { + return &SetAllCloudSettingResponse{} } -func (p *DumpVisitResponse) InitDefault() { +func (p *SetAllCloudSettingResponse) InitDefault() { } -var fieldIDToName_DumpVisitResponse = map[int16]string{} +var fieldIDToName_SetAllCloudSettingResponse = map[int16]string{} -func (p *DumpVisitResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *SetAllCloudSettingResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -10370,8 +10350,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *DumpVisitResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("DumpVisitResponse"); err != nil { +func (p *SetAllCloudSettingResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("SetAllCloudSettingResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -10391,30 +10371,80 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *DumpVisitResponse) String() string { +func (p *SetAllCloudSettingResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("DumpVisitResponse(%+v)", *p) + return fmt.Sprintf("SetAllCloudSettingResponse(%+v)", *p) } -type FZUHelperCSSRequest struct { +type TestSettingRequest struct { + Setting string `thrift:"setting,1,required" form:"setting,required" json:"setting,required" query:"setting,required"` + Account string `thrift:"account,2,required" form:"account,required" json:"account,required" query:"account,required"` + Version string `thrift:"version,3,required" form:"version,required" json:"version,required" query:"version,required"` + Beta string `thrift:"beta,4,required" form:"beta,required" json:"beta,required" query:"beta,required"` + Phone string `thrift:"phone,5,required" form:"phone,required" json:"phone,required" query:"phone,required"` + IsLogin string `thrift:"isLogin,6,required" form:"isLogin,required" json:"isLogin,required" query:"isLogin,required"` + LoginType string `thrift:"loginType,7,required" form:"loginType,required" json:"loginType,required" query:"loginType,required"` } -func NewFZUHelperCSSRequest() *FZUHelperCSSRequest { - return &FZUHelperCSSRequest{} +func NewTestSettingRequest() *TestSettingRequest { + return &TestSettingRequest{} } -func (p *FZUHelperCSSRequest) InitDefault() { +func (p *TestSettingRequest) InitDefault() { } -var fieldIDToName_FZUHelperCSSRequest = map[int16]string{} +func (p *TestSettingRequest) GetSetting() (v string) { + return p.Setting +} -func (p *FZUHelperCSSRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *TestSettingRequest) GetAccount() (v string) { + return p.Account +} + +func (p *TestSettingRequest) GetVersion() (v string) { + return p.Version +} + +func (p *TestSettingRequest) GetBeta() (v string) { + return p.Beta +} + +func (p *TestSettingRequest) GetPhone() (v string) { + return p.Phone +} + +func (p *TestSettingRequest) GetIsLogin() (v string) { + return p.IsLogin +} + +func (p *TestSettingRequest) GetLoginType() (v string) { + return p.LoginType +} + +var fieldIDToName_TestSettingRequest = map[int16]string{ + 1: "setting", + 2: "account", + 3: "version", + 4: "beta", + 5: "phone", + 6: "isLogin", + 7: "loginType", +} + +func (p *TestSettingRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 + var issetSetting bool = false + var issetAccount bool = false + var issetVersion bool = false + var issetBeta bool = false + var issetPhone bool = false + var issetIsLogin bool = false + var issetLoginType bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -10428,202 +10458,248 @@ func (p *FZUHelperCSSRequest) Read(iprot thrift.TProtocol) (err error) { if fieldTypeId == thrift.STOP { break } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError - } - 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *FZUHelperCSSRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("FZUHelperCSSRequest"); err != nil { - goto WriteStructBeginError - } - if p != nil { - } - 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) -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 *FZUHelperCSSRequest) String() string { - if p == nil { - return "" + switch fieldId { + case 1: + if fieldTypeId == thrift.STRING { + if err = p.ReadField1(iprot); err != nil { + goto ReadFieldError + } + issetSetting = true + } 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 + } + issetAccount = true + } 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 + } + issetVersion = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 4: + if fieldTypeId == thrift.STRING { + if err = p.ReadField4(iprot); err != nil { + goto ReadFieldError + } + issetBeta = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 5: + if fieldTypeId == thrift.STRING { + if err = p.ReadField5(iprot); err != nil { + goto ReadFieldError + } + issetPhone = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 6: + if fieldTypeId == thrift.STRING { + if err = p.ReadField6(iprot); err != nil { + goto ReadFieldError + } + issetIsLogin = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 7: + if fieldTypeId == thrift.STRING { + if err = p.ReadField7(iprot); err != nil { + goto ReadFieldError + } + issetLoginType = 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 } - return fmt.Sprintf("FZUHelperCSSRequest(%+v)", *p) - -} - -type FZUHelperCSSResponse struct { -} - -func NewFZUHelperCSSResponse() *FZUHelperCSSResponse { - return &FZUHelperCSSResponse{} -} - -func (p *FZUHelperCSSResponse) InitDefault() { -} -var fieldIDToName_FZUHelperCSSResponse = map[int16]string{} + if !issetSetting { + fieldId = 1 + goto RequiredFieldNotSetError + } -func (p *FZUHelperCSSResponse) Read(iprot thrift.TProtocol) (err error) { + if !issetAccount { + fieldId = 2 + goto RequiredFieldNotSetError + } - var fieldTypeId thrift.TType - var fieldId int16 + if !issetVersion { + fieldId = 3 + goto RequiredFieldNotSetError + } - if _, err = iprot.ReadStructBegin(); err != nil { - goto ReadStructBeginError + if !issetBeta { + fieldId = 4 + goto RequiredFieldNotSetError } - for { - _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() - if err != nil { - goto ReadFieldBeginError - } - if fieldTypeId == thrift.STOP { - break - } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError - } - if err = iprot.ReadFieldEnd(); err != nil { - goto ReadFieldEndError - } + if !issetPhone { + fieldId = 5 + goto RequiredFieldNotSetError } - if err = iprot.ReadStructEnd(); err != nil { - goto ReadStructEndError + + if !issetIsLogin { + fieldId = 6 + goto RequiredFieldNotSetError } + if !issetLoginType { + fieldId = 7 + 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) +ReadFieldError: + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_TestSettingRequest[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_TestSettingRequest[fieldId])) } -func (p *FZUHelperCSSResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("FZUHelperCSSResponse"); err != nil { - goto WriteStructBeginError - } - if p != nil { - } - if err = oprot.WriteFieldStop(); err != nil { - goto WriteFieldStopError - } - if err = oprot.WriteStructEnd(); err != nil { - goto WriteStructEndError +func (p *TestSettingRequest) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v } + p.Setting = _field return nil -WriteStructBeginError: - return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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 *TestSettingRequest) ReadField2(iprot thrift.TProtocol) error { -func (p *FZUHelperCSSResponse) String() string { - if p == nil { - return "" + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v } - return fmt.Sprintf("FZUHelperCSSResponse(%+v)", *p) - + p.Account = _field + return nil } +func (p *TestSettingRequest) ReadField3(iprot thrift.TProtocol) error { -type FZUHelperHTMLRequest struct { + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Version = _field + return nil } +func (p *TestSettingRequest) ReadField4(iprot thrift.TProtocol) error { -func NewFZUHelperHTMLRequest() *FZUHelperHTMLRequest { - return &FZUHelperHTMLRequest{} + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Beta = _field + return nil } +func (p *TestSettingRequest) ReadField5(iprot thrift.TProtocol) error { -func (p *FZUHelperHTMLRequest) InitDefault() { + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Phone = _field + return nil } +func (p *TestSettingRequest) ReadField6(iprot thrift.TProtocol) error { -var fieldIDToName_FZUHelperHTMLRequest = map[int16]string{} + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.IsLogin = _field + return nil +} +func (p *TestSettingRequest) ReadField7(iprot thrift.TProtocol) error { -func (p *FZUHelperHTMLRequest) Read(iprot thrift.TProtocol) (err error) { + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.LoginType = _field + return nil +} - var fieldTypeId thrift.TType +func (p *TestSettingRequest) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - - if _, err = iprot.ReadStructBegin(); err != nil { - goto ReadStructBeginError + if err = oprot.WriteStructBegin("TestSettingRequest"); err != nil { + goto WriteStructBeginError } - - for { - _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() - if err != nil { - goto ReadFieldBeginError + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError } - if fieldTypeId == thrift.STOP { - break + if err = p.writeField2(oprot); err != nil { + fieldId = 2 + goto WriteFieldError } - if err = iprot.Skip(fieldTypeId); err != nil { - goto SkipFieldTypeError + if err = p.writeField3(oprot); err != nil { + fieldId = 3 + goto WriteFieldError } - if err = iprot.ReadFieldEnd(); err != nil { - goto ReadFieldEndError + if err = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } + if err = p.writeField5(oprot); err != nil { + fieldId = 5 + goto WriteFieldError + } + if err = p.writeField6(oprot); err != nil { + fieldId = 6 + goto WriteFieldError + } + if err = p.writeField7(oprot); err != nil { + fieldId = 7 + goto WriteFieldError } - } - 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) -SkipFieldTypeError: - return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *FZUHelperHTMLRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("FZUHelperHTMLRequest"); err != nil { - goto WriteStructBeginError - } - if p != nil { } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -10634,33 +10710,154 @@ func (p *FZUHelperHTMLRequest) Write(oprot thrift.TProtocol) (err error) { 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 *FZUHelperHTMLRequest) String() string { +func (p *TestSettingRequest) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("setting", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Setting); 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 *TestSettingRequest) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("account", thrift.STRING, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Account); 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 *TestSettingRequest) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("version", thrift.STRING, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Version); 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 *TestSettingRequest) writeField4(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("beta", thrift.STRING, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Beta); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) +} + +func (p *TestSettingRequest) writeField5(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("phone", thrift.STRING, 5); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Phone); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err) +} + +func (p *TestSettingRequest) writeField6(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("isLogin", thrift.STRING, 6); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.IsLogin); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err) +} + +func (p *TestSettingRequest) writeField7(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("loginType", thrift.STRING, 7); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.LoginType); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err) +} + +func (p *TestSettingRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("FZUHelperHTMLRequest(%+v)", *p) + return fmt.Sprintf("TestSettingRequest(%+v)", *p) } -type FZUHelperHTMLResponse struct { +type TestSettingResponse struct { } -func NewFZUHelperHTMLResponse() *FZUHelperHTMLResponse { - return &FZUHelperHTMLResponse{} +func NewTestSettingResponse() *TestSettingResponse { + return &TestSettingResponse{} } -func (p *FZUHelperHTMLResponse) InitDefault() { +func (p *TestSettingResponse) InitDefault() { } -var fieldIDToName_FZUHelperHTMLResponse = map[int16]string{} +var fieldIDToName_TestSettingResponse = map[int16]string{} -func (p *FZUHelperHTMLResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *TestSettingResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -10702,8 +10899,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *FZUHelperHTMLResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("FZUHelperHTMLResponse"); err != nil { +func (p *TestSettingResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("TestSettingResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -10723,27 +10920,27 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *FZUHelperHTMLResponse) String() string { +func (p *TestSettingResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("FZUHelperHTMLResponse(%+v)", *p) + return fmt.Sprintf("TestSettingResponse(%+v)", *p) } -type UserAgreementHTMLRequest struct { +type DumpVisitRequest struct { } -func NewUserAgreementHTMLRequest() *UserAgreementHTMLRequest { - return &UserAgreementHTMLRequest{} +func NewDumpVisitRequest() *DumpVisitRequest { + return &DumpVisitRequest{} } -func (p *UserAgreementHTMLRequest) InitDefault() { +func (p *DumpVisitRequest) InitDefault() { } -var fieldIDToName_UserAgreementHTMLRequest = map[int16]string{} +var fieldIDToName_DumpVisitRequest = map[int16]string{} -func (p *UserAgreementHTMLRequest) Read(iprot thrift.TProtocol) (err error) { +func (p *DumpVisitRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -10785,8 +10982,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *UserAgreementHTMLRequest) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("UserAgreementHTMLRequest"); err != nil { +func (p *DumpVisitRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("DumpVisitRequest"); err != nil { goto WriteStructBeginError } if p != nil { @@ -10806,27 +11003,27 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserAgreementHTMLRequest) String() string { +func (p *DumpVisitRequest) String() string { if p == nil { return "" } - return fmt.Sprintf("UserAgreementHTMLRequest(%+v)", *p) + return fmt.Sprintf("DumpVisitRequest(%+v)", *p) } -type UserAgreementHTMLResponse struct { +type DumpVisitResponse struct { } -func NewUserAgreementHTMLResponse() *UserAgreementHTMLResponse { - return &UserAgreementHTMLResponse{} +func NewDumpVisitResponse() *DumpVisitResponse { + return &DumpVisitResponse{} } -func (p *UserAgreementHTMLResponse) InitDefault() { +func (p *DumpVisitResponse) InitDefault() { } -var fieldIDToName_UserAgreementHTMLResponse = map[int16]string{} +var fieldIDToName_DumpVisitResponse = map[int16]string{} -func (p *UserAgreementHTMLResponse) Read(iprot thrift.TProtocol) (err error) { +func (p *DumpVisitResponse) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -10868,8 +11065,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *UserAgreementHTMLResponse) Write(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteStructBegin("UserAgreementHTMLResponse"); err != nil { +func (p *DumpVisitResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("DumpVisitResponse"); err != nil { goto WriteStructBeginError } if p != nil { @@ -10889,977 +11086,1124 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserAgreementHTMLResponse) String() string { +func (p *DumpVisitResponse) String() string { if p == nil { return "" } - return fmt.Sprintf("UserAgreementHTMLResponse(%+v)", *p) + return fmt.Sprintf("DumpVisitResponse(%+v)", *p) } -type ClassRoomService interface { - GetEmptyClassrooms(ctx context.Context, request *EmptyClassroomRequest) (r *EmptyClassroomResponse, err error) +type FZUHelperCSSRequest struct { } -type ClassRoomServiceClient struct { - c thrift.TClient +func NewFZUHelperCSSRequest() *FZUHelperCSSRequest { + return &FZUHelperCSSRequest{} } -func NewClassRoomServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ClassRoomServiceClient { - return &ClassRoomServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } +func (p *FZUHelperCSSRequest) InitDefault() { } -func NewClassRoomServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ClassRoomServiceClient { - return &ClassRoomServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), - } -} +var fieldIDToName_FZUHelperCSSRequest = map[int16]string{} -func NewClassRoomServiceClient(c thrift.TClient) *ClassRoomServiceClient { - return &ClassRoomServiceClient{ - c: c, - } -} +func (p *FZUHelperCSSRequest) Read(iprot thrift.TProtocol) (err error) { -func (p *ClassRoomServiceClient) Client_() thrift.TClient { - return p.c -} + var fieldTypeId thrift.TType + var fieldId int16 -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 + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } - return _result.GetSuccess(), nil -} -type UserService interface { - GetLoginData(ctx context.Context, request *GetLoginDataRequest) (r *GetLoginDataResponse, err error) + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } - ValidateCode(ctx context.Context, request *ValidateCodeRequest) (r *ValidateCodeResponse, err error) -} + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) -type UserServiceClient 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) } -func NewUserServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *UserServiceClient { - return &UserServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), +func (p *FZUHelperCSSRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("FZUHelperCSSRequest"); err != nil { + goto WriteStructBeginError } -} - -func NewUserServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *UserServiceClient { - return &UserServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), + if p != nil { + } + 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) +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 NewUserServiceClient(c thrift.TClient) *UserServiceClient { - return &UserServiceClient{ - c: c, +func (p *FZUHelperCSSRequest) String() string { + if p == nil { + return "" } -} + return fmt.Sprintf("FZUHelperCSSRequest(%+v)", *p) -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 - } - 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 - } - return _result.GetSuccess(), nil +type FZUHelperCSSResponse struct { } -type CourseService interface { - GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) +func NewFZUHelperCSSResponse() *FZUHelperCSSResponse { + return &FZUHelperCSSResponse{} } -type CourseServiceClient struct { - c thrift.TClient +func (p *FZUHelperCSSResponse) InitDefault() { } -func NewCourseServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CourseServiceClient { - return &CourseServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } -} +var fieldIDToName_FZUHelperCSSResponse = map[int16]string{} -func NewCourseServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CourseServiceClient { - return &CourseServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), +func (p *FZUHelperCSSResponse) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } -} -func NewCourseServiceClient(c thrift.TClient) *CourseServiceClient { - return &CourseServiceClient{ - c: c, + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } -} -func (p *CourseServiceClient) Client_() thrift.TClient { - return p.c + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *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 +func (p *FZUHelperCSSResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("FZUHelperCSSResponse"); err != nil { + goto WriteStructBeginError } - return _result.GetSuccess(), nil + if p != nil { + } + 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) +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 LaunchScreenService interface { - CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) +func (p *FZUHelperCSSResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("FZUHelperCSSResponse(%+v)", *p) - GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) +} - ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) +type FZUHelperHTMLRequest struct { +} - ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, err error) +func NewFZUHelperHTMLRequest() *FZUHelperHTMLRequest { + return &FZUHelperHTMLRequest{} +} - DeleteImage(ctx context.Context, req *DeleteImageRequest) (r *DeleteImageResponse, err error) +func (p *FZUHelperHTMLRequest) InitDefault() { +} - MobileGetImage(ctx context.Context, req *MobileGetImageRequest) (r *MobileGetImageResponse, err error) +var fieldIDToName_FZUHelperHTMLRequest = map[int16]string{} - AddImagePointTime(ctx context.Context, req *AddImagePointTimeRequest) (r *AddImagePointTimeResponse, err error) -} +func (p *FZUHelperHTMLRequest) Read(iprot thrift.TProtocol) (err error) { -type LaunchScreenServiceClient struct { - c thrift.TClient -} + var fieldTypeId thrift.TType + var fieldId int16 -func NewLaunchScreenServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *LaunchScreenServiceClient { - return &LaunchScreenServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } -} -func NewLaunchScreenServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *LaunchScreenServiceClient { - return &LaunchScreenServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } } -} - -func NewLaunchScreenServiceClient(c thrift.TClient) *LaunchScreenServiceClient { - return &LaunchScreenServiceClient{ - c: c, + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } -} -func (p *LaunchScreenServiceClient) Client_() thrift.TClient { - return p.c -} + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) -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 - } - 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 - } - return _result.GetSuccess(), nil +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 *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 + +func (p *FZUHelperHTMLRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("FZUHelperHTMLRequest"); err != nil { + goto WriteStructBeginError } - 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 p != nil { } - return _result.GetSuccess(), nil -} -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 + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - 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.WriteStructEnd(); err != nil { + goto WriteStructEndError } - return _result.GetSuccess(), nil + return nil +WriteStructBeginError: + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), 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) 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 *FZUHelperHTMLRequest) String() string { + if p == nil { + return "" } - return _result.GetSuccess(), nil -} + return fmt.Sprintf("FZUHelperHTMLRequest(%+v)", *p) -type PaperService interface { - ListDirFiles(ctx context.Context, req *ListDirFilesRequest) (r *ListDirFilesResponse, err error) +} - GetDownloadUrl(ctx context.Context, req *GetDownloadUrlRequest) (r *GetDownloadUrlResponse, err error) +type FZUHelperHTMLResponse struct { } -type PaperServiceClient struct { - c thrift.TClient +func NewFZUHelperHTMLResponse() *FZUHelperHTMLResponse { + return &FZUHelperHTMLResponse{} } -func NewPaperServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *PaperServiceClient { - return &PaperServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } +func (p *FZUHelperHTMLResponse) InitDefault() { } -func NewPaperServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PaperServiceClient { - return &PaperServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), +var fieldIDToName_FZUHelperHTMLResponse = map[int16]string{} + +func (p *FZUHelperHTMLResponse) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } -} -func NewPaperServiceClient(c thrift.TClient) *PaperServiceClient { - return &PaperServiceClient{ - c: c, + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } -} -func (p *PaperServiceClient) Client_() thrift.TClient { - return p.c + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *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 +func (p *FZUHelperHTMLResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("FZUHelperHTMLResponse"); err != nil { + goto WriteStructBeginError } - 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 { - return + if p != nil { } - return _result.GetSuccess(), nil + 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) +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 AcademicService interface { - GetScores(ctx context.Context, req *GetScoresRequest) (r *GetScoresResponse, err error) - - GetGPA(ctx context.Context, req *GetGPARequest) (r *GetGPAResponse, err error) +func (p *FZUHelperHTMLResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("FZUHelperHTMLResponse(%+v)", *p) - GetCredit(ctx context.Context, req *GetCreditRequest) (r *GetCreditResponse, err error) +} - GetUnifiedExam(ctx context.Context, req *GetUnifiedExamRequest) (r *GetUnifiedExamResponse, err error) +type UserAgreementHTMLRequest struct { } -type AcademicServiceClient struct { - c thrift.TClient +func NewUserAgreementHTMLRequest() *UserAgreementHTMLRequest { + return &UserAgreementHTMLRequest{} } -func NewAcademicServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AcademicServiceClient { - return &AcademicServiceClient{ - c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), - } +func (p *UserAgreementHTMLRequest) InitDefault() { } -func NewAcademicServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AcademicServiceClient { - return &AcademicServiceClient{ - c: thrift.NewTStandardClient(iprot, oprot), +var fieldIDToName_UserAgreementHTMLRequest = map[int16]string{} + +func (p *UserAgreementHTMLRequest) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } -} -func NewAcademicServiceClient(c thrift.TClient) *AcademicServiceClient { - return &AcademicServiceClient{ - c: c, + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } -} -func (p *AcademicServiceClient) Client_() thrift.TClient { - return p.c + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, 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 *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 { - return +func (p *UserAgreementHTMLRequest) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("UserAgreementHTMLRequest"); err != nil { + goto WriteStructBeginError } - 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 { - return + if p != nil { } - 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 { - return + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - 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 { - 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) +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 UrlService interface { - APILogin(ctx context.Context, req *APILoginRequest) (r *APILoginResponse, err error) +func (p *UserAgreementHTMLRequest) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("UserAgreementHTMLRequest(%+v)", *p) - UploadVersionInfo(ctx context.Context, req *UploadVersionInfoRequest) (r *UploadVersionInfoResponse, err error) +} - GetUploadParams(ctx context.Context, req *GetUploadParamsRequest) (r *GetUploadParamsResponse, err error) +type UserAgreementHTMLResponse struct { +} - GetDownloadRelease(ctx context.Context, req *GetDownloadReleaseRequest) (r *GetDownloadReleaseResponse, err error) +func NewUserAgreementHTMLResponse() *UserAgreementHTMLResponse { + return &UserAgreementHTMLResponse{} +} - GetDownloadBeta(ctx context.Context, req *GetDownloadBetaRequest) (r *GetDownloadBetaResponse, err error) +func (p *UserAgreementHTMLResponse) InitDefault() { +} - GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) +var fieldIDToName_UserAgreementHTMLResponse = map[int16]string{} - GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) +func (p *UserAgreementHTMLResponse) Read(iprot thrift.TProtocol) (err error) { - GetCloudSetting(ctx context.Context, req *GetCloudSettingRequest) (r *GetCloudSettingResponse, err error) + var fieldTypeId thrift.TType + var fieldId int16 - GetAllCloudSetting(ctx context.Context, req *GetAllCloudSettingRequest) (r *GetAllCloudSettingResponse, err error) + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError + } - SetAllCloudSetting(ctx context.Context, req *SetAllCloudSettingRequest) (r *SetAllCloudSettingResponse, err error) + for { + _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() + if err != nil { + goto ReadFieldBeginError + } + if fieldTypeId == thrift.STOP { + break + } + if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldTypeError + } + if err = iprot.ReadFieldEnd(); err != nil { + goto ReadFieldEndError + } + } + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError + } - TestSetting(ctx context.Context, req *TestSettingRequest) (r *TestSettingResponse, err error) + 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) +SkipFieldTypeError: + return thrift.PrependError(fmt.Sprintf("%T skip field type %d error", p, fieldTypeId), err) - DumpVisit(ctx context.Context, req *DumpVisitRequest) (r *DumpVisitResponse, 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) +} - FZUHelperCSS(ctx context.Context, req *FZUHelperCSSRequest) (r *FZUHelperCSSResponse, err error) +func (p *UserAgreementHTMLResponse) Write(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteStructBegin("UserAgreementHTMLResponse"); err != nil { + goto WriteStructBeginError + } + if p != nil { + } + 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) +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) +} - FZUHelperHTML(ctx context.Context, req *FZUHelperHTMLRequest) (r *FZUHelperHTMLResponse, err error) +func (p *UserAgreementHTMLResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("UserAgreementHTMLResponse(%+v)", *p) - UserAgreementHTML(ctx context.Context, req *UserAgreementHTMLRequest) (r *UserAgreementHTMLResponse, err error) } -type UrlServiceClient struct { +type ClassRoomService interface { + GetEmptyClassrooms(ctx context.Context, request *EmptyClassroomRequest) (r *EmptyClassroomResponse, err error) +} + +type ClassRoomServiceClient struct { c thrift.TClient } -func NewUrlServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *UrlServiceClient { - return &UrlServiceClient{ +func NewClassRoomServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *ClassRoomServiceClient { + return &ClassRoomServiceClient{ c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } } -func NewUrlServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *UrlServiceClient { - return &UrlServiceClient{ +func NewClassRoomServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *ClassRoomServiceClient { + return &ClassRoomServiceClient{ c: thrift.NewTStandardClient(iprot, oprot), } } -func NewUrlServiceClient(c thrift.TClient) *UrlServiceClient { - return &UrlServiceClient{ +func NewClassRoomServiceClient(c thrift.TClient) *ClassRoomServiceClient { + return &ClassRoomServiceClient{ c: c, } } -func (p *UrlServiceClient) Client_() thrift.TClient { +func (p *ClassRoomServiceClient) Client_() thrift.TClient { return p.c } -func (p *UrlServiceClient) APILogin(ctx context.Context, req *APILoginRequest) (r *APILoginResponse, err error) { - var _args UrlServiceAPILoginArgs - _args.Req = req - var _result UrlServiceAPILoginResult - if err = p.Client_().Call(ctx, "APILogin", &_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 *UrlServiceClient) UploadVersionInfo(ctx context.Context, req *UploadVersionInfoRequest) (r *UploadVersionInfoResponse, err error) { - var _args UrlServiceUploadVersionInfoArgs - _args.Req = req - var _result UrlServiceUploadVersionInfoResult - if err = p.Client_().Call(ctx, "UploadVersionInfo", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil + +type UserService interface { + GetLoginData(ctx context.Context, request *GetLoginDataRequest) (r *GetLoginDataResponse, err error) + + ValidateCode(ctx context.Context, request *ValidateCodeRequest) (r *ValidateCodeResponse, err error) + + ValidateCodeForAndroid(ctx context.Context, request *ValidateCodeForAndroidRequest) (r *ValidateCodeForAndroidResponse, err error) } -func (p *UrlServiceClient) GetUploadParams(ctx context.Context, req *GetUploadParamsRequest) (r *GetUploadParamsResponse, err error) { - var _args UrlServiceGetUploadParamsArgs - _args.Req = req - var _result UrlServiceGetUploadParamsResult - if err = p.Client_().Call(ctx, "GetUploadParams", &_args, &_result); err != nil { - return - } - return _result.GetSuccess(), nil + +type UserServiceClient struct { + c thrift.TClient } -func (p *UrlServiceClient) GetDownloadRelease(ctx context.Context, req *GetDownloadReleaseRequest) (r *GetDownloadReleaseResponse, err error) { - var _args UrlServiceGetDownloadReleaseArgs - _args.Req = req - var _result UrlServiceGetDownloadReleaseResult - if err = p.Client_().Call(ctx, "GetDownloadRelease", &_args, &_result); err != nil { - return + +func NewUserServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *UserServiceClient { + return &UserServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } - return _result.GetSuccess(), nil } -func (p *UrlServiceClient) GetDownloadBeta(ctx context.Context, req *GetDownloadBetaRequest) (r *GetDownloadBetaResponse, err error) { - var _args UrlServiceGetDownloadBetaArgs - _args.Req = req - var _result UrlServiceGetDownloadBetaResult - if err = p.Client_().Call(ctx, "GetDownloadBeta", &_args, &_result); err != nil { - return + +func NewUserServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *UserServiceClient { + return &UserServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), } - return _result.GetSuccess(), nil } -func (p *UrlServiceClient) GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) { - var _args UrlServiceGetReleaseVersionArgs - _args.Req = req - var _result UrlServiceGetReleaseVersionResult - if err = p.Client_().Call(ctx, "GetReleaseVersion", &_args, &_result); err != nil { - return + +func NewUserServiceClient(c thrift.TClient) *UserServiceClient { + return &UserServiceClient{ + c: c, } - return _result.GetSuccess(), nil } -func (p *UrlServiceClient) GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) { - var _args UrlServiceGetBetaVersionArgs - _args.Req = req - var _result UrlServiceGetBetaVersionResult - if err = p.Client_().Call(ctx, "GetBetaVersion", &_args, &_result); err != nil { + +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 } return _result.GetSuccess(), nil } -func (p *UrlServiceClient) GetCloudSetting(ctx context.Context, req *GetCloudSettingRequest) (r *GetCloudSettingResponse, err error) { - var _args UrlServiceGetCloudSettingArgs - _args.Req = req - var _result UrlServiceGetCloudSettingResult - if err = p.Client_().Call(ctx, "GetCloudSetting", &_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 *UrlServiceClient) GetAllCloudSetting(ctx context.Context, req *GetAllCloudSettingRequest) (r *GetAllCloudSettingResponse, err error) { - var _args UrlServiceGetAllCloudSettingArgs - _args.Req = req - var _result UrlServiceGetAllCloudSettingResult - if err = p.Client_().Call(ctx, "GetAllCloudSetting", &_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 *UrlServiceClient) SetAllCloudSetting(ctx context.Context, req *SetAllCloudSettingRequest) (r *SetAllCloudSettingResponse, err error) { - var _args UrlServiceSetAllCloudSettingArgs + +type CourseService interface { + GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) +} + +type CourseServiceClient struct { + c thrift.TClient +} + +func NewCourseServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *CourseServiceClient { + return &CourseServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewCourseServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *CourseServiceClient { + return &CourseServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewCourseServiceClient(c thrift.TClient) *CourseServiceClient { + return &CourseServiceClient{ + c: c, + } +} + +func (p *CourseServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *CourseServiceClient) GetCourseList(ctx context.Context, req *CourseListRequest) (r *CourseListResponse, err error) { + var _args CourseServiceGetCourseListArgs _args.Req = req - var _result UrlServiceSetAllCloudSettingResult - if err = p.Client_().Call(ctx, "SetAllCloudSetting", &_args, &_result); err != nil { + var _result CourseServiceGetCourseListResult + if err = p.Client_().Call(ctx, "GetCourseList", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } -func (p *UrlServiceClient) TestSetting(ctx context.Context, req *TestSettingRequest) (r *TestSettingResponse, err error) { - var _args UrlServiceTestSettingArgs + +type LaunchScreenService interface { + CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) + + GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) + + ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) + + ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, 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 LaunchScreenServiceClient struct { + c thrift.TClient +} + +func NewLaunchScreenServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *LaunchScreenServiceClient { + return &LaunchScreenServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } +} + +func NewLaunchScreenServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *LaunchScreenServiceClient { + return &LaunchScreenServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), + } +} + +func NewLaunchScreenServiceClient(c thrift.TClient) *LaunchScreenServiceClient { + return &LaunchScreenServiceClient{ + c: c, + } +} + +func (p *LaunchScreenServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *LaunchScreenServiceClient) CreateImage(ctx context.Context, req *CreateImageRequest) (r *CreateImageResponse, err error) { + var _args LaunchScreenServiceCreateImageArgs _args.Req = req - var _result UrlServiceTestSettingResult - if err = p.Client_().Call(ctx, "TestSetting", &_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 *UrlServiceClient) DumpVisit(ctx context.Context, req *DumpVisitRequest) (r *DumpVisitResponse, err error) { - var _args UrlServiceDumpVisitArgs +func (p *LaunchScreenServiceClient) GetImage(ctx context.Context, req *GetImageRequest) (r *GetImageResponse, err error) { + var _args LaunchScreenServiceGetImageArgs _args.Req = req - var _result UrlServiceDumpVisitResult - if err = p.Client_().Call(ctx, "DumpVisit", &_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 *UrlServiceClient) FZUHelperCSS(ctx context.Context, req *FZUHelperCSSRequest) (r *FZUHelperCSSResponse, err error) { - var _args UrlServiceFZUHelperCSSArgs +func (p *LaunchScreenServiceClient) ChangeImageProperty(ctx context.Context, req *ChangeImagePropertyRequest) (r *ChangeImagePropertyResponse, err error) { + var _args LaunchScreenServiceChangeImagePropertyArgs _args.Req = req - var _result UrlServiceFZUHelperCSSResult - if err = p.Client_().Call(ctx, "FZUHelperCSS", &_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 *UrlServiceClient) FZUHelperHTML(ctx context.Context, req *FZUHelperHTMLRequest) (r *FZUHelperHTMLResponse, err error) { - var _args UrlServiceFZUHelperHTMLArgs +func (p *LaunchScreenServiceClient) ChangeImage(ctx context.Context, req *ChangeImageRequest) (r *ChangeImageResponse, err error) { + var _args LaunchScreenServiceChangeImageArgs _args.Req = req - var _result UrlServiceFZUHelperHTMLResult - if err = p.Client_().Call(ctx, "FZUHelperHTML", &_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 *UrlServiceClient) UserAgreementHTML(ctx context.Context, req *UserAgreementHTMLRequest) (r *UserAgreementHTMLResponse, err error) { - var _args UrlServiceUserAgreementHTMLArgs +func (p *LaunchScreenServiceClient) DeleteImage(ctx context.Context, req *DeleteImageRequest) (r *DeleteImageResponse, err error) { + var _args LaunchScreenServiceDeleteImageArgs _args.Req = req - var _result UrlServiceUserAgreementHTMLResult - if err = p.Client_().Call(ctx, "UserAgreementHTML", &_args, &_result); err != nil { + var _result LaunchScreenServiceDeleteImageResult + if err = p.Client_().Call(ctx, "DeleteImage", &_args, &_result); err != nil { return } return _result.GetSuccess(), nil } - -type ClassRoomServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler ClassRoomService +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 + } + return _result.GetSuccess(), nil } - -func (p *ClassRoomServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor +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 + } + return _result.GetSuccess(), nil } -func (p *ClassRoomServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} +type PaperService interface { + ListDirFiles(ctx context.Context, req *ListDirFilesRequest) (r *ListDirFilesResponse, err error) -func (p *ClassRoomServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap + 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 NewClassRoomServiceProcessor(handler ClassRoomService) *ClassRoomServiceProcessor { - self := &ClassRoomServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("GetEmptyClassrooms", &classRoomServiceProcessorGetEmptyClassrooms{handler: handler}) - return self +type PaperServiceClient 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 NewPaperServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *PaperServiceClient { + return &PaperServiceClient{ + 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 NewPaperServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PaperServiceClient { + return &PaperServiceClient{ + 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 NewPaperServiceClient(c thrift.TClient) *PaperServiceClient { + return &PaperServiceClient{ + 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 +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 } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + 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 { + return } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + 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 } - if err != nil { + 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 { return } - return true, err + return _result.GetSuccess(), nil } -type ClassRoomServiceGetEmptyClassroomsArgs struct { - Request *EmptyClassroomRequest `thrift:"request,1"` -} +type AcademicService interface { + GetScores(ctx context.Context, req *GetScoresRequest) (r *GetScoresResponse, err error) -func NewClassRoomServiceGetEmptyClassroomsArgs() *ClassRoomServiceGetEmptyClassroomsArgs { - return &ClassRoomServiceGetEmptyClassroomsArgs{} -} - -func (p *ClassRoomServiceGetEmptyClassroomsArgs) InitDefault() { -} + GetGPA(ctx context.Context, req *GetGPARequest) (r *GetGPAResponse, err error) -var ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT *EmptyClassroomRequest + GetCredit(ctx context.Context, req *GetCreditRequest) (r *GetCreditResponse, err error) -func (p *ClassRoomServiceGetEmptyClassroomsArgs) GetRequest() (v *EmptyClassroomRequest) { - if !p.IsSetRequest() { - return ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT - } - return p.Request + GetUnifiedExam(ctx context.Context, req *GetUnifiedExamRequest) (r *GetUnifiedExamResponse, err error) } -var fieldIDToName_ClassRoomServiceGetEmptyClassroomsArgs = map[int16]string{ - 1: "request", +type AcademicServiceClient struct { + c thrift.TClient } -func (p *ClassRoomServiceGetEmptyClassroomsArgs) IsSetRequest() bool { - return p.Request != nil +func NewAcademicServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AcademicServiceClient { + return &AcademicServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), + } } -func (p *ClassRoomServiceGetEmptyClassroomsArgs) Read(iprot thrift.TProtocol) (err error) { - - var fieldTypeId thrift.TType - var fieldId int16 - - if _, err = iprot.ReadStructBegin(); err != nil { - goto ReadStructBeginError +func NewAcademicServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *AcademicServiceClient { + return &AcademicServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), } +} - 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 +func NewAcademicServiceClient(c thrift.TClient) *AcademicServiceClient { + return &AcademicServiceClient{ + c: c, } - - 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_ClassRoomServiceGetEmptyClassroomsArgs[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 *ClassRoomServiceGetEmptyClassroomsArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewEmptyClassroomRequest() - if err := _field.Read(iprot); err != nil { - return err - } - p.Request = _field - return nil +func (p *AcademicServiceClient) Client_() thrift.TClient { + return p.c } -func (p *ClassRoomServiceGetEmptyClassroomsArgs) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("GetEmptyClassrooms_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 +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 { + return } - 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) + return _result.GetSuccess(), nil } - -func (p *ClassRoomServiceGetEmptyClassroomsArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { - goto WriteFieldBeginError +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 { + return } - if err := p.Request.Write(oprot); err != nil { - return err + 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 { + return } - if err = oprot.WriteFieldEnd(); err != nil { - goto WriteFieldEndError + 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 { + return } - 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) + return _result.GetSuccess(), nil } -func (p *ClassRoomServiceGetEmptyClassroomsArgs) String() string { - if p == nil { - return "" - } - return fmt.Sprintf("ClassRoomServiceGetEmptyClassroomsArgs(%+v)", *p) +type UrlService interface { + APILogin(ctx context.Context, req *APILoginRequest) (r *APILoginResponse, err error) -} + UploadVersionInfo(ctx context.Context, req *UploadVersionInfoRequest) (r *UploadVersionInfoResponse, err error) -type ClassRoomServiceGetEmptyClassroomsResult struct { - Success *EmptyClassroomResponse `thrift:"success,0,optional"` -} + GetUploadParams(ctx context.Context, req *GetUploadParamsRequest) (r *GetUploadParamsResponse, err error) -func NewClassRoomServiceGetEmptyClassroomsResult() *ClassRoomServiceGetEmptyClassroomsResult { - return &ClassRoomServiceGetEmptyClassroomsResult{} -} + GetDownloadRelease(ctx context.Context, req *GetDownloadReleaseRequest) (r *GetDownloadReleaseResponse, err error) -func (p *ClassRoomServiceGetEmptyClassroomsResult) InitDefault() { -} + GetDownloadBeta(ctx context.Context, req *GetDownloadBetaRequest) (r *GetDownloadBetaResponse, err error) -var ClassRoomServiceGetEmptyClassroomsResult_Success_DEFAULT *EmptyClassroomResponse + GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) -func (p *ClassRoomServiceGetEmptyClassroomsResult) GetSuccess() (v *EmptyClassroomResponse) { - if !p.IsSetSuccess() { - return ClassRoomServiceGetEmptyClassroomsResult_Success_DEFAULT - } - return p.Success -} + GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) -var fieldIDToName_ClassRoomServiceGetEmptyClassroomsResult = map[int16]string{ - 0: "success", -} + GetCloudSetting(ctx context.Context, req *GetCloudSettingRequest) (r *GetCloudSettingResponse, err error) -func (p *ClassRoomServiceGetEmptyClassroomsResult) IsSetSuccess() bool { - return p.Success != nil -} + GetAllCloudSetting(ctx context.Context, req *GetAllCloudSettingRequest) (r *GetAllCloudSettingResponse, err error) -func (p *ClassRoomServiceGetEmptyClassroomsResult) Read(iprot thrift.TProtocol) (err error) { + SetAllCloudSetting(ctx context.Context, req *SetAllCloudSettingRequest) (r *SetAllCloudSettingResponse, err error) - var fieldTypeId thrift.TType - var fieldId int16 + TestSetting(ctx context.Context, req *TestSettingRequest) (r *TestSettingResponse, err error) - if _, err = iprot.ReadStructBegin(); err != nil { - goto ReadStructBeginError - } + DumpVisit(ctx context.Context, req *DumpVisitRequest) (r *DumpVisitResponse, err error) - for { - _, fieldTypeId, fieldId, err = iprot.ReadFieldBegin() - if err != nil { - goto ReadFieldBeginError - } - if fieldTypeId == thrift.STOP { - break - } + FZUHelperCSS(ctx context.Context, req *FZUHelperCSSRequest) (r *FZUHelperCSSResponse, err error) - 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 - } + FZUHelperHTML(ctx context.Context, req *FZUHelperHTMLRequest) (r *FZUHelperHTMLResponse, err error) - 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_ClassRoomServiceGetEmptyClassroomsResult[fieldId]), err) -SkipFieldError: - return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) + UserAgreementHTML(ctx context.Context, req *UserAgreementHTMLRequest) (r *UserAgreementHTMLResponse, 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) +type UrlServiceClient struct { + c thrift.TClient } -func (p *ClassRoomServiceGetEmptyClassroomsResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewEmptyClassroomResponse() - if err := _field.Read(iprot); err != nil { - return err +func NewUrlServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *UrlServiceClient { + return &UrlServiceClient{ + c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)), } - p.Success = _field - return nil } -func (p *ClassRoomServiceGetEmptyClassroomsResult) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("GetEmptyClassrooms_result"); err != nil { - goto WriteStructBeginError +func NewUrlServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *UrlServiceClient { + return &UrlServiceClient{ + c: thrift.NewTStandardClient(iprot, oprot), } - if p != nil { - if err = p.writeField0(oprot); err != nil { - fieldId = 0 - goto WriteFieldError - } +} + +func NewUrlServiceClient(c thrift.TClient) *UrlServiceClient { + return &UrlServiceClient{ + c: c, } - if err = oprot.WriteFieldStop(); err != nil { - goto WriteFieldStopError +} + +func (p *UrlServiceClient) Client_() thrift.TClient { + return p.c +} + +func (p *UrlServiceClient) APILogin(ctx context.Context, req *APILoginRequest) (r *APILoginResponse, err error) { + var _args UrlServiceAPILoginArgs + _args.Req = req + var _result UrlServiceAPILoginResult + if err = p.Client_().Call(ctx, "APILogin", &_args, &_result); err != nil { + return } - if err = oprot.WriteStructEnd(); err != nil { - goto WriteStructEndError + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) UploadVersionInfo(ctx context.Context, req *UploadVersionInfoRequest) (r *UploadVersionInfoResponse, err error) { + var _args UrlServiceUploadVersionInfoArgs + _args.Req = req + var _result UrlServiceUploadVersionInfoResult + if err = p.Client_().Call(ctx, "UploadVersionInfo", &_args, &_result); err != nil { + return } - 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) + return _result.GetSuccess(), nil } - -func (p *ClassRoomServiceGetEmptyClassroomsResult) 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 *UrlServiceClient) GetUploadParams(ctx context.Context, req *GetUploadParamsRequest) (r *GetUploadParamsResponse, err error) { + var _args UrlServiceGetUploadParamsArgs + _args.Req = req + var _result UrlServiceGetUploadParamsResult + if err = p.Client_().Call(ctx, "GetUploadParams", &_args, &_result); err != nil { + return } - 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) + return _result.GetSuccess(), nil } - -func (p *ClassRoomServiceGetEmptyClassroomsResult) String() string { - if p == nil { - return "" +func (p *UrlServiceClient) GetDownloadRelease(ctx context.Context, req *GetDownloadReleaseRequest) (r *GetDownloadReleaseResponse, err error) { + var _args UrlServiceGetDownloadReleaseArgs + _args.Req = req + var _result UrlServiceGetDownloadReleaseResult + if err = p.Client_().Call(ctx, "GetDownloadRelease", &_args, &_result); err != nil { + return } - return fmt.Sprintf("ClassRoomServiceGetEmptyClassroomsResult(%+v)", *p) - + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) GetDownloadBeta(ctx context.Context, req *GetDownloadBetaRequest) (r *GetDownloadBetaResponse, err error) { + var _args UrlServiceGetDownloadBetaArgs + _args.Req = req + var _result UrlServiceGetDownloadBetaResult + if err = p.Client_().Call(ctx, "GetDownloadBeta", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) GetReleaseVersion(ctx context.Context, req *GetReleaseVersionRequest) (r *GetReleaseVersionResponse, err error) { + var _args UrlServiceGetReleaseVersionArgs + _args.Req = req + var _result UrlServiceGetReleaseVersionResult + if err = p.Client_().Call(ctx, "GetReleaseVersion", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) GetBetaVersion(ctx context.Context, req *GetBetaVersionRequest) (r *GetBetaVersionResponse, err error) { + var _args UrlServiceGetBetaVersionArgs + _args.Req = req + var _result UrlServiceGetBetaVersionResult + if err = p.Client_().Call(ctx, "GetBetaVersion", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) GetCloudSetting(ctx context.Context, req *GetCloudSettingRequest) (r *GetCloudSettingResponse, err error) { + var _args UrlServiceGetCloudSettingArgs + _args.Req = req + var _result UrlServiceGetCloudSettingResult + if err = p.Client_().Call(ctx, "GetCloudSetting", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) GetAllCloudSetting(ctx context.Context, req *GetAllCloudSettingRequest) (r *GetAllCloudSettingResponse, err error) { + var _args UrlServiceGetAllCloudSettingArgs + _args.Req = req + var _result UrlServiceGetAllCloudSettingResult + if err = p.Client_().Call(ctx, "GetAllCloudSetting", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) SetAllCloudSetting(ctx context.Context, req *SetAllCloudSettingRequest) (r *SetAllCloudSettingResponse, err error) { + var _args UrlServiceSetAllCloudSettingArgs + _args.Req = req + var _result UrlServiceSetAllCloudSettingResult + if err = p.Client_().Call(ctx, "SetAllCloudSetting", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) TestSetting(ctx context.Context, req *TestSettingRequest) (r *TestSettingResponse, err error) { + var _args UrlServiceTestSettingArgs + _args.Req = req + var _result UrlServiceTestSettingResult + if err = p.Client_().Call(ctx, "TestSetting", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) DumpVisit(ctx context.Context, req *DumpVisitRequest) (r *DumpVisitResponse, err error) { + var _args UrlServiceDumpVisitArgs + _args.Req = req + var _result UrlServiceDumpVisitResult + if err = p.Client_().Call(ctx, "DumpVisit", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) FZUHelperCSS(ctx context.Context, req *FZUHelperCSSRequest) (r *FZUHelperCSSResponse, err error) { + var _args UrlServiceFZUHelperCSSArgs + _args.Req = req + var _result UrlServiceFZUHelperCSSResult + if err = p.Client_().Call(ctx, "FZUHelperCSS", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) FZUHelperHTML(ctx context.Context, req *FZUHelperHTMLRequest) (r *FZUHelperHTMLResponse, err error) { + var _args UrlServiceFZUHelperHTMLArgs + _args.Req = req + var _result UrlServiceFZUHelperHTMLResult + if err = p.Client_().Call(ctx, "FZUHelperHTML", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} +func (p *UrlServiceClient) UserAgreementHTML(ctx context.Context, req *UserAgreementHTMLRequest) (r *UserAgreementHTMLResponse, err error) { + var _args UrlServiceUserAgreementHTMLArgs + _args.Req = req + var _result UrlServiceUserAgreementHTMLResult + if err = p.Client_().Call(ctx, "UserAgreementHTML", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil } -type UserServiceProcessor struct { +type ClassRoomServiceProcessor struct { processorMap map[string]thrift.TProcessorFunction - handler UserService + handler ClassRoomService } -func (p *UserServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { +func (p *ClassRoomServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { p.processorMap[key] = processor } -func (p *UserServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { +func (p *ClassRoomServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { processor, ok = p.processorMap[key] return processor, ok } -func (p *UserServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { +func (p *ClassRoomServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { return p.processorMap } -func NewUserServiceProcessor(handler UserService) *UserServiceProcessor { - self := &UserServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("GetLoginData", &userServiceProcessorGetLoginData{handler: handler}) - self.AddToProcessorMap("ValidateCode", &userServiceProcessorValidateCode{handler: handler}) +func NewClassRoomServiceProcessor(handler ClassRoomService) *ClassRoomServiceProcessor { + self := &ClassRoomServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetEmptyClassrooms", &classRoomServiceProcessorGetEmptyClassrooms{handler: handler}) return self } -func (p *UserServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { +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 @@ -11877,16 +12221,16 @@ func (p *UserServiceProcessor) Process(ctx context.Context, iprot, oprot thrift. return false, x } -type userServiceProcessorGetLoginData struct { - handler UserService +type classRoomServiceProcessorGetEmptyClassrooms struct { + handler ClassRoomService } -func (p *userServiceProcessorGetLoginData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := UserServiceGetLoginDataArgs{} +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("GetLoginData", thrift.EXCEPTION, seqId) + oprot.WriteMessageBegin("GetEmptyClassrooms", thrift.EXCEPTION, seqId) x.Write(oprot) oprot.WriteMessageEnd() oprot.Flush(ctx) @@ -11895,11 +12239,11 @@ func (p *userServiceProcessorGetLoginData) Process(ctx context.Context, seqId in iprot.ReadMessageEnd() var err2 error - result := UserServiceGetLoginDataResult{} - var retval *GetLoginDataResponse - if retval, err2 = p.handler.GetLoginData(ctx, args.Request); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetLoginData: "+err2.Error()) - oprot.WriteMessageBegin("GetLoginData", 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) @@ -11907,7 +12251,7 @@ func (p *userServiceProcessorGetLoginData) Process(ctx context.Context, seqId in } else { result.Success = retval } - if err2 = oprot.WriteMessageBegin("GetLoginData", 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 { @@ -11925,83 +12269,35 @@ func (p *userServiceProcessorGetLoginData) Process(ctx context.Context, seqId in return true, err } -type userServiceProcessorValidateCode struct { - handler UserService +type ClassRoomServiceGetEmptyClassroomsArgs struct { + Request *EmptyClassroomRequest `thrift:"request,1"` } -func (p *userServiceProcessorValidateCode) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := UserServiceValidateCodeArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("ValidateCode", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } +func NewClassRoomServiceGetEmptyClassroomsArgs() *ClassRoomServiceGetEmptyClassroomsArgs { + return &ClassRoomServiceGetEmptyClassroomsArgs{} +} - iprot.ReadMessageEnd() - var err2 error - result := UserServiceValidateCodeResult{} - var retval *ValidateCodeResponse - if retval, err2 = p.handler.ValidateCode(ctx, args.Request); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ValidateCode: "+err2.Error()) - oprot.WriteMessageBegin("ValidateCode", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("ValidateCode", 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 UserServiceGetLoginDataArgs struct { - Request *GetLoginDataRequest `thrift:"request,1"` -} - -func NewUserServiceGetLoginDataArgs() *UserServiceGetLoginDataArgs { - return &UserServiceGetLoginDataArgs{} -} - -func (p *UserServiceGetLoginDataArgs) InitDefault() { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) InitDefault() { } -var UserServiceGetLoginDataArgs_Request_DEFAULT *GetLoginDataRequest +var ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT *EmptyClassroomRequest -func (p *UserServiceGetLoginDataArgs) GetRequest() (v *GetLoginDataRequest) { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) GetRequest() (v *EmptyClassroomRequest) { if !p.IsSetRequest() { - return UserServiceGetLoginDataArgs_Request_DEFAULT + return ClassRoomServiceGetEmptyClassroomsArgs_Request_DEFAULT } return p.Request } -var fieldIDToName_UserServiceGetLoginDataArgs = map[int16]string{ +var fieldIDToName_ClassRoomServiceGetEmptyClassroomsArgs = map[int16]string{ 1: "request", } -func (p *UserServiceGetLoginDataArgs) IsSetRequest() bool { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) IsSetRequest() bool { return p.Request != nil } -func (p *UserServiceGetLoginDataArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -12047,7 +12343,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_UserServiceGetLoginDataArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ClassRoomServiceGetEmptyClassroomsArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -12057,8 +12353,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *UserServiceGetLoginDataArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetLoginDataRequest() +func (p *ClassRoomServiceGetEmptyClassroomsArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewEmptyClassroomRequest() if err := _field.Read(iprot); err != nil { return err } @@ -12066,9 +12362,9 @@ func (p *UserServiceGetLoginDataArgs) ReadField1(iprot thrift.TProtocol) error { return nil } -func (p *UserServiceGetLoginDataArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetLoginData_args"); err != nil { + if err = oprot.WriteStructBegin("GetEmptyClassrooms_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -12094,7 +12390,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserServiceGetLoginDataArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -12111,43 +12407,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *UserServiceGetLoginDataArgs) String() string { +func (p *ClassRoomServiceGetEmptyClassroomsArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("UserServiceGetLoginDataArgs(%+v)", *p) + return fmt.Sprintf("ClassRoomServiceGetEmptyClassroomsArgs(%+v)", *p) } -type UserServiceGetLoginDataResult struct { - Success *GetLoginDataResponse `thrift:"success,0,optional"` +type ClassRoomServiceGetEmptyClassroomsResult struct { + Success *EmptyClassroomResponse `thrift:"success,0,optional"` } -func NewUserServiceGetLoginDataResult() *UserServiceGetLoginDataResult { - return &UserServiceGetLoginDataResult{} +func NewClassRoomServiceGetEmptyClassroomsResult() *ClassRoomServiceGetEmptyClassroomsResult { + return &ClassRoomServiceGetEmptyClassroomsResult{} } -func (p *UserServiceGetLoginDataResult) InitDefault() { +func (p *ClassRoomServiceGetEmptyClassroomsResult) InitDefault() { } -var UserServiceGetLoginDataResult_Success_DEFAULT *GetLoginDataResponse +var ClassRoomServiceGetEmptyClassroomsResult_Success_DEFAULT *EmptyClassroomResponse -func (p *UserServiceGetLoginDataResult) GetSuccess() (v *GetLoginDataResponse) { +func (p *ClassRoomServiceGetEmptyClassroomsResult) GetSuccess() (v *EmptyClassroomResponse) { if !p.IsSetSuccess() { - return UserServiceGetLoginDataResult_Success_DEFAULT + return ClassRoomServiceGetEmptyClassroomsResult_Success_DEFAULT } return p.Success } -var fieldIDToName_UserServiceGetLoginDataResult = map[int16]string{ +var fieldIDToName_ClassRoomServiceGetEmptyClassroomsResult = map[int16]string{ 0: "success", } -func (p *UserServiceGetLoginDataResult) IsSetSuccess() bool { +func (p *ClassRoomServiceGetEmptyClassroomsResult) IsSetSuccess() bool { return p.Success != nil } -func (p *UserServiceGetLoginDataResult) Read(iprot thrift.TProtocol) (err error) { +func (p *ClassRoomServiceGetEmptyClassroomsResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -12193,7 +12489,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_UserServiceGetLoginDataResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_ClassRoomServiceGetEmptyClassroomsResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -12203,8 +12499,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *UserServiceGetLoginDataResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetLoginDataResponse() +func (p *ClassRoomServiceGetEmptyClassroomsResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewEmptyClassroomResponse() if err := _field.Read(iprot); err != nil { return err } @@ -12212,9 +12508,9 @@ func (p *UserServiceGetLoginDataResult) ReadField0(iprot thrift.TProtocol) error return nil } -func (p *UserServiceGetLoginDataResult) Write(oprot thrift.TProtocol) (err error) { +func (p *ClassRoomServiceGetEmptyClassroomsResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetLoginData_result"); err != nil { + if err = oprot.WriteStructBegin("GetEmptyClassrooms_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -12240,7 +12536,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserServiceGetLoginDataResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *ClassRoomServiceGetEmptyClassroomsResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -12259,125 +12555,312 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *UserServiceGetLoginDataResult) String() string { +func (p *ClassRoomServiceGetEmptyClassroomsResult) String() string { if p == nil { return "" } - return fmt.Sprintf("UserServiceGetLoginDataResult(%+v)", *p) - -} + return fmt.Sprintf("ClassRoomServiceGetEmptyClassroomsResult(%+v)", *p) -type UserServiceValidateCodeArgs struct { - Request *ValidateCodeRequest `thrift:"request,1"` } -func NewUserServiceValidateCodeArgs() *UserServiceValidateCodeArgs { - return &UserServiceValidateCodeArgs{} +type UserServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler UserService } -func (p *UserServiceValidateCodeArgs) InitDefault() { +func (p *UserServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor } -var UserServiceValidateCodeArgs_Request_DEFAULT *ValidateCodeRequest - -func (p *UserServiceValidateCodeArgs) GetRequest() (v *ValidateCodeRequest) { - if !p.IsSetRequest() { - return UserServiceValidateCodeArgs_Request_DEFAULT - } - return p.Request +func (p *UserServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok } -var fieldIDToName_UserServiceValidateCodeArgs = map[int16]string{ - 1: "request", +func (p *UserServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap } -func (p *UserServiceValidateCodeArgs) IsSetRequest() bool { - return p.Request != nil +func NewUserServiceProcessor(handler UserService) *UserServiceProcessor { + self := &UserServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetLoginData", &userServiceProcessorGetLoginData{handler: handler}) + self.AddToProcessorMap("ValidateCode", &userServiceProcessorValidateCode{handler: handler}) + self.AddToProcessorMap("ValidateCodeForAndroid", &userServiceProcessorValidateCodeForAndroid{handler: handler}) + return self } - -func (p *UserServiceValidateCodeArgs) 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 - } +func (p *UserServiceProcessor) 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 err = iprot.ReadStructEnd(); err != nil { - goto ReadStructEndError + 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 +} - 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_UserServiceValidateCodeArgs[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) +type userServiceProcessorGetLoginData struct { + handler UserService } -func (p *UserServiceValidateCodeArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewValidateCodeRequest() - if err := _field.Read(iprot); err != nil { - return err +func (p *userServiceProcessorGetLoginData) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := UserServiceGetLoginDataArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetLoginData", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err } - p.Request = _field - return nil -} -func (p *UserServiceValidateCodeArgs) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("ValidateCode_args"); err != nil { - goto WriteStructBeginError + iprot.ReadMessageEnd() + var err2 error + result := UserServiceGetLoginDataResult{} + var retval *GetLoginDataResponse + if retval, err2 = p.handler.GetLoginData(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetLoginData: "+err2.Error()) + oprot.WriteMessageBegin("GetLoginData", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval } - if p != nil { - if err = p.writeField1(oprot); err != nil { - fieldId = 1 - goto WriteFieldError - } + if err2 = oprot.WriteMessageBegin("GetLoginData", thrift.REPLY, seqId); err2 != nil { + err = err2 } - if err = oprot.WriteFieldStop(); err != nil { - goto WriteFieldStopError + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - if err = oprot.WriteStructEnd(); err != nil { - goto WriteStructEndError + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - return nil + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err +} + +type userServiceProcessorValidateCode struct { + handler UserService +} + +func (p *userServiceProcessorValidateCode) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := UserServiceValidateCodeArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ValidateCode", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := UserServiceValidateCodeResult{} + var retval *ValidateCodeResponse + if retval, err2 = p.handler.ValidateCode(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ValidateCode: "+err2.Error()) + oprot.WriteMessageBegin("ValidateCode", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("ValidateCode", 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 userServiceProcessorValidateCodeForAndroid struct { + handler UserService +} + +func (p *userServiceProcessorValidateCodeForAndroid) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := UserServiceValidateCodeForAndroidArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ValidateCodeForAndroid", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := UserServiceValidateCodeForAndroidResult{} + var retval *ValidateCodeForAndroidResponse + if retval, err2 = p.handler.ValidateCodeForAndroid(ctx, args.Request); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ValidateCodeForAndroid: "+err2.Error()) + oprot.WriteMessageBegin("ValidateCodeForAndroid", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("ValidateCodeForAndroid", 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 UserServiceGetLoginDataArgs struct { + Request *GetLoginDataRequest `thrift:"request,1"` +} + +func NewUserServiceGetLoginDataArgs() *UserServiceGetLoginDataArgs { + return &UserServiceGetLoginDataArgs{} +} + +func (p *UserServiceGetLoginDataArgs) InitDefault() { +} + +var UserServiceGetLoginDataArgs_Request_DEFAULT *GetLoginDataRequest + +func (p *UserServiceGetLoginDataArgs) GetRequest() (v *GetLoginDataRequest) { + if !p.IsSetRequest() { + return UserServiceGetLoginDataArgs_Request_DEFAULT + } + return p.Request +} + +var fieldIDToName_UserServiceGetLoginDataArgs = map[int16]string{ + 1: "request", +} + +func (p *UserServiceGetLoginDataArgs) IsSetRequest() bool { + return p.Request != nil +} + +func (p *UserServiceGetLoginDataArgs) 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_UserServiceGetLoginDataArgs[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 *UserServiceGetLoginDataArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetLoginDataRequest() + if err := _field.Read(iprot); err != nil { + return err + } + p.Request = _field + return nil +} + +func (p *UserServiceGetLoginDataArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetLoginData_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: @@ -12388,7 +12871,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserServiceValidateCodeArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *UserServiceGetLoginDataArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -12405,43 +12888,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *UserServiceValidateCodeArgs) String() string { +func (p *UserServiceGetLoginDataArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("UserServiceValidateCodeArgs(%+v)", *p) + return fmt.Sprintf("UserServiceGetLoginDataArgs(%+v)", *p) } -type UserServiceValidateCodeResult struct { - Success *ValidateCodeResponse `thrift:"success,0,optional"` +type UserServiceGetLoginDataResult struct { + Success *GetLoginDataResponse `thrift:"success,0,optional"` } -func NewUserServiceValidateCodeResult() *UserServiceValidateCodeResult { - return &UserServiceValidateCodeResult{} +func NewUserServiceGetLoginDataResult() *UserServiceGetLoginDataResult { + return &UserServiceGetLoginDataResult{} } -func (p *UserServiceValidateCodeResult) InitDefault() { +func (p *UserServiceGetLoginDataResult) InitDefault() { } -var UserServiceValidateCodeResult_Success_DEFAULT *ValidateCodeResponse +var UserServiceGetLoginDataResult_Success_DEFAULT *GetLoginDataResponse -func (p *UserServiceValidateCodeResult) GetSuccess() (v *ValidateCodeResponse) { +func (p *UserServiceGetLoginDataResult) GetSuccess() (v *GetLoginDataResponse) { if !p.IsSetSuccess() { - return UserServiceValidateCodeResult_Success_DEFAULT + return UserServiceGetLoginDataResult_Success_DEFAULT } return p.Success } -var fieldIDToName_UserServiceValidateCodeResult = map[int16]string{ +var fieldIDToName_UserServiceGetLoginDataResult = map[int16]string{ 0: "success", } -func (p *UserServiceValidateCodeResult) IsSetSuccess() bool { +func (p *UserServiceGetLoginDataResult) IsSetSuccess() bool { return p.Success != nil } -func (p *UserServiceValidateCodeResult) Read(iprot thrift.TProtocol) (err error) { +func (p *UserServiceGetLoginDataResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -12487,7 +12970,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_UserServiceValidateCodeResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_UserServiceGetLoginDataResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -12497,8 +12980,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *UserServiceValidateCodeResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewValidateCodeResponse() +func (p *UserServiceGetLoginDataResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetLoginDataResponse() if err := _field.Read(iprot); err != nil { return err } @@ -12506,9 +12989,9 @@ func (p *UserServiceValidateCodeResult) ReadField0(iprot thrift.TProtocol) error return nil } -func (p *UserServiceValidateCodeResult) Write(oprot thrift.TProtocol) (err error) { +func (p *UserServiceGetLoginDataResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ValidateCode_result"); err != nil { + if err = oprot.WriteStructBegin("GetLoginData_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -12534,7 +13017,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *UserServiceValidateCodeResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *UserServiceGetLoginDataResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -12553,132 +13036,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *UserServiceValidateCodeResult) String() string { +func (p *UserServiceGetLoginDataResult) String() string { if p == nil { return "" } - return fmt.Sprintf("UserServiceValidateCodeResult(%+v)", *p) + return fmt.Sprintf("UserServiceGetLoginDataResult(%+v)", *p) } -type CourseServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler CourseService +type UserServiceValidateCodeArgs struct { + Request *ValidateCodeRequest `thrift:"request,1"` } -func (p *CourseServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *CourseServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *CourseServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewCourseServiceProcessor(handler CourseService) *CourseServiceProcessor { - self := &CourseServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("GetCourseList", &courseServiceProcessorGetCourseList{handler: handler}) - return self -} -func (p *CourseServiceProcessor) 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 courseServiceProcessorGetCourseList struct { - handler CourseService -} - -func (p *courseServiceProcessorGetCourseList) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := CourseServiceGetCourseListArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetCourseList", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } - - iprot.ReadMessageEnd() - var err2 error - result := CourseServiceGetCourseListResult{} - var retval *CourseListResponse - if retval, err2 = p.handler.GetCourseList(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetCourseList: "+err2.Error()) - oprot.WriteMessageBegin("GetCourseList", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetCourseList", 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 CourseServiceGetCourseListArgs struct { - Req *CourseListRequest `thrift:"req,1"` -} - -func NewCourseServiceGetCourseListArgs() *CourseServiceGetCourseListArgs { - return &CourseServiceGetCourseListArgs{} +func NewUserServiceValidateCodeArgs() *UserServiceValidateCodeArgs { + return &UserServiceValidateCodeArgs{} } -func (p *CourseServiceGetCourseListArgs) InitDefault() { +func (p *UserServiceValidateCodeArgs) InitDefault() { } -var CourseServiceGetCourseListArgs_Req_DEFAULT *CourseListRequest +var UserServiceValidateCodeArgs_Request_DEFAULT *ValidateCodeRequest -func (p *CourseServiceGetCourseListArgs) GetReq() (v *CourseListRequest) { - if !p.IsSetReq() { - return CourseServiceGetCourseListArgs_Req_DEFAULT +func (p *UserServiceValidateCodeArgs) GetRequest() (v *ValidateCodeRequest) { + if !p.IsSetRequest() { + return UserServiceValidateCodeArgs_Request_DEFAULT } - return p.Req + return p.Request } -var fieldIDToName_CourseServiceGetCourseListArgs = map[int16]string{ - 1: "req", +var fieldIDToName_UserServiceValidateCodeArgs = map[int16]string{ + 1: "request", } -func (p *CourseServiceGetCourseListArgs) IsSetReq() bool { - return p.Req != nil +func (p *UserServiceValidateCodeArgs) IsSetRequest() bool { + return p.Request != nil } -func (p *CourseServiceGetCourseListArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *UserServiceValidateCodeArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -12724,7 +13118,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_CourseServiceGetCourseListArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_UserServiceValidateCodeArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -12734,18 +13128,18 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CourseServiceGetCourseListArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewCourseListRequest() +func (p *UserServiceValidateCodeArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewValidateCodeRequest() if err := _field.Read(iprot); err != nil { return err } - p.Req = _field + p.Request = _field return nil } -func (p *CourseServiceGetCourseListArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *UserServiceValidateCodeArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetCourseList_args"); err != nil { + if err = oprot.WriteStructBegin("ValidateCode_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -12771,11 +13165,11 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CourseServiceGetCourseListArgs) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { +func (p *UserServiceValidateCodeArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } - if err := p.Req.Write(oprot); err != nil { + if err := p.Request.Write(oprot); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -12788,43 +13182,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *CourseServiceGetCourseListArgs) String() string { +func (p *UserServiceValidateCodeArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("CourseServiceGetCourseListArgs(%+v)", *p) + return fmt.Sprintf("UserServiceValidateCodeArgs(%+v)", *p) } -type CourseServiceGetCourseListResult struct { - Success *CourseListResponse `thrift:"success,0,optional"` +type UserServiceValidateCodeResult struct { + Success *ValidateCodeResponse `thrift:"success,0,optional"` } -func NewCourseServiceGetCourseListResult() *CourseServiceGetCourseListResult { - return &CourseServiceGetCourseListResult{} +func NewUserServiceValidateCodeResult() *UserServiceValidateCodeResult { + return &UserServiceValidateCodeResult{} } -func (p *CourseServiceGetCourseListResult) InitDefault() { +func (p *UserServiceValidateCodeResult) InitDefault() { } -var CourseServiceGetCourseListResult_Success_DEFAULT *CourseListResponse +var UserServiceValidateCodeResult_Success_DEFAULT *ValidateCodeResponse -func (p *CourseServiceGetCourseListResult) GetSuccess() (v *CourseListResponse) { +func (p *UserServiceValidateCodeResult) GetSuccess() (v *ValidateCodeResponse) { if !p.IsSetSuccess() { - return CourseServiceGetCourseListResult_Success_DEFAULT + return UserServiceValidateCodeResult_Success_DEFAULT } return p.Success } -var fieldIDToName_CourseServiceGetCourseListResult = map[int16]string{ +var fieldIDToName_UserServiceValidateCodeResult = map[int16]string{ 0: "success", } -func (p *CourseServiceGetCourseListResult) IsSetSuccess() bool { +func (p *UserServiceValidateCodeResult) IsSetSuccess() bool { return p.Success != nil } -func (p *CourseServiceGetCourseListResult) Read(iprot thrift.TProtocol) (err error) { +func (p *UserServiceValidateCodeResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -12870,7 +13264,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_CourseServiceGetCourseListResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_UserServiceValidateCodeResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -12880,8 +13274,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *CourseServiceGetCourseListResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewCourseListResponse() +func (p *UserServiceValidateCodeResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewValidateCodeResponse() if err := _field.Read(iprot); err != nil { return err } @@ -12889,9 +13283,9 @@ func (p *CourseServiceGetCourseListResult) ReadField0(iprot thrift.TProtocol) er return nil } -func (p *CourseServiceGetCourseListResult) Write(oprot thrift.TProtocol) (err error) { +func (p *UserServiceValidateCodeResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetCourseList_result"); err != nil { + if err = oprot.WriteStructBegin("ValidateCode_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -12917,7 +13311,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *CourseServiceGetCourseListResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *UserServiceValidateCodeResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -12936,288 +13330,384 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *CourseServiceGetCourseListResult) String() string { +func (p *UserServiceValidateCodeResult) String() string { if p == nil { return "" } - return fmt.Sprintf("CourseServiceGetCourseListResult(%+v)", *p) + return fmt.Sprintf("UserServiceValidateCodeResult(%+v)", *p) } -type LaunchScreenServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler LaunchScreenService +type UserServiceValidateCodeForAndroidArgs struct { + Request *ValidateCodeForAndroidRequest `thrift:"request,1"` } -func (p *LaunchScreenServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor +func NewUserServiceValidateCodeForAndroidArgs() *UserServiceValidateCodeForAndroidArgs { + return &UserServiceValidateCodeForAndroidArgs{} } -func (p *LaunchScreenServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok +func (p *UserServiceValidateCodeForAndroidArgs) InitDefault() { } -func (p *LaunchScreenServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} +var UserServiceValidateCodeForAndroidArgs_Request_DEFAULT *ValidateCodeForAndroidRequest -func NewLaunchScreenServiceProcessor(handler LaunchScreenService) *LaunchScreenServiceProcessor { - self := &LaunchScreenServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("CreateImage", &launchScreenServiceProcessorCreateImage{handler: handler}) - self.AddToProcessorMap("GetImage", &launchScreenServiceProcessorGetImage{handler: handler}) - self.AddToProcessorMap("ChangeImageProperty", &launchScreenServiceProcessorChangeImageProperty{handler: handler}) - self.AddToProcessorMap("ChangeImage", &launchScreenServiceProcessorChangeImage{handler: handler}) - self.AddToProcessorMap("DeleteImage", &launchScreenServiceProcessorDeleteImage{handler: handler}) - self.AddToProcessorMap("MobileGetImage", &launchScreenServiceProcessorMobileGetImage{handler: handler}) - self.AddToProcessorMap("AddImagePointTime", &launchScreenServiceProcessorAddImagePointTime{handler: handler}) - return self -} -func (p *LaunchScreenServiceProcessor) 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 *UserServiceValidateCodeForAndroidArgs) GetRequest() (v *ValidateCodeForAndroidRequest) { + if !p.IsSetRequest() { + return UserServiceValidateCodeForAndroidArgs_Request_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 + return p.Request } -type launchScreenServiceProcessorCreateImage struct { - handler LaunchScreenService +var fieldIDToName_UserServiceValidateCodeForAndroidArgs = map[int16]string{ + 1: "request", } -func (p *launchScreenServiceProcessorCreateImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceCreateImageArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("CreateImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } +func (p *UserServiceValidateCodeForAndroidArgs) IsSetRequest() bool { + return p.Request != nil +} - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceCreateImageResult{} - var retval *CreateImageResponse - if retval, err2 = p.handler.CreateImage(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing CreateImage: "+err2.Error()) - oprot.WriteMessageBegin("CreateImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("CreateImage", 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 +func (p *UserServiceValidateCodeForAndroidArgs) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } - 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 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 != nil { - return + if err = iprot.ReadStructEnd(); err != nil { + goto ReadStructEndError } - return true, err -} -type launchScreenServiceProcessorGetImage struct { - handler LaunchScreenService + 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_UserServiceValidateCodeForAndroidArgs[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 *launchScreenServiceProcessorGetImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceGetImageArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err +func (p *UserServiceValidateCodeForAndroidArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewValidateCodeForAndroidRequest() + if err := _field.Read(iprot); err != nil { + return err } + p.Request = _field + return nil +} - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceGetImageResult{} - var retval *GetImageResponse - if retval, err2 = p.handler.GetImage(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetImage: "+err2.Error()) - oprot.WriteMessageBegin("GetImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval +func (p *UserServiceValidateCodeForAndroidArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("ValidateCodeForAndroid_args"); err != nil { + goto WriteStructBeginError } - if err2 = oprot.WriteMessageBegin("GetImage", thrift.REPLY, seqId); err2 != nil { - err = err2 + if p != nil { + if err = p.writeField1(oprot); err != nil { + fieldId = 1 + goto WriteFieldError + } } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + 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 *UserServiceValidateCodeForAndroidArgs) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil { + goto WriteFieldBeginError } - if err != nil { - return + if err := p.Request.Write(oprot); err != nil { + return err } - return true, 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) } -type launchScreenServiceProcessorChangeImageProperty struct { - handler LaunchScreenService +func (p *UserServiceValidateCodeForAndroidArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("UserServiceValidateCodeForAndroidArgs(%+v)", *p) + } -func (p *launchScreenServiceProcessorChangeImageProperty) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceChangeImagePropertyArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("ChangeImageProperty", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } +type UserServiceValidateCodeForAndroidResult struct { + Success *ValidateCodeForAndroidResponse `thrift:"success,0,optional"` +} - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceChangeImagePropertyResult{} - var retval *ChangeImagePropertyResponse - if retval, err2 = p.handler.ChangeImageProperty(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ChangeImageProperty: "+err2.Error()) - oprot.WriteMessageBegin("ChangeImageProperty", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("ChangeImageProperty", 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 NewUserServiceValidateCodeForAndroidResult() *UserServiceValidateCodeForAndroidResult { + return &UserServiceValidateCodeForAndroidResult{} } -type launchScreenServiceProcessorChangeImage struct { - handler LaunchScreenService +func (p *UserServiceValidateCodeForAndroidResult) InitDefault() { } -func (p *launchScreenServiceProcessorChangeImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceChangeImageArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("ChangeImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } +var UserServiceValidateCodeForAndroidResult_Success_DEFAULT *ValidateCodeForAndroidResponse - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceChangeImageResult{} - var retval *ChangeImageResponse - if retval, err2 = p.handler.ChangeImage(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ChangeImage: "+err2.Error()) - oprot.WriteMessageBegin("ChangeImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("ChangeImage", 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 +func (p *UserServiceValidateCodeForAndroidResult) GetSuccess() (v *ValidateCodeForAndroidResponse) { + if !p.IsSetSuccess() { + return UserServiceValidateCodeForAndroidResult_Success_DEFAULT } - return true, err + return p.Success } -type launchScreenServiceProcessorDeleteImage struct { - handler LaunchScreenService +var fieldIDToName_UserServiceValidateCodeForAndroidResult = map[int16]string{ + 0: "success", } -func (p *launchScreenServiceProcessorDeleteImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceDeleteImageArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("DeleteImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } +func (p *UserServiceValidateCodeForAndroidResult) IsSetSuccess() bool { + return p.Success != nil +} - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceDeleteImageResult{} - var retval *DeleteImageResponse - if retval, err2 = p.handler.DeleteImage(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DeleteImage: "+err2.Error()) - oprot.WriteMessageBegin("DeleteImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("DeleteImage", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 +func (p *UserServiceValidateCodeForAndroidResult) 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_UserServiceValidateCodeForAndroidResult[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 *UserServiceValidateCodeForAndroidResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewValidateCodeForAndroidResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *UserServiceValidateCodeForAndroidResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("ValidateCodeForAndroid_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 *UserServiceValidateCodeForAndroidResult) 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 *UserServiceValidateCodeForAndroidResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("UserServiceValidateCodeForAndroidResult(%+v)", *p) + +} + +type CourseServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler CourseService +} + +func (p *CourseServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *CourseServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *CourseServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewCourseServiceProcessor(handler CourseService) *CourseServiceProcessor { + self := &CourseServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("GetCourseList", &courseServiceProcessorGetCourseList{handler: handler}) + return self +} +func (p *CourseServiceProcessor) 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 courseServiceProcessorGetCourseList struct { + handler CourseService +} + +func (p *courseServiceProcessorGetCourseList) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := CourseServiceGetCourseListArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetCourseList", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := CourseServiceGetCourseListResult{} + var retval *CourseListResponse + if retval, err2 = p.handler.GetCourseList(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetCourseList: "+err2.Error()) + oprot.WriteMessageBegin("GetCourseList", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetCourseList", 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 @@ -13231,131 +13721,1300 @@ func (p *launchScreenServiceProcessorDeleteImage) Process(ctx context.Context, s return true, err } -type launchScreenServiceProcessorMobileGetImage struct { - handler LaunchScreenService +type CourseServiceGetCourseListArgs struct { + Req *CourseListRequest `thrift:"req,1"` +} + +func NewCourseServiceGetCourseListArgs() *CourseServiceGetCourseListArgs { + return &CourseServiceGetCourseListArgs{} +} + +func (p *CourseServiceGetCourseListArgs) InitDefault() { +} + +var CourseServiceGetCourseListArgs_Req_DEFAULT *CourseListRequest + +func (p *CourseServiceGetCourseListArgs) GetReq() (v *CourseListRequest) { + if !p.IsSetReq() { + return CourseServiceGetCourseListArgs_Req_DEFAULT + } + return p.Req +} + +var fieldIDToName_CourseServiceGetCourseListArgs = map[int16]string{ + 1: "req", +} + +func (p *CourseServiceGetCourseListArgs) IsSetReq() bool { + return p.Req != nil +} + +func (p *CourseServiceGetCourseListArgs) 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_CourseServiceGetCourseListArgs[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 *CourseServiceGetCourseListArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewCourseListRequest() + if err := _field.Read(iprot); err != nil { + return err + } + p.Req = _field + return nil +} + +func (p *CourseServiceGetCourseListArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetCourseList_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 *CourseServiceGetCourseListArgs) 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 *CourseServiceGetCourseListArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CourseServiceGetCourseListArgs(%+v)", *p) + +} + +type CourseServiceGetCourseListResult struct { + Success *CourseListResponse `thrift:"success,0,optional"` +} + +func NewCourseServiceGetCourseListResult() *CourseServiceGetCourseListResult { + return &CourseServiceGetCourseListResult{} +} + +func (p *CourseServiceGetCourseListResult) InitDefault() { +} + +var CourseServiceGetCourseListResult_Success_DEFAULT *CourseListResponse + +func (p *CourseServiceGetCourseListResult) GetSuccess() (v *CourseListResponse) { + if !p.IsSetSuccess() { + return CourseServiceGetCourseListResult_Success_DEFAULT + } + return p.Success +} + +var fieldIDToName_CourseServiceGetCourseListResult = map[int16]string{ + 0: "success", +} + +func (p *CourseServiceGetCourseListResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *CourseServiceGetCourseListResult) 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_CourseServiceGetCourseListResult[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 *CourseServiceGetCourseListResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewCourseListResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *CourseServiceGetCourseListResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetCourseList_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 *CourseServiceGetCourseListResult) 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 *CourseServiceGetCourseListResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("CourseServiceGetCourseListResult(%+v)", *p) + +} + +type LaunchScreenServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler LaunchScreenService +} + +func (p *LaunchScreenServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *LaunchScreenServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *LaunchScreenServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewLaunchScreenServiceProcessor(handler LaunchScreenService) *LaunchScreenServiceProcessor { + self := &LaunchScreenServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("CreateImage", &launchScreenServiceProcessorCreateImage{handler: handler}) + self.AddToProcessorMap("GetImage", &launchScreenServiceProcessorGetImage{handler: handler}) + self.AddToProcessorMap("ChangeImageProperty", &launchScreenServiceProcessorChangeImageProperty{handler: handler}) + self.AddToProcessorMap("ChangeImage", &launchScreenServiceProcessorChangeImage{handler: handler}) + self.AddToProcessorMap("DeleteImage", &launchScreenServiceProcessorDeleteImage{handler: handler}) + self.AddToProcessorMap("MobileGetImage", &launchScreenServiceProcessorMobileGetImage{handler: handler}) + self.AddToProcessorMap("AddImagePointTime", &launchScreenServiceProcessorAddImagePointTime{handler: handler}) + return self +} +func (p *LaunchScreenServiceProcessor) 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 launchScreenServiceProcessorCreateImage struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorCreateImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceCreateImageArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("CreateImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceCreateImageResult{} + var retval *CreateImageResponse + if retval, err2 = p.handler.CreateImage(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing CreateImage: "+err2.Error()) + oprot.WriteMessageBegin("CreateImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("CreateImage", 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 launchScreenServiceProcessorGetImage struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorGetImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceGetImageArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceGetImageResult{} + var retval *GetImageResponse + if retval, err2 = p.handler.GetImage(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetImage: "+err2.Error()) + oprot.WriteMessageBegin("GetImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetImage", 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 launchScreenServiceProcessorChangeImageProperty struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorChangeImageProperty) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceChangeImagePropertyArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ChangeImageProperty", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceChangeImagePropertyResult{} + var retval *ChangeImagePropertyResponse + if retval, err2 = p.handler.ChangeImageProperty(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ChangeImageProperty: "+err2.Error()) + oprot.WriteMessageBegin("ChangeImageProperty", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("ChangeImageProperty", 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 launchScreenServiceProcessorChangeImage struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorChangeImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceChangeImageArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ChangeImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceChangeImageResult{} + var retval *ChangeImageResponse + if retval, err2 = p.handler.ChangeImage(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ChangeImage: "+err2.Error()) + oprot.WriteMessageBegin("ChangeImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("ChangeImage", 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 launchScreenServiceProcessorDeleteImage struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorDeleteImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceDeleteImageArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("DeleteImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceDeleteImageResult{} + var retval *DeleteImageResponse + if retval, err2 = p.handler.DeleteImage(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing DeleteImage: "+err2.Error()) + oprot.WriteMessageBegin("DeleteImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("DeleteImage", 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 launchScreenServiceProcessorMobileGetImage struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorMobileGetImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceMobileGetImageArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("MobileGetImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceMobileGetImageResult{} + var retval *MobileGetImageResponse + if retval, err2 = p.handler.MobileGetImage(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing MobileGetImage: "+err2.Error()) + oprot.WriteMessageBegin("MobileGetImage", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("MobileGetImage", 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 launchScreenServiceProcessorAddImagePointTime struct { + handler LaunchScreenService +} + +func (p *launchScreenServiceProcessorAddImagePointTime) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := LaunchScreenServiceAddImagePointTimeArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("AddImagePointTime", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := LaunchScreenServiceAddImagePointTimeResult{} + var retval *AddImagePointTimeResponse + if retval, err2 = p.handler.AddImagePointTime(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing AddImagePointTime: "+err2.Error()) + oprot.WriteMessageBegin("AddImagePointTime", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("AddImagePointTime", 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 LaunchScreenServiceCreateImageArgs struct { + Req *CreateImageRequest `thrift:"req,1"` +} + +func NewLaunchScreenServiceCreateImageArgs() *LaunchScreenServiceCreateImageArgs { + return &LaunchScreenServiceCreateImageArgs{} +} + +func (p *LaunchScreenServiceCreateImageArgs) InitDefault() { +} + +var LaunchScreenServiceCreateImageArgs_Req_DEFAULT *CreateImageRequest + +func (p *LaunchScreenServiceCreateImageArgs) GetReq() (v *CreateImageRequest) { + if !p.IsSetReq() { + return LaunchScreenServiceCreateImageArgs_Req_DEFAULT + } + return p.Req +} + +var fieldIDToName_LaunchScreenServiceCreateImageArgs = map[int16]string{ + 1: "req", +} + +func (p *LaunchScreenServiceCreateImageArgs) IsSetReq() bool { + return p.Req != nil +} + +func (p *LaunchScreenServiceCreateImageArgs) 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_LaunchScreenServiceCreateImageArgs[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 *LaunchScreenServiceCreateImageArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewCreateImageRequest() + if err := _field.Read(iprot); err != nil { + return err + } + p.Req = _field + return nil +} + +func (p *LaunchScreenServiceCreateImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("CreateImage_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 *LaunchScreenServiceCreateImageArgs) 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 *LaunchScreenServiceCreateImageArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("LaunchScreenServiceCreateImageArgs(%+v)", *p) + +} + +type LaunchScreenServiceCreateImageResult struct { + Success *CreateImageResponse `thrift:"success,0,optional"` +} + +func NewLaunchScreenServiceCreateImageResult() *LaunchScreenServiceCreateImageResult { + return &LaunchScreenServiceCreateImageResult{} +} + +func (p *LaunchScreenServiceCreateImageResult) InitDefault() { +} + +var LaunchScreenServiceCreateImageResult_Success_DEFAULT *CreateImageResponse + +func (p *LaunchScreenServiceCreateImageResult) GetSuccess() (v *CreateImageResponse) { + if !p.IsSetSuccess() { + return LaunchScreenServiceCreateImageResult_Success_DEFAULT + } + return p.Success +} + +var fieldIDToName_LaunchScreenServiceCreateImageResult = map[int16]string{ + 0: "success", +} + +func (p *LaunchScreenServiceCreateImageResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *LaunchScreenServiceCreateImageResult) 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_LaunchScreenServiceCreateImageResult[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 *LaunchScreenServiceCreateImageResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewCreateImageResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *LaunchScreenServiceCreateImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("CreateImage_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 *LaunchScreenServiceCreateImageResult) 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 *LaunchScreenServiceCreateImageResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("LaunchScreenServiceCreateImageResult(%+v)", *p) + +} + +type LaunchScreenServiceGetImageArgs struct { + Req *GetImageRequest `thrift:"req,1"` +} + +func NewLaunchScreenServiceGetImageArgs() *LaunchScreenServiceGetImageArgs { + return &LaunchScreenServiceGetImageArgs{} +} + +func (p *LaunchScreenServiceGetImageArgs) InitDefault() { +} + +var LaunchScreenServiceGetImageArgs_Req_DEFAULT *GetImageRequest + +func (p *LaunchScreenServiceGetImageArgs) GetReq() (v *GetImageRequest) { + if !p.IsSetReq() { + return LaunchScreenServiceGetImageArgs_Req_DEFAULT + } + return p.Req +} + +var fieldIDToName_LaunchScreenServiceGetImageArgs = map[int16]string{ + 1: "req", +} + +func (p *LaunchScreenServiceGetImageArgs) IsSetReq() bool { + return p.Req != nil +} + +func (p *LaunchScreenServiceGetImageArgs) 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_LaunchScreenServiceGetImageArgs[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 *LaunchScreenServiceGetImageArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetImageRequest() + if err := _field.Read(iprot); err != nil { + return err + } + p.Req = _field + return nil +} + +func (p *LaunchScreenServiceGetImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetImage_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 *LaunchScreenServiceGetImageArgs) 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 *LaunchScreenServiceGetImageArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("LaunchScreenServiceGetImageArgs(%+v)", *p) + +} + +type LaunchScreenServiceGetImageResult struct { + Success *GetImageResponse `thrift:"success,0,optional"` } -func (p *launchScreenServiceProcessorMobileGetImage) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceMobileGetImageArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("MobileGetImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } +func NewLaunchScreenServiceGetImageResult() *LaunchScreenServiceGetImageResult { + return &LaunchScreenServiceGetImageResult{} +} - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceMobileGetImageResult{} - var retval *MobileGetImageResponse - if retval, err2 = p.handler.MobileGetImage(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing MobileGetImage: "+err2.Error()) - oprot.WriteMessageBegin("MobileGetImage", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("MobileGetImage", thrift.REPLY, seqId); err2 != nil { - err = err2 - } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 +func (p *LaunchScreenServiceGetImageResult) InitDefault() { +} + +var LaunchScreenServiceGetImageResult_Success_DEFAULT *GetImageResponse + +func (p *LaunchScreenServiceGetImageResult) GetSuccess() (v *GetImageResponse) { + if !p.IsSetSuccess() { + return LaunchScreenServiceGetImageResult_Success_DEFAULT } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + return p.Success +} + +var fieldIDToName_LaunchScreenServiceGetImageResult = map[int16]string{ + 0: "success", +} + +func (p *LaunchScreenServiceGetImageResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *LaunchScreenServiceGetImageResult) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + + if _, err = iprot.ReadStructBegin(); err != nil { + goto ReadStructBeginError } - 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 launchScreenServiceProcessorAddImagePointTime struct { - handler LaunchScreenService + 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_LaunchScreenServiceGetImageResult[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 *launchScreenServiceProcessorAddImagePointTime) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := LaunchScreenServiceAddImagePointTimeArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("AddImagePointTime", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err +func (p *LaunchScreenServiceGetImageResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetImageResponse() + if err := _field.Read(iprot); err != nil { + return err } + p.Success = _field + return nil +} - iprot.ReadMessageEnd() - var err2 error - result := LaunchScreenServiceAddImagePointTimeResult{} - var retval *AddImagePointTimeResponse - if retval, err2 = p.handler.AddImagePointTime(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing AddImagePointTime: "+err2.Error()) - oprot.WriteMessageBegin("AddImagePointTime", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval +func (p *LaunchScreenServiceGetImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("GetImage_result"); err != nil { + goto WriteStructBeginError } - if err2 = oprot.WriteMessageBegin("AddImagePointTime", thrift.REPLY, seqId); err2 != nil { - err = err2 + if p != nil { + if err = p.writeField0(oprot); err != nil { + fieldId = 0 + goto WriteFieldError + } } - if err2 = result.Write(oprot); err == nil && err2 != nil { - err = err2 + if err = oprot.WriteFieldStop(); err != nil { + goto WriteFieldStopError } - if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { - err = err2 + if err = oprot.WriteStructEnd(); err != nil { + goto WriteStructEndError } - if err2 = oprot.Flush(ctx); err == nil && err2 != nil { - err = err2 + 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 *LaunchScreenServiceGetImageResult) 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 + } } - if err != nil { - return + 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 *LaunchScreenServiceGetImageResult) String() string { + if p == nil { + return "" } - return true, err + return fmt.Sprintf("LaunchScreenServiceGetImageResult(%+v)", *p) + } -type LaunchScreenServiceCreateImageArgs struct { - Req *CreateImageRequest `thrift:"req,1"` +type LaunchScreenServiceChangeImagePropertyArgs struct { + Req *ChangeImagePropertyRequest `thrift:"req,1"` } -func NewLaunchScreenServiceCreateImageArgs() *LaunchScreenServiceCreateImageArgs { - return &LaunchScreenServiceCreateImageArgs{} +func NewLaunchScreenServiceChangeImagePropertyArgs() *LaunchScreenServiceChangeImagePropertyArgs { + return &LaunchScreenServiceChangeImagePropertyArgs{} } -func (p *LaunchScreenServiceCreateImageArgs) InitDefault() { +func (p *LaunchScreenServiceChangeImagePropertyArgs) InitDefault() { } -var LaunchScreenServiceCreateImageArgs_Req_DEFAULT *CreateImageRequest +var LaunchScreenServiceChangeImagePropertyArgs_Req_DEFAULT *ChangeImagePropertyRequest -func (p *LaunchScreenServiceCreateImageArgs) GetReq() (v *CreateImageRequest) { +func (p *LaunchScreenServiceChangeImagePropertyArgs) GetReq() (v *ChangeImagePropertyRequest) { if !p.IsSetReq() { - return LaunchScreenServiceCreateImageArgs_Req_DEFAULT + return LaunchScreenServiceChangeImagePropertyArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceCreateImageArgs = map[int16]string{ +var fieldIDToName_LaunchScreenServiceChangeImagePropertyArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceCreateImageArgs) IsSetReq() bool { +func (p *LaunchScreenServiceChangeImagePropertyArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceCreateImageArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImagePropertyArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -13401,7 +15060,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_LaunchScreenServiceCreateImageArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceChangeImagePropertyArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -13411,8 +15070,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceCreateImageArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewCreateImageRequest() +func (p *LaunchScreenServiceChangeImagePropertyArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewChangeImagePropertyRequest() if err := _field.Read(iprot); err != nil { return err } @@ -13420,9 +15079,9 @@ func (p *LaunchScreenServiceCreateImageArgs) ReadField1(iprot thrift.TProtocol) return nil } -func (p *LaunchScreenServiceCreateImageArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImagePropertyArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("CreateImage_args"); err != nil { + if err = oprot.WriteStructBegin("ChangeImageProperty_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -13448,7 +15107,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceCreateImageArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImagePropertyArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -13465,43 +15124,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceCreateImageArgs) String() string { +func (p *LaunchScreenServiceChangeImagePropertyArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceCreateImageArgs(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceChangeImagePropertyArgs(%+v)", *p) } -type LaunchScreenServiceCreateImageResult struct { - Success *CreateImageResponse `thrift:"success,0,optional"` +type LaunchScreenServiceChangeImagePropertyResult struct { + Success *ChangeImagePropertyResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceCreateImageResult() *LaunchScreenServiceCreateImageResult { - return &LaunchScreenServiceCreateImageResult{} +func NewLaunchScreenServiceChangeImagePropertyResult() *LaunchScreenServiceChangeImagePropertyResult { + return &LaunchScreenServiceChangeImagePropertyResult{} } -func (p *LaunchScreenServiceCreateImageResult) InitDefault() { +func (p *LaunchScreenServiceChangeImagePropertyResult) InitDefault() { } -var LaunchScreenServiceCreateImageResult_Success_DEFAULT *CreateImageResponse +var LaunchScreenServiceChangeImagePropertyResult_Success_DEFAULT *ChangeImagePropertyResponse -func (p *LaunchScreenServiceCreateImageResult) GetSuccess() (v *CreateImageResponse) { +func (p *LaunchScreenServiceChangeImagePropertyResult) GetSuccess() (v *ChangeImagePropertyResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceCreateImageResult_Success_DEFAULT + return LaunchScreenServiceChangeImagePropertyResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceCreateImageResult = map[int16]string{ +var fieldIDToName_LaunchScreenServiceChangeImagePropertyResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceCreateImageResult) IsSetSuccess() bool { +func (p *LaunchScreenServiceChangeImagePropertyResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceCreateImageResult) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImagePropertyResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -13547,7 +15206,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_LaunchScreenServiceCreateImageResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceChangeImagePropertyResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -13557,8 +15216,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceCreateImageResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewCreateImageResponse() +func (p *LaunchScreenServiceChangeImagePropertyResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewChangeImagePropertyResponse() if err := _field.Read(iprot); err != nil { return err } @@ -13566,9 +15225,9 @@ func (p *LaunchScreenServiceCreateImageResult) ReadField0(iprot thrift.TProtocol return nil } -func (p *LaunchScreenServiceCreateImageResult) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImagePropertyResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("CreateImage_result"); err != nil { + if err = oprot.WriteStructBegin("ChangeImageProperty_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -13594,7 +15253,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceCreateImageResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImagePropertyResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -13613,43 +15272,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *LaunchScreenServiceCreateImageResult) String() string { +func (p *LaunchScreenServiceChangeImagePropertyResult) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceCreateImageResult(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceChangeImagePropertyResult(%+v)", *p) } -type LaunchScreenServiceGetImageArgs struct { - Req *GetImageRequest `thrift:"req,1"` +type LaunchScreenServiceChangeImageArgs struct { + Req *ChangeImageRequest `thrift:"req,1"` } -func NewLaunchScreenServiceGetImageArgs() *LaunchScreenServiceGetImageArgs { - return &LaunchScreenServiceGetImageArgs{} +func NewLaunchScreenServiceChangeImageArgs() *LaunchScreenServiceChangeImageArgs { + return &LaunchScreenServiceChangeImageArgs{} } -func (p *LaunchScreenServiceGetImageArgs) InitDefault() { +func (p *LaunchScreenServiceChangeImageArgs) InitDefault() { } -var LaunchScreenServiceGetImageArgs_Req_DEFAULT *GetImageRequest +var LaunchScreenServiceChangeImageArgs_Req_DEFAULT *ChangeImageRequest -func (p *LaunchScreenServiceGetImageArgs) GetReq() (v *GetImageRequest) { +func (p *LaunchScreenServiceChangeImageArgs) GetReq() (v *ChangeImageRequest) { if !p.IsSetReq() { - return LaunchScreenServiceGetImageArgs_Req_DEFAULT + return LaunchScreenServiceChangeImageArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceGetImageArgs = map[int16]string{ +var fieldIDToName_LaunchScreenServiceChangeImageArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceGetImageArgs) IsSetReq() bool { +func (p *LaunchScreenServiceChangeImageArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceGetImageArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImageArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -13695,7 +15354,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_LaunchScreenServiceGetImageArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceChangeImageArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -13705,8 +15364,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceGetImageArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetImageRequest() +func (p *LaunchScreenServiceChangeImageArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewChangeImageRequest() if err := _field.Read(iprot); err != nil { return err } @@ -13714,9 +15373,9 @@ func (p *LaunchScreenServiceGetImageArgs) ReadField1(iprot thrift.TProtocol) err return nil } -func (p *LaunchScreenServiceGetImageArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImageArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetImage_args"); err != nil { + if err = oprot.WriteStructBegin("ChangeImage_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -13742,7 +15401,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceGetImageArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImageArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -13759,43 +15418,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceGetImageArgs) String() string { +func (p *LaunchScreenServiceChangeImageArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceGetImageArgs(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceChangeImageArgs(%+v)", *p) } -type LaunchScreenServiceGetImageResult struct { - Success *GetImageResponse `thrift:"success,0,optional"` +type LaunchScreenServiceChangeImageResult struct { + Success *ChangeImageResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceGetImageResult() *LaunchScreenServiceGetImageResult { - return &LaunchScreenServiceGetImageResult{} +func NewLaunchScreenServiceChangeImageResult() *LaunchScreenServiceChangeImageResult { + return &LaunchScreenServiceChangeImageResult{} } -func (p *LaunchScreenServiceGetImageResult) InitDefault() { +func (p *LaunchScreenServiceChangeImageResult) InitDefault() { } -var LaunchScreenServiceGetImageResult_Success_DEFAULT *GetImageResponse +var LaunchScreenServiceChangeImageResult_Success_DEFAULT *ChangeImageResponse -func (p *LaunchScreenServiceGetImageResult) GetSuccess() (v *GetImageResponse) { +func (p *LaunchScreenServiceChangeImageResult) GetSuccess() (v *ChangeImageResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceGetImageResult_Success_DEFAULT + return LaunchScreenServiceChangeImageResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceGetImageResult = map[int16]string{ +var fieldIDToName_LaunchScreenServiceChangeImageResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceGetImageResult) IsSetSuccess() bool { +func (p *LaunchScreenServiceChangeImageResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceGetImageResult) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImageResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -13841,7 +15500,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_LaunchScreenServiceGetImageResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceChangeImageResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -13851,8 +15510,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceGetImageResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetImageResponse() +func (p *LaunchScreenServiceChangeImageResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewChangeImageResponse() if err := _field.Read(iprot); err != nil { return err } @@ -13860,9 +15519,9 @@ func (p *LaunchScreenServiceGetImageResult) ReadField0(iprot thrift.TProtocol) e return nil } -func (p *LaunchScreenServiceGetImageResult) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImageResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetImage_result"); err != nil { + if err = oprot.WriteStructBegin("ChangeImage_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -13888,7 +15547,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceGetImageResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceChangeImageResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -13907,43 +15566,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *LaunchScreenServiceGetImageResult) String() string { +func (p *LaunchScreenServiceChangeImageResult) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceGetImageResult(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceChangeImageResult(%+v)", *p) } -type LaunchScreenServiceChangeImagePropertyArgs struct { - Req *ChangeImagePropertyRequest `thrift:"req,1"` +type LaunchScreenServiceDeleteImageArgs struct { + Req *DeleteImageRequest `thrift:"req,1"` } -func NewLaunchScreenServiceChangeImagePropertyArgs() *LaunchScreenServiceChangeImagePropertyArgs { - return &LaunchScreenServiceChangeImagePropertyArgs{} +func NewLaunchScreenServiceDeleteImageArgs() *LaunchScreenServiceDeleteImageArgs { + return &LaunchScreenServiceDeleteImageArgs{} } -func (p *LaunchScreenServiceChangeImagePropertyArgs) InitDefault() { +func (p *LaunchScreenServiceDeleteImageArgs) InitDefault() { } -var LaunchScreenServiceChangeImagePropertyArgs_Req_DEFAULT *ChangeImagePropertyRequest +var LaunchScreenServiceDeleteImageArgs_Req_DEFAULT *DeleteImageRequest -func (p *LaunchScreenServiceChangeImagePropertyArgs) GetReq() (v *ChangeImagePropertyRequest) { +func (p *LaunchScreenServiceDeleteImageArgs) GetReq() (v *DeleteImageRequest) { if !p.IsSetReq() { - return LaunchScreenServiceChangeImagePropertyArgs_Req_DEFAULT + return LaunchScreenServiceDeleteImageArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceChangeImagePropertyArgs = map[int16]string{ +var fieldIDToName_LaunchScreenServiceDeleteImageArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceChangeImagePropertyArgs) IsSetReq() bool { +func (p *LaunchScreenServiceDeleteImageArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceChangeImagePropertyArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceDeleteImageArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -13989,7 +15648,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_LaunchScreenServiceChangeImagePropertyArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceDeleteImageArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -13999,8 +15658,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImagePropertyArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewChangeImagePropertyRequest() +func (p *LaunchScreenServiceDeleteImageArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewDeleteImageRequest() if err := _field.Read(iprot); err != nil { return err } @@ -14008,9 +15667,9 @@ func (p *LaunchScreenServiceChangeImagePropertyArgs) ReadField1(iprot thrift.TPr return nil } -func (p *LaunchScreenServiceChangeImagePropertyArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceDeleteImageArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ChangeImageProperty_args"); err != nil { + if err = oprot.WriteStructBegin("DeleteImage_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -14036,7 +15695,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImagePropertyArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceDeleteImageArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -14053,43 +15712,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceChangeImagePropertyArgs) String() string { +func (p *LaunchScreenServiceDeleteImageArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceChangeImagePropertyArgs(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceDeleteImageArgs(%+v)", *p) } -type LaunchScreenServiceChangeImagePropertyResult struct { - Success *ChangeImagePropertyResponse `thrift:"success,0,optional"` +type LaunchScreenServiceDeleteImageResult struct { + Success *DeleteImageResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceChangeImagePropertyResult() *LaunchScreenServiceChangeImagePropertyResult { - return &LaunchScreenServiceChangeImagePropertyResult{} +func NewLaunchScreenServiceDeleteImageResult() *LaunchScreenServiceDeleteImageResult { + return &LaunchScreenServiceDeleteImageResult{} } -func (p *LaunchScreenServiceChangeImagePropertyResult) InitDefault() { +func (p *LaunchScreenServiceDeleteImageResult) InitDefault() { } -var LaunchScreenServiceChangeImagePropertyResult_Success_DEFAULT *ChangeImagePropertyResponse +var LaunchScreenServiceDeleteImageResult_Success_DEFAULT *DeleteImageResponse -func (p *LaunchScreenServiceChangeImagePropertyResult) GetSuccess() (v *ChangeImagePropertyResponse) { +func (p *LaunchScreenServiceDeleteImageResult) GetSuccess() (v *DeleteImageResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceChangeImagePropertyResult_Success_DEFAULT + return LaunchScreenServiceDeleteImageResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceChangeImagePropertyResult = map[int16]string{ +var fieldIDToName_LaunchScreenServiceDeleteImageResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceChangeImagePropertyResult) IsSetSuccess() bool { +func (p *LaunchScreenServiceDeleteImageResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceChangeImagePropertyResult) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceDeleteImageResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -14135,7 +15794,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_LaunchScreenServiceChangeImagePropertyResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceDeleteImageResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -14145,8 +15804,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImagePropertyResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewChangeImagePropertyResponse() +func (p *LaunchScreenServiceDeleteImageResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewDeleteImageResponse() if err := _field.Read(iprot); err != nil { return err } @@ -14154,9 +15813,9 @@ func (p *LaunchScreenServiceChangeImagePropertyResult) ReadField0(iprot thrift.T return nil } -func (p *LaunchScreenServiceChangeImagePropertyResult) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceDeleteImageResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ChangeImageProperty_result"); err != nil { + if err = oprot.WriteStructBegin("DeleteImage_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -14182,7 +15841,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImagePropertyResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceDeleteImageResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -14201,43 +15860,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *LaunchScreenServiceChangeImagePropertyResult) String() string { +func (p *LaunchScreenServiceDeleteImageResult) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceChangeImagePropertyResult(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceDeleteImageResult(%+v)", *p) } -type LaunchScreenServiceChangeImageArgs struct { - Req *ChangeImageRequest `thrift:"req,1"` +type LaunchScreenServiceMobileGetImageArgs struct { + Req *MobileGetImageRequest `thrift:"req,1"` } -func NewLaunchScreenServiceChangeImageArgs() *LaunchScreenServiceChangeImageArgs { - return &LaunchScreenServiceChangeImageArgs{} +func NewLaunchScreenServiceMobileGetImageArgs() *LaunchScreenServiceMobileGetImageArgs { + return &LaunchScreenServiceMobileGetImageArgs{} } -func (p *LaunchScreenServiceChangeImageArgs) InitDefault() { +func (p *LaunchScreenServiceMobileGetImageArgs) InitDefault() { } -var LaunchScreenServiceChangeImageArgs_Req_DEFAULT *ChangeImageRequest +var LaunchScreenServiceMobileGetImageArgs_Req_DEFAULT *MobileGetImageRequest -func (p *LaunchScreenServiceChangeImageArgs) GetReq() (v *ChangeImageRequest) { +func (p *LaunchScreenServiceMobileGetImageArgs) GetReq() (v *MobileGetImageRequest) { if !p.IsSetReq() { - return LaunchScreenServiceChangeImageArgs_Req_DEFAULT + return LaunchScreenServiceMobileGetImageArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceChangeImageArgs = map[int16]string{ +var fieldIDToName_LaunchScreenServiceMobileGetImageArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceChangeImageArgs) IsSetReq() bool { +func (p *LaunchScreenServiceMobileGetImageArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceChangeImageArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceMobileGetImageArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -14283,7 +15942,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_LaunchScreenServiceChangeImageArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceMobileGetImageArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -14293,8 +15952,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImageArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewChangeImageRequest() +func (p *LaunchScreenServiceMobileGetImageArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewMobileGetImageRequest() if err := _field.Read(iprot); err != nil { return err } @@ -14302,9 +15961,9 @@ func (p *LaunchScreenServiceChangeImageArgs) ReadField1(iprot thrift.TProtocol) return nil } -func (p *LaunchScreenServiceChangeImageArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceMobileGetImageArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ChangeImage_args"); err != nil { + if err = oprot.WriteStructBegin("MobileGetImage_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -14330,7 +15989,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImageArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceMobileGetImageArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -14347,43 +16006,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceChangeImageArgs) String() string { +func (p *LaunchScreenServiceMobileGetImageArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceChangeImageArgs(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceMobileGetImageArgs(%+v)", *p) } -type LaunchScreenServiceChangeImageResult struct { - Success *ChangeImageResponse `thrift:"success,0,optional"` +type LaunchScreenServiceMobileGetImageResult struct { + Success *MobileGetImageResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceChangeImageResult() *LaunchScreenServiceChangeImageResult { - return &LaunchScreenServiceChangeImageResult{} +func NewLaunchScreenServiceMobileGetImageResult() *LaunchScreenServiceMobileGetImageResult { + return &LaunchScreenServiceMobileGetImageResult{} } -func (p *LaunchScreenServiceChangeImageResult) InitDefault() { +func (p *LaunchScreenServiceMobileGetImageResult) InitDefault() { } -var LaunchScreenServiceChangeImageResult_Success_DEFAULT *ChangeImageResponse +var LaunchScreenServiceMobileGetImageResult_Success_DEFAULT *MobileGetImageResponse -func (p *LaunchScreenServiceChangeImageResult) GetSuccess() (v *ChangeImageResponse) { +func (p *LaunchScreenServiceMobileGetImageResult) GetSuccess() (v *MobileGetImageResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceChangeImageResult_Success_DEFAULT + return LaunchScreenServiceMobileGetImageResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceChangeImageResult = map[int16]string{ +var fieldIDToName_LaunchScreenServiceMobileGetImageResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceChangeImageResult) IsSetSuccess() bool { +func (p *LaunchScreenServiceMobileGetImageResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceChangeImageResult) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceMobileGetImageResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -14429,7 +16088,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_LaunchScreenServiceChangeImageResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceMobileGetImageResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -14439,8 +16098,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImageResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewChangeImageResponse() +func (p *LaunchScreenServiceMobileGetImageResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewMobileGetImageResponse() if err := _field.Read(iprot); err != nil { return err } @@ -14448,9 +16107,9 @@ func (p *LaunchScreenServiceChangeImageResult) ReadField0(iprot thrift.TProtocol return nil } -func (p *LaunchScreenServiceChangeImageResult) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceMobileGetImageResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ChangeImage_result"); err != nil { + if err = oprot.WriteStructBegin("MobileGetImage_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -14476,7 +16135,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceChangeImageResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceMobileGetImageResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -14495,43 +16154,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *LaunchScreenServiceChangeImageResult) String() string { +func (p *LaunchScreenServiceMobileGetImageResult) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceChangeImageResult(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceMobileGetImageResult(%+v)", *p) } -type LaunchScreenServiceDeleteImageArgs struct { - Req *DeleteImageRequest `thrift:"req,1"` +type LaunchScreenServiceAddImagePointTimeArgs struct { + Req *AddImagePointTimeRequest `thrift:"req,1"` } -func NewLaunchScreenServiceDeleteImageArgs() *LaunchScreenServiceDeleteImageArgs { - return &LaunchScreenServiceDeleteImageArgs{} +func NewLaunchScreenServiceAddImagePointTimeArgs() *LaunchScreenServiceAddImagePointTimeArgs { + return &LaunchScreenServiceAddImagePointTimeArgs{} } -func (p *LaunchScreenServiceDeleteImageArgs) InitDefault() { +func (p *LaunchScreenServiceAddImagePointTimeArgs) InitDefault() { } -var LaunchScreenServiceDeleteImageArgs_Req_DEFAULT *DeleteImageRequest +var LaunchScreenServiceAddImagePointTimeArgs_Req_DEFAULT *AddImagePointTimeRequest -func (p *LaunchScreenServiceDeleteImageArgs) GetReq() (v *DeleteImageRequest) { +func (p *LaunchScreenServiceAddImagePointTimeArgs) GetReq() (v *AddImagePointTimeRequest) { if !p.IsSetReq() { - return LaunchScreenServiceDeleteImageArgs_Req_DEFAULT + return LaunchScreenServiceAddImagePointTimeArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceDeleteImageArgs = map[int16]string{ +var fieldIDToName_LaunchScreenServiceAddImagePointTimeArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceDeleteImageArgs) IsSetReq() bool { +func (p *LaunchScreenServiceAddImagePointTimeArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceDeleteImageArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceAddImagePointTimeArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -14577,7 +16236,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_LaunchScreenServiceDeleteImageArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_LaunchScreenServiceAddImagePointTimeArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -14587,8 +16246,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceDeleteImageArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewDeleteImageRequest() +func (p *LaunchScreenServiceAddImagePointTimeArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewAddImagePointTimeRequest() if err := _field.Read(iprot); err != nil { return err } @@ -14596,9 +16255,9 @@ func (p *LaunchScreenServiceDeleteImageArgs) ReadField1(iprot thrift.TProtocol) return nil } -func (p *LaunchScreenServiceDeleteImageArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceAddImagePointTimeArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("DeleteImage_args"); err != nil { + if err = oprot.WriteStructBegin("AddImagePointTime_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -14624,7 +16283,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceDeleteImageArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceAddImagePointTimeArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -14641,43 +16300,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceDeleteImageArgs) String() string { +func (p *LaunchScreenServiceAddImagePointTimeArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceDeleteImageArgs(%+v)", *p) + return fmt.Sprintf("LaunchScreenServiceAddImagePointTimeArgs(%+v)", *p) } -type LaunchScreenServiceDeleteImageResult struct { - Success *DeleteImageResponse `thrift:"success,0,optional"` +type LaunchScreenServiceAddImagePointTimeResult struct { + Success *AddImagePointTimeResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceDeleteImageResult() *LaunchScreenServiceDeleteImageResult { - return &LaunchScreenServiceDeleteImageResult{} +func NewLaunchScreenServiceAddImagePointTimeResult() *LaunchScreenServiceAddImagePointTimeResult { + return &LaunchScreenServiceAddImagePointTimeResult{} } -func (p *LaunchScreenServiceDeleteImageResult) InitDefault() { +func (p *LaunchScreenServiceAddImagePointTimeResult) InitDefault() { } -var LaunchScreenServiceDeleteImageResult_Success_DEFAULT *DeleteImageResponse +var LaunchScreenServiceAddImagePointTimeResult_Success_DEFAULT *AddImagePointTimeResponse -func (p *LaunchScreenServiceDeleteImageResult) GetSuccess() (v *DeleteImageResponse) { +func (p *LaunchScreenServiceAddImagePointTimeResult) GetSuccess() (v *AddImagePointTimeResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceDeleteImageResult_Success_DEFAULT + return LaunchScreenServiceAddImagePointTimeResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceDeleteImageResult = map[int16]string{ +var fieldIDToName_LaunchScreenServiceAddImagePointTimeResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceDeleteImageResult) IsSetSuccess() bool { +func (p *LaunchScreenServiceAddImagePointTimeResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceDeleteImageResult) Read(iprot thrift.TProtocol) (err error) { +func (p *LaunchScreenServiceAddImagePointTimeResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -14713,119 +16372,355 @@ func (p *LaunchScreenServiceDeleteImageResult) Read(iprot thrift.TProtocol) (err goto ReadFieldEndError } } - if err = iprot.ReadStructEnd(); err != nil { - goto ReadStructEndError + 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_LaunchScreenServiceAddImagePointTimeResult[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 *LaunchScreenServiceAddImagePointTimeResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewAddImagePointTimeResponse() + if err := _field.Read(iprot); err != nil { + return err + } + p.Success = _field + return nil +} + +func (p *LaunchScreenServiceAddImagePointTimeResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("AddImagePointTime_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 *LaunchScreenServiceAddImagePointTimeResult) 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 *LaunchScreenServiceAddImagePointTimeResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("LaunchScreenServiceAddImagePointTimeResult(%+v)", *p) + +} + +type PaperServiceProcessor struct { + processorMap map[string]thrift.TProcessorFunction + handler PaperService +} + +func (p *PaperServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { + p.processorMap[key] = processor +} + +func (p *PaperServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { + processor, ok = p.processorMap[key] + return processor, ok +} + +func (p *PaperServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { + return p.processorMap +} + +func NewPaperServiceProcessor(handler PaperService) *PaperServiceProcessor { + self := &PaperServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} + self.AddToProcessorMap("ListDirFiles", &paperServiceProcessorListDirFiles{handler: handler}) + self.AddToProcessorMap("GetDownloadUrl", &paperServiceProcessorGetDownloadUrl{handler: handler}) + self.AddToProcessorMap("ListDirFilesForAndroid", &paperServiceProcessorListDirFilesForAndroid{handler: handler}) + self.AddToProcessorMap("GetDownloadUrlForAndroid", &paperServiceProcessorGetDownloadUrlForAndroid{handler: handler}) + return self +} +func (p *PaperServiceProcessor) 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 paperServiceProcessorListDirFiles struct { + handler PaperService +} + +func (p *paperServiceProcessorListDirFiles) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := PaperServiceListDirFilesArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ListDirFiles", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := PaperServiceListDirFilesResult{} + var retval *ListDirFilesResponse + if retval, err2 = p.handler.ListDirFiles(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ListDirFiles: "+err2.Error()) + oprot.WriteMessageBegin("ListDirFiles", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("ListDirFiles", 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 paperServiceProcessorGetDownloadUrl struct { + handler PaperService +} + +func (p *paperServiceProcessorGetDownloadUrl) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := PaperServiceGetDownloadUrlArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetDownloadUrl", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err + } + + iprot.ReadMessageEnd() + var err2 error + result := PaperServiceGetDownloadUrlResult{} + var retval *GetDownloadUrlResponse + if retval, err2 = p.handler.GetDownloadUrl(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetDownloadUrl: "+err2.Error()) + oprot.WriteMessageBegin("GetDownloadUrl", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetDownloadUrl", 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 +} - 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_LaunchScreenServiceDeleteImageResult[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) +type paperServiceProcessorListDirFilesForAndroid struct { + handler PaperService } -func (p *LaunchScreenServiceDeleteImageResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewDeleteImageResponse() - if err := _field.Read(iprot); err != nil { - return err +func (p *paperServiceProcessorListDirFilesForAndroid) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := PaperServiceListDirFilesForAndroidArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("ListDirFilesForAndroid", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err } - p.Success = _field - return nil -} -func (p *LaunchScreenServiceDeleteImageResult) Write(oprot thrift.TProtocol) (err error) { - var fieldId int16 - if err = oprot.WriteStructBegin("DeleteImage_result"); err != nil { - goto WriteStructBeginError + iprot.ReadMessageEnd() + var err2 error + result := PaperServiceListDirFilesForAndroidResult{} + var retval *ListDirFilesForAndroidResponse + if retval, err2 = p.handler.ListDirFilesForAndroid(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ListDirFilesForAndroid: "+err2.Error()) + oprot.WriteMessageBegin("ListDirFilesForAndroid", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval } - if p != nil { - if err = p.writeField0(oprot); err != nil { - fieldId = 0 - goto WriteFieldError - } + if err2 = oprot.WriteMessageBegin("ListDirFilesForAndroid", thrift.REPLY, seqId); err2 != nil { + err = err2 } - if err = oprot.WriteFieldStop(); err != nil { - goto WriteFieldStopError + if err2 = result.Write(oprot); err == nil && err2 != nil { + err = err2 } - if err = oprot.WriteStructEnd(); err != nil { - goto WriteStructEndError + if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil { + err = err2 } - 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) + if err2 = oprot.Flush(ctx); err == nil && err2 != nil { + err = err2 + } + if err != nil { + return + } + return true, err } -func (p *LaunchScreenServiceDeleteImageResult) 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) +type paperServiceProcessorGetDownloadUrlForAndroid struct { + handler PaperService } -func (p *LaunchScreenServiceDeleteImageResult) String() string { - if p == nil { - return "" +func (p *paperServiceProcessorGetDownloadUrlForAndroid) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { + args := PaperServiceGetDownloadUrlForAndroidArgs{} + if err = args.Read(iprot); err != nil { + iprot.ReadMessageEnd() + x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) + oprot.WriteMessageBegin("GetDownloadUrlForAndroid", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return false, err } - return fmt.Sprintf("LaunchScreenServiceDeleteImageResult(%+v)", *p) + iprot.ReadMessageEnd() + var err2 error + result := PaperServiceGetDownloadUrlForAndroidResult{} + var retval *GetDownloadUrlForAndroidResponse + if retval, err2 = p.handler.GetDownloadUrlForAndroid(ctx, args.Req); err2 != nil { + x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetDownloadUrlForAndroid: "+err2.Error()) + oprot.WriteMessageBegin("GetDownloadUrlForAndroid", thrift.EXCEPTION, seqId) + x.Write(oprot) + oprot.WriteMessageEnd() + oprot.Flush(ctx) + return true, err2 + } else { + result.Success = retval + } + if err2 = oprot.WriteMessageBegin("GetDownloadUrlForAndroid", 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 LaunchScreenServiceMobileGetImageArgs struct { - Req *MobileGetImageRequest `thrift:"req,1"` +type PaperServiceListDirFilesArgs struct { + Req *ListDirFilesRequest `thrift:"req,1"` } -func NewLaunchScreenServiceMobileGetImageArgs() *LaunchScreenServiceMobileGetImageArgs { - return &LaunchScreenServiceMobileGetImageArgs{} +func NewPaperServiceListDirFilesArgs() *PaperServiceListDirFilesArgs { + return &PaperServiceListDirFilesArgs{} } -func (p *LaunchScreenServiceMobileGetImageArgs) InitDefault() { +func (p *PaperServiceListDirFilesArgs) InitDefault() { } -var LaunchScreenServiceMobileGetImageArgs_Req_DEFAULT *MobileGetImageRequest +var PaperServiceListDirFilesArgs_Req_DEFAULT *ListDirFilesRequest -func (p *LaunchScreenServiceMobileGetImageArgs) GetReq() (v *MobileGetImageRequest) { +func (p *PaperServiceListDirFilesArgs) GetReq() (v *ListDirFilesRequest) { if !p.IsSetReq() { - return LaunchScreenServiceMobileGetImageArgs_Req_DEFAULT + return PaperServiceListDirFilesArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceMobileGetImageArgs = map[int16]string{ +var fieldIDToName_PaperServiceListDirFilesArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceMobileGetImageArgs) IsSetReq() bool { +func (p *PaperServiceListDirFilesArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceMobileGetImageArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -14871,7 +16766,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_LaunchScreenServiceMobileGetImageArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceListDirFilesArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -14881,8 +16776,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceMobileGetImageArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewMobileGetImageRequest() +func (p *PaperServiceListDirFilesArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewListDirFilesRequest() if err := _field.Read(iprot); err != nil { return err } @@ -14890,9 +16785,9 @@ func (p *LaunchScreenServiceMobileGetImageArgs) ReadField1(iprot thrift.TProtoco return nil } -func (p *LaunchScreenServiceMobileGetImageArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("MobileGetImage_args"); err != nil { + if err = oprot.WriteStructBegin("ListDirFiles_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -14918,7 +16813,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceMobileGetImageArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -14935,43 +16830,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceMobileGetImageArgs) String() string { +func (p *PaperServiceListDirFilesArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceMobileGetImageArgs(%+v)", *p) + return fmt.Sprintf("PaperServiceListDirFilesArgs(%+v)", *p) } -type LaunchScreenServiceMobileGetImageResult struct { - Success *MobileGetImageResponse `thrift:"success,0,optional"` +type PaperServiceListDirFilesResult struct { + Success *ListDirFilesResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceMobileGetImageResult() *LaunchScreenServiceMobileGetImageResult { - return &LaunchScreenServiceMobileGetImageResult{} +func NewPaperServiceListDirFilesResult() *PaperServiceListDirFilesResult { + return &PaperServiceListDirFilesResult{} } -func (p *LaunchScreenServiceMobileGetImageResult) InitDefault() { +func (p *PaperServiceListDirFilesResult) InitDefault() { } -var LaunchScreenServiceMobileGetImageResult_Success_DEFAULT *MobileGetImageResponse +var PaperServiceListDirFilesResult_Success_DEFAULT *ListDirFilesResponse -func (p *LaunchScreenServiceMobileGetImageResult) GetSuccess() (v *MobileGetImageResponse) { +func (p *PaperServiceListDirFilesResult) GetSuccess() (v *ListDirFilesResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceMobileGetImageResult_Success_DEFAULT + return PaperServiceListDirFilesResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceMobileGetImageResult = map[int16]string{ +var fieldIDToName_PaperServiceListDirFilesResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceMobileGetImageResult) IsSetSuccess() bool { +func (p *PaperServiceListDirFilesResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceMobileGetImageResult) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -15017,7 +16912,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_LaunchScreenServiceMobileGetImageResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceListDirFilesResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -15027,8 +16922,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceMobileGetImageResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewMobileGetImageResponse() +func (p *PaperServiceListDirFilesResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewListDirFilesResponse() if err := _field.Read(iprot); err != nil { return err } @@ -15036,9 +16931,9 @@ func (p *LaunchScreenServiceMobileGetImageResult) ReadField0(iprot thrift.TProto return nil } -func (p *LaunchScreenServiceMobileGetImageResult) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("MobileGetImage_result"); err != nil { + if err = oprot.WriteStructBegin("ListDirFiles_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -15064,7 +16959,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceMobileGetImageResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -15083,43 +16978,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *LaunchScreenServiceMobileGetImageResult) String() string { +func (p *PaperServiceListDirFilesResult) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceMobileGetImageResult(%+v)", *p) + return fmt.Sprintf("PaperServiceListDirFilesResult(%+v)", *p) } -type LaunchScreenServiceAddImagePointTimeArgs struct { - Req *AddImagePointTimeRequest `thrift:"req,1"` +type PaperServiceGetDownloadUrlArgs struct { + Req *GetDownloadUrlRequest `thrift:"req,1"` } -func NewLaunchScreenServiceAddImagePointTimeArgs() *LaunchScreenServiceAddImagePointTimeArgs { - return &LaunchScreenServiceAddImagePointTimeArgs{} +func NewPaperServiceGetDownloadUrlArgs() *PaperServiceGetDownloadUrlArgs { + return &PaperServiceGetDownloadUrlArgs{} } -func (p *LaunchScreenServiceAddImagePointTimeArgs) InitDefault() { +func (p *PaperServiceGetDownloadUrlArgs) InitDefault() { } -var LaunchScreenServiceAddImagePointTimeArgs_Req_DEFAULT *AddImagePointTimeRequest +var PaperServiceGetDownloadUrlArgs_Req_DEFAULT *GetDownloadUrlRequest -func (p *LaunchScreenServiceAddImagePointTimeArgs) GetReq() (v *AddImagePointTimeRequest) { +func (p *PaperServiceGetDownloadUrlArgs) GetReq() (v *GetDownloadUrlRequest) { if !p.IsSetReq() { - return LaunchScreenServiceAddImagePointTimeArgs_Req_DEFAULT + return PaperServiceGetDownloadUrlArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_LaunchScreenServiceAddImagePointTimeArgs = map[int16]string{ +var fieldIDToName_PaperServiceGetDownloadUrlArgs = map[int16]string{ 1: "req", } -func (p *LaunchScreenServiceAddImagePointTimeArgs) IsSetReq() bool { +func (p *PaperServiceGetDownloadUrlArgs) IsSetReq() bool { return p.Req != nil } -func (p *LaunchScreenServiceAddImagePointTimeArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -15165,7 +17060,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_LaunchScreenServiceAddImagePointTimeArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceGetDownloadUrlArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -15175,8 +17070,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceAddImagePointTimeArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewAddImagePointTimeRequest() +func (p *PaperServiceGetDownloadUrlArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetDownloadUrlRequest() if err := _field.Read(iprot); err != nil { return err } @@ -15184,9 +17079,9 @@ func (p *LaunchScreenServiceAddImagePointTimeArgs) ReadField1(iprot thrift.TProt return nil } -func (p *LaunchScreenServiceAddImagePointTimeArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("AddImagePointTime_args"); err != nil { + if err = oprot.WriteStructBegin("GetDownloadUrl_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -15212,7 +17107,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceAddImagePointTimeArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -15229,43 +17124,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *LaunchScreenServiceAddImagePointTimeArgs) String() string { +func (p *PaperServiceGetDownloadUrlArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceAddImagePointTimeArgs(%+v)", *p) + return fmt.Sprintf("PaperServiceGetDownloadUrlArgs(%+v)", *p) } -type LaunchScreenServiceAddImagePointTimeResult struct { - Success *AddImagePointTimeResponse `thrift:"success,0,optional"` +type PaperServiceGetDownloadUrlResult struct { + Success *GetDownloadUrlResponse `thrift:"success,0,optional"` } -func NewLaunchScreenServiceAddImagePointTimeResult() *LaunchScreenServiceAddImagePointTimeResult { - return &LaunchScreenServiceAddImagePointTimeResult{} +func NewPaperServiceGetDownloadUrlResult() *PaperServiceGetDownloadUrlResult { + return &PaperServiceGetDownloadUrlResult{} } -func (p *LaunchScreenServiceAddImagePointTimeResult) InitDefault() { +func (p *PaperServiceGetDownloadUrlResult) InitDefault() { } -var LaunchScreenServiceAddImagePointTimeResult_Success_DEFAULT *AddImagePointTimeResponse +var PaperServiceGetDownloadUrlResult_Success_DEFAULT *GetDownloadUrlResponse -func (p *LaunchScreenServiceAddImagePointTimeResult) GetSuccess() (v *AddImagePointTimeResponse) { +func (p *PaperServiceGetDownloadUrlResult) GetSuccess() (v *GetDownloadUrlResponse) { if !p.IsSetSuccess() { - return LaunchScreenServiceAddImagePointTimeResult_Success_DEFAULT + return PaperServiceGetDownloadUrlResult_Success_DEFAULT } return p.Success } -var fieldIDToName_LaunchScreenServiceAddImagePointTimeResult = map[int16]string{ +var fieldIDToName_PaperServiceGetDownloadUrlResult = map[int16]string{ 0: "success", } -func (p *LaunchScreenServiceAddImagePointTimeResult) IsSetSuccess() bool { +func (p *PaperServiceGetDownloadUrlResult) IsSetSuccess() bool { return p.Success != nil } -func (p *LaunchScreenServiceAddImagePointTimeResult) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -15311,7 +17206,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_LaunchScreenServiceAddImagePointTimeResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceGetDownloadUrlResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -15321,8 +17216,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *LaunchScreenServiceAddImagePointTimeResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewAddImagePointTimeResponse() +func (p *PaperServiceGetDownloadUrlResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetDownloadUrlResponse() if err := _field.Read(iprot); err != nil { return err } @@ -15330,9 +17225,9 @@ func (p *LaunchScreenServiceAddImagePointTimeResult) ReadField0(iprot thrift.TPr return nil } -func (p *LaunchScreenServiceAddImagePointTimeResult) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("AddImagePointTime_result"); err != nil { + if err = oprot.WriteStructBegin("GetDownloadUrl_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -15358,7 +17253,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *LaunchScreenServiceAddImagePointTimeResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -15377,181 +17272,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *LaunchScreenServiceAddImagePointTimeResult) String() string { +func (p *PaperServiceGetDownloadUrlResult) String() string { if p == nil { return "" } - return fmt.Sprintf("LaunchScreenServiceAddImagePointTimeResult(%+v)", *p) - -} - -type PaperServiceProcessor struct { - processorMap map[string]thrift.TProcessorFunction - handler PaperService -} - -func (p *PaperServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) { - p.processorMap[key] = processor -} - -func (p *PaperServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) { - processor, ok = p.processorMap[key] - return processor, ok -} - -func (p *PaperServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction { - return p.processorMap -} - -func NewPaperServiceProcessor(handler PaperService) *PaperServiceProcessor { - self := &PaperServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)} - self.AddToProcessorMap("ListDirFiles", &paperServiceProcessorListDirFiles{handler: handler}) - self.AddToProcessorMap("GetDownloadUrl", &paperServiceProcessorGetDownloadUrl{handler: handler}) - return self -} -func (p *PaperServiceProcessor) 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 paperServiceProcessorListDirFiles struct { - handler PaperService -} - -func (p *paperServiceProcessorListDirFiles) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := PaperServiceListDirFilesArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("ListDirFiles", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } - - iprot.ReadMessageEnd() - var err2 error - result := PaperServiceListDirFilesResult{} - var retval *ListDirFilesResponse - if retval, err2 = p.handler.ListDirFiles(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing ListDirFiles: "+err2.Error()) - oprot.WriteMessageBegin("ListDirFiles", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("ListDirFiles", 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 paperServiceProcessorGetDownloadUrl struct { - handler PaperService -} - -func (p *paperServiceProcessorGetDownloadUrl) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { - args := PaperServiceGetDownloadUrlArgs{} - if err = args.Read(iprot); err != nil { - iprot.ReadMessageEnd() - x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error()) - oprot.WriteMessageBegin("GetDownloadUrl", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return false, err - } + return fmt.Sprintf("PaperServiceGetDownloadUrlResult(%+v)", *p) - iprot.ReadMessageEnd() - var err2 error - result := PaperServiceGetDownloadUrlResult{} - var retval *GetDownloadUrlResponse - if retval, err2 = p.handler.GetDownloadUrl(ctx, args.Req); err2 != nil { - x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetDownloadUrl: "+err2.Error()) - oprot.WriteMessageBegin("GetDownloadUrl", thrift.EXCEPTION, seqId) - x.Write(oprot) - oprot.WriteMessageEnd() - oprot.Flush(ctx) - return true, err2 - } else { - result.Success = retval - } - if err2 = oprot.WriteMessageBegin("GetDownloadUrl", 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 PaperServiceListDirFilesArgs struct { - Req *ListDirFilesRequest `thrift:"req,1"` +type PaperServiceListDirFilesForAndroidArgs struct { + Req *ListDirFilesForAndroidRequest `thrift:"req,1"` } -func NewPaperServiceListDirFilesArgs() *PaperServiceListDirFilesArgs { - return &PaperServiceListDirFilesArgs{} +func NewPaperServiceListDirFilesForAndroidArgs() *PaperServiceListDirFilesForAndroidArgs { + return &PaperServiceListDirFilesForAndroidArgs{} } -func (p *PaperServiceListDirFilesArgs) InitDefault() { +func (p *PaperServiceListDirFilesForAndroidArgs) InitDefault() { } -var PaperServiceListDirFilesArgs_Req_DEFAULT *ListDirFilesRequest +var PaperServiceListDirFilesForAndroidArgs_Req_DEFAULT *ListDirFilesForAndroidRequest -func (p *PaperServiceListDirFilesArgs) GetReq() (v *ListDirFilesRequest) { +func (p *PaperServiceListDirFilesForAndroidArgs) GetReq() (v *ListDirFilesForAndroidRequest) { if !p.IsSetReq() { - return PaperServiceListDirFilesArgs_Req_DEFAULT + return PaperServiceListDirFilesForAndroidArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_PaperServiceListDirFilesArgs = map[int16]string{ +var fieldIDToName_PaperServiceListDirFilesForAndroidArgs = map[int16]string{ 1: "req", } -func (p *PaperServiceListDirFilesArgs) IsSetReq() bool { +func (p *PaperServiceListDirFilesForAndroidArgs) IsSetReq() bool { return p.Req != nil } -func (p *PaperServiceListDirFilesArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesForAndroidArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -15597,7 +17354,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_PaperServiceListDirFilesArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceListDirFilesForAndroidArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -15607,8 +17364,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *PaperServiceListDirFilesArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewListDirFilesRequest() +func (p *PaperServiceListDirFilesForAndroidArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewListDirFilesForAndroidRequest() if err := _field.Read(iprot); err != nil { return err } @@ -15616,9 +17373,9 @@ func (p *PaperServiceListDirFilesArgs) ReadField1(iprot thrift.TProtocol) error return nil } -func (p *PaperServiceListDirFilesArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesForAndroidArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ListDirFiles_args"); err != nil { + if err = oprot.WriteStructBegin("ListDirFilesForAndroid_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -15644,7 +17401,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *PaperServiceListDirFilesArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesForAndroidArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -15661,43 +17418,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *PaperServiceListDirFilesArgs) String() string { +func (p *PaperServiceListDirFilesForAndroidArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("PaperServiceListDirFilesArgs(%+v)", *p) + return fmt.Sprintf("PaperServiceListDirFilesForAndroidArgs(%+v)", *p) } -type PaperServiceListDirFilesResult struct { - Success *ListDirFilesResponse `thrift:"success,0,optional"` +type PaperServiceListDirFilesForAndroidResult struct { + Success *ListDirFilesForAndroidResponse `thrift:"success,0,optional"` } -func NewPaperServiceListDirFilesResult() *PaperServiceListDirFilesResult { - return &PaperServiceListDirFilesResult{} +func NewPaperServiceListDirFilesForAndroidResult() *PaperServiceListDirFilesForAndroidResult { + return &PaperServiceListDirFilesForAndroidResult{} } -func (p *PaperServiceListDirFilesResult) InitDefault() { +func (p *PaperServiceListDirFilesForAndroidResult) InitDefault() { } -var PaperServiceListDirFilesResult_Success_DEFAULT *ListDirFilesResponse +var PaperServiceListDirFilesForAndroidResult_Success_DEFAULT *ListDirFilesForAndroidResponse -func (p *PaperServiceListDirFilesResult) GetSuccess() (v *ListDirFilesResponse) { +func (p *PaperServiceListDirFilesForAndroidResult) GetSuccess() (v *ListDirFilesForAndroidResponse) { if !p.IsSetSuccess() { - return PaperServiceListDirFilesResult_Success_DEFAULT + return PaperServiceListDirFilesForAndroidResult_Success_DEFAULT } return p.Success } -var fieldIDToName_PaperServiceListDirFilesResult = map[int16]string{ +var fieldIDToName_PaperServiceListDirFilesForAndroidResult = map[int16]string{ 0: "success", } -func (p *PaperServiceListDirFilesResult) IsSetSuccess() bool { +func (p *PaperServiceListDirFilesForAndroidResult) IsSetSuccess() bool { return p.Success != nil } -func (p *PaperServiceListDirFilesResult) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesForAndroidResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -15743,7 +17500,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_PaperServiceListDirFilesResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceListDirFilesForAndroidResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -15753,8 +17510,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *PaperServiceListDirFilesResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewListDirFilesResponse() +func (p *PaperServiceListDirFilesForAndroidResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewListDirFilesForAndroidResponse() if err := _field.Read(iprot); err != nil { return err } @@ -15762,9 +17519,9 @@ func (p *PaperServiceListDirFilesResult) ReadField0(iprot thrift.TProtocol) erro return nil } -func (p *PaperServiceListDirFilesResult) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesForAndroidResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("ListDirFiles_result"); err != nil { + if err = oprot.WriteStructBegin("ListDirFilesForAndroid_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -15790,7 +17547,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *PaperServiceListDirFilesResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceListDirFilesForAndroidResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -15809,43 +17566,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *PaperServiceListDirFilesResult) String() string { +func (p *PaperServiceListDirFilesForAndroidResult) String() string { if p == nil { return "" } - return fmt.Sprintf("PaperServiceListDirFilesResult(%+v)", *p) + return fmt.Sprintf("PaperServiceListDirFilesForAndroidResult(%+v)", *p) } -type PaperServiceGetDownloadUrlArgs struct { - Req *GetDownloadUrlRequest `thrift:"req,1"` +type PaperServiceGetDownloadUrlForAndroidArgs struct { + Req *GetDownloadUrlForAndroidRequest `thrift:"req,1"` } -func NewPaperServiceGetDownloadUrlArgs() *PaperServiceGetDownloadUrlArgs { - return &PaperServiceGetDownloadUrlArgs{} +func NewPaperServiceGetDownloadUrlForAndroidArgs() *PaperServiceGetDownloadUrlForAndroidArgs { + return &PaperServiceGetDownloadUrlForAndroidArgs{} } -func (p *PaperServiceGetDownloadUrlArgs) InitDefault() { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) InitDefault() { } -var PaperServiceGetDownloadUrlArgs_Req_DEFAULT *GetDownloadUrlRequest +var PaperServiceGetDownloadUrlForAndroidArgs_Req_DEFAULT *GetDownloadUrlForAndroidRequest -func (p *PaperServiceGetDownloadUrlArgs) GetReq() (v *GetDownloadUrlRequest) { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) GetReq() (v *GetDownloadUrlForAndroidRequest) { if !p.IsSetReq() { - return PaperServiceGetDownloadUrlArgs_Req_DEFAULT + return PaperServiceGetDownloadUrlForAndroidArgs_Req_DEFAULT } return p.Req } -var fieldIDToName_PaperServiceGetDownloadUrlArgs = map[int16]string{ +var fieldIDToName_PaperServiceGetDownloadUrlForAndroidArgs = map[int16]string{ 1: "req", } -func (p *PaperServiceGetDownloadUrlArgs) IsSetReq() bool { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) IsSetReq() bool { return p.Req != nil } -func (p *PaperServiceGetDownloadUrlArgs) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -15891,7 +17648,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_PaperServiceGetDownloadUrlArgs[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceGetDownloadUrlForAndroidArgs[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -15901,8 +17658,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *PaperServiceGetDownloadUrlArgs) ReadField1(iprot thrift.TProtocol) error { - _field := NewGetDownloadUrlRequest() +func (p *PaperServiceGetDownloadUrlForAndroidArgs) ReadField1(iprot thrift.TProtocol) error { + _field := NewGetDownloadUrlForAndroidRequest() if err := _field.Read(iprot); err != nil { return err } @@ -15910,9 +17667,9 @@ func (p *PaperServiceGetDownloadUrlArgs) ReadField1(iprot thrift.TProtocol) erro return nil } -func (p *PaperServiceGetDownloadUrlArgs) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetDownloadUrl_args"); err != nil { + if err = oprot.WriteStructBegin("GetDownloadUrlForAndroid_args"); err != nil { goto WriteStructBeginError } if p != nil { @@ -15938,7 +17695,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *PaperServiceGetDownloadUrlArgs) writeField1(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) writeField1(oprot thrift.TProtocol) (err error) { if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil { goto WriteFieldBeginError } @@ -15955,43 +17712,43 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) } -func (p *PaperServiceGetDownloadUrlArgs) String() string { +func (p *PaperServiceGetDownloadUrlForAndroidArgs) String() string { if p == nil { return "" } - return fmt.Sprintf("PaperServiceGetDownloadUrlArgs(%+v)", *p) + return fmt.Sprintf("PaperServiceGetDownloadUrlForAndroidArgs(%+v)", *p) } -type PaperServiceGetDownloadUrlResult struct { - Success *GetDownloadUrlResponse `thrift:"success,0,optional"` +type PaperServiceGetDownloadUrlForAndroidResult struct { + Success *GetDownloadUrlForAndroidResponse `thrift:"success,0,optional"` } -func NewPaperServiceGetDownloadUrlResult() *PaperServiceGetDownloadUrlResult { - return &PaperServiceGetDownloadUrlResult{} +func NewPaperServiceGetDownloadUrlForAndroidResult() *PaperServiceGetDownloadUrlForAndroidResult { + return &PaperServiceGetDownloadUrlForAndroidResult{} } -func (p *PaperServiceGetDownloadUrlResult) InitDefault() { +func (p *PaperServiceGetDownloadUrlForAndroidResult) InitDefault() { } -var PaperServiceGetDownloadUrlResult_Success_DEFAULT *GetDownloadUrlResponse +var PaperServiceGetDownloadUrlForAndroidResult_Success_DEFAULT *GetDownloadUrlForAndroidResponse -func (p *PaperServiceGetDownloadUrlResult) GetSuccess() (v *GetDownloadUrlResponse) { +func (p *PaperServiceGetDownloadUrlForAndroidResult) GetSuccess() (v *GetDownloadUrlForAndroidResponse) { if !p.IsSetSuccess() { - return PaperServiceGetDownloadUrlResult_Success_DEFAULT + return PaperServiceGetDownloadUrlForAndroidResult_Success_DEFAULT } return p.Success } -var fieldIDToName_PaperServiceGetDownloadUrlResult = map[int16]string{ +var fieldIDToName_PaperServiceGetDownloadUrlForAndroidResult = map[int16]string{ 0: "success", } -func (p *PaperServiceGetDownloadUrlResult) IsSetSuccess() bool { +func (p *PaperServiceGetDownloadUrlForAndroidResult) IsSetSuccess() bool { return p.Success != nil } -func (p *PaperServiceGetDownloadUrlResult) Read(iprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlForAndroidResult) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 @@ -16037,7 +17794,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_PaperServiceGetDownloadUrlResult[fieldId]), err) + return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_PaperServiceGetDownloadUrlForAndroidResult[fieldId]), err) SkipFieldError: return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err) @@ -16047,8 +17804,8 @@ ReadStructEndError: return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) } -func (p *PaperServiceGetDownloadUrlResult) ReadField0(iprot thrift.TProtocol) error { - _field := NewGetDownloadUrlResponse() +func (p *PaperServiceGetDownloadUrlForAndroidResult) ReadField0(iprot thrift.TProtocol) error { + _field := NewGetDownloadUrlForAndroidResponse() if err := _field.Read(iprot); err != nil { return err } @@ -16056,9 +17813,9 @@ func (p *PaperServiceGetDownloadUrlResult) ReadField0(iprot thrift.TProtocol) er return nil } -func (p *PaperServiceGetDownloadUrlResult) Write(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlForAndroidResult) Write(oprot thrift.TProtocol) (err error) { var fieldId int16 - if err = oprot.WriteStructBegin("GetDownloadUrl_result"); err != nil { + if err = oprot.WriteStructBegin("GetDownloadUrlForAndroid_result"); err != nil { goto WriteStructBeginError } if p != nil { @@ -16084,7 +17841,7 @@ WriteStructEndError: return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err) } -func (p *PaperServiceGetDownloadUrlResult) writeField0(oprot thrift.TProtocol) (err error) { +func (p *PaperServiceGetDownloadUrlForAndroidResult) writeField0(oprot thrift.TProtocol) (err error) { if p.IsSetSuccess() { if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil { goto WriteFieldBeginError @@ -16103,11 +17860,11 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err) } -func (p *PaperServiceGetDownloadUrlResult) String() string { +func (p *PaperServiceGetDownloadUrlForAndroidResult) String() string { if p == nil { return "" } - return fmt.Sprintf("PaperServiceGetDownloadUrlResult(%+v)", *p) + return fmt.Sprintf("PaperServiceGetDownloadUrlForAndroidResult(%+v)", *p) } diff --git a/api/model/model/model.go b/api/model/model/model.go index 0e41f07c..3caa75b1 100644 --- a/api/model/model/model.go +++ b/api/model/model/model.go @@ -2692,7 +2692,12 @@ func (p *Picture) String() string { } -// 又拍云文件目录结构 +/* +* @Description 又拍云文件目录结构 +* @Param basePath 当前所在路径 +* @Param files 当前所在目录文件 +* @Param folders 当前所在目录下的文件夹 + */ type UpYunFileDir struct { BasePath string `thrift:"basePath,1,required" form:"basePath,required" json:"basePath,required" query:"basePath,required"` Files []string `thrift:"files,2,required" form:"files,required" json:"files,required" query:"files,required"` @@ -4387,3 +4392,445 @@ func (p *UnifiedExam) String() string { return fmt.Sprintf("UnifiedExam(%+v)", *p) } + +type PaperData struct { + BasePath string `thrift:"base_path,1,required" form:"base_path,required" json:"base_path,required" query:"base_path,required"` + Files []string `thrift:"files,2,required" form:"files,required" json:"files,required" query:"files,required"` + Folders []string `thrift:"folders,3,required" form:"folders,required" json:"folders,required" query:"folders,required"` +} + +func NewPaperData() *PaperData { + return &PaperData{} +} + +func (p *PaperData) InitDefault() { +} + +func (p *PaperData) GetBasePath() (v string) { + return p.BasePath +} + +func (p *PaperData) GetFiles() (v []string) { + return p.Files +} + +func (p *PaperData) GetFolders() (v []string) { + return p.Folders +} + +var fieldIDToName_PaperData = map[int16]string{ + 1: "base_path", + 2: "files", + 3: "folders", +} + +func (p *PaperData) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + var issetBasePath bool = false + var issetFiles bool = false + var issetFolders bool = false + + 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 + } + issetBasePath = 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 + } + issetFiles = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.LIST { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + issetFolders = 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 + } + + if !issetBasePath { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetFiles { + fieldId = 2 + goto RequiredFieldNotSetError + } + + if !issetFolders { + 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_PaperData[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PaperData[fieldId])) +} + +func (p *PaperData) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.BasePath = _field + return nil +} +func (p *PaperData) ReadField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]string, 0, size) + for i := 0; i < size; i++ { + + var _elem string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _elem = v + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Files = _field + return nil +} +func (p *PaperData) ReadField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]string, 0, size) + for i := 0; i < size; i++ { + + var _elem string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _elem = v + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Folders = _field + return nil +} + +func (p *PaperData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("PaperData"); 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 *PaperData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("base_path", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.BasePath); 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 *PaperData) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("files", thrift.LIST, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRING, len(p.Files)); err != nil { + return err + } + for _, v := range p.Files { + if err := oprot.WriteString(v); 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 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} + +func (p *PaperData) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("folders", thrift.LIST, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRING, len(p.Folders)); err != nil { + return err + } + for _, v := range p.Folders { + if err := oprot.WriteString(v); 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 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *PaperData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PaperData(%+v)", *p) + +} + +type PaperUrlData struct { + URL string `thrift:"url,1,required" form:"url,required" json:"url,required" query:"url,required"` +} + +func NewPaperUrlData() *PaperUrlData { + return &PaperUrlData{} +} + +func (p *PaperUrlData) InitDefault() { +} + +func (p *PaperUrlData) GetURL() (v string) { + return p.URL +} + +var fieldIDToName_PaperUrlData = map[int16]string{ + 1: "url", +} + +func (p *PaperUrlData) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + var issetURL bool = false + + 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 + } + issetURL = 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 + } + + if !issetURL { + 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_PaperUrlData[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PaperUrlData[fieldId])) +} + +func (p *PaperUrlData) ReadField1(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 *PaperUrlData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("PaperUrlData"); 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 *PaperUrlData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("url", thrift.STRING, 1); 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 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *PaperUrlData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PaperUrlData(%+v)", *p) + +} diff --git a/api/pack/paper.go b/api/pack/paper.go index b737c277..edca87c9 100644 --- a/api/pack/paper.go +++ b/api/pack/paper.go @@ -17,8 +17,12 @@ limitations under the License. package pack import ( + "github.com/cloudwego/hertz/pkg/app" + "github.com/cloudwego/hertz/pkg/protocol/consts" + api "github.com/west2-online/fzuhelper-server/api/model/model" "github.com/west2-online/fzuhelper-server/kitex_gen/model" + "github.com/west2-online/fzuhelper-server/pkg/errno" ) func BuildUpYunFileDir(res *model.UpYunFileDir) *api.UpYunFileDir { @@ -28,3 +32,26 @@ func BuildUpYunFileDir(res *model.UpYunFileDir) *api.UpYunFileDir { Files: res.Files, } } + +type RespWithDataInPaper struct { + Code int `json:"code"` + Data any `json:"data"` + Msg string `json:"msg"` +} + +func RespDataInPaper(c *app.RequestContext, data any) { + c.JSON(consts.StatusOK, RespWithDataInPaper{ + Code: errno.SuccessCodePaper, + Msg: "Success", + Data: data, + }) +} + +func RespErrorInPaper(c *app.RequestContext, err error) { + Errno := errno.ConvertErr(err) + c.JSON(consts.StatusOK, RespWithDataInPaper{ + Code: int(Errno.ErrorCode), + Msg: Errno.ErrorMsg, + Data: nil, + }) +} diff --git a/api/router/api/api.go b/api/router/api/api.go index ff98ad4f..19d2743b 100644 --- a/api/router/api/api.go +++ b/api/router/api/api.go @@ -36,8 +36,14 @@ func Register(r *server.Hertz) { root := r.Group("/", rootMw()...) { _api := root.Group("/api", _apiMw()...) + { + _login := _api.Group("/login", _loginMw()...) + _login.POST("/validateCode", append(_validatecodeforandroidMw(), api.ValidateCodeForAndroid)...) + } { _v1 := _api.Group("/v1", _v1Mw()...) + _v1.GET("/downloadUrl", append(_getdownloadurlforandroidMw(), api.GetDownloadUrlForAndroid)...) + _v1.GET("/list", append(_listdirfilesforandroidMw(), api.ListDirFilesForAndroid)...) { _common := _v1.Group("/common", _commonMw()...) { diff --git a/api/router/api/middleware.go b/api/router/api/middleware.go index a7a1f37c..e340f0bf 100644 --- a/api/router/api/middleware.go +++ b/api/router/api/middleware.go @@ -276,3 +276,23 @@ func _validatecodeMw() []app.HandlerFunc { // your code... return nil } + +func _loginMw() []app.HandlerFunc { + // your code... + return nil +} + +func _validatecodeforandroidMw() []app.HandlerFunc { + // your code... + return nil +} + +func _getdownloadurlforandroidMw() []app.HandlerFunc { + // your code... + return nil +} + +func _listdirfilesforandroidMw() []app.HandlerFunc { + // your code... + return nil +} diff --git a/api/router/custom_router.go b/api/router/custom_router.go index 7bb28692..5755df92 100644 --- a/api/router/custom_router.go +++ b/api/router/custom_router.go @@ -42,7 +42,21 @@ func customizedRegister(r *server.Hertz) { r.GET("/api/image/point", api.AddImagePointTime) r.GET("/api/screen", api.MobileGetImage) - // 历年卷兼容 - r.GET("/api/v1/list", api.ListDirFiles) - r.GET("/api/v1/downloadUrl", api.GetDownloadUrl) + // url服务的兼容 + /* + 旧的fuu客户端采取的是 + r.GET("/onekey/FZUHelper.html", api.FZUHelperHTML) 对应 福uu隐私政策 + r.GET("/onekey/UserAgreement.html", api.UserAgreementHTML) 对应 福uu用户服务协议 + + 隐私政策和用户协议对应url前缀 + const val USER_AGREEMENT = "https://iosfzuhelper.west2online.com/onekey/UserAgreement.html" + const val PRIVACY_POLICY = "https://iosfzuhelper.west2online.com/onekey/FZUHelper.html" + 飞书文档:https://west2-online.feishu.cn/wiki/AGaHw9B2EiEV04knIHEczlTxn5f + + r.GET("/onekey/FZUHelper.css", api.FZUHelperCSS) FZUHelper.html需要这个来正常呈现结果 + + */ + r.GET("/onekey/FZUHelper.html", api.FZUHelperHTML) + r.GET("/onekey/UserAgreement.html", api.UserAgreementHTML) + r.GET("/onekey/FZUHelper.css", api.FZUHelperCSS) } diff --git a/config/config.example.yaml b/config/config.example.yaml index c09fd7c8..f2b9ffd2 100644 --- a/config/config.example.yaml +++ b/config/config.example.yaml @@ -33,6 +33,7 @@ upyuns: token-secret: "" token-timeout: 0 uss-domain: "" + download-domain: "" path: "/pictures/" paper: bucket: "fzuhelper-paper-cos" @@ -41,6 +42,7 @@ upyuns: token-secret: "" token-timeout: 60 uss-domain: "" + download-domain: "" path: "/__Unchecked_adjowe/" elasticsearch: diff --git a/config/config.go b/config/config.go index f933aeb5..8183de65 100644 --- a/config/config.go +++ b/config/config.go @@ -17,14 +17,14 @@ limitations under the License. package config import ( + "errors" "os" "github.com/fsnotify/fsnotify" "github.com/spf13/viper" + _ "github.com/spf13/viper/remote" "github.com/west2-online/fzuhelper-server/pkg/logger" - - _ "github.com/spf13/viper/remote" ) var ( @@ -60,10 +60,9 @@ func Init(service string) { runtime_viper.SetConfigName("config") runtime_viper.SetConfigType("yaml") if err := runtime_viper.ReadRemoteConfig(); err != nil { - if _, ok := err.(viper.ConfigFileNotFoundError); ok { + var configFileNotFoundError viper.ConfigFileNotFoundError + if errors.As(err, &configFileNotFoundError) { logger.Fatal("config.Init: could not find config files") - } else { - logger.Fatal("config.Init: read config error: %v", err) } logger.Fatal("config.Init: read config error: %v", err) } diff --git a/config/types.go b/config/types.go index 392c53f8..94bc73c4 100644 --- a/config/types.go +++ b/config/types.go @@ -96,13 +96,14 @@ type defaultUser struct { * @UnCheckedDir: 上传目录 */ type upyun struct { - Bucket string - Operator string - Password string - TokenSecret string `mapstructure:"token-secret"` - TokenTimeout int64 `mapstructure:"token-timeout"` - UssDomain string `mapstructure:"uss-domain"` - Path string + Bucket string + Operator string + Password string + TokenSecret string `mapstructure:"token-secret"` + TokenTimeout int64 `mapstructure:"token-timeout"` + UssDomain string `mapstructure:"uss-domain"` + DownloadDomain string `mapstructure:"download-domain"` + Path string } type config struct { diff --git a/go.mod b/go.mod index c075eced..9019322a 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/cloudwego/kitex v0.11.3 github.com/elastic/go-elasticsearch v0.0.0 github.com/fsnotify/fsnotify v1.8.0 + github.com/hertz-contrib/jwt v1.0.2 github.com/kitex-contrib/obs-opentelemetry/logging/zap v0.0.0-20241010093641-c58c6426d043 github.com/kitex-contrib/registry-etcd v0.2.5 github.com/opentracing/opentracing-go v1.2.0 @@ -26,6 +27,10 @@ require ( k8s.io/client-go v0.31.2 ) +require github.com/h2non/filetype v1.1.3 + +require github.com/golang-jwt/jwt/v4 v4.4.2 // indirect + require ( cloud.google.com/go v0.116.0 // indirect cloud.google.com/go/auth v0.10.0 // indirect diff --git a/go.sum b/go.sum index 11eacb70..5be5d670 100644 --- a/go.sum +++ b/go.sum @@ -60,8 +60,8 @@ github.com/bytedance/gopkg v0.1.1/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP github.com/bytedance/mockey v1.2.13 h1:jokWZAm/pUEbD939Rhznz615MKUCZNuvCFQlJ2+ntoo= github.com/bytedance/mockey v1.2.13/go.mod h1:1BPHF9sol5R1ud/+0VEHGQq/+i2lN+GTsr3O2Q9IENY= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= -github.com/bytedance/sonic v1.12.4 h1:9Csb3c9ZJhfUWeMtpCDCq6BUoH5ogfDFLUgQ/jG+R0k= -github.com/bytedance/sonic v1.12.4/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= +github.com/bytedance/sonic v1.12.3 h1:W2MGa7RCU1QTeYRTPE3+88mVC0yXmsRQRChiyVocVjU= +github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.2.1 h1:1GgorWTqf12TA8mma4DDSbaQigE2wOgQo7iCjjJv3+E= github.com/bytedance/sonic/loader v0.2.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= @@ -98,8 +98,8 @@ github.com/cloudwego/netpoll v0.6.4 h1:z/dA4sOTUQof6zZIO4QNnLBXsDFFFEos9OOGloR6k github.com/cloudwego/netpoll v0.6.4/go.mod h1:BtM+GjKTdwKoC8IOzD08/+8eEn2gYoiNLipFca6BVXQ= github.com/cloudwego/runtimex v0.1.1 h1:lheZjFOyKpsq8TsGGfmX9/4O7F0TKpWmB8on83k7GE8= github.com/cloudwego/runtimex v0.1.1/go.mod h1:23vL/HGV0W8nSCHbe084AgEBdDV4rvXenEUMnUNvUd8= -github.com/cloudwego/thriftgo v0.3.18 h1:gnr1vz7G3RbwwCK9AMKHZf63VYGa7ene6WbI9VrBJSw= -github.com/cloudwego/thriftgo v0.3.18/go.mod h1:AdLEJJVGW/ZJYvkkYAZf5SaJH+pA3OyC801WSwqcBwI= +github.com/cloudwego/thriftgo v0.3.17 h1:k0iQe2jEAN1WhPsXWvatwHzoxObUSX2Nw5NqdnywS8k= +github.com/cloudwego/thriftgo v0.3.17/go.mod h1:AdLEJJVGW/ZJYvkkYAZf5SaJH+pA3OyC801WSwqcBwI= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= @@ -195,8 +195,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20241101162523-b92577c0c142 h1:sAGdeJj0bnMgUNVeUpp6AYlVdCt3/GdI3pGRqsNSQLs= -github.com/google/pprof v0.0.0-20241101162523-b92577c0c142/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -219,6 +219,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 h1:RtRsiaGvWxcwd8y3BiRZxsylPT8hLWZ5SPcfI+3IDNk= github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0/go.mod h1:TzP6duP4Py2pHLVPPQp42aoYI92+PCrVotyR5e8Vqlk= +github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= +github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= github.com/hashicorp/consul/api v1.30.0 h1:ArHVMMILb1nQv8vZSGIwwQd2gtc+oSQZ6CalyiyH2XQ= github.com/hashicorp/consul/api v1.30.0/go.mod h1:B2uGchvaXVW2JhFoS8nqTxMD5PBykr4ebY4JWHTTeLM= github.com/hashicorp/consul/sdk v0.16.1 h1:V8TxTnImoPD5cj0U9Spl0TUxcytjcbbJeADFF07KdHg= @@ -265,6 +267,8 @@ github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= +github.com/hertz-contrib/jwt v1.0.2 h1:sAW3wqgBDsbPKr5JWJRObY61jg1NqYkUCg+o8UXLsaI= +github.com/hertz-contrib/jwt v1.0.2/go.mod h1:3zUSK+44dcw/9z/89JZ+mA0FoyhmVN7Hx+f46ucVV4I= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -679,19 +683,19 @@ gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJ gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -google.golang.org/api v0.204.0 h1:3PjmQQEDkR/ENVZZwIYB4W/KzYtN8OrqnNcHWpeR8E4= -google.golang.org/api v0.204.0/go.mod h1:69y8QSoKIbL9F94bWgWAq6wGqGwyjBgi2y8rAK8zLag= +google.golang.org/api v0.203.0 h1:SrEeuwU3S11Wlscsn+LA1kb/Y5xT8uggJSkIhD08NAU= +google.golang.org/api v0.203.0/go.mod h1:BuOVyCSYEPwJb3npWvDnNmFI92f3GeRnHNkETneT3SI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 h1:KJjNNclfpIkVqrZlTWcgOOaVQ00LdBnoEaRfkUx760s= -google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:mt9/MofW7AWQ+Gy179ChOnvmJatV8YHUmrcedo9CIFI= -google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= -google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 h1:Q3nlH8iSQSRUwOskjbcSMcF2jiYMNiQYZ0c2KEJLKKU= +google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38/go.mod h1:xBI+tzfqGGN2JBeSebfKXFSdBpWVQ7sLW40PTupVRm4= +google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw= +google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -744,8 +748,8 @@ k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc= k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 h1:jGnCPejIetjiy2gqaJ5V0NLwTpF4wbQ6cZIItJCSHno= -k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI= +k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= diff --git a/idl/api.thrift b/idl/api.thrift index 62f6e5ca..6c17201f 100644 --- a/idl/api.thrift +++ b/idl/api.thrift @@ -34,10 +34,18 @@ struct ValidateCodeRequest { struct ValidateCodeResponse { } +// Android兼容 +struct ValidateCodeForAndroidRequest { + 1: required string validateCode +} + +struct ValidateCodeForAndroidResponse { +} service UserService { GetLoginDataResponse GetLoginData(1: GetLoginDataRequest request)(api.get="/api/v1/jwch/user/login"), ValidateCodeResponse ValidateCode(1: ValidateCodeRequest request)(api.post="/api/v1/jwch/user/validateCode") + ValidateCodeForAndroidResponse ValidateCodeForAndroid(1: ValidateCodeForAndroidRequest request)(api.post="/api/login/validateCode") } // course @@ -165,16 +173,38 @@ struct ListDirFilesResponse { } struct GetDownloadUrlRequest { - 1: required string url, + 1: required string filepath, } struct GetDownloadUrlResponse { 1: required string url, } +// 兼容 +struct ListDirFilesForAndroidRequest { + 1: required string path, +} + +struct ListDirFilesForAndroidResponse { + +} + +struct GetDownloadUrlForAndroidRequest { + 1: required string filepath, +} + +struct GetDownloadUrlForAndroidResponse { + +} + + service PaperService { ListDirFilesResponse ListDirFiles(1: ListDirFilesRequest req) (api.get="/api/v1/paper/list"), GetDownloadUrlResponse GetDownloadUrl(1: GetDownloadUrlRequest req) (api.get="/api/v1/paper/download"), + + // 兼容安卓 + ListDirFilesForAndroidResponse ListDirFilesForAndroid(1: ListDirFilesForAndroidRequest req) (api.get="/api/v1/list") + GetDownloadUrlForAndroidResponse GetDownloadUrlForAndroid(1: GetDownloadUrlForAndroidRequest req) (api.get="/api/v1/downloadUrl") } // academic diff --git a/idl/launch_screen.thrift b/idl/launch_screen.thrift index 2fc2c569..c1116c6e 100644 --- a/idl/launch_screen.thrift +++ b/idl/launch_screen.thrift @@ -15,6 +15,7 @@ struct CreateImageRequest { 11:required string text, 12:required string regex, 13:i64 buffer_count, + 14:string suffix, } struct CreateImageResponse{ @@ -58,6 +59,7 @@ struct ChangeImageRequest { 1:required i64 picture_id, 2:required binary image, 3:i64 buffer_count, + 4:string suffix, } struct ChangeImageResponse{ diff --git a/idl/model.thrift b/idl/model.thrift index 76357f9a..9ba2d98f 100644 --- a/idl/model.thrift +++ b/idl/model.thrift @@ -63,7 +63,13 @@ struct Picture{ 16:string regex, // 推送对象,通过正则里是否有学号来判断是否为推送目标 } -// 又拍云文件目录结构 + +/* +* @Description 又拍云文件目录结构 +* @Param basePath 当前所在路径 +* @Param files 当前所在目录文件 +* @Param folders 当前所在目录下的文件夹 +*/ struct UpYunFileDir { 1: required string basePath, 2: required list files, @@ -104,3 +110,15 @@ struct UnifiedExam { 2: required string score 3: required string term } + + + +struct PaperData { + 1: required string base_path, + 2: required list files, + 3: required list folders, +} + +struct PaperUrlData { + 1: required string url, +} \ No newline at end of file diff --git a/idl/paper.thrift b/idl/paper.thrift index 765f935f..12c1eb35 100644 --- a/idl/paper.thrift +++ b/idl/paper.thrift @@ -13,7 +13,7 @@ struct ListDirFilesResponse { } struct GetDownloadUrlRequest { - 1: required string url, + 1: required string filepath, } struct GetDownloadUrlResponse { diff --git a/internal/classroom/handler.go b/internal/classroom/handler.go index 213b7d9e..7fc18db8 100644 --- a/internal/classroom/handler.go +++ b/internal/classroom/handler.go @@ -25,10 +25,17 @@ import ( "github.com/west2-online/fzuhelper-server/internal/classroom/service" "github.com/west2-online/fzuhelper-server/kitex_gen/classroom" "github.com/west2-online/fzuhelper-server/pkg/base" + "github.com/west2-online/fzuhelper-server/pkg/constants" "github.com/west2-online/fzuhelper-server/pkg/logger" "github.com/west2-online/fzuhelper-server/pkg/utils" ) +const ( + HoursInADay = 24 + MinDateDiff = 0 + MaxDateDiff = 30 +) + // ClassroomServiceImpl implements the last service interface defined in the IDL. type ClassroomServiceImpl struct { ClientSet *base.ClientSet @@ -51,10 +58,10 @@ func (s *ClassroomServiceImpl) GetEmptyRoom(ctx context.Context, req *classroom. resp.Base = base.BuildBaseResp(err) return resp, nil } - now := time.Now().Truncate(24 * time.Hour) - requestDate = requestDate.Truncate(24 * time.Hour) - dateDiff := requestDate.Sub(now).Hours() / 24 - if dateDiff < 0 || dateDiff > 30 { + now := time.Now().Truncate(constants.OneDay) + requestDate = requestDate.Truncate(constants.OneDay) + dateDiff := requestDate.Sub(now).Hours() / HoursInADay + if dateDiff < MinDateDiff || dateDiff > MaxDateDiff { err = fmt.Errorf("date out of range, date: %v", req.Date) logger.Infof("Classroom.GetEmptyRoom: %v", err) resp.Base = base.BuildBaseResp(err) diff --git a/internal/classroom/service/get_room_test.go b/internal/classroom/service/get_room_test.go index 43f0747e..965673fa 100644 --- a/internal/classroom/service/get_room_test.go +++ b/internal/classroom/service/get_room_test.go @@ -24,6 +24,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/west2-online/fzuhelper-server/kitex_gen/classroom" + "github.com/west2-online/fzuhelper-server/pkg/base" + "github.com/west2-online/fzuhelper-server/pkg/cache" + classroomCache "github.com/west2-online/fzuhelper-server/pkg/cache/classroom" ) func TestGetEmptyRoom(t *testing.T) { @@ -66,13 +69,18 @@ func TestGetEmptyRoom(t *testing.T) { // 运行所有测试用例 for _, tc := range tests { mockey.PatchConvey(tc.name, t, func() { - classroomService := NewClassroomService(context.Background(), nil) - + // mock 对象 + mockClientSet := new(base.ClientSet) + mockClientSet.CacheClient = new(cache.Cache) // 根据测试用例设置 Mock 行为 - mockey.Mock(classroomService.cache.IsKeyExist).Return(tc.mockIsExist).Build() + mockey.Mock((*cache.Cache).IsKeyExist).Return(tc.mockIsExist).Build() + + // mockey.Mock(classroomService.cache.IsKeyExist).Return(tc.mockIsExist).Build() if tc.mockIsExist { - mockey.Mock(classroomService.cache.Classroom.GetEmptyRoomCache).Return(tc.mockReturn, nil).Build() + mockey.Mock((*classroomCache.CacheClassroom).GetEmptyRoomCache).Return(tc.mockReturn, nil).Build() + // mockey.Mock(classroomService.cache.Classroom.GetEmptyRoomCache).Return(tc.mockReturn, nil).Build() } + classroomService := NewClassroomService(context.Background(), mockClientSet) // 调用 GetEmptyRoom 方法 result, err := classroomService.GetEmptyRoom(req) diff --git a/internal/classroom/syncer/workqueue.go b/internal/classroom/syncer/workqueue.go index 385c5c5e..5163cfe0 100644 --- a/internal/classroom/syncer/workqueue.go +++ b/internal/classroom/syncer/workqueue.go @@ -27,6 +27,13 @@ import ( "github.com/west2-online/fzuhelper-server/pkg/logger" ) +const ( + baseDelay = 2 + maxDelay = 1000 + maxTokens = 100 + maxRate = rate.Limit(10) +) + type EmptyRoomSyncer struct { workQueue workqueue.TypedRateLimitingInterface[string] cache *cache.Cache @@ -44,7 +51,8 @@ func InitEmptyRoomSyncer(cache *cache.Cache) *EmptyRoomSyncer { // 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](5, 1000), &workqueue.TypedBucketRateLimiter[string]{Limiter: rate.NewLimiter(rate.Limit(10), 100)}), + workqueue.NewTypedMaxOfRateLimiter[string](workqueue.NewTypedItemExponentialFailureRateLimiter[string](baseDelay, maxDelay), + &workqueue.TypedBucketRateLimiter[string]{Limiter: rate.NewLimiter(maxRate, maxTokens)}), ), ), } diff --git a/internal/course/service/service.go b/internal/course/service/service.go index e82e44a4..daaa92e6 100644 --- a/internal/course/service/service.go +++ b/internal/course/service/service.go @@ -19,10 +19,9 @@ package service import ( "context" - "github.com/west2-online/fzuhelper-server/pkg/utils" - "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/db" + "github.com/west2-online/fzuhelper-server/pkg/utils" ) type CourseService struct { diff --git a/internal/launch_screen/handler.go b/internal/launch_screen/handler.go index f641d3a1..f927f51d 100644 --- a/internal/launch_screen/handler.go +++ b/internal/launch_screen/handler.go @@ -72,7 +72,9 @@ func (s *LaunchScreenServiceImpl) CreateImage(stream launch_screen.LaunchScreenS } // GetImage implements the LaunchScreenServiceImpl interface. -func (s *LaunchScreenServiceImpl) GetImage(ctx context.Context, req *launch_screen.GetImageRequest) (resp *launch_screen.GetImageResponse, err error) { +func (s *LaunchScreenServiceImpl) GetImage(ctx context.Context, req *launch_screen.GetImageRequest) ( + resp *launch_screen.GetImageResponse, err error, +) { resp = new(launch_screen.GetImageResponse) pic, err := service.NewLaunchScreenService(ctx, s.ClientSet).GetImageById(req.PictureId) @@ -86,7 +88,9 @@ func (s *LaunchScreenServiceImpl) GetImage(ctx context.Context, req *launch_scre } // ChangeImageProperty implements the LaunchScreenServiceImpl interface. -func (s *LaunchScreenServiceImpl) ChangeImageProperty(ctx context.Context, req *launch_screen.ChangeImagePropertyRequest) (resp *launch_screen.ChangeImagePropertyResponse, err error) { +func (s *LaunchScreenServiceImpl) ChangeImageProperty(ctx context.Context, + req *launch_screen.ChangeImagePropertyRequest, +) (resp *launch_screen.ChangeImagePropertyResponse, err error) { resp = new(launch_screen.ChangeImagePropertyResponse) pic, err := service.NewLaunchScreenService(ctx, s.ClientSet).UpdateImageProperty(req) resp.Base = base.BuildBaseResp(err) @@ -147,7 +151,9 @@ func (s *LaunchScreenServiceImpl) DeleteImage(ctx context.Context, req *launch_s } // MobileGetImage implements the LaunchScreenServiceImpl interface. -func (s *LaunchScreenServiceImpl) MobileGetImage(ctx context.Context, req *launch_screen.MobileGetImageRequest) (resp *launch_screen.MobileGetImageResponse, err error) { +func (s *LaunchScreenServiceImpl) MobileGetImage(ctx context.Context, req *launch_screen.MobileGetImageRequest) ( + resp *launch_screen.MobileGetImageResponse, err error, +) { resp = new(launch_screen.MobileGetImageResponse) pictureList, cnt, err := service.NewLaunchScreenService(ctx, s.ClientSet).MobileGetImage(req) if err != nil { @@ -163,7 +169,9 @@ func (s *LaunchScreenServiceImpl) MobileGetImage(ctx context.Context, req *launc } // AddImagePointTime implements the LaunchScreenServiceImpl interface. -func (s *LaunchScreenServiceImpl) AddImagePointTime(ctx context.Context, req *launch_screen.AddImagePointTimeRequest) (resp *launch_screen.AddImagePointTimeResponse, err error) { +func (s *LaunchScreenServiceImpl) AddImagePointTime(ctx context.Context, req *launch_screen.AddImagePointTimeRequest) ( + resp *launch_screen.AddImagePointTimeResponse, err error, +) { resp = new(launch_screen.AddImagePointTimeResponse) err = service.NewLaunchScreenService(ctx, s.ClientSet).AddPointTime(req.PictureId) resp.Base = base.BuildBaseResp(err) diff --git a/internal/launch_screen/pack/image.go b/internal/launch_screen/pack/image.go index 283c2298..95de56c9 100644 --- a/internal/launch_screen/pack/image.go +++ b/internal/launch_screen/pack/image.go @@ -17,6 +17,9 @@ limitations under the License. package pack import ( + "strings" + + "github.com/west2-online/fzuhelper-server/config" "github.com/west2-online/fzuhelper-server/kitex_gen/model" db "github.com/west2-online/fzuhelper-server/pkg/db/model" ) @@ -24,7 +27,7 @@ import ( func BuildImageResp(dbP *db.Picture) *model.Picture { return &model.Picture{ Id: dbP.ID, - Url: dbP.Url, + Url: strings.Join([]string{config.UpYun.DownloadDomain, strings.TrimPrefix(dbP.Url, config.UpYun.UssDomain)}, ""), Href: dbP.Href, Text: dbP.Text, Type: dbP.PicType, diff --git a/internal/launch_screen/service/create_image.go b/internal/launch_screen/service/create_image.go index bc7457ee..7a2a9f19 100644 --- a/internal/launch_screen/service/create_image.go +++ b/internal/launch_screen/service/create_image.go @@ -25,16 +25,14 @@ import ( "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/upyun" - "github.com/west2-online/fzuhelper-server/pkg/utils" ) func (s *LaunchScreenService) CreateImage(req *launch_screen.CreateImageRequest) (pic *model.Picture, err error) { - Loc := utils.LoadCNLocation() id, err := s.sf.NextVal() if err != nil { return nil, fmt.Errorf("LaunchScreen.CreateImage SFCreateIDError:%w", err) } - imgUrl := upyun.GenerateImgName(id) + imgUrl := upyun.GenerateImgName(id, req.Suffix) var eg errgroup.Group eg.Go(func() error { @@ -52,8 +50,8 @@ func (s *LaunchScreenService) CreateImage(req *launch_screen.CreateImageRequest) StartTime: req.StartTime, EndTime: req.EndTime, Regex: req.Regex, - StartAt: time.Unix(req.StartAt, 0).In(Loc), - EndAt: time.Unix(req.EndAt, 0).In(Loc), + StartAt: time.Unix(req.StartAt, 0), + EndAt: time.Unix(req.EndAt, 0), } pic, err = s.db.LaunchScreen.CreateImage(s.ctx, pictureModel) return err diff --git a/internal/launch_screen/service/create_image_test.go b/internal/launch_screen/service/create_image_test.go index ec50c875..77cbf035 100644 --- a/internal/launch_screen/service/create_image_test.go +++ b/internal/launch_screen/service/create_image_test.go @@ -25,8 +25,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/errno" "github.com/west2-online/fzuhelper-server/pkg/upyun" @@ -92,14 +94,15 @@ func TestLaunchScreenService_CreateImage(t *testing.T) { defer mockey.UnPatchAll() for _, tc := range testCases { mockey.PatchConvey(tc.name, t, func() { - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) - mockey.Mock(launchScreenService.sf.NextVal).To(func() (int64, error) { return expectedResult.ID, nil }).Build() - mockey.Mock(upyun.GenerateImgName).Return(expectedResult.Url).Build() - mockey.Mock(launchScreenService.db.LaunchScreen.CreateImage).Return(tc.mockReturn, nil).Build() + mockey.Mock((*utils.Snowflake).NextVal).To(func() (int64, error) { return expectedResult.ID, nil }).Build() + mockey.Mock(upyun.GenerateImgName).To(func(id int64, suffix string) string { return expectedResult.Url }).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).CreateImage).Return(tc.mockReturn, nil).Build() mockey.Mock(upyun.UploadImg).Return(tc.mockCloudReturn).Build() result, err := launchScreenService.CreateImage(req) diff --git a/internal/launch_screen/service/delete_image_test.go b/internal/launch_screen/service/delete_image_test.go index f767ec6c..49da07e0 100644 --- a/internal/launch_screen/service/delete_image_test.go +++ b/internal/launch_screen/service/delete_image_test.go @@ -25,8 +25,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/errno" "github.com/west2-online/fzuhelper-server/pkg/upyun" @@ -80,12 +82,13 @@ func TestLaunchScreenService_DeleteImage(t *testing.T) { for _, tc := range testCases { mockey.PatchConvey(tc.name, t, func() { - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) - mockey.Mock(launchScreenService.db.LaunchScreen.DeleteImage).Return(tc.mockReturn, nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).DeleteImage).Return(tc.mockReturn, nil).Build() mockey.Mock(upyun.DeleteImg).Return(tc.mockCloudReturn).Build() err := launchScreenService.DeleteImage(req.PictureId) diff --git a/internal/launch_screen/service/get_image_test.go b/internal/launch_screen/service/get_image_test.go index 045eca7b..c15b83c2 100644 --- a/internal/launch_screen/service/get_image_test.go +++ b/internal/launch_screen/service/get_image_test.go @@ -26,8 +26,10 @@ import ( "gorm.io/gorm" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/utils" ) @@ -79,14 +81,16 @@ func TestLaunchScreenService_GetImageById(t *testing.T) { for _, tc := range testCases { mockey.PatchConvey(tc.name, t, func() { - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) + if tc.mockIsExist { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageById).Return(tc.mockReturn, nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageById).Return(tc.mockReturn, nil).Build() } else { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageById).Return(nil, tc.mockReturn).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageById).Return(nil, tc.mockReturn).Build() } result, err := launchScreenService.GetImageById(req.PictureId) if tc.expectingError { diff --git a/internal/launch_screen/service/mobile_get.go b/internal/launch_screen/service/mobile_get.go index 9c5973f6..32465bed 100644 --- a/internal/launch_screen/service/mobile_get.go +++ b/internal/launch_screen/service/mobile_get.go @@ -32,128 +32,139 @@ import ( ) func (s *LaunchScreenService) MobileGetImage(req *launch_screen.MobileGetImageRequest) (respList *[]model.Picture, cntResp int64, err error) { - getFromMysql := false - if !s.cache.IsKeyExist(s.ctx, utils.GenerateRedisKeyByStuId(req.StudentId, req.SType)) { - // no cache exist - getFromMysql = true - } - - if !getFromMysql { - if s.cache.LaunchScreen.IsLastLaunchScreenIdCacheExist(s.ctx) { - id, err := s.db.LaunchScreen.GetLastImageId(s.ctx) - if err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.GetLastImageId error:%v", err.Error()) - } - cacheId, err := s.cache.LaunchScreen.GetLastLaunchScreenIdCache(s.ctx) - if err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage cache.GetLastLaunchScreenIdCache error:%v", err.Error()) - } - // 当最新存入图片id与缓存中的不一致时,需要重新获取 - if cacheId != id { - getFromMysql = true - } - } else { - getFromMysql = true - } + getFromMysql, err := s.shouldGetFromMySQL(req.StudentId, req.SType) + if err != nil { + return nil, 0, err } if !getFromMysql { // 直接从缓存中获取id imgIdList, err := s.cache.LaunchScreen.GetLaunchScreenCache(s.ctx, utils.GenerateRedisKeyByStuId(req.StudentId, req.SType)) if err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage cache.GetLaunchScreenCache error:%v", err.Error()) + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage cache.GetLaunchScreenCache error:%w", err) } respList, cntResp, err = s.db.LaunchScreen.GetImageByIdList(s.ctx, &imgIdList) if err != nil { if errors.Is(err, gorm.ErrRecordNotFound) { getFromMysql = true } else { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.GetImageByIdList error:%v", err.Error()) + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.GetImageByIdList error:%w", err) } } } if getFromMysql { - // 获取符合当前时间的imgList - imgList, cnt, err := s.db.LaunchScreen.GetImageBySType(s.ctx, req.SType) + return s.getImagesFromMySQL(req.StudentId, req.SType) + } + + // addShowtime for cache + if err = s.db.LaunchScreen.AddImageListShowTime(s.ctx, respList); err != nil { + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.AddImageListShowTime error:%w", err) + } + + return respList, cntResp, nil +} + +// shouldGetFromMySQL 确认缓存是否过期或不存在 +func (s *LaunchScreenService) shouldGetFromMySQL(studentId string, sType int64) (bool, error) { + if !s.cache.IsKeyExist(s.ctx, utils.GenerateRedisKeyByStuId(studentId, sType)) { + return true, nil + } + + if s.cache.LaunchScreen.IsLastLaunchScreenIdCacheExist(s.ctx) { + id, err := s.db.LaunchScreen.GetLastImageId(s.ctx) + if err != nil { + return true, fmt.Errorf("LaunchScreenService.MobileGetImage db.GetLastImageId error:%w", err) + } + cacheId, err := s.cache.LaunchScreen.GetLastLaunchScreenIdCache(s.ctx) if err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.GetImageBySType error:%v", err.Error()) + return true, fmt.Errorf("LaunchScreenService.MobileGetImage cache.GetLastLaunchScreenIdCache error:%w", err) } - // 没有符合条件的图片 - if cnt == 0 { - return nil, 0, errno.NoRunningPictureError + // 当最新存入图片id与缓存中的不一致时,需要重新获取 + if cacheId != id { + return true, nil } + } else { + return true, nil + } - // 从中筛选出JSON含当前学号的图片(regex) - cntResp = 0 - currentImgList := make([]model.Picture, 0) - for _, picture := range *imgList { - // 处理JSON - m := make(map[string]string) - if err = sonic.Unmarshal([]byte(picture.Regex), &m); err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage unmarshal JSON error:%v", err.Error()) - } + return false, nil +} - match := false - for k, v := range m { - if k == "picture_id" || k == "device" { - continue - } - // 此时key是student_id,value是学号JSON - match, err = regexp.MatchString(req.StudentId, v) - if err != nil { - continue - } - if !match { - continue - } - } - if match { - cntResp++ - currentImgList = append(currentImgList, picture) - } +// getImagesFromMySQL 从数据库中获取图片url +func (s *LaunchScreenService) getImagesFromMySQL(studentId string, sType int64) (*[]model.Picture, int64, error) { + // 获取符合当前时间的imgList + imgList, cnt, err := s.db.LaunchScreen.GetImageBySType(s.ctx, sType) + if err != nil { + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.GetImageBySType error:%w", err) + } + // 没有符合条件的图片 + if cnt == 0 { + return nil, 0, errno.NoRunningPictureError + } + + // 从中筛选出JSON含当前学号的图片(regex) + cntResp := int64(0) + currentImgList := make([]model.Picture, 0) + for _, picture := range *imgList { + // 处理JSON + m := make(map[string]string) + if err = sonic.Unmarshal([]byte(picture.Regex), &m); err != nil { + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage unmarshal JSON error:%w", err) } - if cntResp != 0 { - var eg errgroup.Group - eg.Go(func() error { - // addShowTime - return s.db.LaunchScreen.AddImageListShowTime(s.ctx, imgList) - }) - eg.Go(func() error { - // setIdCache - imgIdList := make([]int64, len(*imgList)) - - for i, img := range *imgList { - imgIdList[i] = img.ID - } - return s.cache.LaunchScreen.SetLaunchScreenCache(s.ctx, utils.GenerateRedisKeyByStuId(req.StudentId, req.SType), &imgIdList) - }) - eg.Go(func() error { - // setExpireCheckCache - id, err := s.db.LaunchScreen.GetLastImageId(s.ctx) - if err != nil { - return err - } - if err = s.cache.LaunchScreen.SetLastLaunchScreenIdCache(s.ctx, id); err != nil { - return err - } - return nil - }) - if err = eg.Wait(); err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage set cache error:%v", err.Error()) + match := false + for k, v := range m { + if k == "picture_id" || k == "device" { + continue + } + // 此时key是student_id,value是学号JSON + match, err = regexp.MatchString(studentId, v) + if err != nil { + continue + } + if !match { + continue } - } else { - return nil, 0, errno.NoRunningPictureError } - - return ¤tImgList, cntResp, nil + if match { + cntResp++ + currentImgList = append(currentImgList, picture) + } } - // addShowtime for cache - if err = s.db.LaunchScreen.AddImageListShowTime(s.ctx, respList); err != nil { - return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage db.AddImageListShowTime error:%v", err.Error()) + if cntResp != 0 { + var eg errgroup.Group + eg.Go(func() error { + // addShowTime + return s.db.LaunchScreen.AddImageListShowTime(s.ctx, imgList) + }) + eg.Go(func() error { + // setIdCache + imgIdList := make([]int64, len(*imgList)) + + for i, img := range *imgList { + imgIdList[i] = img.ID + } + return s.cache.LaunchScreen.SetLaunchScreenCache(s.ctx, utils.GenerateRedisKeyByStuId(studentId, sType), &imgIdList) + }) + eg.Go(func() error { + // setExpireCheckCache + id, err := s.db.LaunchScreen.GetLastImageId(s.ctx) + if err != nil { + return err + } + if err = s.cache.LaunchScreen.SetLastLaunchScreenIdCache(s.ctx, id); err != nil { + return err + } + return nil + }) + if err = eg.Wait(); err != nil { + return nil, -1, fmt.Errorf("LaunchScreenService.MobileGetImage set cache error:%w", err) + } + } else { + return nil, 0, errno.NoRunningPictureError } - return respList, cntResp, nil + return ¤tImgList, cntResp, nil } diff --git a/internal/launch_screen/service/mobile_get_test.go b/internal/launch_screen/service/mobile_get_test.go index 72810f09..be55f34a 100644 --- a/internal/launch_screen/service/mobile_get_test.go +++ b/internal/launch_screen/service/mobile_get_test.go @@ -25,8 +25,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" + launchScreenCache "github.com/west2-online/fzuhelper-server/pkg/cache/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/errno" "github.com/west2-online/fzuhelper-server/pkg/utils" @@ -142,25 +145,26 @@ func TestLaunchScreenService_MobileGetImage(t *testing.T) { // PatchConvey封装了testCase,在其中组织testCase逻辑,同时匿名函数中的mock行为只会在函数作用域中生效 mockey.PatchConvey(tc.name, t, func() { // 进行服务的初始化 - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) // 模拟外部依赖函数的行为,确保所以的外部函数不会影响到测试 - mockey.Mock(launchScreenService.cache.IsKeyExist).Return(tc.mockIsCacheExist).Build() - mockey.Mock(launchScreenService.cache.LaunchScreen.IsLastLaunchScreenIdCacheExist).Return(tc.mockExpireReturn).Build() - mockey.Mock(launchScreenService.db.LaunchScreen.GetLastImageId).Return(tc.mockDbLastIdReturn, nil).Build() - mockey.Mock(launchScreenService.cache.LaunchScreen.GetLastLaunchScreenIdCache).Return(tc.mockCacheLastIdReturn, nil).Build() - mockey.Mock(launchScreenService.cache.LaunchScreen.GetLaunchScreenCache).Return(tc.mockCacheReturn, nil).Build() + mockey.Mock((*cache.Cache).IsKeyExist).Return(tc.mockIsCacheExist).Build() + mockey.Mock((*launchScreenCache.CacheLaunchScreen).IsLastLaunchScreenIdCacheExist).Return(tc.mockExpireReturn).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetLastImageId).Return(tc.mockDbLastIdReturn, nil).Build() + mockey.Mock((*launchScreenCache.CacheLaunchScreen).GetLastLaunchScreenIdCache).Return(tc.mockCacheLastIdReturn, nil).Build() + mockey.Mock((*launchScreenCache.CacheLaunchScreen).GetLaunchScreenCache).Return(tc.mockCacheReturn, nil).Build() if tc.mockIsCacheExpire { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageBySType).Return(tc.mockDbReturn, len(*tc.mockDbReturn), nil).Build() - mockey.Mock(launchScreenService.cache.LaunchScreen.SetLaunchScreenCache).Return(nil).Build() - mockey.Mock(launchScreenService.cache.LaunchScreen.SetLastLaunchScreenIdCache).Return(nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageBySType).Return(tc.mockDbReturn, len(*tc.mockDbReturn), nil).Build() + mockey.Mock((*launchScreenCache.CacheLaunchScreen).SetLaunchScreenCache).Return(nil).Build() + mockey.Mock((*launchScreenCache.CacheLaunchScreen).SetLastLaunchScreenIdCache).Return(nil).Build() } else { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageByIdList).Return(tc.mockDbReturn, len(*tc.mockDbReturn), nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageByIdList).Return(tc.mockDbReturn, len(*tc.mockDbReturn), nil).Build() } - mockey.Mock(launchScreenService.db.LaunchScreen.AddImageListShowTime).Return(nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).AddImageListShowTime).Return(nil).Build() // 得到结果 result, _, err := launchScreenService.MobileGetImage(req) diff --git a/internal/launch_screen/service/point_time.go b/internal/launch_screen/service/point_time.go index 1f8ba893..d453b5f1 100644 --- a/internal/launch_screen/service/point_time.go +++ b/internal/launch_screen/service/point_time.go @@ -23,7 +23,7 @@ import ( func (s *LaunchScreenService) AddPointTime(id int64) error { err := s.db.LaunchScreen.AddPointTime(s.ctx, id) if err != nil { - return fmt.Errorf("LaunchScreenService.AddPointTime err: %v", err) + return fmt.Errorf("LaunchScreenService.AddPointTime err: %w", err) } return nil } diff --git a/internal/launch_screen/service/point_time_test.go b/internal/launch_screen/service/point_time_test.go index 5e243dab..398666fa 100644 --- a/internal/launch_screen/service/point_time_test.go +++ b/internal/launch_screen/service/point_time_test.go @@ -25,8 +25,10 @@ import ( "gorm.io/gorm" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/utils" ) @@ -54,12 +56,13 @@ func TestAddPointTime(t *testing.T) { for _, tc := range testCases { mockey.PatchConvey(tc.name, t, func() { - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) - mockey.Mock(launchScreenService.db.LaunchScreen.AddPointTime).Return(tc.mockReturn).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).AddPointTime).Return(tc.mockReturn).Build() err := launchScreenService.AddPointTime(req.PictureId) diff --git a/internal/launch_screen/service/update_image.go b/internal/launch_screen/service/update_image.go index 60d45788..92cbbe65 100644 --- a/internal/launch_screen/service/update_image.go +++ b/internal/launch_screen/service/update_image.go @@ -33,7 +33,7 @@ func (s *LaunchScreenService) UpdateImagePath(req *launch_screen.ChangeImageRequ } delUrl := origin.Url - imgUrl := upyun.GenerateImgName(req.PictureId) + imgUrl := upyun.GenerateImgName(req.PictureId, req.Suffix) var eg errgroup.Group var err2 error diff --git a/internal/launch_screen/service/update_image_property.go b/internal/launch_screen/service/update_image_property.go index 37602163..eddaa225 100644 --- a/internal/launch_screen/service/update_image_property.go +++ b/internal/launch_screen/service/update_image_property.go @@ -22,7 +22,6 @@ import ( "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" - "github.com/west2-online/fzuhelper-server/pkg/utils" ) func (s *LaunchScreenService) UpdateImageProperty(req *launch_screen.ChangeImagePropertyRequest) (*model.Picture, error) { @@ -30,15 +29,14 @@ func (s *LaunchScreenService) UpdateImageProperty(req *launch_screen.ChangeImage if err != nil { return nil, fmt.Errorf("LaunchScreenService.UpdateImageProperty error: %w", err) } - Loc := utils.LoadCNLocation() origin.PicType = req.PicType origin.SType = req.SType origin.Duration = *req.Duration origin.Href = *req.Href origin.Frequency = req.Frequency origin.Text = req.Text - origin.StartAt = time.Unix(req.StartAt, 0).In(Loc) - origin.EndAt = time.Unix(req.EndAt, 0).In(Loc) + origin.StartAt = time.Unix(req.StartAt, 0) + origin.EndAt = time.Unix(req.EndAt, 0) origin.StartTime = req.StartTime origin.EndTime = req.EndTime origin.Regex = req.Regex diff --git a/internal/launch_screen/service/update_image_property_test.go b/internal/launch_screen/service/update_image_property_test.go index b29fc258..8d2ad3cc 100644 --- a/internal/launch_screen/service/update_image_property_test.go +++ b/internal/launch_screen/service/update_image_property_test.go @@ -26,8 +26,10 @@ import ( "gorm.io/gorm" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/utils" ) @@ -109,16 +111,18 @@ func TestLaunchScreenService_UpdateImageProperty(t *testing.T) { for _, tc := range testCases { mockey.PatchConvey(tc.name, t, func() { - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) + if tc.mockIsExist { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageById).Return(tc.mockOriginReturn, nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageById).Return(tc.mockOriginReturn, nil).Build() } else { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageById).Return(nil, tc.mockOriginReturn).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageById).Return(nil, tc.mockOriginReturn).Build() } - mockey.Mock(launchScreenService.db.LaunchScreen.UpdateImage).Return(tc.mockReturn, nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).UpdateImage).Return(tc.mockReturn, nil).Build() result, err := launchScreenService.UpdateImageProperty(req) if tc.expectingError { diff --git a/internal/launch_screen/service/update_image_test.go b/internal/launch_screen/service/update_image_test.go index 48d2c59e..9b95f818 100644 --- a/internal/launch_screen/service/update_image_test.go +++ b/internal/launch_screen/service/update_image_test.go @@ -26,8 +26,10 @@ import ( "gorm.io/gorm" "github.com/west2-online/fzuhelper-server/kitex_gen/launch_screen" + "github.com/west2-online/fzuhelper-server/pkg/base" "github.com/west2-online/fzuhelper-server/pkg/cache" "github.com/west2-online/fzuhelper-server/pkg/db" + launchScreenDB "github.com/west2-online/fzuhelper-server/pkg/db/launch_screen" "github.com/west2-online/fzuhelper-server/pkg/db/model" "github.com/west2-online/fzuhelper-server/pkg/errno" "github.com/west2-online/fzuhelper-server/pkg/upyun" @@ -111,20 +113,22 @@ func TestLaunchScreenService_UpdateImagePath(t *testing.T) { for _, tc := range testCases { mockey.PatchConvey(tc.name, t, func() { - launchScreenService := NewLaunchScreenService(context.Background(), nil) - launchScreenService.sf = &utils.Snowflake{} - launchScreenService.db = &db.Database{} - launchScreenService.cache = &cache.Cache{} + mockClientSet := new(base.ClientSet) + mockClientSet.SFClient = new(utils.Snowflake) + mockClientSet.DBClient = new(db.Database) + mockClientSet.CacheClient = new(cache.Cache) + launchScreenService := NewLaunchScreenService(context.Background(), mockClientSet) if tc.mockIsExist { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageById).Return(tc.mockOriginReturn, nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageById).Return(tc.mockOriginReturn, nil).Build() } else { - mockey.Mock(launchScreenService.db.LaunchScreen.GetImageById).Return(nil, tc.mockOriginReturn).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).GetImageById).Return(nil, tc.mockOriginReturn).Build() } mockey.Mock(upyun.DeleteImg).Return(tc.mockCloudReturn).Build() mockey.Mock(upyun.UploadImg).Return(tc.mockCloudReturn).Build() + mockey.Mock(upyun.GenerateImgName).To(func(id int64, suffix string) string { return expectedResult.Url }).Build() - mockey.Mock(launchScreenService.db.LaunchScreen.UpdateImage).Return(tc.mockReturn, nil).Build() + mockey.Mock((*launchScreenDB.DBLaunchScreen).UpdateImage).Return(tc.mockReturn, nil).Build() result, err := launchScreenService.UpdateImagePath(req) if tc.expectingError { diff --git a/internal/paper/service/download_url.go b/internal/paper/service/download_url.go index 771d73de..565eed2e 100644 --- a/internal/paper/service/download_url.go +++ b/internal/paper/service/download_url.go @@ -22,5 +22,5 @@ import ( ) func (s *PaperService) GetDownloadUrl(req *paper.GetDownloadUrlRequest) (string, error) { - return upyun.GetDownloadUrl(req.Url) + return upyun.GetDownloadUrl(req.Filepath) } diff --git a/kitex_gen/launch_screen/k-launch_screen.go b/kitex_gen/launch_screen/k-launch_screen.go index f580631f..47770c0c 100644 --- a/kitex_gen/launch_screen/k-launch_screen.go +++ b/kitex_gen/launch_screen/k-launch_screen.go @@ -260,6 +260,20 @@ func (p *CreateImageRequest) FastRead(buf []byte) (int, error) { goto SkipFieldError } } + case 14: + if fieldTypeId == thrift.STRING { + l, err = p.FastReadField14(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 @@ -512,6 +526,20 @@ func (p *CreateImageRequest) FastReadField13(buf []byte) (int, error) { return offset, nil } +func (p *CreateImageRequest) FastReadField14(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.Suffix = _field + return offset, nil +} + // for compatibility func (p *CreateImageRequest) FastWrite(buf []byte) int { return 0 @@ -533,6 +561,7 @@ func (p *CreateImageRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) offset += p.fastWriteField4(buf[offset:], w) offset += p.fastWriteField11(buf[offset:], w) offset += p.fastWriteField12(buf[offset:], w) + offset += p.fastWriteField14(buf[offset:], w) } offset += thrift.Binary.WriteFieldStop(buf[offset:]) return offset @@ -554,6 +583,7 @@ func (p *CreateImageRequest) BLength() int { l += p.field11Length() l += p.field12Length() l += p.field13Length() + l += p.field14Length() } l += thrift.Binary.FieldStopLength() return l @@ -654,6 +684,13 @@ func (p *CreateImageRequest) fastWriteField13(buf []byte, w thrift.NocopyWriter) return offset } +func (p *CreateImageRequest) fastWriteField14(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 14) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, p.Suffix) + return offset +} + func (p *CreateImageRequest) field1Length() int { l := 0 l += thrift.Binary.FieldBeginLength() @@ -749,6 +786,13 @@ func (p *CreateImageRequest) field13Length() int { return l } +func (p *CreateImageRequest) field14Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(p.Suffix) + return l +} + func (p *CreateImageResponse) FastRead(buf []byte) (int, error) { var err error var offset int @@ -2009,6 +2053,20 @@ func (p *ChangeImageRequest) FastRead(buf []byte) (int, error) { goto SkipFieldError } } + case 4: + if fieldTypeId == thrift.STRING { + l, err = p.FastReadField4(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 @@ -2081,6 +2139,20 @@ func (p *ChangeImageRequest) FastReadField3(buf []byte) (int, error) { return offset, nil } +func (p *ChangeImageRequest) FastReadField4(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.Suffix = _field + return offset, nil +} + // for compatibility func (p *ChangeImageRequest) FastWrite(buf []byte) int { return 0 @@ -2092,6 +2164,7 @@ func (p *ChangeImageRequest) FastWriteNocopy(buf []byte, w thrift.NocopyWriter) offset += p.fastWriteField1(buf[offset:], w) offset += p.fastWriteField3(buf[offset:], w) offset += p.fastWriteField2(buf[offset:], w) + offset += p.fastWriteField4(buf[offset:], w) } offset += thrift.Binary.WriteFieldStop(buf[offset:]) return offset @@ -2103,6 +2176,7 @@ func (p *ChangeImageRequest) BLength() int { l += p.field1Length() l += p.field2Length() l += p.field3Length() + l += p.field4Length() } l += thrift.Binary.FieldStopLength() return l @@ -2129,6 +2203,13 @@ func (p *ChangeImageRequest) fastWriteField3(buf []byte, w thrift.NocopyWriter) return offset } +func (p *ChangeImageRequest) fastWriteField4(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 4) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, p.Suffix) + return offset +} + func (p *ChangeImageRequest) field1Length() int { l := 0 l += thrift.Binary.FieldBeginLength() @@ -2150,6 +2231,13 @@ func (p *ChangeImageRequest) field3Length() int { return l } +func (p *ChangeImageRequest) field4Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(p.Suffix) + return l +} + func (p *ChangeImageResponse) FastRead(buf []byte) (int, error) { var err error var offset int diff --git a/kitex_gen/launch_screen/launch_screen.go b/kitex_gen/launch_screen/launch_screen.go index fbbd62ce..d7aa0b99 100644 --- a/kitex_gen/launch_screen/launch_screen.go +++ b/kitex_gen/launch_screen/launch_screen.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 launch_screen @@ -44,6 +44,7 @@ type CreateImageRequest struct { Text string `thrift:"text,11,required" frugal:"11,required,string" json:"text"` Regex string `thrift:"regex,12,required" frugal:"12,required,string" json:"regex"` BufferCount int64 `thrift:"buffer_count,13" frugal:"13,default,i64" json:"buffer_count"` + Suffix string `thrift:"suffix,14" frugal:"14,default,string" json:"suffix"` } func NewCreateImageRequest() *CreateImageRequest { @@ -114,6 +115,10 @@ func (p *CreateImageRequest) GetRegex() (v string) { func (p *CreateImageRequest) GetBufferCount() (v int64) { return p.BufferCount } + +func (p *CreateImageRequest) GetSuffix() (v string) { + return p.Suffix +} func (p *CreateImageRequest) SetPicType(val int64) { p.PicType = val } @@ -153,6 +158,9 @@ func (p *CreateImageRequest) SetRegex(val string) { func (p *CreateImageRequest) SetBufferCount(val int64) { p.BufferCount = val } +func (p *CreateImageRequest) SetSuffix(val string) { + p.Suffix = val +} var fieldIDToName_CreateImageRequest = map[int16]string{ 1: "pic_type", @@ -168,6 +176,7 @@ var fieldIDToName_CreateImageRequest = map[int16]string{ 11: "text", 12: "regex", 13: "buffer_count", + 14: "suffix", } func (p *CreateImageRequest) IsSetDuration() bool { @@ -321,6 +330,14 @@ func (p *CreateImageRequest) Read(iprot thrift.TProtocol) (err error) { } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } + case 14: + if fieldTypeId == thrift.STRING { + if err = p.ReadField14(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 @@ -544,8 +561,20 @@ func (p *CreateImageRequest) ReadField13(iprot thrift.TProtocol) error { p.BufferCount = _field return nil } +func (p *CreateImageRequest) ReadField14(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Suffix = _field + return nil +} func (p *CreateImageRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("CreateImageRequest"); err != nil { goto WriteStructBeginError @@ -603,6 +632,10 @@ func (p *CreateImageRequest) Write(oprot thrift.TProtocol) (err error) { fieldId = 13 goto WriteFieldError } + if err = p.writeField14(oprot); err != nil { + fieldId = 14 + goto WriteFieldError + } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -846,6 +879,23 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 13 end error: ", p), err) } +func (p *CreateImageRequest) writeField14(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("suffix", thrift.STRING, 14); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Suffix); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 14 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 14 end error: ", p), err) +} + func (p *CreateImageRequest) String() string { if p == nil { return "" @@ -899,6 +949,9 @@ func (p *CreateImageRequest) DeepEqual(ano *CreateImageRequest) bool { if !p.Field13DeepEqual(ano.BufferCount) { return false } + if !p.Field14DeepEqual(ano.Suffix) { + return false + } return true } @@ -1003,6 +1056,13 @@ func (p *CreateImageRequest) Field13DeepEqual(src int64) bool { } return true } +func (p *CreateImageRequest) Field14DeepEqual(src string) bool { + + if strings.Compare(p.Suffix, src) != 0 { + return false + } + return true +} type CreateImageResponse struct { Base *model.BaseResp `thrift:"base,1" frugal:"1,default,model.BaseResp" json:"base"` @@ -1135,6 +1195,7 @@ func (p *CreateImageResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *CreateImageResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("CreateImageResponse"); err != nil { goto WriteStructBeginError @@ -1339,6 +1400,7 @@ func (p *GetImageRequest) ReadField1(iprot thrift.TProtocol) error { } func (p *GetImageRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetImageRequest"); err != nil { goto WriteStructBeginError @@ -1542,6 +1604,7 @@ func (p *GetImageResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *GetImageResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetImageResponse"); err != nil { goto WriteStructBeginError @@ -2135,6 +2198,7 @@ func (p *ChangeImagePropertyRequest) ReadField12(iprot thrift.TProtocol) error { } func (p *ChangeImagePropertyRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImagePropertyRequest"); err != nil { goto WriteStructBeginError @@ -2693,6 +2757,7 @@ func (p *ChangeImagePropertyResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *ChangeImagePropertyResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImagePropertyResponse"); err != nil { goto WriteStructBeginError @@ -2802,6 +2867,7 @@ type ChangeImageRequest struct { PictureId int64 `thrift:"picture_id,1,required" frugal:"1,required,i64" json:"picture_id"` Image []byte `thrift:"image,2,required" frugal:"2,required,binary" json:"image"` BufferCount int64 `thrift:"buffer_count,3" frugal:"3,default,i64" json:"buffer_count"` + Suffix string `thrift:"suffix,4" frugal:"4,default,string" json:"suffix"` } func NewChangeImageRequest() *ChangeImageRequest { @@ -2822,6 +2888,10 @@ func (p *ChangeImageRequest) GetImage() (v []byte) { func (p *ChangeImageRequest) GetBufferCount() (v int64) { return p.BufferCount } + +func (p *ChangeImageRequest) GetSuffix() (v string) { + return p.Suffix +} func (p *ChangeImageRequest) SetPictureId(val int64) { p.PictureId = val } @@ -2831,11 +2901,15 @@ func (p *ChangeImageRequest) SetImage(val []byte) { func (p *ChangeImageRequest) SetBufferCount(val int64) { p.BufferCount = val } +func (p *ChangeImageRequest) SetSuffix(val string) { + p.Suffix = val +} var fieldIDToName_ChangeImageRequest = map[int16]string{ 1: "picture_id", 2: "image", 3: "buffer_count", + 4: "suffix", } func (p *ChangeImageRequest) Read(iprot thrift.TProtocol) (err error) { @@ -2885,6 +2959,14 @@ func (p *ChangeImageRequest) Read(iprot thrift.TProtocol) (err error) { } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } + case 4: + if fieldTypeId == thrift.STRING { + if err = p.ReadField4(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 @@ -2958,8 +3040,20 @@ func (p *ChangeImageRequest) ReadField3(iprot thrift.TProtocol) error { p.BufferCount = _field return nil } +func (p *ChangeImageRequest) ReadField4(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.Suffix = _field + return nil +} func (p *ChangeImageRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImageRequest"); err != nil { goto WriteStructBeginError @@ -2977,6 +3071,10 @@ func (p *ChangeImageRequest) Write(oprot thrift.TProtocol) (err error) { fieldId = 3 goto WriteFieldError } + if err = p.writeField4(oprot); err != nil { + fieldId = 4 + goto WriteFieldError + } } if err = oprot.WriteFieldStop(); err != nil { goto WriteFieldStopError @@ -3046,6 +3144,23 @@ WriteFieldEndError: return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) } +func (p *ChangeImageRequest) writeField4(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("suffix", thrift.STRING, 4); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.Suffix); err != nil { + return err + } + if err = oprot.WriteFieldEnd(); err != nil { + goto WriteFieldEndError + } + return nil +WriteFieldBeginError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err) +} + func (p *ChangeImageRequest) String() string { if p == nil { return "" @@ -3069,6 +3184,9 @@ func (p *ChangeImageRequest) DeepEqual(ano *ChangeImageRequest) bool { if !p.Field3DeepEqual(ano.BufferCount) { return false } + if !p.Field4DeepEqual(ano.Suffix) { + return false + } return true } @@ -3093,6 +3211,13 @@ func (p *ChangeImageRequest) Field3DeepEqual(src int64) bool { } return true } +func (p *ChangeImageRequest) Field4DeepEqual(src string) bool { + + if strings.Compare(p.Suffix, src) != 0 { + return false + } + return true +} type ChangeImageResponse struct { Base *model.BaseResp `thrift:"base,1" frugal:"1,default,model.BaseResp" json:"base"` @@ -3225,6 +3350,7 @@ func (p *ChangeImageResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *ChangeImageResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImageResponse"); err != nil { goto WriteStructBeginError @@ -3429,6 +3555,7 @@ func (p *DeleteImageRequest) ReadField1(iprot thrift.TProtocol) error { } func (p *DeleteImageRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("DeleteImageRequest"); err != nil { goto WriteStructBeginError @@ -3598,6 +3725,7 @@ func (p *DeleteImageResponse) ReadField1(iprot thrift.TProtocol) error { } func (p *DeleteImageResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("DeleteImageResponse"); err != nil { goto WriteStructBeginError @@ -3876,6 +4004,7 @@ func (p *MobileGetImageRequest) ReadField4(iprot thrift.TProtocol) error { } func (p *MobileGetImageRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("MobileGetImageRequest"); err != nil { goto WriteStructBeginError @@ -4231,6 +4360,7 @@ func (p *MobileGetImageResponse) ReadField3(iprot thrift.TProtocol) error { } func (p *MobileGetImageResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("MobileGetImageResponse"); err != nil { goto WriteStructBeginError @@ -4487,6 +4617,7 @@ func (p *AddImagePointTimeRequest) ReadField1(iprot thrift.TProtocol) error { } func (p *AddImagePointTimeRequest) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("AddImagePointTimeRequest"); err != nil { goto WriteStructBeginError @@ -4690,6 +4821,7 @@ func (p *AddImagePointTimeResponse) ReadField2(iprot thrift.TProtocol) error { } func (p *AddImagePointTimeResponse) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("AddImagePointTimeResponse"); err != nil { goto WriteStructBeginError @@ -4923,6 +5055,7 @@ func (p *LaunchScreenServiceCreateImageArgs) ReadField1(iprot thrift.TProtocol) } func (p *LaunchScreenServiceCreateImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("CreateImage_args"); err != nil { goto WriteStructBeginError @@ -5092,6 +5225,7 @@ func (p *LaunchScreenServiceCreateImageResult) ReadField0(iprot thrift.TProtocol } func (p *LaunchScreenServiceCreateImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("CreateImage_result"); err != nil { goto WriteStructBeginError @@ -5263,6 +5397,7 @@ func (p *LaunchScreenServiceGetImageArgs) ReadField1(iprot thrift.TProtocol) err } func (p *LaunchScreenServiceGetImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetImage_args"); err != nil { goto WriteStructBeginError @@ -5432,6 +5567,7 @@ func (p *LaunchScreenServiceGetImageResult) ReadField0(iprot thrift.TProtocol) e } func (p *LaunchScreenServiceGetImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("GetImage_result"); err != nil { goto WriteStructBeginError @@ -5603,6 +5739,7 @@ func (p *LaunchScreenServiceChangeImagePropertyArgs) ReadField1(iprot thrift.TPr } func (p *LaunchScreenServiceChangeImagePropertyArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImageProperty_args"); err != nil { goto WriteStructBeginError @@ -5772,6 +5909,7 @@ func (p *LaunchScreenServiceChangeImagePropertyResult) ReadField0(iprot thrift.T } func (p *LaunchScreenServiceChangeImagePropertyResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImageProperty_result"); err != nil { goto WriteStructBeginError @@ -5943,6 +6081,7 @@ func (p *LaunchScreenServiceChangeImageArgs) ReadField1(iprot thrift.TProtocol) } func (p *LaunchScreenServiceChangeImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImage_args"); err != nil { goto WriteStructBeginError @@ -6112,6 +6251,7 @@ func (p *LaunchScreenServiceChangeImageResult) ReadField0(iprot thrift.TProtocol } func (p *LaunchScreenServiceChangeImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("ChangeImage_result"); err != nil { goto WriteStructBeginError @@ -6283,6 +6423,7 @@ func (p *LaunchScreenServiceDeleteImageArgs) ReadField1(iprot thrift.TProtocol) } func (p *LaunchScreenServiceDeleteImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("DeleteImage_args"); err != nil { goto WriteStructBeginError @@ -6452,6 +6593,7 @@ func (p *LaunchScreenServiceDeleteImageResult) ReadField0(iprot thrift.TProtocol } func (p *LaunchScreenServiceDeleteImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("DeleteImage_result"); err != nil { goto WriteStructBeginError @@ -6623,6 +6765,7 @@ func (p *LaunchScreenServiceMobileGetImageArgs) ReadField1(iprot thrift.TProtoco } func (p *LaunchScreenServiceMobileGetImageArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("MobileGetImage_args"); err != nil { goto WriteStructBeginError @@ -6792,6 +6935,7 @@ func (p *LaunchScreenServiceMobileGetImageResult) ReadField0(iprot thrift.TProto } func (p *LaunchScreenServiceMobileGetImageResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("MobileGetImage_result"); err != nil { goto WriteStructBeginError @@ -6963,6 +7107,7 @@ func (p *LaunchScreenServiceAddImagePointTimeArgs) ReadField1(iprot thrift.TProt } func (p *LaunchScreenServiceAddImagePointTimeArgs) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("AddImagePointTime_args"); err != nil { goto WriteStructBeginError @@ -7132,6 +7277,7 @@ func (p *LaunchScreenServiceAddImagePointTimeResult) ReadField0(iprot thrift.TPr } func (p *LaunchScreenServiceAddImagePointTimeResult) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 if err = oprot.WriteStructBegin("AddImagePointTime_result"); err != nil { goto WriteStructBeginError diff --git a/kitex_gen/model/k-model.go b/kitex_gen/model/k-model.go index b6ace762..e3f5d022 100644 --- a/kitex_gen/model/k-model.go +++ b/kitex_gen/model/k-model.go @@ -3765,3 +3765,361 @@ func (p *UnifiedExam) field3Length() int { l += thrift.Binary.StringLengthNocopy(p.Term) return l } + +func (p *PaperData) FastRead(buf []byte) (int, error) { + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + var issetBasePath bool = false + var issetFiles bool = false + var issetFolders 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.STRING { + l, err = p.FastReadField1(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + issetBasePath = 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 + } + issetFiles = true + } else { + l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) + offset += l + if err != nil { + goto SkipFieldError + } + } + case 3: + if fieldTypeId == thrift.LIST { + l, err = p.FastReadField3(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + issetFolders = 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 !issetBasePath { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetFiles { + fieldId = 2 + goto RequiredFieldNotSetError + } + + if !issetFolders { + 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_PaperData[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_PaperData[fieldId])) +} + +func (p *PaperData) 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.BasePath = _field + return offset, nil +} + +func (p *PaperData) 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([]string, 0, size) + for i := 0; i < size; i++ { + var _elem string + if v, l, err := thrift.Binary.ReadString(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _elem = v + } + + _field = append(_field, _elem) + } + p.Files = _field + return offset, nil +} + +func (p *PaperData) FastReadField3(buf []byte) (int, error) { + offset := 0 + + _, size, l, err := thrift.Binary.ReadListBegin(buf[offset:]) + offset += l + if err != nil { + return offset, err + } + _field := make([]string, 0, size) + for i := 0; i < size; i++ { + var _elem string + if v, l, err := thrift.Binary.ReadString(buf[offset:]); err != nil { + return offset, err + } else { + offset += l + _elem = v + } + + _field = append(_field, _elem) + } + p.Folders = _field + return offset, nil +} + +// for compatibility +func (p *PaperData) FastWrite(buf []byte) int { + return 0 +} + +func (p *PaperData) 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 *PaperData) BLength() int { + l := 0 + if p != nil { + l += p.field1Length() + l += p.field2Length() + l += p.field3Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *PaperData) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 1) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, p.BasePath) + return offset +} + +func (p *PaperData) fastWriteField2(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.LIST, 2) + listBeginOffset := offset + offset += thrift.Binary.ListBeginLength() + var length int + for _, v := range p.Files { + length++ + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, v) + } + thrift.Binary.WriteListBegin(buf[listBeginOffset:], thrift.STRING, length) + return offset +} + +func (p *PaperData) fastWriteField3(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.LIST, 3) + listBeginOffset := offset + offset += thrift.Binary.ListBeginLength() + var length int + for _, v := range p.Folders { + length++ + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, v) + } + thrift.Binary.WriteListBegin(buf[listBeginOffset:], thrift.STRING, length) + return offset +} + +func (p *PaperData) field1Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(p.BasePath) + return l +} + +func (p *PaperData) field2Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.ListBeginLength() + for _, v := range p.Files { + _ = v + l += thrift.Binary.StringLengthNocopy(v) + } + return l +} + +func (p *PaperData) field3Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.ListBeginLength() + for _, v := range p.Folders { + _ = v + l += thrift.Binary.StringLengthNocopy(v) + } + return l +} + +func (p *PaperUrlData) FastRead(buf []byte) (int, error) { + var err error + var offset int + var l int + var fieldTypeId thrift.TType + var fieldId int16 + var issetUrl 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.STRING { + l, err = p.FastReadField1(buf[offset:]) + offset += l + if err != nil { + goto ReadFieldError + } + issetUrl = 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 !issetUrl { + 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_PaperUrlData[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_PaperUrlData[fieldId])) +} + +func (p *PaperUrlData) 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.Url = _field + return offset, nil +} + +// for compatibility +func (p *PaperUrlData) FastWrite(buf []byte) int { + return 0 +} + +func (p *PaperUrlData) 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 *PaperUrlData) BLength() int { + l := 0 + if p != nil { + l += p.field1Length() + } + l += thrift.Binary.FieldStopLength() + return l +} + +func (p *PaperUrlData) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { + offset := 0 + offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 1) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, p.Url) + return offset +} + +func (p *PaperUrlData) field1Length() int { + l := 0 + l += thrift.Binary.FieldBeginLength() + l += thrift.Binary.StringLengthNocopy(p.Url) + return l +} diff --git a/kitex_gen/model/model.go b/kitex_gen/model/model.go index ca0e3365..a68a7057 100644 --- a/kitex_gen/model/model.go +++ b/kitex_gen/model/model.go @@ -5301,3 +5301,529 @@ func (p *UnifiedExam) Field3DeepEqual(src string) bool { } return true } + +type PaperData struct { + BasePath string `thrift:"base_path,1,required" frugal:"1,required,string" json:"base_path"` + Files []string `thrift:"files,2,required" frugal:"2,required,list" json:"files"` + Folders []string `thrift:"folders,3,required" frugal:"3,required,list" json:"folders"` +} + +func NewPaperData() *PaperData { + return &PaperData{} +} + +func (p *PaperData) InitDefault() { +} + +func (p *PaperData) GetBasePath() (v string) { + return p.BasePath +} + +func (p *PaperData) GetFiles() (v []string) { + return p.Files +} + +func (p *PaperData) GetFolders() (v []string) { + return p.Folders +} +func (p *PaperData) SetBasePath(val string) { + p.BasePath = val +} +func (p *PaperData) SetFiles(val []string) { + p.Files = val +} +func (p *PaperData) SetFolders(val []string) { + p.Folders = val +} + +var fieldIDToName_PaperData = map[int16]string{ + 1: "base_path", + 2: "files", + 3: "folders", +} + +func (p *PaperData) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + var issetBasePath bool = false + var issetFiles bool = false + var issetFolders bool = false + + 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 + } + issetBasePath = 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 + } + issetFiles = true + } else if err = iprot.Skip(fieldTypeId); err != nil { + goto SkipFieldError + } + case 3: + if fieldTypeId == thrift.LIST { + if err = p.ReadField3(iprot); err != nil { + goto ReadFieldError + } + issetFolders = 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 + } + + if !issetBasePath { + fieldId = 1 + goto RequiredFieldNotSetError + } + + if !issetFiles { + fieldId = 2 + goto RequiredFieldNotSetError + } + + if !issetFolders { + 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_PaperData[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PaperData[fieldId])) +} + +func (p *PaperData) ReadField1(iprot thrift.TProtocol) error { + + var _field string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _field = v + } + p.BasePath = _field + return nil +} +func (p *PaperData) ReadField2(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]string, 0, size) + for i := 0; i < size; i++ { + + var _elem string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _elem = v + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Files = _field + return nil +} +func (p *PaperData) ReadField3(iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin() + if err != nil { + return err + } + _field := make([]string, 0, size) + for i := 0; i < size; i++ { + + var _elem string + if v, err := iprot.ReadString(); err != nil { + return err + } else { + _elem = v + } + + _field = append(_field, _elem) + } + if err := iprot.ReadListEnd(); err != nil { + return err + } + p.Folders = _field + return nil +} + +func (p *PaperData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("PaperData"); 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 *PaperData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("base_path", thrift.STRING, 1); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteString(p.BasePath); 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 *PaperData) writeField2(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("files", thrift.LIST, 2); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRING, len(p.Files)); err != nil { + return err + } + for _, v := range p.Files { + if err := oprot.WriteString(v); 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 2 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err) +} + +func (p *PaperData) writeField3(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("folders", thrift.LIST, 3); err != nil { + goto WriteFieldBeginError + } + if err := oprot.WriteListBegin(thrift.STRING, len(p.Folders)); err != nil { + return err + } + for _, v := range p.Folders { + if err := oprot.WriteString(v); 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 3 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err) +} + +func (p *PaperData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PaperData(%+v)", *p) + +} + +func (p *PaperData) DeepEqual(ano *PaperData) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field1DeepEqual(ano.BasePath) { + return false + } + if !p.Field2DeepEqual(ano.Files) { + return false + } + if !p.Field3DeepEqual(ano.Folders) { + return false + } + return true +} + +func (p *PaperData) Field1DeepEqual(src string) bool { + + if strings.Compare(p.BasePath, src) != 0 { + return false + } + return true +} +func (p *PaperData) Field2DeepEqual(src []string) bool { + + if len(p.Files) != len(src) { + return false + } + for i, v := range p.Files { + _src := src[i] + if strings.Compare(v, _src) != 0 { + return false + } + } + return true +} +func (p *PaperData) Field3DeepEqual(src []string) bool { + + if len(p.Folders) != len(src) { + return false + } + for i, v := range p.Folders { + _src := src[i] + if strings.Compare(v, _src) != 0 { + return false + } + } + return true +} + +type PaperUrlData struct { + Url string `thrift:"url,1,required" frugal:"1,required,string" json:"url"` +} + +func NewPaperUrlData() *PaperUrlData { + return &PaperUrlData{} +} + +func (p *PaperUrlData) InitDefault() { +} + +func (p *PaperUrlData) GetUrl() (v string) { + return p.Url +} +func (p *PaperUrlData) SetUrl(val string) { + p.Url = val +} + +var fieldIDToName_PaperUrlData = map[int16]string{ + 1: "url", +} + +func (p *PaperUrlData) Read(iprot thrift.TProtocol) (err error) { + + var fieldTypeId thrift.TType + var fieldId int16 + var issetUrl bool = false + + 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 + } + issetUrl = 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 + } + + if !issetUrl { + 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_PaperUrlData[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) +RequiredFieldNotSetError: + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_PaperUrlData[fieldId])) +} + +func (p *PaperUrlData) ReadField1(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 *PaperUrlData) Write(oprot thrift.TProtocol) (err error) { + var fieldId int16 + if err = oprot.WriteStructBegin("PaperUrlData"); 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 *PaperUrlData) writeField1(oprot thrift.TProtocol) (err error) { + if err = oprot.WriteFieldBegin("url", thrift.STRING, 1); 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 1 begin error: ", p), err) +WriteFieldEndError: + return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err) +} + +func (p *PaperUrlData) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("PaperUrlData(%+v)", *p) + +} + +func (p *PaperUrlData) DeepEqual(ano *PaperUrlData) bool { + if p == ano { + return true + } else if p == nil || ano == nil { + return false + } + if !p.Field1DeepEqual(ano.Url) { + return false + } + return true +} + +func (p *PaperUrlData) Field1DeepEqual(src string) bool { + + if strings.Compare(p.Url, src) != 0 { + return false + } + return true +} diff --git a/kitex_gen/paper/k-paper.go b/kitex_gen/paper/k-paper.go index d8c74575..303c6123 100644 --- a/kitex_gen/paper/k-paper.go +++ b/kitex_gen/paper/k-paper.go @@ -309,7 +309,7 @@ func (p *GetDownloadUrlRequest) FastRead(buf []byte) (int, error) { var l int var fieldTypeId thrift.TType var fieldId int16 - var issetUrl bool = false + var issetFilepath bool = false for { fieldTypeId, fieldId, l, err = thrift.Binary.ReadFieldBegin(buf[offset:]) offset += l @@ -327,7 +327,7 @@ func (p *GetDownloadUrlRequest) FastRead(buf []byte) (int, error) { if err != nil { goto ReadFieldError } - issetUrl = true + issetFilepath = true } else { l, err = thrift.Binary.Skip(buf[offset:], fieldTypeId) offset += l @@ -344,7 +344,7 @@ func (p *GetDownloadUrlRequest) FastRead(buf []byte) (int, error) { } } - if !issetUrl { + if !issetFilepath { fieldId = 1 goto RequiredFieldNotSetError } @@ -369,7 +369,7 @@ func (p *GetDownloadUrlRequest) FastReadField1(buf []byte) (int, error) { offset += l _field = v } - p.Url = _field + p.Filepath = _field return offset, nil } @@ -399,14 +399,14 @@ func (p *GetDownloadUrlRequest) BLength() int { func (p *GetDownloadUrlRequest) fastWriteField1(buf []byte, w thrift.NocopyWriter) int { offset := 0 offset += thrift.Binary.WriteFieldBegin(buf[offset:], thrift.STRING, 1) - offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, p.Url) + offset += thrift.Binary.WriteStringNocopy(buf[offset:], w, p.Filepath) return offset } func (p *GetDownloadUrlRequest) field1Length() int { l := 0 l += thrift.Binary.FieldBeginLength() - l += thrift.Binary.StringLengthNocopy(p.Url) + l += thrift.Binary.StringLengthNocopy(p.Filepath) return l } diff --git a/kitex_gen/paper/paper.go b/kitex_gen/paper/paper.go index affd6fd1..10e8758b 100644 --- a/kitex_gen/paper/paper.go +++ b/kitex_gen/paper/paper.go @@ -449,7 +449,7 @@ func (p *ListDirFilesResponse) Field2DeepEqual(src *model.UpYunFileDir) bool { } type GetDownloadUrlRequest struct { - Url string `thrift:"url,1,required" frugal:"1,required,string" json:"url"` + Filepath string `thrift:"filepath,1,required" frugal:"1,required,string" json:"filepath"` } func NewGetDownloadUrlRequest() *GetDownloadUrlRequest { @@ -459,22 +459,22 @@ func NewGetDownloadUrlRequest() *GetDownloadUrlRequest { func (p *GetDownloadUrlRequest) InitDefault() { } -func (p *GetDownloadUrlRequest) GetUrl() (v string) { - return p.Url +func (p *GetDownloadUrlRequest) GetFilepath() (v string) { + return p.Filepath } -func (p *GetDownloadUrlRequest) SetUrl(val string) { - p.Url = val +func (p *GetDownloadUrlRequest) SetFilepath(val string) { + p.Filepath = val } var fieldIDToName_GetDownloadUrlRequest = map[int16]string{ - 1: "url", + 1: "filepath", } func (p *GetDownloadUrlRequest) Read(iprot thrift.TProtocol) (err error) { var fieldTypeId thrift.TType var fieldId int16 - var issetUrl bool = false + var issetFilepath bool = false if _, err = iprot.ReadStructBegin(); err != nil { goto ReadStructBeginError @@ -495,7 +495,7 @@ func (p *GetDownloadUrlRequest) Read(iprot thrift.TProtocol) (err error) { if err = p.ReadField1(iprot); err != nil { goto ReadFieldError } - issetUrl = true + issetFilepath = true } else if err = iprot.Skip(fieldTypeId); err != nil { goto SkipFieldError } @@ -512,7 +512,7 @@ func (p *GetDownloadUrlRequest) Read(iprot thrift.TProtocol) (err error) { goto ReadStructEndError } - if !issetUrl { + if !issetFilepath { fieldId = 1 goto RequiredFieldNotSetError } @@ -542,7 +542,7 @@ func (p *GetDownloadUrlRequest) ReadField1(iprot thrift.TProtocol) error { } else { _field = v } - p.Url = _field + p.Filepath = _field return nil } @@ -575,10 +575,10 @@ WriteStructEndError: } func (p *GetDownloadUrlRequest) writeField1(oprot thrift.TProtocol) (err error) { - if err = oprot.WriteFieldBegin("url", thrift.STRING, 1); err != nil { + if err = oprot.WriteFieldBegin("filepath", thrift.STRING, 1); err != nil { goto WriteFieldBeginError } - if err := oprot.WriteString(p.Url); err != nil { + if err := oprot.WriteString(p.Filepath); err != nil { return err } if err = oprot.WriteFieldEnd(); err != nil { @@ -605,7 +605,7 @@ func (p *GetDownloadUrlRequest) DeepEqual(ano *GetDownloadUrlRequest) bool { } else if p == nil || ano == nil { return false } - if !p.Field1DeepEqual(ano.Url) { + if !p.Field1DeepEqual(ano.Filepath) { return false } return true @@ -613,7 +613,7 @@ func (p *GetDownloadUrlRequest) DeepEqual(ano *GetDownloadUrlRequest) bool { func (p *GetDownloadUrlRequest) Field1DeepEqual(src string) bool { - if strings.Compare(p.Url, src) != 0 { + if strings.Compare(p.Filepath, src) != 0 { return false } return true diff --git a/pkg/base/client/es.go b/pkg/base/client/es.go index 654ea65f..3c397fb2 100644 --- a/pkg/base/client/es.go +++ b/pkg/base/client/es.go @@ -37,7 +37,7 @@ func NewEsClient() (*elasticsearch.Client, error) { } client, err := elasticsearch.NewClient(cfg) if err != nil { - return nil, fmt.Errorf("es clint failed,error: %v", err) + return nil, fmt.Errorf("es clint failed,error: %w", err) } return client, nil } diff --git a/pkg/base/client/kafka.go b/pkg/base/client/kafka.go index 1e563d0e..d0054710 100644 --- a/pkg/base/client/kafka.go +++ b/pkg/base/client/kafka.go @@ -28,13 +28,17 @@ import ( "github.com/west2-online/fzuhelper-server/pkg/constants" ) +const ( + Timeout = 10 * time.Second // 默认超时时间 +) + // GetConn conn不能保证并发安全,仅可作为单线程的长连接使用。 func GetConn() (*kafukago.Conn, error) { dialer := getDialer() conn, err := dialer.Dial(config.Kafka.Network, config.Kafka.Address) if err != nil { - return nil, fmt.Errorf("failed dial kafka server,error: %v", err) + return nil, fmt.Errorf("failed dial kafka server,error: %w", err) } return conn, nil } @@ -61,7 +65,7 @@ func GetNewReader(topic string, groupID ...string) *kafukago.Reader { func GetNewWriter() (*kafukago.Writer, error) { addr, err := net.ResolveTCPAddr(config.Kafka.Network, config.Kafka.Address) if err != nil { - return nil, fmt.Errorf("failed create kafka writer,error: %v", err) + return nil, fmt.Errorf("failed create kafka writer,error: %w", err) } return &kafukago.Writer{ @@ -81,7 +85,7 @@ func getDialer() *kafukago.Dialer { Password: config.Kafka.Password, } return &kafukago.Dialer{ - Timeout: 10 * time.Second, + Timeout: Timeout, DualStack: true, SASLMechanism: mechanism, } diff --git a/pkg/cache/paper/set_file_dir.go b/pkg/cache/paper/set_file_dir.go index 46962e06..1ca74718 100644 --- a/pkg/cache/paper/set_file_dir.go +++ b/pkg/cache/paper/set_file_dir.go @@ -19,17 +19,19 @@ package paper import ( "context" "fmt" - "time" "github.com/bytedance/sonic" "github.com/west2-online/fzuhelper-server/kitex_gen/model" + "github.com/west2-online/fzuhelper-server/pkg/constants" ) +const TwoDay = 2 * constants.OneDay + func (c *CachePaper) SetFileDirCache(ctx context.Context, key string, dir model.UpYunFileDir) error { data, err := sonic.Marshal(dir) if err != nil { return fmt.Errorf("dal.SetFileDirCache: Unmarshal dir info failed: %w", err) } - return c.client.Set(ctx, key, data, 48*time.Hour).Err() + return c.client.Set(ctx, key, data, TwoDay).Err() } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index af412293..7fffaffc 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -21,10 +21,11 @@ import "time" const ( JWTValue = "MTAxNTkwMTg1Mw==" - MuxConnection = 1 // (RPC) 最大连接数 - RPCTimeout = 3 * time.Second // (RPC) RPC请求超时时间 - ConnectTimeout = 50 * time.Millisecond // (RPC) 连接超时时间 - StreamBufferSize = 1024 // (RPC) 流请求 Buffer 尺寸 + MuxConnection = 1 // (RPC) 最大连接数 + RPCTimeout = 3 * time.Second // (RPC) RPC请求超时时间 + ConnectTimeout = 50 * time.Millisecond // (RPC) 连接超时时间 + StreamBufferSize = 1024 // (RPC) 流请求 Buffer 尺寸 + CheckFileTypeBufferSize = 512 // 判断文件类型时需读取前512个字节 TemplateServiceName = "template" ClassroomServiceName = "classroom" @@ -33,6 +34,7 @@ const ( ApiServiceName = "api" LaunchScreenServiceName = "launch_screen" PaperServiceName = "paper" + URLServiceName = "url" AcademicServiceName = "academic" TemplateServiceTableName = "template" UserTableName = "user" @@ -88,6 +90,13 @@ const ( KB = 1024 * B MB = 1024 * KB GB = 1024 * MB + + DayTime = 24 + TimeZoneOffset = 8 +) + +const ( + OneDay = 24 * time.Hour ) var CampusArray = []string{"旗山校区", "厦门工艺美院", "铜盘校区", "怡山校区", "晋江校区", "泉港校区"} diff --git a/pkg/db/course/create_course.go b/pkg/db/course/create_course.go index f0aa16f1..02ae4bd6 100644 --- a/pkg/db/course/create_course.go +++ b/pkg/db/course/create_course.go @@ -25,7 +25,7 @@ import ( func (c *DBCourse) CreateUserTermCourse(ctx context.Context, userCourseModel *model.UserCourse) (*model.UserCourse, error) { if err := c.client.WithContext(ctx).Create(userCourseModel).Error; err != nil { - return nil, fmt.Errorf("dal.CreateUserTermCourse error: %v", err) + return nil, fmt.Errorf("dal.CreateUserTermCourse error: %w", err) } return userCourseModel, nil } diff --git a/pkg/db/course/get_course.go b/pkg/db/course/get_course.go index 1207cef8..f91fcd49 100644 --- a/pkg/db/course/get_course.go +++ b/pkg/db/course/get_course.go @@ -32,7 +32,7 @@ func (c *DBCourse) GetUserTermCourseByStuIdAndTerm(ctx context.Context, stuId st if errors.Is(err, gorm.ErrRecordNotFound) { return nil, nil } - return nil, fmt.Errorf("dal.GetUserTermCourseByStuIdAndTerm error: %v", err) + return nil, fmt.Errorf("dal.GetUserTermCourseByStuIdAndTerm error: %w", err) } return userCourseModel, nil } @@ -46,7 +46,7 @@ func (c *DBCourse) GetUserTermCourseSha256ByStuIdAndTerm(ctx context.Context, st if errors.Is(err, gorm.ErrRecordNotFound) { return nil, nil } - return nil, fmt.Errorf("dal.GetUserTermCourseSha256ByStuIdAndTerm error: %v", err) + return nil, fmt.Errorf("dal.GetUserTermCourseSha256ByStuIdAndTerm error: %w", err) } return userCourseModel, nil } diff --git a/pkg/db/course/update_course.go b/pkg/db/course/update_course.go index 3cb3f040..11f9751f 100644 --- a/pkg/db/course/update_course.go +++ b/pkg/db/course/update_course.go @@ -25,7 +25,7 @@ import ( func (c *DBCourse) UpdateUserTermCourse(ctx context.Context, userCourseModel *model.UserCourse) (*model.UserCourse, error) { if err := c.client.WithContext(ctx).Model(userCourseModel).Updates(userCourseModel).Error; err != nil { - return nil, fmt.Errorf("dal.UpdateUserTermCourse error: %v", err) + return nil, fmt.Errorf("dal.UpdateUserTermCourse error: %w", err) } return userCourseModel, nil } diff --git a/pkg/db/launch_screen/add_image_list_showtime.go b/pkg/db/launch_screen/add_image_list_showtime.go index 0d0782d4..cb236c30 100644 --- a/pkg/db/launch_screen/add_image_list_showtime.go +++ b/pkg/db/launch_screen/add_image_list_showtime.go @@ -28,7 +28,7 @@ func (c *DBLaunchScreen) AddImageListShowTime(ctx context.Context, pictureList * (*pictureList)[i].ShowTimes++ } if err := c.client.WithContext(ctx).Save(pictureList).Error; err != nil { - return fmt.Errorf("dal.AddImageListShowTime error: %v", err) + return fmt.Errorf("dal.AddImageListShowTime error: %w", err) } return nil } diff --git a/pkg/db/launch_screen/add_point_time.go b/pkg/db/launch_screen/add_point_time.go index fe52f521..f70b51e6 100644 --- a/pkg/db/launch_screen/add_point_time.go +++ b/pkg/db/launch_screen/add_point_time.go @@ -26,11 +26,11 @@ import ( func (c *DBLaunchScreen) AddPointTime(ctx context.Context, id int64) error { pictureModel := new(model.Picture) if err := c.client.WithContext(ctx).Where("id = ?", id).First(pictureModel).Error; err != nil { - return fmt.Errorf("dal.AddPointTime error: %v", err) + return fmt.Errorf("dal.AddPointTime error: %w", err) } pictureModel.PointTimes++ if err := c.client.WithContext(ctx).Save(pictureModel).Error; err != nil { - return fmt.Errorf("dal.AddPointTime error: %v", err) + return fmt.Errorf("dal.AddPointTime error: %w", err) } return nil } diff --git a/pkg/db/launch_screen/create_image.go b/pkg/db/launch_screen/create_image.go index 7f3cf17f..a64fb435 100644 --- a/pkg/db/launch_screen/create_image.go +++ b/pkg/db/launch_screen/create_image.go @@ -25,7 +25,7 @@ import ( func (c *DBLaunchScreen) CreateImage(ctx context.Context, pictureModel *model.Picture) (*model.Picture, error) { if err := c.client.WithContext(ctx).Create(pictureModel).Error; err != nil { - return nil, fmt.Errorf("dal.CreateImage error: %v", err) + return nil, fmt.Errorf("dal.CreateImage error: %w", err) } return pictureModel, nil } diff --git a/pkg/db/launch_screen/delete_image.go b/pkg/db/launch_screen/delete_image.go index 5f24f1fe..99047f6d 100644 --- a/pkg/db/launch_screen/delete_image.go +++ b/pkg/db/launch_screen/delete_image.go @@ -28,11 +28,11 @@ func (c *DBLaunchScreen) DeleteImage(ctx context.Context, id int64) (*model.Pict ID: id, } if err := c.client.WithContext(ctx).Take(pictureModel).Error; err != nil { - return nil, fmt.Errorf("dal.DeleteImage error: %v", err) + return nil, fmt.Errorf("dal.DeleteImage error: %w", err) } if err := c.client.WithContext(ctx).Delete(pictureModel).Error; err != nil { - return nil, fmt.Errorf("dal.DeleteImage error: %v", err) + return nil, fmt.Errorf("dal.DeleteImage error: %w", err) } return pictureModel, nil } diff --git a/pkg/db/launch_screen/get_image.go b/pkg/db/launch_screen/get_image.go index 0215b3ec..a01851da 100644 --- a/pkg/db/launch_screen/get_image.go +++ b/pkg/db/launch_screen/get_image.go @@ -22,24 +22,23 @@ import ( "time" "github.com/west2-online/fzuhelper-server/pkg/db/model" + "github.com/west2-online/fzuhelper-server/pkg/utils" ) func (c *DBLaunchScreen) GetImageById(ctx context.Context, id int64) (*model.Picture, error) { pictureModel := new(model.Picture) if err := c.client.WithContext(ctx).Where("id = ?", id).First(pictureModel).Error; err != nil { - return nil, fmt.Errorf("dal.GetImageById error: %v", err) + return nil, fmt.Errorf("dal.GetImageById error: %w", err) } return pictureModel, nil } func (c *DBLaunchScreen) GetImageBySType(ctx context.Context, sType int64) (*[]model.Picture, int64, error) { + Loc := utils.LoadCNLocation() pictures := new([]model.Picture) var count int64 = 0 - now := time.Now().Add(time.Hour * 8) - hour := now.Hour() + 8 - if hour > 24 { - hour -= 24 - } + now := time.Now().In(Loc) + hour := now.Hour() // 按创建时间降序 if err := c.client.WithContext(ctx). Where("s_type = ? AND start_at < ? AND end_at > ? AND start_time <= ? AND end_time >= ?", @@ -53,13 +52,11 @@ func (c *DBLaunchScreen) GetImageBySType(ctx context.Context, sType int64) (*[]m } func (c *DBLaunchScreen) GetImageByIdList(ctx context.Context, imgIdList *[]int64) (*[]model.Picture, int64, error) { + Loc := utils.LoadCNLocation() pictures := new([]model.Picture) var count int64 = 0 - now := time.Now().Add(time.Hour * 8) - hour := now.Hour() + 8 - if hour > 24 { - hour -= 24 - } + now := time.Now().In(Loc) + hour := now.Hour() err := c.client.WithContext(ctx). Where("id IN ? AND start_at < ? AND end_at > ? AND start_time <= ? AND end_time >= ?", *imgIdList, now, now, hour, hour).Count(&count).Order("created_at DESC").Find(pictures).Error @@ -72,7 +69,7 @@ func (c *DBLaunchScreen) GetImageByIdList(ctx context.Context, imgIdList *[]int6 func (c *DBLaunchScreen) GetLastImageId(ctx context.Context) (int64, error) { pictureModel := new(model.Picture) if err := c.client.WithContext(ctx).Last(pictureModel).Error; err != nil { - return -1, fmt.Errorf("dal.GetLastImageId error: %v", err) + return -1, fmt.Errorf("dal.GetLastImageId error: %w", err) } return pictureModel.ID, nil } diff --git a/pkg/db/launch_screen/update_image.go b/pkg/db/launch_screen/update_image.go index 24930940..91103275 100644 --- a/pkg/db/launch_screen/update_image.go +++ b/pkg/db/launch_screen/update_image.go @@ -25,7 +25,7 @@ import ( func (c *DBLaunchScreen) UpdateImage(ctx context.Context, pictureModel *model.Picture) (*model.Picture, error) { if err := c.client.WithContext(ctx).Save(pictureModel).Take(pictureModel).Error; err != nil { - return nil, fmt.Errorf("dal.UpdateImage error: %v", err) + return nil, fmt.Errorf("dal.UpdateImage error: %w", err) } return pictureModel, nil } diff --git a/pkg/errno/code.go b/pkg/errno/code.go index b4998018..1f306413 100644 --- a/pkg/errno/code.go +++ b/pkg/errno/code.go @@ -75,4 +75,7 @@ const ( InternalQueueErrorCode = 50018 // 队列错误 InternalETCDErrorCode = 50019 // ETCD错误 InternalTraceErrorCode = 50020 // Trace错误 + + // paper在旧版Android中的SuccessCode是2000,用作兼容 + SuccessCodePaper = 2000 ) diff --git a/pkg/eshook/eshook.go b/pkg/eshook/eshook.go index 60f736d4..cb5e3796 100644 --- a/pkg/eshook/eshook.go +++ b/pkg/eshook/eshook.go @@ -94,8 +94,12 @@ func (hook *ElasticHook) Fire(entry zapcore.Entry) error { if err = json.NewDecoder(res.Body).Decode(&r); err != nil { log.Printf("Error parsing the response body: %s", err) } else { - // Print the response status and indexed document version. - log.Printf("[%s] %s; version=%d", res.Status(), r["result"], int(r["_version"].(float64))) + if version, ok := r["_version"].(float64); ok { + // Print the response status and indexed document version. + log.Printf("[%s] %s; version=%d", res.Status(), r["result"], int(version)) + } else { + log.Printf("Error: _version is not of type float64") + } } return err } diff --git a/pkg/logger/config.go b/pkg/logger/config.go index b6c27d23..a248e7bb 100644 --- a/pkg/logger/config.go +++ b/pkg/logger/config.go @@ -25,6 +25,10 @@ import ( "go.uber.org/zap/zapcore" ) +const ( + DefaultSkip = 4 // 默认跳过的栈帧数 +) + type Config struct { Enc zapcore.Encoder Ws zapcore.WriteSyncer @@ -97,6 +101,6 @@ func defaultOptions() []zap.Option { return []zap.Option{ zap.AddStacktrace(zap.ErrorLevel), zap.AddCaller(), - zap.AddCallerSkip(4), + zap.AddCallerSkip(DefaultSkip), } } diff --git a/pkg/upyun/launch_screen.go b/pkg/upyun/launch_screen.go index 3813072b..b1e3ecae 100644 --- a/pkg/upyun/launch_screen.go +++ b/pkg/upyun/launch_screen.go @@ -20,6 +20,7 @@ import ( "bytes" "fmt" "net/http" + "strings" "time" "github.com/west2-online/fzuhelper-server/config" @@ -27,10 +28,8 @@ import ( ) // UploadImg 又拍云上传文件 -func UploadImg(file []byte, name string) error { +func UploadImg(file []byte, url string) error { body := bytes.NewReader(file) - url := config.UpYun.UssDomain + config.UpYun.Path + name - req, err := http.NewRequest("PUT", url, body) if err != nil { return err @@ -42,17 +41,14 @@ func UploadImg(file []byte, name string) error { return err } defer res.Body.Close() - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { return errno.UpcloudError } return nil } // DeleteImg 又拍云删除文件 -func DeleteImg(name string) error { - // body := bytes.NewReader(file) - url := config.UpYun.UssDomain + config.UpYun.Path + name - +func DeleteImg(url string) error { req, err := http.NewRequest("DELETE", url, nil) if err != nil { return err @@ -64,18 +60,22 @@ func DeleteImg(name string) error { return err } defer res.Body.Close() - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { return errno.UpcloudError } return nil } // GenerateImgName 生成图片名字 -func GenerateImgName(id int64) string { +func GenerateImgName(id int64, suffix string) string { currentTime := time.Now() // 获取年月日和小时分钟 year, month, day := currentTime.Date() hour, minute := currentTime.Hour(), currentTime.Minute() second := currentTime.Second() - return fmt.Sprintf("%v_%d%02d%02d_%02d%02d%02d.jpg", id, year, month, day, hour, minute, second) + return strings.Join([]string{ + config.UpYun.UssDomain, config.UpYun.Path, + fmt.Sprintf("%v_%d%02d%02d_%02d%02d%02d.", id, year, month, day, hour, minute, second), + suffix, + }, "") } diff --git a/pkg/upyun/paper.go b/pkg/upyun/paper.go index 23b42527..114e75e7 100644 --- a/pkg/upyun/paper.go +++ b/pkg/upyun/paper.go @@ -26,10 +26,11 @@ import ( "github.com/west2-online/fzuhelper-server/config" "github.com/west2-online/fzuhelper-server/kitex_gen/model" - "github.com/west2-online/fzuhelper-server/pkg/logger" "github.com/west2-online/fzuhelper-server/pkg/utils" ) +const DefaultObjsChannelSize = 10 + var UpYun *upyun.UpYun func NewUpYun() { @@ -50,13 +51,12 @@ func GetDir(path string) (*model.UpYunFileDir, error) { Folders: []string{}, Files: []string{}, } - objsChan := make(chan *upyun.FileInfo, 10) + objsChan := make(chan *upyun.FileInfo, DefaultObjsChannelSize) go func() { err = UpYun.List(&upyun.GetObjectsConfig{ Path: path, ObjectsChan: objsChan, }) - logger.Error(err) }() for obj := range objsChan { if obj.IsDir { diff --git a/pkg/utils/jwch.go b/pkg/utils/jwch.go new file mode 100644 index 00000000..08651a8e --- /dev/null +++ b/pkg/utils/jwch.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 utils + +import ( + "errors" + "fmt" + "time" + + "github.com/west2-online/fzuhelper-server/pkg/constants" + "github.com/west2-online/jwch" +) + +const StuIDLen = 23 + +// RetryLogin 将会重新尝试进行登录 +func RetryLogin(stu *jwch.Student) error { + var err error + delay := constants.InitialDelay + + for attempt := 1; attempt <= constants.MaxRetries; attempt++ { + err = stu.Login() + if err == nil { + return nil // 登录成功 + } + + if attempt < constants.MaxRetries { + time.Sleep(delay) // 等待一段时间后再重试 + delay *= 2 // 指数退避,逐渐增加等待时间 + } + } + + return fmt.Errorf("failed to login after %d attempts: %w", constants.MaxRetries, err) +} + +// ParseJwchStuId 用于解析教务处 id 里的学号 +// 如 20241025133150102401339 的后 9 位 +func ParseJwchStuId(id string) (string, error) { + if len(id) != StuIDLen { + return "", errors.New("invalid id") + } + + return id[len(id)-9:], nil +} diff --git a/pkg/utils/snowflake.go b/pkg/utils/snowflake.go index 0a5cdbe4..56654800 100644 --- a/pkg/utils/snowflake.go +++ b/pkg/utils/snowflake.go @@ -35,6 +35,9 @@ const ( workeridShift int64 = 12 // sequenceBits 机器id左移位数 datacenteridShift int64 = 17 // sequenceBits + workeridBits 数据中心id左移位数 timestampShift int64 = 22 // sequenceBits + workeridBits + datacenteridBits 时间戳左移位数 + + NanosecondsInAMillisecond = 1_000_000 // 每毫秒的纳秒数 + MillisecondsInASecond = 1000 // 每秒的毫秒数 ) type Snowflake struct { @@ -63,7 +66,7 @@ func NewSnowflake(datacenterid, workerid int64) (*Snowflake, error) { // timestamp + 数据中心id + 工作节点id + 自旋id func (s *Snowflake) NextVal() (int64, error) { s.Lock() - now := time.Now().UnixNano() / 1000000 // 转毫秒 + now := time.Now().UnixNano() / NanosecondsInAMillisecond // 转毫秒 if s.timestamp == now { // 当同一时间戳(精度:毫秒)下多次生成id会增加序列号 s.sequence = (s.sequence + 1) & sequenceMask @@ -71,7 +74,7 @@ func (s *Snowflake) NextVal() (int64, error) { // 如果当前序列超出12bit长度,则需要等待下一毫秒 // 下一毫秒将使用sequence:0 for now <= s.timestamp { - now = time.Now().UnixNano() / 1000000 + now = time.Now().UnixNano() / NanosecondsInAMillisecond } } } else { @@ -111,12 +114,12 @@ func GetGenTimestamp(sid int64) (timestamp int64) { // 获取创建ID时的时间字符串(精度:秒) func GetGenTime(sid int64) (t string) { // 需将GetGenTimestamp获取的时间戳/1000转换成秒 - t = time.Unix(GetGenTimestamp(sid)/1000, 0).Format("2006-01-02 15:04:05") + t = time.Unix(GetGenTimestamp(sid)/MillisecondsInASecond, 0).Format("2006-01-02 15:04:05") return } // 获取时间戳已使用的占比:范围(0.0 - 1.0) func GetTimestampStatus() (state float64) { - state = float64((time.Now().UnixNano()/1000000 - epoch)) / float64(timestampMax) + state = float64((time.Now().UnixNano()/NanosecondsInAMillisecond - epoch)) / float64(timestampMax) return } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index bcf2362c..eaaf06be 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -32,13 +32,17 @@ import ( "strings" "time" + "github.com/h2non/filetype" + "github.com/h2non/filetype/types" + "github.com/west2-online/fzuhelper-server/config" "github.com/west2-online/fzuhelper-server/pkg/constants" "github.com/west2-online/fzuhelper-server/pkg/errno" "github.com/west2-online/fzuhelper-server/pkg/logger" - "github.com/west2-online/jwch" ) +const DefaultFilePermissions = 0o666 // 默认文件权限 + // TimeParse 会将文本日期解析为标准时间对象 func TimeParse(date string) (time.Time, error) { return time.Parse("2006-01-02", date) @@ -56,7 +60,11 @@ func GetMysqlDSN() (string, error) { return "", errors.New("config not found") } - dsn := strings.Join([]string{config.Mysql.Username, ":", config.Mysql.Password, "@tcp(", config.Mysql.Addr, ")/", config.Mysql.Database, "?charset=" + config.Mysql.Charset + "&parseTime=true"}, "") + dsn := strings.Join([]string{ + config.Mysql.Username, ":", config.Mysql.Password, + "@tcp(", config.Mysql.Addr, ")/", + config.Mysql.Database, "?charset=" + config.Mysql.Charset + "&parseTime=true", + }, "") return dsn, nil } @@ -162,26 +170,6 @@ func GetAvailablePort() (string, error) { return "", errors.New("utils.GetAvailablePort: not available port from config") } -// RetryLogin 将会重新尝试进行登录 -func RetryLogin(stu *jwch.Student) error { - var err error - delay := constants.InitialDelay - - for attempt := 1; attempt <= constants.MaxRetries; attempt++ { - err = stu.Login() - if err == nil { - return nil // 登录成功 - } - - if attempt < constants.MaxRetries { - time.Sleep(delay) // 等待一段时间后再重试 - delay *= 2 // 指数退避,逐渐增加等待时间 - } - } - - return fmt.Errorf("failed to login after %d attempts: %w", constants.MaxRetries, err) -} - // FileToByteArray 用于将客户端发来的文件转换为[][]byte格式,用于流式传输 func FileToByteArray(file *multipart.FileHeader) (fileBuf [][]byte, err error) { fileContent, err := file.Open() @@ -192,7 +180,7 @@ func FileToByteArray(file *multipart.FileHeader) (fileBuf [][]byte, err error) { for { buf := make([]byte, constants.StreamBufferSize) _, err = fileContent.Read(buf) - if err == io.EOF { + if errors.Is(err, io.EOF) { break } if err != nil { @@ -203,23 +191,31 @@ func FileToByteArray(file *multipart.FileHeader) (fileBuf [][]byte, err error) { return fileBuf, nil } -// IsAllowImageFile 检查文件格式是否合规,支持jpg png jpeg格式 -func IsAllowImageFile(header *multipart.FileHeader) bool { - contentType := header.Header.Get("Content-Type") - // MIME类型判断 - if strings.HasPrefix(contentType, "image/") { - return true +// IsAllowImageFile 检查文件格式是否合规,同时获得图片格式 +func IsAllowImageFile(header *multipart.FileHeader) (string, bool) { + file, err := header.Open() + if err != nil { + return "", false } + defer file.Close() - filename := header.Filename - extensions := []string{".jpg", ".png", ".jpeg"} // Add more image extensions if needed - for _, ext := range extensions { - if strings.HasSuffix(strings.ToLower(filename), ext) { - return true - } + buffer := make([]byte, constants.CheckFileTypeBufferSize) + _, err = file.Read(buffer) + if err != nil { + return "", false } - return false + kind, _ := filetype.Match(buffer) + + // 检查是否为jpg、png + switch kind { + case types.Get("jpg"): + return "jpg", true + case types.Get("png"): + return "png", true + default: + return "", false + } } // GenerateRedisKeyByStuId 开屏页通过学号与sType生成缓存对应Key @@ -235,13 +231,13 @@ func SaveImageFromBytes(imgBytes []byte, format string) error { // 解码图片,自动检测图片格式(jpeg, png 等) img, _, err := image.Decode(imgReader) if err != nil { - return fmt.Errorf("无法解码图片: %v", err) + return fmt.Errorf("无法解码图片: %w", err) } // 创建保存图片的文件 - outFile, err := os.OpenFile("testImg.jpg", os.O_CREATE|os.O_WRONLY, 0o666) + outFile, err := os.OpenFile("testImg.jpg", os.O_CREATE|os.O_WRONLY, DefaultFilePermissions) if err != nil { - return fmt.Errorf("无法创建文件: %v", err) + return fmt.Errorf("无法创建文件: %w", err) } defer outFile.Close() @@ -258,18 +254,8 @@ func SaveImageFromBytes(imgBytes []byte, format string) error { } if err != nil { - return fmt.Errorf("保存图片失败: %v", err) + return fmt.Errorf("保存图片失败: %w", err) } return nil } - -// 解析教务处 id 里的学号 -// 如 20241025133150102401339 的后 9 位 -func ParseJwchStuId(id string) (string, error) { - if len(id) != 23 { - return "", errors.New("invalid id") - } - - return id[len(id)-9:], nil -}