12345678910111213141516171819202122232425262728293031323334353637383940 |
- package system
- import (
- "kpt-tmr-group/http/middleware"
- "kpt-tmr-group/pkg/apierr"
- "kpt-tmr-group/pkg/apiok"
- operationPb "kpt-tmr-group/proto/go/backend/operation"
- "net/http"
- "github.com/gin-gonic/gin"
- )
- func Auth(c *gin.Context) {
- req := &operationPb.UserAuth{}
- if err := c.BindJSON(req); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.Auth(c, req)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- c.JSON(http.StatusOK, apiok.CommonResponse(res))
- }
- func AddUser(c *gin.Context) {
- c.JSON(http.StatusOK, apiok.CommonResponse(apiok.NewApiOk(true)))
- }
- func GetUserInfo(c *gin.Context) {
- res, err := middleware.BackendOperation(c).OpsService.GetUserInfo(c, middleware.GetToken(c))
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- c.JSON(http.StatusOK, apiok.CommonResponse(res))
- }
|