temp
This commit is contained in:
@@ -18,7 +18,7 @@ type response {
|
||||
@server (
|
||||
group: IVYZ
|
||||
prefix: /api/v1
|
||||
middleware: ApiAuthInterceptor,ApiMqsInterceptor
|
||||
middleware: ApiAuthInterceptor
|
||||
)
|
||||
service api-api {
|
||||
@handler IVYZ0B03
|
||||
@@ -43,7 +43,7 @@ service api-api {
|
||||
@server (
|
||||
group: FLXG
|
||||
prefix: /api/v1
|
||||
middleware: ApiAuthInterceptor,ApiMqsInterceptor
|
||||
middleware: ApiAuthInterceptor
|
||||
)
|
||||
service api-api {
|
||||
@handler FLXGCA3D
|
||||
@@ -80,7 +80,7 @@ service api-api {
|
||||
@server (
|
||||
group: QYGL
|
||||
prefix: /api/v1
|
||||
middleware: ApiAuthInterceptor,ApiMqsInterceptor
|
||||
middleware: ApiAuthInterceptor
|
||||
)
|
||||
service api-api {
|
||||
@handler QYGLB4C0
|
||||
@@ -102,7 +102,7 @@ service api-api {
|
||||
@server (
|
||||
group: YYSY
|
||||
prefix: /api/v1
|
||||
middleware: ApiAuthInterceptor,ApiMqsInterceptor
|
||||
middleware: ApiAuthInterceptor
|
||||
)
|
||||
service api-api {
|
||||
@handler YYSY6F2E
|
||||
@@ -127,7 +127,7 @@ service api-api {
|
||||
@server (
|
||||
group: JRZQ
|
||||
prefix: /api/v1
|
||||
middleware: ApiAuthInterceptor,ApiMqsInterceptor
|
||||
middleware: ApiAuthInterceptor
|
||||
)
|
||||
service api-api {
|
||||
@handler JRZQDCBE
|
||||
|
||||
@@ -22,10 +22,13 @@ func FLXG3D56Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
||||
l := FLXG.NewFLXG3D56Logic(r.Context(), svcCtx)
|
||||
resp, err := l.FLXG3D56(&req)
|
||||
ctx := r.Context()
|
||||
if err != nil {
|
||||
response.Fail(r.Context(), w, err)
|
||||
r = r.WithContext(ctx)
|
||||
response.Fail(ctx, w, err)
|
||||
} else {
|
||||
response.Success(r.Context(), w, resp)
|
||||
r = r.WithContext(ctx)
|
||||
response.Success(ctx, w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor},
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
@@ -78,7 +78,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor},
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
@@ -117,7 +117,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor},
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
@@ -146,7 +146,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor},
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
@@ -180,7 +180,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor},
|
||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
||||
[]rest.Route{
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
|
||||
@@ -32,6 +32,9 @@ func NewFLXG3D56Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG3D56
|
||||
|
||||
// FLXG3D56 特殊名单
|
||||
func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
@@ -40,6 +43,29 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
status = "failed"
|
||||
charges = false
|
||||
} else {
|
||||
status = "success"
|
||||
charges = true
|
||||
}
|
||||
sendApiRequestMessageErr := l.svcCtx.ApiRequestMqsService.SendApiRequestMessage(l.ctx, transactionID, userId, productCode, status, charges, remark)
|
||||
if sendApiRequestMessageErr != nil {
|
||||
logx.Errorf("发送 API 请求消息失败: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
@@ -87,6 +113,7 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err
|
||||
if aesEncrypt != nil {
|
||||
return nil, errs.ErrSystem
|
||||
}
|
||||
|
||||
return &types.Response{
|
||||
Data: encryptData,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user