first commit

This commit is contained in:
2024-10-02 00:57:17 +08:00
commit 6773f86bc5
312 changed files with 19169 additions and 0 deletions

31
apps/api/Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
FROM golang:alpine AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache && apk add --no-cache tzdata
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
COPY apps/api/etc /app/etc
RUN go build -ldflags="-s -w" -o /app/api apps/api/api.go
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
ENV TZ Asia/Shanghai
WORKDIR /app
COPY --from=builder /app/api /app/api
COPY --from=builder /app/etc /app/etc
CMD ["./api", "-f", "etc/api-api.yaml"]

154
apps/api/api.api Normal file
View File

@@ -0,0 +1,154 @@
syntax = "v1"
info (
title: "User Management API"
desc: "This API is designed for managing user information and authentication."
author: "Liang Zai"
version: "v1.0.0"
)
type request {
data string `json:"data"`
}
type response {
data string `json:"data"`
}
@server (
group: IVYZ
prefix: /api/v1
middleware: ApiAuthInterceptor
)
service api-api {
@handler IVYZ0B03
post /IVYZ0B03 (request) returns (response)
@handler IVYZ5733
post /IVYZ5733 (request) returns (response)
@handler IVYZ9363
post /IVYZ9363 (request) returns (response)
@handler IVYZ385E
post /IVYZ385E (request) returns (response)
@handler IVYZ2125
post /IVYZ2125 (request) returns (response)
@handler IVYZADEE
post /IVYZADEE (request) returns (response)
}
@server (
group: FLXG
prefix: /api/v1
middleware: ApiAuthInterceptor
)
service api-api {
@handler FLXGCA3D
post /FLXGCA3D (request) returns (response)
@handler FLXG970F
post /FLXG970F (request) returns (response)
@handler FLXG75FE
post /FLXG75FE (request) returns (response)
@handler FLXGDEC7
post /FLXGDEC7 (request) returns (response)
@handler FLXG5876
post /FLXG5876 (request) returns (response)
@handler FLXG54F5
post /FLXG54F5 (request) returns (response)
@handler FLXGC9D1
post /FLXGC9D1 (request) returns (response)
@handler FLXG9687
post /FLXG9687 (request) returns (response)
@handler FLXG162A
post /FLXG162A (request) returns (response)
@handler FLXG3D56
post /FLXG3D56 (request) returns (response)
}
@server (
group: QYGL
prefix: /api/v1
middleware: ApiAuthInterceptor
)
service api-api {
@handler QYGLB4C0
post /QYGLB4C0 (request) returns (response)
@handler QYGL8261
post /QYGL8261 (request) returns (response)
@handler QYGL45BD
post /QYGL45BD (request) returns (response)
@handler QYGL2ACD
post /QYGL2ACD (request) returns (response)
@handler QYGL6F2D
post /QYGL6F2D (request) returns (response)
@handler QYGL51BC
post /QYGL51BC (request) returns (response)
}
@server (
group: YYSY
prefix: /api/v1
middleware: ApiAuthInterceptor
)
service api-api {
@handler YYSY6F2E
post /YYSY6F2E (request) returns (response)
@handler YYSY09CD
post /YYSY09CD (request) returns (response)
@handler YYSYBE08
post /YYSYBE08 (request) returns (response)
@handler YYSYD50F
post /YYSYD50F (request) returns (response)
@handler YYSYF7DB
post /YYSYF7DB (request) returns (response)
@handler YYSY4B37
post /YYSY4B37 (request) returns (response)
}
@server (
group: JRZQ
prefix: /api/v1
middleware: ApiAuthInterceptor
)
service api-api {
@handler JRZQDCBE
post /JRZQDCBE (request) returns (response)
@handler JRZQ0A03
post /JRZQ0A03 (request) returns (response)
@handler JRZQ8203
post /JRZQ8203 (request) returns (response)
@handler JRZQ4AA8
post /JRZQ4AA8 (request) returns (response)
@handler JRZQCEE8
post /JRZQCEE8 (request) returns (response)
@handler JRZQFEF8
post /JRZQFEF8 (request) returns (response)
}

31
apps/api/api.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"flag"
"fmt"
"tianyuan-api/apps/api/internal/config"
"tianyuan-api/apps/api/internal/handler"
"tianyuan-api/apps/api/internal/svc"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest"
)
var configFile = flag.String("f", "etc/api-api.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
server := rest.MustNewServer(c.RestConf)
defer server.Stop()
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}

