From b2185f77849e64b6576251673bb707cb4b2cf20c Mon Sep 17 00:00:00 2001 From: 474420502 <474420502@qq.com> Date: Mon, 15 Apr 2024 17:35:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E4=BA=A4=E6=98=93?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 3 +- server/app/internal/handlers/actions/auth.go | 2 - .../internal/handlers/actions/securities.go | 43 +++++++ .../internal/handlers/actions/types_gen.go | 109 ++++++++++++++++++ 4 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 server/app/internal/handlers/actions/securities.go diff --git a/readme.md b/readme.md index bf7c74f..99d7b99 100644 --- a/readme.md +++ b/readme.md @@ -11,4 +11,5 @@ 7. 表绝大部分没建索引, 数量上去, 性能立马下降 8. 表的部分字段不对应, 如 parent_id 和 customer_id 是同一事物, 但是类型不一样. 可能会产生不可预料的错误 9. 数据库里递归查询, 一个查询n个query请求.出问题数据库死锁,整个项目崩溃. 例如 getFullParents -10. 部分翻译了, 部分不翻译, 导致国际语言经常会返回中文. 多语言只实现了小部分, 错误非常多. 如: $this->translate('minimum_purchase_amount').' ' . number_format($fund['minimum'], 3) .' '.$this->translate('rise') 这样的拼接中文可以, 其他语言就不是这个意思了, 中式翻译! \ No newline at end of file +10. 部分翻译了, 部分不翻译, 导致国际语言经常会返回中文. 多语言只实现了小部分, 错误非常多. 如: $this->translate('minimum_purchase_amount').' ' . number_format($fund['minimum'], 3) .' '.$this->translate('rise') 这样的拼接中文可以, 其他语言就不是这个意思了, 中式翻译! +11. 全局锁表, 中间没做错误处理, 如果出错, 死锁表. 全服务阻塞! \ No newline at end of file diff --git a/server/app/internal/handlers/actions/auth.go b/server/app/internal/handlers/actions/auth.go index 7bd60c6..3ef0df4 100644 --- a/server/app/internal/handlers/actions/auth.go +++ b/server/app/internal/handlers/actions/auth.go @@ -304,8 +304,6 @@ func AccountRegisterEmailCode(ctx *ActionContext[AccountRegisterEmailCodeParam]) // old_password: string; // token?: string; func MemberAlterPassword(ctx *ActionContext[MemberAlterPasswordParam]) (resp *basic.Response) { - // ctx.ShouldBind() - log.Println() return resp.Success() } diff --git a/server/app/internal/handlers/actions/securities.go b/server/app/internal/handlers/actions/securities.go new file mode 100644 index 0000000..dba6b19 --- /dev/null +++ b/server/app/internal/handlers/actions/securities.go @@ -0,0 +1,43 @@ +package actions + +import "github.com/iapologizewhenimwrong/Vestmore_GO/utils/basic" + +// @Action securities/account +// SecuritiesAccount +// market: string; +// randstr: string; +// sign: string; +// action: string; +// app_market: int64; +// timestamp: int64; +// token: string; +func SecuritiesAccount(ctx *ActionContext[SecuritiesAccountParam]) (resp *basic.Response) { + + return resp.Success() +} + +// @Action securities/currency +// SecuritiesCurrency +// randstr: string; +// sign: string; +// action: string; +// app_market: int64; +// timestamp: int64; +// token: string; +func SecuritiesCurrency(ctx *ActionContext[SecuritiesCurrencyParam]) (resp *basic.Response) { + + return resp.Success() +} + +// @Action securities/capital +// SecuritiesCapital +// randstr: string; +// sign: string; +// action: string; +// app_market: int64; +// timestamp: int64; +// token: string; +func SecuritiesCapital(ctx *ActionContext[SecuritiesCapitalParam]) (resp *basic.Response) { + + return resp.Success() +} diff --git a/server/app/internal/handlers/actions/types_gen.go b/server/app/internal/handlers/actions/types_gen.go index 4fe64fa..f6b76de 100644 --- a/server/app/internal/handlers/actions/types_gen.go +++ b/server/app/internal/handlers/actions/types_gen.go @@ -53,6 +53,12 @@ func init() { HandlersFuncRoutes["base/getToken"] = BaseGetTokenHandler // func MemberAlterPassword(ctx *gin.Context, param *MemberAlterPasswordParam) (resp *basic.Response) HandlersFuncRoutes["member/alterPassword"] = MemberAlterPasswordHandler + // func SecuritiesAccount(ctx *gin.Context, param *SecuritiesAccountParam) (resp *basic.Response) + HandlersFuncRoutes["securities/account"] = SecuritiesAccountHandler + // func SecuritiesCapital(ctx *gin.Context, param *SecuritiesCapitalParam) (resp *basic.Response) + HandlersFuncRoutes["securities/capital"] = SecuritiesCapitalHandler + // func SecuritiesCurrency(ctx *gin.Context, param *SecuritiesCurrencyParam) (resp *basic.Response) + HandlersFuncRoutes["securities/currency"] = SecuritiesCurrencyHandler } type AccountForgetSmsCodeParam struct { @@ -299,3 +305,106 @@ func MemberAlterPasswordHandler(ctx *gin.Context) { } ctx.JSON(200, resp) } + +type SecuritiesAccountParam struct { + Market string `json:"market" form:"market" binding:"-"` + Randstr string `json:"randstr" form:"randstr" binding:"-"` + Sign string `json:"sign" form:"sign" binding:"-"` + Action string `json:"action" form:"action" binding:"-"` + AppMarket int64 `json:"app_market" form:"app_market" binding:"-"` + Timestamp int64 `json:"timestamp" form:"timestamp" binding:"-"` + Token string `json:"token" form:"token" binding:"-"` +} + +func SecuritiesAccountHandler(ctx *gin.Context) { + var resp *basic.Response + + param := &SecuritiesAccountParam{} + err := ctx.ShouldBind(param) + if err != nil { + log.Println(err) + resp = resp.Error(basic.ErrParamParse) + ctx.JSON(200, resp) + return + } + + actx := &ActionContext[SecuritiesAccountParam]{ + Lang: basic.GetLangString(param), + GinCtx: ctx, + Param: param, + } + + resp = SecuritiesAccount(actx) + if resp == nil { + resp = resp.Error(basic.ErrRespNotNil) + } + ctx.JSON(200, resp) +} + +type SecuritiesCapitalParam struct { + Randstr string `json:"randstr" form:"randstr" binding:"-"` + Sign string `json:"sign" form:"sign" binding:"-"` + Action string `json:"action" form:"action" binding:"-"` + AppMarket int64 `json:"app_market" form:"app_market" binding:"-"` + Timestamp int64 `json:"timestamp" form:"timestamp" binding:"-"` + Token string `json:"token" form:"token" binding:"-"` +} + +func SecuritiesCapitalHandler(ctx *gin.Context) { + var resp *basic.Response + + param := &SecuritiesCapitalParam{} + err := ctx.ShouldBind(param) + if err != nil { + log.Println(err) + resp = resp.Error(basic.ErrParamParse) + ctx.JSON(200, resp) + return + } + + actx := &ActionContext[SecuritiesCapitalParam]{ + Lang: basic.GetLangString(param), + GinCtx: ctx, + Param: param, + } + + resp = SecuritiesCapital(actx) + if resp == nil { + resp = resp.Error(basic.ErrRespNotNil) + } + ctx.JSON(200, resp) +} + +type SecuritiesCurrencyParam struct { + Randstr string `json:"randstr" form:"randstr" binding:"-"` + Sign string `json:"sign" form:"sign" binding:"-"` + Action string `json:"action" form:"action" binding:"-"` + AppMarket int64 `json:"app_market" form:"app_market" binding:"-"` + Timestamp int64 `json:"timestamp" form:"timestamp" binding:"-"` + Token string `json:"token" form:"token" binding:"-"` +} + +func SecuritiesCurrencyHandler(ctx *gin.Context) { + var resp *basic.Response + + param := &SecuritiesCurrencyParam{} + err := ctx.ShouldBind(param) + if err != nil { + log.Println(err) + resp = resp.Error(basic.ErrParamParse) + ctx.JSON(200, resp) + return + } + + actx := &ActionContext[SecuritiesCurrencyParam]{ + Lang: basic.GetLangString(param), + GinCtx: ctx, + Param: param, + } + + resp = SecuritiesCurrency(actx) + if resp == nil { + resp = resp.Error(basic.ErrRespNotNil) + } + ctx.JSON(200, resp) +}