diff --git a/aes.go b/aes.go index 990107c..08b374f 100644 --- a/aes.go +++ b/aes.go @@ -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 字符串 diff --git a/apps/api/internal/handler/FLXG/flxg3d56handler.go b/apps/api/internal/handler/FLXG/flxg3d56handler.go index 6a0fe73..3590161 100644 --- a/apps/api/internal/handler/FLXG/flxg3d56handler.go +++ b/apps/api/internal/handler/FLXG/flxg3d56handler.go @@ -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) } } } diff --git a/apps/api/internal/logic/FLXG/flxg162alogic.go b/apps/api/internal/logic/FLXG/flxg162alogic.go index 38922ed..706aa2b 100644 --- a/apps/api/internal/logic/FLXG/flxg162alogic.go +++ b/apps/api/internal/logic/FLXG/flxg162alogic.go @@ -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 } diff --git a/apps/api/internal/logic/FLXG/flxg3d56logic.go b/apps/api/internal/logic/FLXG/flxg3d56logic.go index df1e7da..01aa461 100644 --- a/apps/api/internal/logic/FLXG/flxg3d56logic.go +++ b/apps/api/internal/logic/FLXG/flxg3d56logic.go @@ -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 } diff --git a/apps/api/internal/logic/FLXG/flxg54f5logic.go b/apps/api/internal/logic/FLXG/flxg54f5logic.go index eeef73e..6af0635 100644 --- a/apps/api/internal/logic/FLXG/flxg54f5logic.go +++ b/apps/api/internal/logic/FLXG/flxg54f5logic.go @@ -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 } diff --git a/apps/api/internal/logic/FLXG/flxg5876logic.go b/apps/api/internal/logic/FLXG/flxg5876logic.go index 18ff925..a36a482 100644 --- a/apps/api/internal/logic/FLXG/flxg5876logic.go +++ b/apps/api/internal/logic/FLXG/flxg5876logic.go @@ -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 } diff --git a/apps/api/internal/logic/FLXG/flxg75felogic.go b/apps/api/internal/logic/FLXG/flxg75felogic.go index 616d862..433dfd7 100644 --- a/apps/api/internal/logic/FLXG/flxg75felogic.go +++ b/apps/api/internal/logic/FLXG/flxg75felogic.go @@ -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 diff --git a/apps/api/internal/logic/FLXG/flxg9687logic.go b/apps/api/internal/logic/FLXG/flxg9687logic.go index bb031c6..c841d06 100644 --- a/apps/api/internal/logic/FLXG/flxg9687logic.go +++ b/apps/api/internal/logic/FLXG/flxg9687logic.go @@ -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 diff --git a/apps/api/internal/logic/FLXG/flxg970flogic.go b/apps/api/internal/logic/FLXG/flxg970flogic.go index 290b27a..491c68f 100644 --- a/apps/api/internal/logic/FLXG/flxg970flogic.go +++ b/apps/api/internal/logic/FLXG/flxg970flogic.go @@ -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 } diff --git a/apps/api/internal/logic/FLXG/flxgc9d1logic.go b/apps/api/internal/logic/FLXG/flxgc9d1logic.go index d6c0dff..f6d29a5 100644 --- a/apps/api/internal/logic/FLXG/flxgc9d1logic.go +++ b/apps/api/internal/logic/FLXG/flxgc9d1logic.go @@ -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 diff --git a/apps/api/internal/logic/FLXG/flxgca3dlogic.go b/apps/api/internal/logic/FLXG/flxgca3dlogic.go index 14a76eb..bda40ef 100644 --- a/apps/api/internal/logic/FLXG/flxgca3dlogic.go +++ b/apps/api/internal/logic/FLXG/flxgca3dlogic.go @@ -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 diff --git a/apps/api/internal/logic/FLXG/flxgdec7logic.go b/apps/api/internal/logic/FLXG/flxgdec7logic.go index 6e7f903..be1ce4b 100644 --- a/apps/api/internal/logic/FLXG/flxgdec7logic.go +++ b/apps/api/internal/logic/FLXG/flxgdec7logic.go @@ -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 diff --git a/apps/api/internal/logic/IVYZ/ivyz0b03logic.go b/apps/api/internal/logic/IVYZ/ivyz0b03logic.go index 42b4d3f..e38b3d7 100644 --- a/apps/api/internal/logic/IVYZ/ivyz0b03logic.go +++ b/apps/api/internal/logic/IVYZ/ivyz0b03logic.go @@ -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 diff --git a/apps/api/internal/logic/IVYZ/ivyz2125logic.go b/apps/api/internal/logic/IVYZ/ivyz2125logic.go index 71c699b..39b8780 100644 --- a/apps/api/internal/logic/IVYZ/ivyz2125logic.go +++ b/apps/api/internal/logic/IVYZ/ivyz2125logic.go @@ -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 diff --git a/apps/api/internal/logic/IVYZ/ivyz385elogic.go b/apps/api/internal/logic/IVYZ/ivyz385elogic.go index 362ac32..998a533 100644 --- a/apps/api/internal/logic/IVYZ/ivyz385elogic.go +++ b/apps/api/internal/logic/IVYZ/ivyz385elogic.go @@ -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 diff --git a/apps/api/internal/logic/IVYZ/ivyz9363logic.go b/apps/api/internal/logic/IVYZ/ivyz9363logic.go index 853234f..bbd6012 100644 --- a/apps/api/internal/logic/IVYZ/ivyz9363logic.go +++ b/apps/api/internal/logic/IVYZ/ivyz9363logic.go @@ -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 diff --git a/apps/api/internal/logic/IVYZ/ivyzadeelogic.go b/apps/api/internal/logic/IVYZ/ivyzadeelogic.go index 54c669e..f5a7b3a 100644 --- a/apps/api/internal/logic/IVYZ/ivyzadeelogic.go +++ b/apps/api/internal/logic/IVYZ/ivyzadeelogic.go @@ -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 diff --git a/apps/api/internal/logic/JRZQ/jrzq0a03logic.go b/apps/api/internal/logic/JRZQ/jrzq0a03logic.go index 1808f75..9d9bcbe 100644 --- a/apps/api/internal/logic/JRZQ/jrzq0a03logic.go +++ b/apps/api/internal/logic/JRZQ/jrzq0a03logic.go @@ -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 diff --git a/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go b/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go index 66ec21b..ce03dce 100644 --- a/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go +++ b/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go @@ -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 diff --git a/apps/api/internal/logic/JRZQ/jrzq8203logic.go b/apps/api/internal/logic/JRZQ/jrzq8203logic.go index 831031c..42b3a1f 100644 --- a/apps/api/internal/logic/JRZQ/jrzq8203logic.go +++ b/apps/api/internal/logic/JRZQ/jrzq8203logic.go @@ -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 diff --git a/apps/api/internal/logic/JRZQ/jrzqcee8logic.go b/apps/api/internal/logic/JRZQ/jrzqcee8logic.go index 6e2f266..12a6c9f 100644 --- a/apps/api/internal/logic/JRZQ/jrzqcee8logic.go +++ b/apps/api/internal/logic/JRZQ/jrzqcee8logic.go @@ -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 diff --git a/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go b/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go index 8a218b3..5d829ca 100644 --- a/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go +++ b/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go @@ -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 diff --git a/apps/api/internal/logic/JRZQ/jrzqfef8logic.go b/apps/api/internal/logic/JRZQ/jrzqfef8logic.go index 69aba52..ade4d2b 100644 --- a/apps/api/internal/logic/JRZQ/jrzqfef8logic.go +++ b/apps/api/internal/logic/JRZQ/jrzqfef8logic.go @@ -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 diff --git a/apps/api/internal/logic/QYGL/qygl2acdlogic.go b/apps/api/internal/logic/QYGL/qygl2acdlogic.go index bc86ec4..8ed2847 100644 --- a/apps/api/internal/logic/QYGL/qygl2acdlogic.go +++ b/apps/api/internal/logic/QYGL/qygl2acdlogic.go @@ -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 diff --git a/apps/api/internal/logic/QYGL/qygl45bdlogic.go b/apps/api/internal/logic/QYGL/qygl45bdlogic.go index 63dde75..e229cdf 100644 --- a/apps/api/internal/logic/QYGL/qygl45bdlogic.go +++ b/apps/api/internal/logic/QYGL/qygl45bdlogic.go @@ -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 diff --git a/apps/api/internal/logic/QYGL/qygl51bclogic.go b/apps/api/internal/logic/QYGL/qygl51bclogic.go index 1176f09..6a79b3d 100644 --- a/apps/api/internal/logic/QYGL/qygl51bclogic.go +++ b/apps/api/internal/logic/QYGL/qygl51bclogic.go @@ -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 diff --git a/apps/api/internal/logic/QYGL/qygl6f2dlogic.go b/apps/api/internal/logic/QYGL/qygl6f2dlogic.go index c98bd80..27c9164 100644 --- a/apps/api/internal/logic/QYGL/qygl6f2dlogic.go +++ b/apps/api/internal/logic/QYGL/qygl6f2dlogic.go @@ -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 diff --git a/apps/api/internal/logic/QYGL/qygl8261logic.go b/apps/api/internal/logic/QYGL/qygl8261logic.go index 286eb1e..09d59f4 100644 --- a/apps/api/internal/logic/QYGL/qygl8261logic.go +++ b/apps/api/internal/logic/QYGL/qygl8261logic.go @@ -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 diff --git a/apps/api/internal/logic/QYGL/qyglb4c0logic.go b/apps/api/internal/logic/QYGL/qyglb4c0logic.go index 625d174..d6f4b99 100644 --- a/apps/api/internal/logic/QYGL/qyglb4c0logic.go +++ b/apps/api/internal/logic/QYGL/qyglb4c0logic.go @@ -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 diff --git a/apps/api/internal/logic/YYSY/yysy09cdlogic.go b/apps/api/internal/logic/YYSY/yysy09cdlogic.go index fb9345d..ad590cc 100644 --- a/apps/api/internal/logic/YYSY/yysy09cdlogic.go +++ b/apps/api/internal/logic/YYSY/yysy09cdlogic.go @@ -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 diff --git a/apps/api/internal/logic/YYSY/yysy4b37logic.go b/apps/api/internal/logic/YYSY/yysy4b37logic.go index bf18667..7a95509 100644 --- a/apps/api/internal/logic/YYSY/yysy4b37logic.go +++ b/apps/api/internal/logic/YYSY/yysy4b37logic.go @@ -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 diff --git a/apps/api/internal/logic/YYSY/yysy6f2elogic.go b/apps/api/internal/logic/YYSY/yysy6f2elogic.go index 1375e41..05e898f 100644 --- a/apps/api/internal/logic/YYSY/yysy6f2elogic.go +++ b/apps/api/internal/logic/YYSY/yysy6f2elogic.go @@ -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 diff --git a/apps/api/internal/logic/YYSY/yysybe08logic.go b/apps/api/internal/logic/YYSY/yysybe08logic.go index 45715cf..fd67dfa 100644 --- a/apps/api/internal/logic/YYSY/yysybe08logic.go +++ b/apps/api/internal/logic/YYSY/yysybe08logic.go @@ -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 diff --git a/apps/api/internal/logic/YYSY/yysyd50flogic.go b/apps/api/internal/logic/YYSY/yysyd50flogic.go index 591fbca..08c6dd7 100644 --- a/apps/api/internal/logic/YYSY/yysyd50flogic.go +++ b/apps/api/internal/logic/YYSY/yysyd50flogic.go @@ -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 diff --git a/apps/api/internal/logic/YYSY/yysyf7dblogic.go b/apps/api/internal/logic/YYSY/yysyf7dblogic.go index 3b75272..47be70a 100644 --- a/apps/api/internal/logic/YYSY/yysyf7dblogic.go +++ b/apps/api/internal/logic/YYSY/yysyf7dblogic.go @@ -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 } diff --git a/apps/api/internal/service/west_dex_service.go b/apps/api/internal/service/west_dex_service.go index 264bf64..4faa583 100644 --- a/apps/api/internal/service/west_dex_service.go +++ b/apps/api/internal/service/west_dex_service.go @@ -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" {