This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/perfect-panel/server/internal/logic/common"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/perfect-panel/server/internal/types"
|
||||
"github.com/perfect-panel/server/pkg/result"
|
||||
"github.com/perfect-panel/server/pkg/xerr"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// GetAppVersionHandler 获取 App 版本
|
||||
func GetAppVersionHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
var req types.GetAppVersionRequest
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
result.HttpResult(c, nil, errors.Wrapf(xerr.NewErrCode(xerr.InvalidParams), "parse params failed: %v", err))
|
||||
return
|
||||
}
|
||||
validate := validator.New()
|
||||
if err := validate.Struct(&req); err != nil {
|
||||
result.HttpResult(c, nil, errors.Wrapf(xerr.NewErrCode(xerr.InvalidParams), "validate params failed: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
l := common.NewGetAppVersionLogic(c.Request.Context(), svcCtx)
|
||||
resp, err := l.GetAppVersion(&req)
|
||||
result.HttpResult(c, resp, err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/perfect-panel/server/internal/logic/common"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/perfect-panel/server/internal/types"
|
||||
"github.com/perfect-panel/server/pkg/result"
|
||||
"github.com/perfect-panel/server/pkg/xerr"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// GetDownloadLinkHandler 获取下载链接
|
||||
func GetDownloadLinkHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
var req types.GetDownloadLinkRequest
|
||||
if err := c.ShouldBind(&req); err != nil {
|
||||
result.HttpResult(c, nil, errors.Wrapf(xerr.NewErrCode(xerr.InvalidParams), "parse params failed: %v", err))
|
||||
return
|
||||
}
|
||||
validate := validator.New()
|
||||
if err := validate.Struct(&req); err != nil {
|
||||
result.HttpResult(c, nil, errors.Wrapf(xerr.NewErrCode(xerr.InvalidParams), "validate params failed: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
l := common.NewGetDownloadLinkLogic(c.Request.Context(), svcCtx)
|
||||
resp, err := l.GetDownloadLink(&req)
|
||||
result.HttpResult(c, resp, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user