添加 交易相关的处理

This commit is contained in:
474420502 2024-04-15 17:35:31 +08:00
parent 62db070f61
commit b2185f7784
4 changed files with 154 additions and 3 deletions

View File

@ -12,3 +12,4 @@
8. 表的部分字段不对应, 如 parent_id 和 customer_id 是同一事物, 但是类型不一样. 可能会产生不可预料的错误
9. 数据库里递归查询, 一个查询n个query请求.出问题数据库死锁,整个项目崩溃. 例如 getFullParents
10. 部分翻译了, 部分不翻译, 导致国际语言经常会返回中文. 多语言只实现了小部分, 错误非常多. 如: $this->translate('minimum_purchase_amount').' ' . number_format($fund['minimum'], 3) .' '.$this->translate('rise') 这样的拼接中文可以, 其他语言就不是这个意思了, 中式翻译!
11. 全局锁表, 中间没做错误处理, 如果出错, 死锁表. 全服务阻塞!

View File

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

View File

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

View File

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