add app wgt

This commit is contained in:
liangzai 2025-03-14 13:53:48 +08:00
parent 0e6cb95499
commit 7e333b47f2
7 changed files with 108 additions and 0 deletions

View 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)
}

View 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"`
}
)

View File

@ -13,3 +13,4 @@ import "query.api"
import "pay.api"
import "product.api"
import "agent.api"
import "app.api"

View File

@ -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)
}
}

View File

@ -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{
{

View 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
}

View File

@ -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"`