add app wgt
This commit is contained in:
parent
0e6cb95499
commit
7e333b47f2
22
app/user/cmd/api/desc/app.api
Normal file
22
app/user/cmd/api/desc/app.api
Normal file
@ -0,0 +1,22 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "APP服务"
|
||||
desc: "APP服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
import (
|
||||
"app/app.api"
|
||||
)
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: app
|
||||
)
|
||||
service main {
|
||||
|
||||
@handler getAppVersion
|
||||
get /app/version returns (getAppVersionResp)
|
||||
|
||||
}
|
17
app/user/cmd/api/desc/app/app.api
Normal file
17
app/user/cmd/api/desc/app/app.api
Normal file
@ -0,0 +1,17 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "APP服务"
|
||||
desc: "APP服务"
|
||||
author: "Liangzai"
|
||||
email: "2440983361@qq.com"
|
||||
version: "v1"
|
||||
)
|
||||
|
||||
type (
|
||||
getAppVersionResp {
|
||||
version string `json:"version"`
|
||||
wgtUrl string `json:"wgtUrl"`
|
||||
}
|
||||
)
|
||||
|
@ -13,3 +13,4 @@ import "query.api"
|
||||
import "pay.api"
|
||||
import "product.api"
|
||||
import "agent.api"
|
||||
import "app.api"
|
||||
|
@ -0,0 +1,19 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"tydata-server/app/user/cmd/api/internal/logic/app"
|
||||
"tydata-server/app/user/cmd/api/internal/svc"
|
||||
"tydata-server/common/result"
|
||||
"tydata-server/pkg/lzkit/validator"
|
||||
)
|
||||
|
||||
func GetAppVersionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := app.NewGetAppVersionLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetAppVersion()
|
||||
result.HttpResult(r, w, resp, err)
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
agent "tydata-server/app/user/cmd/api/internal/handler/agent"
|
||||
app "tydata-server/app/user/cmd/api/internal/handler/app"
|
||||
auth "tydata-server/app/user/cmd/api/internal/handler/auth"
|
||||
notification "tydata-server/app/user/cmd/api/internal/handler/notification"
|
||||
pay "tydata-server/app/user/cmd/api/internal/handler/pay"
|
||||
@ -100,6 +101,17 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
rest.WithPrefix("/api/v1/agent"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/app/version",
|
||||
Handler: app.GetAppVersionHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/api/v1"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
|
32
app/user/cmd/api/internal/logic/app/getappversionlogic.go
Normal file
32
app/user/cmd/api/internal/logic/app/getappversionlogic.go
Normal file
@ -0,0 +1,32 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"tydata-server/app/user/cmd/api/internal/svc"
|
||||
"tydata-server/app/user/cmd/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetAppVersionLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewGetAppVersionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAppVersionLogic {
|
||||
return &GetAppVersionLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetAppVersionLogic) GetAppVersion() (resp *types.GetAppVersionResp, err error) {
|
||||
|
||||
return &types.GetAppVersionResp{
|
||||
Version: "1.0.0",
|
||||
WgtUrl: "https://www.quannengcha.com/app_version/qnc_1.0.0.wgt",
|
||||
}, nil
|
||||
}
|
@ -444,6 +444,11 @@ type WithdrawalResp struct {
|
||||
FailMsg string `json:"fail_msg"`
|
||||
}
|
||||
|
||||
type GetAppVersionResp struct {
|
||||
Version string `json:"version"`
|
||||
WgtUrl string `json:"wgtUrl"`
|
||||
}
|
||||
|
||||
type SendSmsReq struct {
|
||||
Mobile string `json:"mobile" validate:"required,mobile"`
|
||||
ActionType string `json:"actionType" validate:"required,oneof=login register query agentApply"`
|
||||
|
Loading…
Reference in New Issue
Block a user