51
apps/api/api.proto Normal file
View File

@@ -0,0 +1,51 @@
syntax = "proto3";
package product;
option go_package = "./api";
service ProductService {
// 获取产品列表
rpc GetProducts(ProductListReq) returns (ProductListResp);
// 获取用户开通的产品列表
rpc GetUserProducts(UserProductListReq) returns (UserProductListResp);
}
// 获取产品列表的请求
message ProductListReq {}
// 获取产品列表的响应
message ProductListResp {
repeated ProductItem products = 1;
}
// 产品信息
message ProductItem {
int64 id = 1; // 产品ID
string product_name = 2; // 产品名称
string product_code = 3; // 产品编号
string product_description = 4; // 产品简介
string product_content = 5; // 产品内容
float product_price = 6; // 产品价格
string created_at = 7; // 产品创建时间
}
// 获取用户开通的产品列表的请求
message UserProductListReq {
int64 user_id = 1; // 用户ID
}
// 获取用户开通的产品列表的响应
message UserProductListResp {
repeated UserProductItem user_products = 1;
}
// 用户产品信息
message UserProductItem {
int64 id = 1; // 用户产品ID
int64 user_id = 2; // 用户ID
int64 product_id = 3; // 产品ID
string activation_date = 4; // 激活时间
string expiration_date = 5; // 到期时间
}

20
apps/api/etc/api-api.yaml Normal file
View File

@@ -0,0 +1,20 @@
Name: api-api
Host: 0.0.0.0
Port: 10003
DataSource: "tianyuanapi:g3h98u0291j@tcp(127.0.0.1:3307)/tianyuanapi?charset=utf8mb4&parseTime=True&loc=Local"
CacheRedis:
- Host: "127.0.0.1:6379"
Pass: "" # Redis 密码,如果未设置则留空
Type: "node" # 单节点模式
SentinelRpc:
Etcd:
Hosts:
- 127.0.0.1:2379
Key: sentinel.rpc
KqPusherConf:
Brokers:
- 127.0.0.1:9092
Topic: apirequest
WestConfig:
key: "121a1e41fc1690dd6b90afbcacd80cf4"
secretId: "449159"

View File

