1、response修改 2、负数扣款

This commit is contained in:
liangzai 2024-10-15 20:52:51 +08:00
parent 8c14915955
commit d63d70847b
67 changed files with 368 additions and 202 deletions

View File

@ -25,6 +25,7 @@ func EncryptStructFields(inputStruct interface{}, key string) (map[string]interf
// 检查字段的 encrypt 标签是否为 "false"
encryptTag := field.Tag.Get("encrypt")
if encryptTag == "false" {
encryptedFields[field.Name] = fieldValue.Interface()
continue
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG162AHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG162ALogic(r.Context(), svcCtx)
resp, err := l.FLXG162A(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG3D56Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG3D56Logic(r.Context(), svcCtx)
resp, err := l.FLXG3D56(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG54F5Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG54F5Logic(r.Context(), svcCtx)
resp, err := l.FLXG54F5(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG5876Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG5876Logic(r.Context(), svcCtx)
resp, err := l.FLXG5876(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG75FEHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG75FELogic(r.Context(), svcCtx)
resp, err := l.FLXG75FE(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG9687Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG9687Logic(r.Context(), svcCtx)
resp, err := l.FLXG9687(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXG970FHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXG970FLogic(r.Context(), svcCtx)
resp, err := l.FLXG970F(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXGC9D1Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXGC9D1Logic(r.Context(), svcCtx)
resp, err := l.FLXGC9D1(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXGCA3DHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXGCA3DLogic(r.Context(), svcCtx)
resp, err := l.FLXGCA3D(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package FLXG
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/FLXG"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func FLXGDEC7Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := FLXG.NewFLXGDEC7Logic(r.Context(), svcCtx)
resp, err := l.FLXGDEC7(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package IVYZ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/IVYZ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func IVYZ0B03Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := IVYZ.NewIVYZ0B03Logic(r.Context(), svcCtx)
resp, err := l.IVYZ0B03(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package IVYZ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/IVYZ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func IVYZ2125Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := IVYZ.NewIVYZ2125Logic(r.Context(), svcCtx)
resp, err := l.IVYZ2125(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package IVYZ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/IVYZ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func IVYZ385EHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := IVYZ.NewIVYZ385ELogic(r.Context(), svcCtx)
resp, err := l.IVYZ385E(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -1,8 +1,8 @@
package IVYZ
import (
xhttp "github.com/zeromicro/x/http"
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
@ -15,13 +15,13 @@ func IVYZ5733Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := IVYZ.NewIVYZ5733Logic(r.Context(), svcCtx)
resp, err := l.IVYZ5733(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package IVYZ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/IVYZ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func IVYZ9363Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := IVYZ.NewIVYZ9363Logic(r.Context(), svcCtx)
resp, err := l.IVYZ9363(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package IVYZ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/IVYZ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func IVYZADEEHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := IVYZ.NewIVYZADEELogic(r.Context(), svcCtx)
resp, err := l.IVYZADEE(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package JRZQ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/JRZQ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func JRZQ0A03Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := JRZQ.NewJRZQ0A03Logic(r.Context(), svcCtx)
resp, err := l.JRZQ0A03(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package JRZQ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/JRZQ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func JRZQ4AA8Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := JRZQ.NewJRZQ4AA8Logic(r.Context(), svcCtx)
resp, err := l.JRZQ4AA8(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package JRZQ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/JRZQ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func JRZQ8203Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := JRZQ.NewJRZQ8203Logic(r.Context(), svcCtx)
resp, err := l.JRZQ8203(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package JRZQ
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/JRZQ"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func JRZQDCBEHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := JRZQ.NewJRZQDCBELogic(r.Context(), svcCtx)
resp, err := l.JRZQDCBE(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package QYGL
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/QYGL"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func QYGL2ACDHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := QYGL.NewQYGL2ACDLogic(r.Context(), svcCtx)
resp, err := l.QYGL2ACD(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package QYGL
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/QYGL"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func QYGL45BDHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := QYGL.NewQYGL45BDLogic(r.Context(), svcCtx)
resp, err := l.QYGL45BD(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package QYGL
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/QYGL"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func QYGL6F2DHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := QYGL.NewQYGL6F2DLogic(r.Context(), svcCtx)
resp, err := l.QYGL6F2D(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package QYGL
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/QYGL"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func QYGL8261Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := QYGL.NewQYGL8261Logic(r.Context(), svcCtx)
resp, err := l.QYGL8261(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package QYGL
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/QYGL"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func QYGLB4C0Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := QYGL.NewQYGLB4C0Logic(r.Context(), svcCtx)
resp, err := l.QYGLB4C0(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSY09CDHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSY09CDLogic(r.Context(), svcCtx)
resp, err := l.YYSY09CD(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSY4B21Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSY4B21Logic(r.Context(), svcCtx)
resp, err := l.YYSY4B21(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSY4B37Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSY4B37Logic(r.Context(), svcCtx)
resp, err := l.YYSY4B37(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSY6F2EHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSY6F2ELogic(r.Context(), svcCtx)
resp, err := l.YYSY6F2E(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSYBE08Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSYBE08Logic(r.Context(), svcCtx)
resp, err := l.YYSYBE08(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSYD50FHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSYD50FLogic(r.Context(), svcCtx)
resp, err := l.YYSYD50F(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -2,28 +2,27 @@ package YYSY
import (
"net/http"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/api/internal/logic/YYSY"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func YYSYF7DBHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
return
}
l := YYSY.NewYYSYF7DBLogic(r.Context(), svcCtx)
resp, err := l.YYSYF7DB(&req)
if err != nil {
response.Fail(r.Context(), w, err)
response.Fail(r.Context(), w, err, resp)
} else {
response.Success(r.Context(), w, resp)
}

View File

@ -92,7 +92,14 @@ func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G32BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -94,7 +94,14 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G26BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
// 5、响应解析

View File

@ -92,7 +92,14 @@ func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G03HZ01", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G03XM02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G31BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00028", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G30BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G22BJ03", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G23BJ03", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00020", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -91,7 +91,14 @@ func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G09GX01", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G10GX01", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G27BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G29BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G28BJ05", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G20GZ01", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00022", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00021", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G05XM02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("Q03BJ03", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G05HZ01", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -93,7 +93,14 @@ func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G16BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *YYSY4B21Logic) YYSY4B21(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G25BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G02BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -93,7 +93,14 @@ func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G15BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G17BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -92,7 +92,14 @@ func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G18BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -90,7 +90,14 @@ func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G19BJ02", apiRequest)
if callAPIErr != nil {
return "", errs.ErrSystem
if callAPIErr == errs.ErrDataSource {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, callAPIErr
}
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)

View File

@ -2,11 +2,9 @@ package middleware
import (
"context"
"errors"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/core/stores/redis"
xhttp "github.com/zeromicro/x/http"
"net"
"net/http"
"strings"
@ -16,6 +14,8 @@ import (
"tianyuan-api/apps/sentinel/sentinel"
"tianyuan-api/apps/user/user"
"tianyuan-api/pkg/crypto"
"tianyuan-api/pkg/errs"
"tianyuan-api/pkg/response"
)
type ApiAuthInterceptorMiddleware struct {
@ -60,14 +60,14 @@ func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.Handle
// 此处不调用 next(w, r),而是继续后续鉴权逻辑
// 后续鉴权逻辑将继续执行
} else {
isAllowedResp, err := m.WhitelistRpc.MatchWhitelistByIp(r.Context(), &whitelist.MatchWhitelistByIpRequest{Ip: clientIP})
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误,请联系管理员"))
isAllowedResp, matchWhitelistByIpErr := m.WhitelistRpc.MatchWhitelistByIp(r.Context(), &whitelist.MatchWhitelistByIpRequest{Ip: clientIP})
if matchWhitelistByIpErr != nil {
response.Fail(r.Context(), w, errs.ErrSystem, nil)
return
}
if !isAllowedResp.Match {
logx.Debugf("未经授权的IP%s", clientIP)
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未经授权的IP"))
response.Fail(r.Context(), w, errs.ErrUnauthorizedIP, nil)
return
}
}
@ -75,16 +75,16 @@ func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.Handle
// 2、查找相关accessId
accessId := r.Header.Get("Access-Id")
if accessId == "" {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("缺少Access-Id"))
response.Fail(r.Context(), w, errs.ErrMissingAccessID, nil)
return
}
secrets, err := m.SecretRpc.GetSecretBySecretId(r.Context(), &secret.GetSecretBySecretIdRequest{SecretId: accessId})
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误"))
response.Fail(r.Context(), w, errs.ErrSystem, nil)
return
}
if secrets.Id == 0 {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未经授权的AccessId"))
response.Fail(r.Context(), w, errs.ErrUnauthorizedAccessID, nil)
return
}
@ -93,12 +93,12 @@ func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.Handle
// 3、额度是否冻结
info, err := m.UserRpc.GetUserInfo(r.Context(), &user.UserInfoReq{UserId: userId})
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误,请联系管理员"))
response.Fail(r.Context(), w, errs.ErrSystem, nil)
return
}
if info.QuotaExceeded == 1 {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("账户余额不足,无法请求"))
response.Fail(r.Context(), w, errs.ErrInsufficientBalance, nil)
return
}
@ -113,11 +113,11 @@ func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.Handle
} else {
isUserProductAllowedResp, err := m.UserProductRpc.MatchingUserIdProductCode(r.Context(), &userproduct.MatchingUserIdProductCodeRequest{Id: userId, ProductCode: productCode})
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误,请联系管理员"))
response.Fail(r.Context(), w, errs.ErrSystem, nil)
return
}
if !isUserProductAllowedResp.Match {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未开通此产品"))
response.Fail(r.Context(), w, errs.ErrProductNotAvailable, nil)
return
}
}

View File

@ -3,7 +3,6 @@ package service
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"io"
@ -11,6 +10,7 @@ import (
"strconv"
"tianyuan-api/apps/api/internal/config"
"tianyuan-api/pkg/crypto"
"tianyuan-api/pkg/errs"
"time"
)
@ -37,7 +37,7 @@ func NewWestDexService(config config.WestConfig) *WestDexService {
}
// CallAPI 调用西部数据的 API
func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (resp []byte, err error) {
func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (resp []byte, err *errs.AppError) {
logx.Infof("西部请求传入%v", reqData)
// 生成当前的13位时间戳
timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
@ -45,17 +45,17 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
// 构造请求URL
reqUrl := fmt.Sprintf("%s/%s/%s?timestamp=%s", w.config.Url, w.config.SecretId, code, timestamp)
jsonData, err := json.Marshal(reqData)
if err != nil {
logx.Errorf("【西部数据请求】JSON编码错误: %v", err)
return
jsonData, marshalErr := json.Marshal(reqData)
if marshalErr != nil {
logx.Errorf("【西部数据请求】JSON编码错误: %v", marshalErr)
return nil, errs.ErrSystem
}
// 创建HTTP POST请求
req, err := http.NewRequest("POST", reqUrl, bytes.NewBuffer(jsonData))
if err != nil {
logx.Errorf("【西部数据请求】创建请求错误: %v", err)
return
req, newRequestErr := http.NewRequest("POST", reqUrl, bytes.NewBuffer(jsonData))
if newRequestErr != nil {
logx.Errorf("【西部数据请求】创建请求错误: %v", newRequestErr)
return nil, errs.ErrSystem
}
// 设置请求头
@ -63,14 +63,14 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
// 发送请求
client := &http.Client{}
httpResp, err := client.Do(req)
if err != nil {
logx.Errorf("【西部数据请求】发送请求错误: %v", err)
return nil, errors.New("业务异常")
httpResp, clientDoErr := client.Do(req)
if clientDoErr != nil {
logx.Errorf("【西部数据请求】发送请求错误: %v", clientDoErr)
return nil, errs.ErrSystem
}
defer func(Body io.ReadCloser) {
err := Body.Close()
if err != nil {
closeErr := Body.Close()
if closeErr != nil {
}
}(httpResp.Body)
@ -81,7 +81,7 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
bodyBytes, ReadErr := io.ReadAll(httpResp.Body)
if ReadErr != nil {
logx.Errorf("【西部数据请求】读取响应体错误: %v", ReadErr)
return nil, ReadErr
return nil, errs.ErrSystem
}
// 手动调用 json.Unmarshal 触发自定义的 UnmarshalJSON 方法
@ -89,7 +89,7 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
UnmarshalErr := json.Unmarshal(bodyBytes, &westDexResp)
if UnmarshalErr != nil {
logx.Errorf("【西部数据请求】JSON反序列化错误: %v", UnmarshalErr)
return nil, UnmarshalErr
return nil, errs.ErrSystem
}
logx.Infof("西部请求响应%v", westDexResp)
@ -97,14 +97,14 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
// 到这层是西部系统
if westDexResp.Code != "00000" {
logx.Errorf("【西部数据请求】响应数据业务异常: %s %s", westDexResp.Message, westDexResp.Reason)
return nil, errors.New("业务异常")
return []byte(westDexResp.Data), errs.ErrDataSource
}
// 解密响应数据
decryptedData, DecryptErr := crypto.WestDexDecrypt(westDexResp.Data, w.config.Key)
if DecryptErr != nil {
logx.Errorf("【西部数据请求】响应数据解密错误: %v", DecryptErr)
return nil, DecryptErr
return nil, errs.ErrSystem
}
// 输出解密后的数据
@ -112,5 +112,5 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
}
logx.Errorf("【西部数据请求】请求失败,状态码: %d", httpResp.StatusCode)
return nil, errors.New("west response error status code: " + strconv.Itoa(httpResp.StatusCode))
return nil, errs.ErrSystem
}

View File

@ -51,11 +51,6 @@ func (m *customWalletsModel) UpdateBalance(session sqlx.Session, ctx context.Con
return err
}
// 检查余额是否足够
if wallet.Balance+amount < 0 {
return ErrBalanceNotEnough
}
// 使用乐观锁更新余额
result, err := session.Exec("UPDATE wallets SET balance = balance + ?, version = version + 1 WHERE user_id = ? AND version = ?", amount, userId, wallet.Version)
if err != nil {

View File

@ -2,8 +2,13 @@ package errs
// 常见错误
var (
ErrSystem = NewAppError(1001, "业务失败")
ErrParamDecryption = NewAppError(1002, "参数解密失败")
ErrParamValidation = NewAppError(1003, "校验参数不正确")
ErrDataSource = NewAppError(1004, "数据源异常")
ErrSystem = NewAppError(1001, "接口异常")
ErrParamDecryption = NewAppError(1002, "参数解密失败")
ErrParamValidation = NewAppError(1003, "基础参数校验不正确")
ErrUnauthorizedIP = NewAppError(1004, "未经授权的IP")
ErrMissingAccessID = NewAppError(1005, "缺少Access-Id")
ErrUnauthorizedAccessID = NewAppError(1006, "未经授权的AccessId")
ErrInsufficientBalance = NewAppError(1007, "账户余额不足,无法请求")
ErrProductNotAvailable = NewAppError(1008, "未开通此产品")
ErrDataSource = NewAppError(2001, "业务失败")
)

View File

@ -44,10 +44,10 @@ func sendResponse(ctx context.Context, w http.ResponseWriter, code int, message
// 响应成功
func Success(ctx context.Context, w http.ResponseWriter, data interface{}) {
sendResponse(ctx, w, 0, "success", data)
sendResponse(ctx, w, 0, "业务成功", data)
}
// 响应失败
func Fail(ctx context.Context, w http.ResponseWriter, err *errs.AppError) {
sendResponse(ctx, w, err.Code, err.Message, nil)
func Fail(ctx context.Context, w http.ResponseWriter, err *errs.AppError, data interface{}) {
sendResponse(ctx, w, err.Code, err.Message, data)
}

View File

@ -6,7 +6,7 @@ import (
)
func main() {
data := "GBymoxlPVETbdHlL6lI20qG6i006C3WkVM/m4AVpD9G7YE3rvAELhTrgcP7XTF0kgJ8sr9PVmiX0AdLyceIzYHzeGRGQFr1k9YbcSCzhwEBnsybVGunurX7RnhPNpCzKI0k1FUWaIkH3UXl5DNPly+fH822K7IUGiYDpKKDb8Rl5xMmIuRuO7D5CvhNhT3wgIVzHcdpoSDQ9eTREyODC2Q=="
data := "ySXeqcGiynpuLvY2uRSptUwArQeHHm6EkuGrIxmiAIDpzdOG3LusaXRx4MYrgDL5aSKTLYz5AtP2AMpaOwJCJNeNOyns8zJuMTiwoOxAtz19Kc6rVNltPwCgxKdSyHCb"
decrypt, err := crypto.WestDexDecrypt(data, "121a1e41fc1690dd6b90afbcacd80cf4")
if err != nil {
return