demoApi

package
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CheckAuthErrMsg = "权限不足2333"

Variables

View Source
var AuthObj = Auth{
	UriToFnNameM: map[string]string{
		"vege_api": "VegeApi",
	},
}
View Source
var CustomerObj = Customer{
	UriToFnNameM: map[string]string{
		"vege_api": "VegeApi",
	},
}
View Source
var JwtDefaultReq midware.JwtReq

Functions

func GetWebMsgCode added in v1.0.15

func GetWebMsgCode(errMsg string) string

func InitHttpDemo

func InitHttpDemo(r *gin.Engine)

Types

type ApiResp

type ApiResp struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
	Data any    `json:"data,omitempty" swaggerignore:"true"`
}

所有200 的接口 resp 为ApiResp

type Auth added in v1.1.1

type Auth struct {
	UriToFnNameM map[string]string
}

func (Auth) CheckAuth added in v1.1.1

func (a Auth) CheckAuth(c *gin.Context) error

func (Auth) DemoGetFn added in v1.1.1

func (a Auth) DemoGetFn(ctx *gin.Context, req *DemoFnReq) (resp *DemoFnResp, err error)

func (Auth) DemoPostFn added in v1.1.1

func (a Auth) DemoPostFn(ctx *gin.Context, req *DemoFnReq) (resp *DemoFnResp, err error)

func (Auth) SendBad added in v1.1.1

func (a Auth) SendBad(c *gin.Context, errMsg string)

func (Auth) SendOk added in v1.1.1

func (a Auth) SendOk(c *gin.Context, body any)

func (Auth) UriToFnName added in v1.1.1

func (a Auth) UriToFnName(uri string) string

type Customer added in v1.1.1

type Customer struct {
	UriToFnNameM map[string]string
}

func (Customer) CheckAuth added in v1.1.1

func (a Customer) CheckAuth(c *gin.Context) error

func (Customer) SendBad added in v1.1.1

func (a Customer) SendBad(c *gin.Context, errMsg string)

func (Customer) SendOk added in v1.1.1

func (a Customer) SendOk(c *gin.Context, body any)

func (Customer) UriToFnName added in v1.1.1

func (a Customer) UriToFnName(uri string) string

func (Customer) VegeApi added in v1.1.1

func (a Customer) VegeApi(ctx *gin.Context, req *struct{}) (ApiResp, error)

type DemoFnReq added in v1.0.15

type DemoFnReq struct {
	Id string `json:"id" form:"id"`
}

type DemoFnResp added in v1.0.15

type DemoFnResp struct {
	Id   string `json:"id" form:"id"`
	Data string `json:"Data"`
}

type WebError added in v1.0.15

type WebError struct {
	// contains filtered or unexported fields
}

func GetWebErrorFromErrMsg added in v1.0.15

func GetWebErrorFromErrMsg(errMsg string) *WebError

func (*WebError) Code added in v1.0.15

func (err *WebError) Code() string

func (*WebError) Error added in v1.0.15

func (err *WebError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL