This commit is contained in:
liangzai 2024-10-12 21:35:35 +08:00
parent dd8d23416c
commit 3d3ab79e20
36 changed files with 85 additions and 115 deletions

8
aes.go
View File

@ -48,15 +48,13 @@ type Data struct {
func main() {
// 定义 AES 密钥
key, _ := hex.DecodeString("0ebf6481d213c846070c8f2964617d42")
key, _ := hex.DecodeString("ff83609b2b24fc73196aac3d3dfb874f")
var data interface{}
data = map[string]interface{}{
"id_card": "45212220000827423X",
"name": "张荣宏",
"mobile_no": "18276151590",
"time_range": "5",
"id_card": "45212220000827423X",
"name": "张荣宏",
}
// 将结构体转为 JSON 字符串

View File

@ -2,6 +2,7 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
@ -22,9 +23,9 @@ func FLXG3D56Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := FLXG.NewFLXG3D56Logic(r.Context(), svcCtx)
resp, err := l.FLXG3D56(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
response.Success(r.Context(), w, resp)
}
}
}

View File

@ -30,7 +30,7 @@ func NewFLXG162ALogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG162A
}
}
func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err *errs.AppError) {
secretKey, ok := l.ctx.Value("secretKey").(string)
if !ok {
return &types.Response{}, errs.ErrSystem
@ -57,9 +57,9 @@ func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err
// 3、西部加密
westConfig := l.svcCtx.Config.WestConfig
encryptedFields, err := common.EncryptStructFields(data, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
if encryptStructFieldsErr != nil {
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
return nil, errs.ErrSystem
}

View File

@ -31,7 +31,7 @@ func NewFLXG3D56Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG3D56
}
// FLXG3D56 特殊名单
func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err *errs.AppError) {
secretKey, ok := l.ctx.Value("secretKey").(string)
if !ok {
return &types.Response{}, errs.ErrSystem
@ -58,9 +58,9 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err
// 3、西部加密
westConfig := l.svcCtx.Config.WestConfig
encryptedFields, err := common.EncryptStructFields(data, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
if encryptStructFieldsErr != nil {
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
return nil, errs.ErrSystem
}

View File

@ -30,7 +30,7 @@ func NewFLXG54F5Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG54F5
}
}
func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err *errs.AppError) {
secretKey, ok := l.ctx.Value("secretKey").(string)
if !ok {
return &types.Response{}, errs.ErrSystem
@ -57,9 +57,9 @@ func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err
// 3、西部加密
westConfig := l.svcCtx.Config.WestConfig
encryptedFields, err := common.EncryptStructFields(data, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
if encryptStructFieldsErr != nil {
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
return nil, errs.ErrSystem
}

View File

@ -29,7 +29,7 @@ func NewFLXG5876Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG5876
}
}
func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err *errs.AppError) {
secretKey, ok := l.ctx.Value("secretKey").(string)
if !ok {
return &types.Response{}, errs.ErrSystem
@ -56,9 +56,9 @@ func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err
// 3、西部加密
westConfig := l.svcCtx.Config.WestConfig
encryptedFields, err := common.EncryptStructFields(data, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
if encryptStructFieldsErr != nil {
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
return nil, errs.ErrSystem
}

View File

@ -2,6 +2,7 @@ package FLXG
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewFLXG75FELogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG75FE
}
}
func (l *FLXG75FELogic) FLXG75FE(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG75FELogic) FLXG75FE(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package FLXG
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewFLXG9687Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG9687
}
}
func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -29,7 +29,7 @@ func NewFLXG970FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG970F
}
}
func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err error) {
func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err *errs.AppError) {
secretKey, ok := l.ctx.Value("secretKey").(string)
if !ok {
return &types.Response{}, errs.ErrSystem
@ -56,9 +56,9 @@ func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err
// 3、西部加密
westConfig := l.svcCtx.Config.WestConfig
encryptedFields, err := common.EncryptStructFields(data, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
if encryptStructFieldsErr != nil {
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
return nil, errs.ErrSystem
}

View File

@ -2,6 +2,7 @@ package FLXG
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewFLXGC9D1Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGC9D1
}
}
func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err error) {
func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package FLXG
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewFLXGCA3DLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGCA3D
}
}
func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err error) {
func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package FLXG
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewFLXGDEC7Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGDEC7
}
}
func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err error) {
func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package IVYZ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewIVYZ0B03Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ0B03
}
}
func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err error) {
func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package IVYZ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewIVYZ2125Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ2125
}
}
func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err error) {
func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package IVYZ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewIVYZ385ELogic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ385E
}
}
func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err error) {
func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package IVYZ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewIVYZ9363Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ9363
}
}
func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err error) {
func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package IVYZ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewIVYZADEELogic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZADEE
}
}
func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err error) {
func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package JRZQ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewJRZQ0A03Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ0A03
}
}
func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err error) {
func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package JRZQ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewJRZQ4AA8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ4AA8
}
}
func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err error) {
func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package JRZQ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewJRZQ8203Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ8203
}
}
func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err error) {
func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package JRZQ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewJRZQCEE8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQCEE8
}
}
func (l *JRZQCEE8Logic) JRZQCEE8(req *types.Request) (resp *types.Response, err error) {
func (l *JRZQCEE8Logic) JRZQCEE8(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package JRZQ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewJRZQDCBELogic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQDCBE
}
}
func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err error) {
func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package JRZQ
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewJRZQFEF8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQFEF8
}
}
func (l *JRZQFEF8Logic) JRZQFEF8(req *types.Request) (resp *types.Response, err error) {
func (l *JRZQFEF8Logic) JRZQFEF8(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package QYGL
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewQYGL2ACDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL2ACD
}
}
func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err error) {
func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err *errs.AppError) {
return &types.Response{
Data: "三要素合演",
}, nil

View File

@ -2,6 +2,7 @@ package QYGL
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewQYGL45BDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL45BD
}
}
func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err error) {
func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package QYGL
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewQYGL51BCLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL51BC
}
}
func (l *QYGL51BCLogic) QYGL51BC(req *types.Request) (resp *types.Response, err error) {
func (l *QYGL51BCLogic) QYGL51BC(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package QYGL
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewQYGL6F2DLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL6F2D
}
}
func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err error) {
func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package QYGL
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewQYGL8261Logic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL8261
}
}
func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err error) {
func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package QYGL
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewQYGLB4C0Logic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGLB4C0
}
}
func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err error) {
func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package YYSY
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewYYSY09CDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY09CD
}
}
func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err error) {
func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package YYSY
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewYYSY4B37Logic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY4B37
}
}
func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err error) {
func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package YYSY
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewYYSY6F2ELogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY6F2E
}
}
func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err error) {
func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package YYSY
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewYYSYBE08Logic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYBE08
}
}
func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err error) {
func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -2,6 +2,7 @@ package YYSY
import (
"context"
"tianyuan-api/pkg/errs"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@ -23,7 +24,7 @@ func NewYYSYD50FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYD50F
}
}
func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err error) {
func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err *errs.AppError) {
// todo: add your logic here and delete this line
return

View File

@ -5,6 +5,7 @@ import (
"github.com/zeromicro/go-zero/core/logx"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"tianyuan-api/pkg/errs"
)
type YYSYF7DBLogic struct {
@ -21,67 +22,7 @@ func NewYYSYF7DBLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYF7DB
}
}
func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (*types.Response, error) {
////userId, ok := l.ctx.Value("userId").(int64)
////if !ok {
//// return &types.Response{}, errors.New("系统错误,请联系管理员")
////}
//secretKey, ok := l.ctx.Value("secretKey").(string)
//if !ok {
// return &types.Response{}, errors.New("系统错误,请联系管理员")
//}
//
//// 1、解密
//key, err := hex.DecodeString(secretKey)
//decryptData, err := crypto.AesDecrypt(req.Data, key)
//if err != nil || len(decryptData) == 0 {
// return nil, errors.New("参数解密失败")
//}
//
//// 2、校验
//var data validator.YYSYf7dbRequest
//
//if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
// return nil, validatorErr
//}
//
//// 3、西部加密
//westConfig := l.svcCtx.Config.WestConfig
////name, err := crypto.WestDexEncrypt(data., westConfig.Key)
////if err != nil {
//// logx.Errorf("西部加密错误:%v", err)
//// return nil, errors.New("业务异常")
////}
//phone, err := crypto.WestDexEncrypt(data.MobileNo, westConfig.Key)
//if err != nil {
// logx.Errorf("西部加密错误:%v", err)
// return nil, errors.New("业务异常")
//}
//startDate, err := crypto.WestDexEncrypt(data.StartDate, westConfig.Key)
//if err != nil {
// logx.Errorf("西部加密错误:%v", err)
// return nil, errors.New("业务异常")
//}
//// 4、发送请求到西部
//westdexRequest := map[string]interface{}{
// "phone": phone,
// "startDate": startDate,
//}
//westResp, err := l.svcCtx.WestDexService.CallAPI("G19BJ02", westdexRequest)
//if err != nil {
// return nil, err
//}
//
//// 5、响应解析
////var respData westmodel.G09GX01Response
////unmarshalErr := json.Unmarshal(westResp, &respData)
////if unmarshalErr != nil {
//// return nil, unmarshalErr
////}
////crypto.AesEncrypt()
//return &types.Response{
// Data: string(westResp),
//}, nil
func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (*types.Response, *errs.AppError) {
return &types.Response{}, nil
}

View File

@ -38,6 +38,7 @@ func NewWestDexService(config config.WestConfig) *WestDexService {
// CallAPI 调用西部数据的 API
func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (resp []byte, err error) {
logx.Infof("西部请求传入%v", reqData)
// 生成当前的13位时间戳
timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
@ -90,6 +91,8 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
logx.Errorf("【西部数据请求】JSON反序列化错误: %v", UnmarshalErr)
return nil, UnmarshalErr
}
logx.Infof("西部请求响应%v", westDexResp)
logx.Infof("西部流水号: %s", westDexResp.ID)
// 到这层是西部系统
if westDexResp.Code != "00000" {