@@ -0,0 +1,24 @@
package config
import (
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/rest"
"github.com/zeromicro/go-zero/zrpc"
)
type Config struct {
rest.RestConf
DataSource string // 数据库连接的 DSN 字符串
CacheRedis cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体
SentinelRpc zrpc.RpcClientConf
KqPusherConf KqPusherConf
WestConfig WestConfig
}
type KqPusherConf struct {
Brokers []string
Topic string
}
type WestConfig struct {
Key string
SecretId string
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG162ALogic(r.Context(), svcCtx)
resp, err := l.FLXG162A(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG3D56Logic(r.Context(), svcCtx)
resp, err := l.FLXG3D56(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG54F5Logic(r.Context(), svcCtx)
resp, err := l.FLXG54F5(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG5876Logic(r.Context(), svcCtx)
resp, err := l.FLXG5876(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG75FELogic(r.Context(), svcCtx)
resp, err := l.FLXG75FE(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG9687Logic(r.Context(), svcCtx)
resp, err := l.FLXG9687(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXG970FLogic(r.Context(), svcCtx)
resp, err := l.FLXG970F(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXGC9D1Logic(r.Context(), svcCtx)
resp, err := l.FLXGC9D1(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXGCA3DLogic(r.Context(), svcCtx)
resp, err := l.FLXGCA3D(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"net/http"
"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)
return
}
l := FLXG.NewFLXGDEC7Logic(r.Context(), svcCtx)
resp, err := l.FLXGDEC7(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"net/http"
"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)
return
}
l := IVYZ.NewIVYZ0B03Logic(r.Context(), svcCtx)
resp, err := l.IVYZ0B03(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"net/http"
"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)
return
}
l := IVYZ.NewIVYZ2125Logic(r.Context(), svcCtx)
resp, err := l.IVYZ2125(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"net/http"
"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)
return
}
l := IVYZ.NewIVYZ385ELogic(r.Context(), svcCtx)
resp, err := l.IVYZ385E(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"net/http"
"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 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)
return
}
l := IVYZ.NewIVYZ5733Logic(r.Context(), svcCtx)
resp, err := l.IVYZ5733(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"net/http"
"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)
return
}
l := IVYZ.NewIVYZ9363Logic(r.Context(), svcCtx)
resp, err := l.IVYZ9363(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"net/http"
"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)
return
}
l := IVYZ.NewIVYZADEELogic(r.Context(), svcCtx)
resp, err := l.IVYZADEE(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"net/http"
"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)
return
}
l := JRZQ.NewJRZQ0A03Logic(r.Context(), svcCtx)
resp, err := l.JRZQ0A03(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"net/http"
"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)
return
}
l := JRZQ.NewJRZQ4AA8Logic(r.Context(), svcCtx)
resp, err := l.JRZQ4AA8(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"net/http"
"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)
return
}
l := JRZQ.NewJRZQ8203Logic(r.Context(), svcCtx)
resp, err := l.JRZQ8203(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"net/http"
"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 JRZQCEE8Handler(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)
return
}
l := JRZQ.NewJRZQCEE8Logic(r.Context(), svcCtx)
resp, err := l.JRZQCEE8(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"net/http"
"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)
return
}
l := JRZQ.NewJRZQDCBELogic(r.Context(), svcCtx)
resp, err := l.JRZQDCBE(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"net/http"
"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 JRZQFEF8Handler(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)
return
}
l := JRZQ.NewJRZQFEF8Logic(r.Context(), svcCtx)
resp, err := l.JRZQFEF8(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"net/http"
"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)
return
}
l := QYGL.NewQYGL2ACDLogic(r.Context(), svcCtx)
resp, err := l.QYGL2ACD(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"net/http"
"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)
return
}
l := QYGL.NewQYGL45BDLogic(r.Context(), svcCtx)
resp, err := l.QYGL45BD(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"net/http"
"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 QYGL51BCHandler(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)
return
}
l := QYGL.NewQYGL51BCLogic(r.Context(), svcCtx)
resp, err := l.QYGL51BC(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"net/http"
"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)
return
}
l := QYGL.NewQYGL6F2DLogic(r.Context(), svcCtx)
resp, err := l.QYGL6F2D(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"net/http"
"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)
return
}
l := QYGL.NewQYGL8261Logic(r.Context(), svcCtx)
resp, err := l.QYGL8261(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"net/http"
"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)
return
}
l := QYGL.NewQYGLB4C0Logic(r.Context(), svcCtx)
resp, err := l.QYGLB4C0(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"net/http"
"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)
return
}
l := YYSY.NewYYSY09CDLogic(r.Context(), svcCtx)
resp, err := l.YYSY09CD(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"net/http"
"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)
return
}
l := YYSY.NewYYSY4B37Logic(r.Context(), svcCtx)
resp, err := l.YYSY4B37(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"net/http"
"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)
return
}
l := YYSY.NewYYSY6F2ELogic(r.Context(), svcCtx)
resp, err := l.YYSY6F2E(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"net/http"
"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)
return
}
l := YYSY.NewYYSYBE08Logic(r.Context(), svcCtx)
resp, err := l.YYSYBE08(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"net/http"
"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)
return
}
l := YYSY.NewYYSYD50FLogic(r.Context(), svcCtx)
resp, err := l.YYSYD50F(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"net/http"
"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)
return
}
l := YYSY.NewYYSYF7DBLogic(r.Context(), svcCtx)
resp, err := l.YYSYF7DB(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,234 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.2
package handler
import (
"net/http"
FLXG "tianyuan-api/apps/api/internal/handler/FLXG"
IVYZ "tianyuan-api/apps/api/internal/handler/IVYZ"
JRZQ "tianyuan-api/apps/api/internal/handler/JRZQ"
QYGL "tianyuan-api/apps/api/internal/handler/QYGL"
YYSY "tianyuan-api/apps/api/internal/handler/YYSY"
"tianyuan-api/apps/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/FLXG162A",
Handler: FLXG.FLXG162AHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXG3D56",
Handler: FLXG.FLXG3D56Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXG54F5",
Handler: FLXG.FLXG54F5Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXG5876",
Handler: FLXG.FLXG5876Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXG75FE",
Handler: FLXG.FLXG75FEHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXG9687",
Handler: FLXG.FLXG9687Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXG970F",
Handler: FLXG.FLXG970FHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXGC9D1",
Handler: FLXG.FLXGC9D1Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXGCA3D",
Handler: FLXG.FLXGCA3DHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/FLXGDEC7",
Handler: FLXG.FLXGDEC7Handler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/IVYZ0B03",
Handler: IVYZ.IVYZ0B03Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/IVYZ2125",
Handler: IVYZ.IVYZ2125Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/IVYZ385E",
Handler: IVYZ.IVYZ385EHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/IVYZ5733",
Handler: IVYZ.IVYZ5733Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/IVYZ9363",
Handler: IVYZ.IVYZ9363Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/IVYZADEE",
Handler: IVYZ.IVYZADEEHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/JRZQ0A03",
Handler: JRZQ.JRZQ0A03Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/JRZQ4AA8",
Handler: JRZQ.JRZQ4AA8Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/JRZQ8203",
Handler: JRZQ.JRZQ8203Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/JRZQCEE8",
Handler: JRZQ.JRZQCEE8Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/JRZQDCBE",
Handler: JRZQ.JRZQDCBEHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/JRZQFEF8",
Handler: JRZQ.JRZQFEF8Handler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/QYGL2ACD",
Handler: QYGL.QYGL2ACDHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/QYGL45BD",
Handler: QYGL.QYGL45BDHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/QYGL51BC",
Handler: QYGL.QYGL51BCHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/QYGL6F2D",
Handler: QYGL.QYGL6F2DHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/QYGL8261",
Handler: QYGL.QYGL8261Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/QYGLB4C0",
Handler: QYGL.QYGLB4C0Handler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/YYSY09CD",
Handler: YYSY.YYSY09CDHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/YYSY4B37",
Handler: YYSY.YYSY4B37Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/YYSY6F2E",
Handler: YYSY.YYSY6F2EHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/YYSYBE08",
Handler: YYSY.YYSYBE08Handler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/YYSYD50F",
Handler: YYSY.YYSYD50FHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/YYSYF7DB",
Handler: YYSY.YYSYF7DBHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1"),
)
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG162ALogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG162ALogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG162ALogic {
return &FLXG162ALogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,98 @@
package FLXG
import (
"context"
"encoding/hex"
"errors"
"tianyuan-api/apps/api/internal/validator"
"tianyuan-api/pkg/crypto"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG3D56Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG3D56Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG3D56Logic {
return &FLXG3D56Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err 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.FLXG3D56Request
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
return nil, validatorErr
}
// 3、西部加密
westConfig := l.svcCtx.Config.WestConfig
mobileNo, err := crypto.WestDexEncrypt(data.MobileNo, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
return nil, errors.New("业务异常")
}
name, err := crypto.WestDexEncrypt(data.Name, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
return nil, errors.New("业务异常")
}
idCard, err := crypto.WestDexEncrypt(data.IDCard, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
return nil, errors.New("业务异常")
}
timeRange, err := crypto.WestDexEncrypt(data.TimeRange, westConfig.Key)
if err != nil {
logx.Errorf("西部加密错误:%v", err)
return nil, errors.New("业务异常")
}
// 4、发送请求到西部
westdexRequest := map[string]interface{}{
"id": idCard,
"cell": mobileNo,
"name": name,
"time_range": timeRange,
}
westResp, err := l.svcCtx.WestDexService.CallAPI("G26BJ05", 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
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG54F5Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG54F5Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG54F5Logic {
return &FLXG54F5Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG5876Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG5876Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG5876Logic {
return &FLXG5876Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG75FELogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG75FELogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG75FELogic {
return &FLXG75FELogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG75FELogic) FLXG75FE(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG9687Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG9687Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG9687Logic {
return &FLXG9687Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXG970FLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXG970FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG970FLogic {
return &FLXG970FLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXGC9D1Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXGC9D1Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGC9D1Logic {
return &FLXGC9D1Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXGCA3DLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXGCA3DLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGCA3DLogic {
return &FLXGCA3DLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package FLXG
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type FLXGDEC7Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewFLXGDEC7Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGDEC7Logic {
return &FLXGDEC7Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type IVYZ0B03Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewIVYZ0B03Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ0B03Logic {
return &IVYZ0B03Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type IVYZ2125Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewIVYZ2125Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ2125Logic {
return &IVYZ2125Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type IVYZ385ELogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewIVYZ385ELogic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ385ELogic {
return &IVYZ385ELogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type IVYZ5733Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewIVYZ5733Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ5733Logic {
return &IVYZ5733Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type IVYZ9363Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewIVYZ9363Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ9363Logic {
return &IVYZ9363Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package IVYZ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type IVYZADEELogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewIVYZADEELogic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZADEELogic {
return &IVYZADEELogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JRZQ0A03Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewJRZQ0A03Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ0A03Logic {
return &JRZQ0A03Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JRZQ4AA8Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewJRZQ4AA8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ4AA8Logic {
return &JRZQ4AA8Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JRZQ8203Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewJRZQ8203Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ8203Logic {
return &JRZQ8203Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JRZQCEE8Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewJRZQCEE8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQCEE8Logic {
return &JRZQCEE8Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JRZQCEE8Logic) JRZQCEE8(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JRZQDCBELogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewJRZQDCBELogic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQDCBELogic {
return &JRZQDCBELogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package JRZQ
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type JRZQFEF8Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewJRZQFEF8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQFEF8Logic {
return &JRZQFEF8Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *JRZQFEF8Logic) JRZQFEF8(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,35 @@
package QYGL
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QYGL2ACDLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQYGL2ACDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL2ACDLogic {
return &QYGL2ACDLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err error) {
data := "zhangSan"
err = l.svcCtx.KqPusherClient.Push(l.ctx, data)
if err != nil {
logx.Errorf("KqPusherClient Push Error , err :%v", err)
}
return &types.Response{
Data: "三要素合演",
}, nil
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QYGL45BDLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQYGL45BDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL45BDLogic {
return &QYGL45BDLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QYGL51BCLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQYGL51BCLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL51BCLogic {
return &QYGL51BCLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QYGL51BCLogic) QYGL51BC(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QYGL6F2DLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQYGL6F2DLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL6F2DLogic {
return &QYGL6F2DLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QYGL8261Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQYGL8261Logic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL8261Logic {
return &QYGL8261Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package QYGL
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type QYGLB4C0Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewQYGLB4C0Logic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGLB4C0Logic {
return &QYGLB4C0Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type YYSY09CDLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewYYSY09CDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY09CDLogic {
return &YYSY09CDLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type YYSY4B37Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewYYSY4B37Logic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY4B37Logic {
return &YYSY4B37Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type YYSY6F2ELogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewYYSY6F2ELogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY6F2ELogic {
return &YYSY6F2ELogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type YYSYBE08Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewYYSYBE08Logic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYBE08Logic {
return &YYSYBE08Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,30 @@
package YYSY
import (
"context"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type YYSYD50FLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewYYSYD50FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYD50FLogic {
return &YYSYD50FLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err error) {
// todo: add your logic here and delete this line
return
}

View File

@@ -0,0 +1,87 @@
package YYSY
import (
"context"
"github.com/zeromicro/go-zero/core/logx"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
)
type YYSYF7DBLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewYYSYF7DBLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYF7DBLogic {
return &YYSYF7DBLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
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
return &types.Response{}, nil
}

View File

@@ -0,0 +1,112 @@
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"
"tianyuan-api/apps/sentinel/client/secret"
"tianyuan-api/apps/sentinel/client/userproduct"
"tianyuan-api/apps/sentinel/client/whitelist"
"tianyuan-api/apps/sentinel/sentinel"
"net"
"net/http"
"strings"
)
type ApiAuthInterceptorMiddleware struct {
WhitelistRpc sentinel.WhitelistClient
SecretRpc sentinel.SecretClient
UserProductRpc sentinel.UserProductClient
Rds *redis.Redis
}
func NewApiAuthInterceptorMiddleware(
whitelistRpc sentinel.WhitelistClient,
secretRpc sentinel.SecretClient,
userProductRpc sentinel.UserProductClient,
rds *redis.Redis) *ApiAuthInterceptorMiddleware {
return &ApiAuthInterceptorMiddleware{
WhitelistRpc: whitelistRpc,
SecretRpc: secretRpc,
UserProductRpc: userProductRpc,
Rds: rds,
}
}
func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// 1. 查找IP白名单
clientIP := r.Header.Get("X-Forwarded-For")
if clientIP == "" {
clientIP = r.Header.Get("X-Real-IP")
}
if clientIP == "" {
clientIP, _, _ = net.SplitHostPort(r.RemoteAddr)
}
logx.Infof("当前请求IP%s", clientIP)
redisKey := "whitelist_ips"
isMember, err := m.Rds.SismemberCtx(r.Context(), redisKey, clientIP)
if err == nil && isMember {
// 如果缓存中存在该IP继续执行后续鉴权操作
// 此处不调用 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("系统错误,请联系管理员"))
return
}
if !isAllowedResp.Match {
logx.Debugf("未经授权的IP%s", clientIP)
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未经授权的IP"))
return
}
}
// 2、查找相关accessId
accessId := r.Header.Get("Access-Id")
if accessId == "" {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("缺少Access-Id"))
return
}
secrets, err := m.SecretRpc.GetSecretBySecretId(r.Context(), &secret.GetSecretBySecretIdRequest{SecretId: accessId})
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误"))
return
}
if secrets.Id == 0 {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未经授权的AccessId"))
return
}
// 3、是否有开通该产品
userId := secrets.UserId
pathParts := strings.Split(r.URL.Path, "/")
productCode := pathParts[len(pathParts)-1]
userProductRedisKey := fmt.Sprintf("user_products:%d", userId)
isMemberUserProduct, err := m.Rds.SismemberCtx(r.Context(), userProductRedisKey, productCode)
if err == nil && isMemberUserProduct {
} else {
isUserProductAllowedResp, err := m.UserProductRpc.MatchingUserIdProductCode(r.Context(), &userproduct.MatchingUserIdProductCodeRequest{Id: userId, ProductCode: productCode})
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误,请联系管理员"))
return
}
if !isUserProductAllowedResp.Match {
xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未开通此产品"))
return
}
}
// 将 userId 存入 context供后续逻辑使用
ctx := context.WithValue(r.Context(), "userId", userId)
ctx = context.WithValue(r.Context(), "secretKey", secrets.AesKey)
next(w, r.WithContext(ctx))
}
}

View File

@@ -0,0 +1,114 @@
package service
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"github.com/zeromicro/go-zero/core/logx"
"tianyuan-api/pkg/crypto"
"io"
"net/http"
"strconv"
"time"
)
type Wrapper[T any] struct {
Data T `json:"data"`
}
type WestResp struct {
Message string `json:"message"`
Code string `json:"code"`
Data string `json:"data"`
ID string `json:"id"`
ErrorCode *int `json:"error_code"`
Reason string `json:"reason"`
}
type WestDexService struct {
Key string
SecretID string
}
// NewWestDexService 是一个构造函数,用于初始化 WestDexService
func NewWestDexService(key, secretID string) *WestDexService {
return &WestDexService{
Key: key,
SecretID: secretID,
}
}
// CallAPI 调用西部数据的 API
func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (resp []byte, err error) {
// 生成当前的13位时间戳
timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
// 构造请求URL
//https://apimaster.westdex.com.cn
reqUrl := fmt.Sprintf("http://proxy.tianyuanapi.com/api/invoke/%s/%s?timestamp=%s", w.SecretID, code, timestamp)
// 将请求参数编码为JSON格式
data := map[string]interface{}{
"data": reqData,
}
jsonData, err := json.Marshal(data)
if err != nil {
logx.Errorf("【西部数据请求】JSON编码错误: %v", err)
return
}
// 创建HTTP POST请求
req, err := http.NewRequest("POST", reqUrl, bytes.NewBuffer(jsonData))
if err != nil {
logx.Errorf("【西部数据请求】创建请求错误: %v", err)
return
}
// 设置请求头
req.Header.Set("Content-Type", "application/json")
// 发送请求
client := &http.Client{}
httpResp, err := client.Do(req)
if err != nil {
logx.Errorf("【西部数据请求】发送请求错误: %v", err)
return nil, errors.New("业务异常")
}
defer httpResp.Body.Close()
// 检查请求是否成功
if httpResp.StatusCode == 200 {
// 读取响应体
bodyBytes, ReadErr := io.ReadAll(httpResp.Body)
if ReadErr != nil {
logx.Errorf("【西部数据请求】读取响应体错误: %v", ReadErr)
return nil, ReadErr
}
// 手动调用 json.Unmarshal 触发自定义的 UnmarshalJSON 方法
var westDexResp WestResp
UnmarshalErr := json.Unmarshal(bodyBytes, &westDexResp)
if UnmarshalErr != nil {
logx.Errorf("【西部数据请求】JSON反序列化错误: %v", UnmarshalErr)
return nil, UnmarshalErr
}
// 到这层是西部系统
if westDexResp.Code != "00000" {
logx.Errorf("【西部数据请求】响应数据业务异常: %s %s", westDexResp.Message, westDexResp.Reason)
return nil, errors.New("业务异常")
}
// 解密响应数据
decryptedData, DecryptErr := crypto.WestDexDecrypt(westDexResp.Data, w.Key)
if DecryptErr != nil {
logx.Errorf("【西部数据请求】响应数据解密错误: %v", DecryptErr)
return nil, DecryptErr
}
// 输出解密后的数据
return decryptedData, nil
}
logx.Errorf("【西部数据请求】请求失败,状态码: %d", httpResp.StatusCode)
return nil, errors.New("west response error status code: " + strconv.Itoa(httpResp.StatusCode))
}

View File

@@ -0,0 +1,50 @@
package svc
import (
"github.com/zeromicro/go-queue/kq"
"github.com/zeromicro/go-zero/core/stores/redis"
"github.com/zeromicro/go-zero/rest"
"github.com/zeromicro/go-zero/zrpc"
"tianyuan-api/apps/api/internal/config"
"tianyuan-api/apps/api/internal/middleware"
"tianyuan-api/apps/api/internal/service"
"tianyuan-api/apps/sentinel/sentinel"
)
type ServiceContext struct {
Config config.Config
ApiAuthInterceptor rest.Middleware
Redis *redis.Redis
WhitelistRpc sentinel.WhitelistClient
SecretRpc sentinel.SecretClient
ProductRpc sentinel.ProductClient
UserProductRpc sentinel.UserProductClient
KqPusherClient *kq.Pusher
WestDexService *service.WestDexService
}
func NewServiceContext(c config.Config) *ServiceContext {
redisConf := redis.RedisConf{
Host: c.CacheRedis[0].Host,
Pass: c.CacheRedis[0].Pass,
Type: c.CacheRedis[0].Type, // Redis 节点类型,如 "node"
}
// 使用 MustNewRedis 来初始化 Redis 客户端
rds := redis.MustNewRedis(redisConf)
productRpc := sentinel.NewProductClient(zrpc.MustNewClient(c.SentinelRpc).Conn())
userProductRpc := sentinel.NewUserProductClient(zrpc.MustNewClient(c.SentinelRpc).Conn())
whitelistRpc := sentinel.NewWhitelistClient(zrpc.MustNewClient(c.SentinelRpc).Conn())
secretRpc := sentinel.NewSecretClient(zrpc.MustNewClient(c.SentinelRpc).Conn())
return &ServiceContext{
Config: c,
Redis: rds,
WhitelistRpc: whitelistRpc,
SecretRpc: secretRpc,
ProductRpc: productRpc,
UserProductRpc: userProductRpc,
ApiAuthInterceptor: middleware.NewApiAuthInterceptorMiddleware(whitelistRpc, secretRpc, userProductRpc, rds).Handle,
KqPusherClient: kq.NewPusher(c.KqPusherConf.Brokers, c.KqPusherConf.Topic),
WestDexService: service.NewWestDexService(c.WestConfig.Key, c.WestConfig.SecretId), // 假设你将密钥和 ID 配置在 config 中
}
}

View File

@@ -0,0 +1,12 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.2
package types
type Request struct {
Data string `json:"data"`
}
type Response struct {
Data string `json:"data"`
}

View File

@@ -0,0 +1,24 @@
package validator
// 定义自定义错误消息
var customMessages = map[string]string{
"Name.min": "name 不能少于1个字",
"Name.required": "name 是必填项",
"Name.validName": "name 只能包含中文字符",
"MobileNo.required": "mobile_no 是必填项",
"MobileNo.min": "mobile_no 电话号码必须为有效的中国电话号码",
"MobileNo.max": "mobile_no 电话号码必须为有效的中国电话号码",
"MobileNo.validMobileNo": "电话号码必须为有效的中国电话号码",
"ID.required": "id_card 是必填项",
"ID.validID": "id 必须为有效的身份证号码",
"TimeRange.validTimeRange": "time_range 必须为1到5的数字表示年",
}
// 获取自定义错误消息
func GetErrorMessage(field, tag string) string {
key := field + "." + tag
if msg, exists := customMessages[key]; exists {
return msg
}
return "请输入正确格式的参数"
}

View File

@@ -0,0 +1,27 @@
package validator
// 通用字段结构体
type MobileNo struct {
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
}
type StartDate struct {
StartDate string `json:"start_date" validate:"required,validDate"`
}
type IDCard struct {
IDCard string `json:"id_card" validate:"required,validIDCard"`
}
type Name struct {
Name string `json:"name" validate:"required,min=1,validName"`
}
type FLXG3D56Request struct {
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
IDCard string `json:"id_card" validate:"required,validIDCard"`
Name string `json:"name" validate:"required,min=1,validName"`
TimeRange string `json:"time_range" validate:"omitempty,validTimeRange"` // 非必填字段
}
type YYSYf7dbRequest struct {
MobileNo
StartDate
}

View File

@@ -0,0 +1,112 @@
package validator
import (
"encoding/json"
"errors"
"fmt"
"github.com/go-playground/validator/v10"
"regexp"
"strconv"
)
var validate *validator.Validate
// 初始化自定义校验器
func init() {
validate = validator.New()
if err := validate.RegisterValidation("validName", validName); err != nil {
panic(fmt.Sprintf("注册 validName 验证器时发生错误: %v", err))
}
// 注册自定义验证器 validMobileNo
if err := validate.RegisterValidation("validMobileNo", validMobileNo); err != nil {
panic(fmt.Sprintf("注册 validMobileNo 验证器时发生错误: %v", err))
}
// 注册自定义验证器 validDate
if err := validate.RegisterValidation("validDate", validDate); err != nil {
panic(fmt.Sprintf("注册 validDate 验证器时发生错误: %v", err))
}
// 注册自定义验证器 validIDCard
if err := validate.RegisterValidation("validIDCard", validIDCard); err != nil {
panic(fmt.Sprintf("注册 validIDCard 验证器时发生错误: %v", err))
}
// 注册自定义验证器 validTimeRange
if err := validate.RegisterValidation("validTimeRange", validTimeRange); err != nil {
panic(fmt.Sprintf("注册 validTimeRange 验证器时发生错误: %v", err))
}
}
// ValidateAndParse 封装了解密、解析和校验逻辑
func ValidateAndParse(decryptData []byte, req interface{}) error {
// 解析解密后的 JSON 数据
if err := json.Unmarshal(decryptData, req); err != nil {
return errors.New("解密后的数据格式不正确")
}
// 校验
v := GetValidator()
if err := v.Struct(req); err != nil {
for _, validationErr := range err.(validator.ValidationErrors) {
field := validationErr.StructField()
tag := validationErr.Tag()
return errors.New(GetErrorMessage(field, tag))
}
}
// 如果没有错误,返回 nil
return nil
}
// 获取验证器实例
func GetValidator() *validator.Validate {
return validate
}
// 自定义的名称验证
func validName(fl validator.FieldLevel) bool {
name := fl.Field().String()
validNamePattern := `^[\p{Han}]+$`
matched, _ := regexp.MatchString(validNamePattern, name)
return matched
}
// 自定义的手机号验证
func validMobileNo(fl validator.FieldLevel) bool {
phone := fl.Field().String()
validMobileNoPattern := `^1[3-9]\d{9}$`
matched, _ := regexp.MatchString(validMobileNoPattern, phone)
return matched
}
// 自定义正则表达式校验 yyyyMMdd 格式
func validDate(fl validator.FieldLevel) bool {
date := fl.Field().String()
validDatePattern := `^\d{4}(0[1-9]|1[0-2])(0[1-9]|[12][0-9]|3[01])$`
matched, _ := regexp.MatchString(validDatePattern, date)
return matched
}
// 自定义身份证校验
func validIDCard(fl validator.FieldLevel) bool {
id := fl.Field().String()
validIDPattern := `^\d{15}$|^\d{18}$|^\d{17}(\d|X|x)$` // 匹配15位或18位身份证
matched, _ := regexp.MatchString(validIDPattern, id)
return matched
}
// 自定义 time_range 校验 (1-5年)
func validTimeRange(fl validator.FieldLevel) bool {
timeRange := fl.Field().String()
if timeRange == "" {
return true // 如果为空,认为是有效的,因为是非必填项
}
value, err := strconv.Atoi(timeRange)
if err != nil || value < 1 || value > 5 {
return false
}
return true
}

View File

@@ -0,0 +1,13 @@
package westmodel
type G09GX01Response struct {
Msg string `json:"msg"`
Code int `json:"code"`
Data string `json:"data"`
Success bool `json:"success"`
}
type G16BJ02Response struct {
Code int `json:"code"`
Msg string `json:"msg"`
PhoneType string `json:"phoneType"`
}