Skip to content
/ yxy-go Public

YXY(yiSchool) platform HTTP API bindings, written in go.

License

Notifications You must be signed in to change notification settings

zjutjh/yxy-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yxy-go

YXY(yiSchool) platform HTTP API bindings, written in go, refactored from yxy. A monolithic service written using the go-zero framework.


Features

  • APP login stage simulation.
  • Query school card balance and consumption records.
  • Query electricity surplus, recharge and usage records.
  • More...

Development

  1. Set up the go-zero development environment. reference

  2. Clone the repo.

    git clone https://github.com/zjutjh/yxy-go.git
  3. Modify api/handler.tpl template. reference

    package {{.PkgName}}
    
    import (
        "net/http"
    
        "github.com/zeromicro/go-zero/rest/httpx"
        "yxy-go/pkg/response"
        {{.ImportPackages}}
    )
    
    {{if .HasDoc}}{{.Doc}}{{end}}
    func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
        return func(w http.ResponseWriter, r *http.Request) {
            {{if .HasRequest}}var req types.{{.RequestType}}
            if err := httpx.Parse(r, &req); err != nil {
                response.ParamErrorResponse(r, w, err)
                return
            }
    
            {{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
            {{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}&req{{end}})
            response.HttpResponse(r, w, resp, err)
        }
    }
  4. Create or edit .api files in the api directory. reference

  5. Use goctl to automatically generate code. reference

    goctl api go -api api/yxy.api -dir . --style goZero
  6. Implement the business logic in the internal/logic directory.

Disclaimer

Completely FREE software for learning only. Any inappropriate use is at your own risk.

About

YXY(yiSchool) platform HTTP API bindings, written in go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published