commit 6773f86bc5a1a099e3903d3cc24625a9f153e63e
Author: liangzai <2440983361@qq.com>
Date: Wed Oct 2 00:57:17 2024 +0800
first commit
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..6840a98
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+tianyuan-api
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..cd2f929
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,12 @@
+
+
+
+
+ redis
+ true
+ jdbc.RedisDriver
+ jdbc:redis://localhost:6379/0
+ $ProjectFileDir$
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..be4b286
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..33ef06d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
new file mode 100644
index 0000000..e829a10
--- /dev/null
+++ b/.idea/sqldialects.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/tianyuan-api.iml b/.idea/tianyuan-api.iml
new file mode 100644
index 0000000..5e764c4
--- /dev/null
+++ b/.idea/tianyuan-api.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aes.go b/aes.go
new file mode 100644
index 0000000..fea6cec
--- /dev/null
+++ b/aes.go
@@ -0,0 +1,78 @@
+package main
+
+import (
+ "bytes"
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/rand"
+ "encoding/base64"
+ "encoding/hex"
+ "encoding/json"
+ "fmt"
+ "io"
+)
+
+// PKCS7填充
+func PKCS7Padding(ciphertext []byte, blockSize int) []byte {
+ padding := blockSize - len(ciphertext)%blockSize
+ padtext := bytes.Repeat([]byte{byte(padding)}, padding)
+ return append(ciphertext, padtext...)
+}
+
+// AES CBC模式加密,Base64传入传出
+func AesEncrypt(plainText, key []byte) (string, error) {
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return "", err
+ }
+ blockSize := block.BlockSize()
+ plainText = PKCS7Padding(plainText, blockSize)
+
+ cipherText := make([]byte, blockSize+len(plainText))
+ iv := cipherText[:blockSize] // 使用前blockSize字节作为IV
+ _, err = io.ReadFull(rand.Reader, iv)
+ if err != nil {
+ return "", err
+ }
+
+ mode := cipher.NewCBCEncrypter(block, iv)
+ mode.CryptBlocks(cipherText[blockSize:], plainText)
+
+ return base64.StdEncoding.EncodeToString(cipherText), nil
+}
+
+type Data struct {
+ Name string `json:"name"`
+ Email string `json:"email"`
+}
+
+func main() {
+ // 定义 AES 密钥
+ key, _ := hex.DecodeString("c58e5aa2f91ddd5e0947ffc119b029c4")
+
+ var data interface{}
+
+ data = map[string]interface{}{
+ "id_card": "45212220000827423X",
+ "mobile_no": "18276151590",
+ "name": "张荣宏",
+ "time_range": "5",
+ }
+
+ // 将结构体转为 JSON 字符串
+ jsonData, err := json.Marshal(data)
+ if err != nil {
+ fmt.Println("JSON 序列化错误:", err)
+ return
+ }
+
+ // 对 JSON 数据进行加密
+ encryptedData, err := AesEncrypt(jsonData, key)
+ if err != nil {
+ fmt.Println("加密错误:", err)
+ return
+ }
+
+ // 输出加密后的结果
+ fmt.Println("加密后的数据:", encryptedData)
+}
diff --git a/api.json b/api.json
new file mode 100644
index 0000000..13ca2f6
--- /dev/null
+++ b/api.json
@@ -0,0 +1,250 @@
+[
+ {
+ "serviceId": "IVYZ0B03",
+ "sourceId": "G07-XM01",
+ "serviceName": "实名信息对比技术服务(两项)",
+ "dataDescription": "核验二要素是否一致",
+ "group_cn": "身份验证",
+ "group": "IVYZ"
+ },
+ {
+ "serviceId": "IVYZ5733",
+ "sourceId": "G09-GX01",
+ "serviceName": "单人婚姻登记信息核验",
+ "dataDescription": "核验单人婚姻当前状态",
+ "group_cn": "身份验证",
+ "group": "IVYZ"
+ },
+ {
+ "serviceId": "FLXGCA3D",
+ "sourceId": "G22-BJ03",
+ "serviceName": "个人综合涉诉",
+ "dataDescription": "查询个人涉诉信息",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "FLXG970F",
+ "sourceId": "G01-BJ01",
+ "serviceName": "风险人员核验",
+ "dataDescription": "包含所查人员涉稳、涉恐、肇事、闹事等风险等级",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "FLXG75FE",
+ "sourceId": "G04-HZ01",
+ "serviceName": "涉网风险",
+ "dataDescription": "全国公安部门的网络犯罪调查服务",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "QYGLB4C0",
+ "sourceId": "G05-HZ01",
+ "serviceName": "股东人企关系精准版",
+ "dataDescription": "返回与个人关联的法人-股东-高管-失信被执行-被行政处罚信息",
+ "group_cn": "企业相关",
+ "group": "QYGL"
+ },
+ {
+ "serviceId": "QYGL8261",
+ "sourceId": "Q03-BI03",
+ "serviceName": "企业综合涉诉",
+ "dataDescription": "查询企业涉诉信息",
+ "group_cn": "企业相关",
+ "group": "QYGL"
+ },
+ {
+ "serviceId": "FLXGDEC7",
+ "sourceId": "G23-BJ03",
+ "serviceName": "个人不良",
+ "dataDescription": "核验个人是否有涉毒、在逃等记录",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "FLXG5876",
+ "sourceId": "G03-XM02",
+ "serviceName": "易诉人",
+ "dataDescription": "核验是否为易诉人群",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "IVYZ9363",
+ "sourceId": "G10-GX01",
+ "serviceName": "双人婚姻状态识别",
+ "dataDescription": "核验双人婚姻关系",
+ "group_cn": "身份验证",
+ "group": "IVYZ"
+ },
+ {
+ "serviceId": "IVYZ385E",
+ "sourceId": "G08-SC01",
+ "serviceName": "自然人生存状态标识",
+ "dataDescription": "核验自然人生存状态",
+ "group_cn": "身份验证",
+ "group": "IVYZ"
+ },
+ {
+ "serviceId": "FLXG54F5",
+ "sourceId": "G03-HZ01",
+ "serviceName": "易诉人群识别",
+ "dataDescription": "识别用户是否为易诉人群",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "IVYZ2125",
+ "sourceId": "ZJ01-JS01",
+ "serviceName": "活体+人像核验组件",
+ "dataDescription": "集成活体+人像核验功能",
+ "group_cn": "身份验证",
+ "group": "IVYZ"
+ },
+ {
+ "serviceId": "IVYZADEE",
+ "sourceId": "G06-JS01",
+ "serviceName": "身份证三要素比对",
+ "dataDescription": "人像核验功能",
+ "group_cn": "身份验证",
+ "group": "IVYZ"
+ },
+ {
+ "serviceId": "QYGL45BD",
+ "sourceId": "Q01-JS01",
+ "serviceName": "企业法人四要素核验",
+ "dataDescription": "验证信用代码、企业名称、法人姓名和法人id是否一致",
+ "group_cn": "企业相关",
+ "group": "QYGL"
+ },
+ {
+ "serviceId": "QYGL2ACD",
+ "sourceId": "Q02-JS01",
+ "serviceName": "企业三要素核验",
+ "dataDescription": "验证信用代码、企业名称和法人姓名是否一致",
+ "group_cn": "企业相关",
+ "group": "QYGL"
+ },
+ {
+ "serviceId": "YYSY6F2E",
+ "sourceId": "G15-BJ02",
+ "serviceName": "运营商三要素核验(详版)",
+ "dataDescription": "核验三要素是否一致",
+ "group_cn": "运营商验证",
+ "group": "YYSY"
+ },
+ {
+ "serviceId": "YYSY09CD",
+ "sourceId": "G16-BJ02",
+ "serviceName": "运营商三要素验证(简版)",
+ "dataDescription": "核验三要素是否一致",
+ "group_cn": "运营商验证",
+ "group": "YYSY"
+ },
+ {
+ "serviceId": "YYSYBE08",
+ "sourceId": "G17-BJ02",
+ "serviceName": "运营商二要素核验(手机号、姓名)",
+ "dataDescription": "核验用户提交的二要素信息与运营商登记的是否一致",
+ "group_cn": "运营商验证",
+ "group": "YYSY"
+ },
+ {
+ "serviceId": "YYSYD50F",
+ "sourceId": "G18-BJ02",
+ "serviceName": "运营商二要素核验(手机号、身份证)",
+ "dataDescription": "核验用户提交的二要素信息与运营商登记的是否一致",
+ "group_cn": "运营商验证",
+ "group": "YYSY"
+ },
+ {1111111111111111
+ "serviceId": "YYSYF7DB",
+ "sourceId": "G19-BJ02",
+ "serviceName": "手机二次卡",
+ "dataDescription": "可检测用户号码更换状态",
+ "group_cn": "运营商验证",
+ "group": "YYSY"
+ },
+ {
+ "serviceId": "JRZQDCBE",
+ "sourceId": "G20-GZ01",
+ "serviceName": "银行卡四要素验证",
+ "dataDescription": "核验姓名、身份证号、银行卡号、手机号是否匹配",
+ "group_cn": "金融验证",
+ "group": "JRZQ"
+ },
+ {
+ "serviceId": "YYSY4B37",
+ "sourceId": "G02-BJ02",
+ "serviceName": "手机在网时长",
+ "dataDescription": "查询手机号使用的时间",
+ "group_cn": "运营商验证",
+ "group": "YYSY"
+ },
+ {
+ "serviceId": "QYGL6F2D",
+ "sourceId": "G05-XM02",
+ "serviceName": "人企关联",
+ "dataDescription": "人企关联",
+ "group_cn": "企业相关",
+ "group": "QYGL"
+ },
+ {1111111111111111111111
+ "serviceId": "FLXG3D56",
+ "sourceId": "G26-BJ05",
+ "serviceName": "特殊名单验证",
+ "dataDescription": "特殊名单验证",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "JRZQ0A03",
+ "sourceId": "G27-BJ05",
+ "serviceName": "借贷意向验证",
+ "dataDescription": "借贷意向验证",
+ "group_cn": "金融验证",
+ "group": "JRZQ"
+ },
+ {
+ "serviceId": "JRZQ8203",
+ "sourceId": "G28-BJ05",
+ "serviceName": "借贷行为验证",
+ "dataDescription": "借贷行为验证",
+ "group_cn": "金融验证",
+ "group": "JRZQ"
+ },
+ {
+ "serviceId": "JRZQ4AA8",
+ "sourceId": "G29-BJ05",
+ "serviceName": "偿债压力指数",
+ "dataDescription": "偿债压力指数",
+ "group_cn": "金融验证",
+ "group": "JRZQ"
+ },
+ {
+ "serviceId": "FLXGC9D1",
+ "sourceId": "G30-BJ05",
+ "serviceName": "黑灰产等级",
+ "dataDescription": "黑灰产等级",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "FLXG9687",
+ "sourceId": "G31-BJ05",
+ "serviceName": "电诈风险预警-标准版",
+ "dataDescription": "电诈风险预警-标准版",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ },
+ {
+ "serviceId": "FLXG162A",
+ "sourceId": "G32-BJ05",
+ "serviceName": "团伙欺诈排查(通用版)",
+ "dataDescription": "团伙欺诈排查(通用版)",
+ "group_cn": "法律相关",
+ "group": "FLXG"
+ }
+]
diff --git a/apps/admin/Dockerfile b/apps/admin/Dockerfile
new file mode 100644
index 0000000..c6139f5
--- /dev/null
+++ b/apps/admin/Dockerfile
@@ -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/admin/etc /app/etc
+RUN go build -ldflags="-s -w" -o /app/admin apps/admin/.\admin.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/admin /app/admin
+COPY --from=builder /app/etc /app/etc
+
+CMD ["./admin", "-f", "etc/admin-api.yaml"]
diff --git a/apps/admin/admin.api b/apps/admin/admin.api
new file mode 100644
index 0000000..db6b6be
--- /dev/null
+++ b/apps/admin/admin.api
@@ -0,0 +1,154 @@
+syntax = "v1"
+
+info (
+ title: "Enterprise API"
+ desc: "API for managing enterprise reviews and authentication"
+ author: "Your Name"
+ date: "2024-09-25"
+)
+
+type (
+ LoginReq {
+ Username string `json:"username"`
+ Password string `json:"password"`
+ }
+ LoginResp {}
+)
+
+type (
+ GetPendingEnterpriseReq {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+ }
+ GetPendingEnterpriseResp {
+ Total int64 `json:"total"`
+ List []EnterpriseItem `json:"list"`
+ }
+ ReviewEnterpriseReq {
+ EnterpriseID int64 `json:"enterpriseId"`
+ Status string `json:"status"`
+ Remarks string `json:"remarks"`
+ }
+ ReviewEnterpriseResp {}
+)
+
+type EnterpriseItem {
+ Id int64 `json:"id"` // 企业ID
+ EnterpriseName string `json:"enterpriseName"` // 企业名称
+ CreditCode string `json:"creditCode"` // 企业信用代码
+ LegalPerson string `json:"legalPerson"` // 法人
+ EnterpriseContact string `json:"enterpriseContact"` // 企业联系方式
+ AuthStatus string `json:"authStatus"` // 认证状态
+ BusinessLicense string `json:"businessLicense"`
+ CreatedAt string `json:"createdAt"` // 创建时间
+ UpdatedAt string `json:"updatedAt"` // 更新时间
+}
+
+type (
+ UserInfoResp {
+ username string `json:"username"`
+ }
+)
+
+@server (
+ group: auth
+ prefix: /api/admin/auth
+)
+service admin-api {
+ @handler login
+ post /login (LoginReq) returns (LoginResp)
+}
+
+@server (
+ group: user
+ prefix: /api/admin/user
+ middleware: AuthInterceptor
+)
+service admin-api {
+ @handler getUserInfo
+ get /info returns (UserInfoResp)
+}
+
+@server (
+ group: review
+ prefix: /api/admin/enterprise
+ middleware: AuthInterceptor
+)
+service admin-api {
+ @handler reviewEnterprise
+ post /review (ReviewEnterpriseReq) returns (ReviewEnterpriseResp)
+
+ @handler getPendingEnterprise
+ get /pending (GetPendingEnterpriseReq) returns (GetPendingEnterpriseResp)
+}
+
+type (
+ CreateProductReq {
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+ }
+ UpdateProductReq {
+ ProductId int64 `json:"productId"`
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+ }
+ DeleteProductReq {
+ ProductId int64 `json:"productId"`
+ }
+ GetProductByIdReq {
+ ProductId int64 `path:"productId"`
+ }
+ GetProductByIdResp {
+ ProductItem
+ }
+ GetProductListReq {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+ }
+ GetProductListResp {
+ Total int64 `json:"total"`
+ List []ProductItem `json:"list"`
+ }
+ ProductItem {
+ ProductId int64 `json:"productId"`
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+ CreatedAt string `json:"createdAt"`
+ UpdatedAt string `json:"updatedAt"`
+ }
+)
+
+@server (
+ group: product
+ prefix: /api/admin/product
+ middleware: AuthInterceptor
+)
+service admin-api {
+ @handler createProduct
+ post /create (CreateProductReq)
+
+ @handler updateProduct
+ post /update (UpdateProductReq)
+
+ @handler deleteProduct
+ post /delete (DeleteProductReq)
+
+ @handler getProductById
+ get /:productId (GetProductByIdReq) returns (GetProductByIdResp)
+
+ @handler getProductList
+ get /list (GetProductListReq) returns (GetProductListResp)
+}
+
diff --git a/apps/admin/admin.go b/apps/admin/admin.go
new file mode 100644
index 0000000..6127d17
--- /dev/null
+++ b/apps/admin/admin.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+
+ "tianyuan-api/apps/admin/internal/config"
+ "tianyuan-api/apps/admin/internal/handler"
+ "tianyuan-api/apps/admin/internal/svc"
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/rest"
+)
+
+var configFile = flag.String("f", "etc/admin-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()
+}
diff --git a/apps/admin/etc/admin-api.yaml b/apps/admin/etc/admin-api.yaml
new file mode 100644
index 0000000..0e2a98d
--- /dev/null
+++ b/apps/admin/etc/admin-api.yaml
@@ -0,0 +1,22 @@
+Name: admin-api
+Host: 0.0.0.0
+Port: 10002
+DataSource: "tianyuanapi:g3h98u0291j@tcp(127.0.0.1:3307)/tianyuanapi?charset=utf8mb4&parseTime=True&loc=Local"
+AuthJWT:
+ AccessSecret: "Mf5Xph3PoyKzVpRw0Zy1+X4uR/tM7JvGMEV/5p2M/tU="
+ AccessExpire: 86400 # JWT过期时间
+CacheRedis:
+ - Host: "127.0.0.1:6379"
+ Pass: "" # Redis 密码,如果未设置则留空
+ Type: "node" # 单节点模式
+
+UserRpc:
+ Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: user.rpc
+SentinelRpc:
+ Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: sentinel.rpc
\ No newline at end of file
diff --git a/apps/admin/internal/config/config.go b/apps/admin/internal/config/config.go
new file mode 100644
index 0000000..9433cfb
--- /dev/null
+++ b/apps/admin/internal/config/config.go
@@ -0,0 +1,22 @@
+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 字符串
+ AuthJWT AuthConfig // JWT 鉴权相关配置
+ CacheRedis cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体
+ UserRpc zrpc.RpcClientConf
+ SentinelRpc zrpc.RpcClientConf
+}
+
+// AuthConfig 用于 JWT 鉴权配置
+type AuthConfig struct {
+ AccessSecret string // JWT 密钥,用于签发 Token
+ AccessExpire int64 // Token 过期时间,单位为秒
+}
diff --git a/apps/admin/internal/handler/auth/loginhandler.go b/apps/admin/internal/handler/auth/loginhandler.go
new file mode 100644
index 0000000..830233b
--- /dev/null
+++ b/apps/admin/internal/handler/auth/loginhandler.go
@@ -0,0 +1,40 @@
+package auth
+
+import (
+ "net/http"
+ "time"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/auth"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func LoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.LoginReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := auth.NewLoginLogic(r.Context(), svcCtx)
+ token, err := l.Login(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ http.SetCookie(w, &http.Cookie{
+ Name: "Authorization",
+ Value: token, // JWT 令牌
+ HttpOnly: true, // 防止 JavaScript 访问
+ Secure: false, // HTTPS 使用
+ SameSite: http.SameSiteLaxMode, // 防止 CSRF 攻击
+ Path: "/",
+ Expires: time.Now().Add(time.Duration(svcCtx.Config.AuthJWT.AccessExpire) * time.Second), // 过期时间
+ })
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/product/createproducthandler.go b/apps/admin/internal/handler/product/createproducthandler.go
new file mode 100644
index 0000000..4182850
--- /dev/null
+++ b/apps/admin/internal/handler/product/createproducthandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/product"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func CreateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.CreateProductReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewCreateProductLogic(r.Context(), svcCtx)
+ err := l.CreateProduct(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/product/deleteproducthandler.go b/apps/admin/internal/handler/product/deleteproducthandler.go
new file mode 100644
index 0000000..98339cc
--- /dev/null
+++ b/apps/admin/internal/handler/product/deleteproducthandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/product"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func DeleteProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.DeleteProductReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewDeleteProductLogic(r.Context(), svcCtx)
+ err := l.DeleteProduct(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/product/getproductbyidhandler.go b/apps/admin/internal/handler/product/getproductbyidhandler.go
new file mode 100644
index 0000000..363eeb8
--- /dev/null
+++ b/apps/admin/internal/handler/product/getproductbyidhandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/product"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetProductByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetProductByIdReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewGetProductByIdLogic(r.Context(), svcCtx)
+ resp, err := l.GetProductById(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/product/getproductlisthandler.go b/apps/admin/internal/handler/product/getproductlisthandler.go
new file mode 100644
index 0000000..c7ba799
--- /dev/null
+++ b/apps/admin/internal/handler/product/getproductlisthandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/product"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetProductListReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewGetProductListLogic(r.Context(), svcCtx)
+ resp, err := l.GetProductList(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/product/updateproducthandler.go b/apps/admin/internal/handler/product/updateproducthandler.go
new file mode 100644
index 0000000..81211e5
--- /dev/null
+++ b/apps/admin/internal/handler/product/updateproducthandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/product"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func UpdateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.UpdateProductReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewUpdateProductLogic(r.Context(), svcCtx)
+ err := l.UpdateProduct(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/review/getpendingenterprisehandler.go b/apps/admin/internal/handler/review/getpendingenterprisehandler.go
new file mode 100644
index 0000000..fea0e0c
--- /dev/null
+++ b/apps/admin/internal/handler/review/getpendingenterprisehandler.go
@@ -0,0 +1,30 @@
+package review
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/review"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetPendingEnterpriseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetPendingEnterpriseReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := review.NewGetPendingEnterpriseLogic(r.Context(), svcCtx)
+ resp, err := l.GetPendingEnterprise(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/review/reviewenterprisehandler.go b/apps/admin/internal/handler/review/reviewenterprisehandler.go
new file mode 100644
index 0000000..a6eb4d9
--- /dev/null
+++ b/apps/admin/internal/handler/review/reviewenterprisehandler.go
@@ -0,0 +1,30 @@
+package review
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/admin/internal/logic/review"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func ReviewEnterpriseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.ReviewEnterpriseReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := review.NewReviewEnterpriseLogic(r.Context(), svcCtx)
+ resp, err := l.ReviewEnterprise(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/admin/internal/handler/routes.go b/apps/admin/internal/handler/routes.go
new file mode 100644
index 0000000..af23419
--- /dev/null
+++ b/apps/admin/internal/handler/routes.go
@@ -0,0 +1,96 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+
+package handler
+
+import (
+ "net/http"
+
+ auth "tianyuan-api/apps/admin/internal/handler/auth"
+ product "tianyuan-api/apps/admin/internal/handler/product"
+ review "tianyuan-api/apps/admin/internal/handler/review"
+ user "tianyuan-api/apps/admin/internal/handler/user"
+ "tianyuan-api/apps/admin/internal/svc"
+
+ "github.com/zeromicro/go-zero/rest"
+)
+
+func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
+ server.AddRoutes(
+ []rest.Route{
+ {
+ Method: http.MethodPost,
+ Path: "/login",
+ Handler: auth.LoginHandler(serverCtx),
+ },
+ },
+ rest.WithPrefix("/api/admin/auth"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodGet,
+ Path: "/:productId",
+ Handler: product.GetProductByIdHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/create",
+ Handler: product.CreateProductHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/delete",
+ Handler: product.DeleteProductHandler(serverCtx),
+ },
+ {
+ Method: http.MethodGet,
+ Path: "/list",
+ Handler: product.GetProductListHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/update",
+ Handler: product.UpdateProductHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/admin/product"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodGet,
+ Path: "/pending",
+ Handler: review.GetPendingEnterpriseHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/review",
+ Handler: review.ReviewEnterpriseHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/admin/enterprise"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodGet,
+ Path: "/info",
+ Handler: user.GetUserInfoHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/admin/user"),
+ )
+}
diff --git a/apps/admin/internal/handler/user/getuserinfohandler.go b/apps/admin/internal/handler/user/getuserinfohandler.go
new file mode 100644
index 0000000..74ba9db
--- /dev/null
+++ b/apps/admin/internal/handler/user/getuserinfohandler.go
@@ -0,0 +1,21 @@
+package user
+
+import (
+ "net/http"
+
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/admin/internal/logic/user"
+ "tianyuan-api/apps/admin/internal/svc"
+)
+
+func GetUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ l := user.NewGetUserInfoLogic(r.Context(), svcCtx)
+ resp, err := l.GetUserInfo()
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/admin/internal/logic/auth/loginlogic.go b/apps/admin/internal/logic/auth/loginlogic.go
new file mode 100644
index 0000000..69145cc
--- /dev/null
+++ b/apps/admin/internal/logic/auth/loginlogic.go
@@ -0,0 +1,45 @@
+package auth
+
+import (
+ "context"
+ "errors"
+ jwtx "tianyuan-api/pkg/jwt"
+
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type LoginLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginLogic {
+ return &LoginLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *LoginLogic) Login(req *types.LoginReq) (token string, err error) {
+ if req.Username == "" || req.Password == "" {
+ return "", errors.New("用户名或密码不能为空")
+ }
+
+ if req.Username != "SkyWalker_8273" && req.Password != "mD$9tPzQ&1kB2z%L" {
+ return "", errors.New("密码错误")
+ }
+
+ // 生成 JWT token,调用封装好的函数
+ token, err = jwtx.GenerateJwtToken(1, l.svcCtx.Config.AuthJWT.AccessSecret, l.svcCtx.Config.AuthJWT.AccessExpire)
+ if err != nil {
+ return "", err
+ }
+
+ // 返回成功的登录响应
+ return token, nil
+}
diff --git a/apps/admin/internal/logic/product/createproductlogic.go b/apps/admin/internal/logic/product/createproductlogic.go
new file mode 100644
index 0000000..a8ca3f4
--- /dev/null
+++ b/apps/admin/internal/logic/product/createproductlogic.go
@@ -0,0 +1,40 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateProductLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewCreateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProductLogic {
+ return &CreateProductLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *CreateProductLogic) CreateProduct(req *types.CreateProductReq) error {
+ _, err := l.svcCtx.ProductRpc.CreateProduct(l.ctx, &product.CreateProductRequest{
+ ProductName: req.ProductName,
+ ProductCode: req.ProductCode,
+ ProductDescription: req.ProductDescription,
+ ProductContent: req.ProductContent,
+ ProductPrice: req.ProductPrice,
+ ProductGroup: req.ProductGroup,
+ })
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/apps/admin/internal/logic/product/deleteproductlogic.go b/apps/admin/internal/logic/product/deleteproductlogic.go
new file mode 100644
index 0000000..1c60873
--- /dev/null
+++ b/apps/admin/internal/logic/product/deleteproductlogic.go
@@ -0,0 +1,36 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteProductLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewDeleteProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProductLogic {
+ return &DeleteProductLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *DeleteProductLogic) DeleteProduct(req *types.DeleteProductReq) error {
+ _, err := l.svcCtx.ProductRpc.DeleteProduct(l.ctx, &product.DeleteProductRequest{
+ Id: req.ProductId,
+ })
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/apps/admin/internal/logic/product/getproductbyidlogic.go b/apps/admin/internal/logic/product/getproductbyidlogic.go
new file mode 100644
index 0000000..6eabb37
--- /dev/null
+++ b/apps/admin/internal/logic/product/getproductbyidlogic.go
@@ -0,0 +1,46 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetProductByIdLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetProductByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductByIdLogic {
+ return &GetProductByIdLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetProductByIdLogic) GetProductById(req *types.GetProductByIdReq) (resp *types.GetProductByIdResp, err error) {
+ productResp, err := l.svcCtx.ProductRpc.GetProductById(l.ctx, &product.GetRecordByIdRequest{
+ Id: req.ProductId,
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ return &types.GetProductByIdResp{
+ ProductItem: types.ProductItem{
+ ProductId: productResp.Id,
+ ProductName: productResp.ProductName,
+ ProductCode: productResp.ProductCode,
+ ProductDescription: productResp.ProductDescription,
+ ProductContent: productResp.ProductContent,
+ ProductPrice: productResp.ProductPrice,
+ ProductGroup: productResp.ProductGroup,
+ },
+ }, nil
+}
diff --git a/apps/admin/internal/logic/product/getproductlistlogic.go b/apps/admin/internal/logic/product/getproductlistlogic.go
new file mode 100644
index 0000000..70871c6
--- /dev/null
+++ b/apps/admin/internal/logic/product/getproductlistlogic.go
@@ -0,0 +1,50 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetProductListLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductListLogic {
+ return &GetProductListLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq) (resp *types.GetProductListResp, err error) {
+ productList, err := l.svcCtx.ProductRpc.GetProductPageList(l.ctx, &product.PageListRequest{Page: req.Page, PageSize: req.PageSize})
+ if err != nil {
+ return nil, err
+ }
+ var list []types.ProductItem
+
+ for _, p := range productList.Products {
+ list = append(list, types.ProductItem{
+ ProductId: p.Id,
+ ProductName: p.ProductName,
+ ProductCode: p.ProductCode,
+ ProductDescription: p.ProductDescription,
+ ProductPrice: p.ProductPrice,
+ ProductGroup: p.ProductGroup,
+ CreatedAt: p.CreatedAt,
+ UpdatedAt: p.UpdatedAt,
+ })
+ }
+ resp = &types.GetProductListResp{
+ Total: productList.Total,
+ List: list,
+ }
+ return resp, nil
+}
diff --git a/apps/admin/internal/logic/product/updateproductlogic.go b/apps/admin/internal/logic/product/updateproductlogic.go
new file mode 100644
index 0000000..ce30529
--- /dev/null
+++ b/apps/admin/internal/logic/product/updateproductlogic.go
@@ -0,0 +1,42 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type UpdateProductLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewUpdateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProductLogic {
+ return &UpdateProductLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *UpdateProductLogic) UpdateProduct(req *types.UpdateProductReq) error {
+ _, err := l.svcCtx.ProductRpc.UpdateProduct(l.ctx, &product.UpdateProductRequest{
+ Id: req.ProductId,
+ ProductName: req.ProductName,
+ ProductCode: req.ProductCode,
+ ProductDescription: req.ProductDescription,
+ ProductContent: req.ProductContent,
+ ProductPrice: req.ProductPrice,
+ ProductGroup: req.ProductGroup,
+ })
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/apps/admin/internal/logic/review/getpendingenterpriselogic.go b/apps/admin/internal/logic/review/getpendingenterpriselogic.go
new file mode 100644
index 0000000..83141e6
--- /dev/null
+++ b/apps/admin/internal/logic/review/getpendingenterpriselogic.go
@@ -0,0 +1,52 @@
+package review
+
+import (
+ "context"
+ "tianyuan-api/apps/user/client/enterprise"
+
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetPendingEnterpriseLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetPendingEnterpriseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPendingEnterpriseLogic {
+ return &GetPendingEnterpriseLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetPendingEnterpriseLogic) GetPendingEnterprise(req *types.GetPendingEnterpriseReq) (resp *types.GetPendingEnterpriseResp, err error) {
+ pendingEnterpriseList, err := l.svcCtx.EntRpc.GetPendingEnterprise(l.ctx, &enterprise.GetPendingEnterpriseReq{Page: req.Page, PageSize: req.PageSize})
+ if err != nil {
+ return nil, err
+ }
+ var list []types.EnterpriseItem
+
+ for _, ent := range pendingEnterpriseList.List {
+ list = append(list, types.EnterpriseItem{
+ Id: ent.Id,
+ EnterpriseName: ent.EnterpriseName,
+ EnterpriseContact: ent.EnterpriseContact,
+ CreditCode: ent.CreditCode,
+ LegalPerson: ent.LegalPerson,
+ AuthStatus: ent.AuthStatus,
+ BusinessLicense: ent.BusinessLicense,
+ UpdatedAt: ent.UpdatedAt,
+ CreatedAt: ent.CreatedAt,
+ })
+ }
+ resp = &types.GetPendingEnterpriseResp{
+ Total: pendingEnterpriseList.Total,
+ List: list,
+ }
+ return resp, nil
+}
diff --git a/apps/admin/internal/logic/review/reviewenterpriselogic.go b/apps/admin/internal/logic/review/reviewenterpriselogic.go
new file mode 100644
index 0000000..d011e56
--- /dev/null
+++ b/apps/admin/internal/logic/review/reviewenterpriselogic.go
@@ -0,0 +1,37 @@
+package review
+
+import (
+ "context"
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+ "tianyuan-api/apps/user/client/enterprise"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type ReviewEnterpriseLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewReviewEnterpriseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReviewEnterpriseLogic {
+ return &ReviewEnterpriseLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *ReviewEnterpriseLogic) ReviewEnterprise(req *types.ReviewEnterpriseReq) (resp *types.ReviewEnterpriseResp, err error) {
+
+ _, err = l.svcCtx.EntRpc.ReviewEnterprise(l.ctx, &enterprise.ReviewEnterpriseReq{
+ EnterpriseId: req.EnterpriseID,
+ Status: req.Status,
+ Remarks: req.Remarks,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return &types.ReviewEnterpriseResp{}, nil
+}
diff --git a/apps/admin/internal/logic/user/getuserinfologic.go b/apps/admin/internal/logic/user/getuserinfologic.go
new file mode 100644
index 0000000..d613db8
--- /dev/null
+++ b/apps/admin/internal/logic/user/getuserinfologic.go
@@ -0,0 +1,30 @@
+package user
+
+import (
+ "context"
+
+ "tianyuan-api/apps/admin/internal/svc"
+ "tianyuan-api/apps/admin/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserInfoLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
+ return &GetUserInfoLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetUserInfoLogic) GetUserInfo() (resp *types.UserInfoResp, err error) {
+ return &types.UserInfoResp{
+ Username: "admin",
+ }, nil
+}
diff --git a/apps/admin/internal/middleware/authinterceptormiddleware.go b/apps/admin/internal/middleware/authinterceptormiddleware.go
new file mode 100644
index 0000000..aefae0c
--- /dev/null
+++ b/apps/admin/internal/middleware/authinterceptormiddleware.go
@@ -0,0 +1,54 @@
+package middleware
+
+import (
+ "context"
+ "errors"
+ "github.com/zeromicro/go-zero/core/logx"
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/admin/internal/config"
+ jwtx "tianyuan-api/pkg/jwt"
+ "net/http"
+ "time"
+)
+
+type AuthInterceptorMiddleware struct {
+ Config config.Config
+}
+
+func NewAuthInterceptorMiddleware(c config.Config) *AuthInterceptorMiddleware {
+ return &AuthInterceptorMiddleware{
+ Config: c,
+ }
+}
+
+func (m *AuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ // 从 Cookie 中获取 JWT
+ cookie, err := r.Cookie("Authorization")
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("用户未登录"))
+ return
+ }
+
+ tokenStr := cookie.Value
+ // 验证并解析 JWT
+ userId, err := jwtx.ParseJwtToken(tokenStr, m.Config.AuthJWT.AccessSecret)
+ if err != nil {
+ // 设置过期的 Cookie 来删除无效的 Token
+ http.SetCookie(w, &http.Cookie{
+ Name: "Authorization",
+ Value: "",
+ Path: "/",
+ HttpOnly: true,
+ Expires: time.Unix(0, 0), // 过期时间设置为过去
+ })
+ logx.Error("Invalid JWT: ", err)
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未经授权的访问"))
+ return
+ }
+
+ // 将 userId 存入 context,供后续逻辑使用
+ ctx := context.WithValue(r.Context(), "userId", userId)
+ next(w, r.WithContext(ctx))
+ }
+}
diff --git a/apps/admin/internal/svc/servicecontext.go b/apps/admin/internal/svc/servicecontext.go
new file mode 100644
index 0000000..8030e76
--- /dev/null
+++ b/apps/admin/internal/svc/servicecontext.go
@@ -0,0 +1,28 @@
+package svc
+
+import (
+ "github.com/zeromicro/go-zero/rest"
+ "github.com/zeromicro/go-zero/zrpc"
+ "tianyuan-api/apps/admin/internal/config"
+ "tianyuan-api/apps/admin/internal/middleware"
+ "tianyuan-api/apps/sentinel/sentinel"
+ "tianyuan-api/apps/user/user"
+)
+
+type ServiceContext struct {
+ Config config.Config
+ AuthInterceptor rest.Middleware
+ EntRpc user.EnterpriseClient
+ UserRpc user.UserClient
+ ProductRpc sentinel.ProductClient
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+ return &ServiceContext{
+ Config: c,
+ AuthInterceptor: middleware.NewAuthInterceptorMiddleware(c).Handle,
+ EntRpc: user.NewEnterpriseClient(zrpc.MustNewClient(c.UserRpc).Conn()),
+ UserRpc: user.NewUserClient(zrpc.MustNewClient(c.UserRpc).Conn()),
+ ProductRpc: sentinel.NewProductClient(zrpc.MustNewClient(c.SentinelRpc).Conn()),
+ }
+}
diff --git a/apps/admin/internal/types/types.go b/apps/admin/internal/types/types.go
new file mode 100644
index 0000000..0b2693d
--- /dev/null
+++ b/apps/admin/internal/types/types.go
@@ -0,0 +1,100 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+
+package types
+
+type CreateProductReq struct {
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+}
+
+type DeleteProductReq struct {
+ ProductId int64 `json:"productId"`
+}
+
+type EnterpriseItem struct {
+ Id int64 `json:"id"` // 企业ID
+ EnterpriseName string `json:"enterpriseName"` // 企业名称
+ CreditCode string `json:"creditCode"` // 企业信用代码
+ LegalPerson string `json:"legalPerson"` // 法人
+ EnterpriseContact string `json:"enterpriseContact"` // 企业联系方式
+ AuthStatus string `json:"authStatus"` // 认证状态
+ BusinessLicense string `json:"businessLicense"`
+ CreatedAt string `json:"createdAt"` // 创建时间
+ UpdatedAt string `json:"updatedAt"` // 更新时间
+}
+
+type GetPendingEnterpriseReq struct {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+}
+
+type GetPendingEnterpriseResp struct {
+ Total int64 `json:"total"`
+ List []EnterpriseItem `json:"list"`
+}
+
+type GetProductByIdReq struct {
+ ProductId int64 `path:"productId"`
+}
+
+type GetProductByIdResp struct {
+ ProductItem
+}
+
+type GetProductListReq struct {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+}
+
+type GetProductListResp struct {
+ Total int64 `json:"total"`
+ List []ProductItem `json:"list"`
+}
+
+type LoginReq struct {
+ Username string `json:"username"`
+ Password string `json:"password"`
+}
+
+type LoginResp struct {
+}
+
+type ProductItem struct {
+ ProductId int64 `json:"productId"`
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+ CreatedAt string `json:"createdAt"`
+ UpdatedAt string `json:"updatedAt"`
+}
+
+type ReviewEnterpriseReq struct {
+ EnterpriseID int64 `json:"enterpriseId"`
+ Status string `json:"status"`
+ Remarks string `json:"remarks"`
+}
+
+type ReviewEnterpriseResp struct {
+}
+
+type UpdateProductReq struct {
+ ProductId int64 `json:"productId"`
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+}
+
+type UserInfoResp struct {
+ Username string `json:"username"`
+}
diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile
new file mode 100644
index 0000000..5dcd1e7
--- /dev/null
+++ b/apps/api/Dockerfile
@@ -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"]
diff --git a/apps/api/api.api b/apps/api/api.api
new file mode 100644
index 0000000..1bacc1f
--- /dev/null
+++ b/apps/api/api.api
@@ -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)
+}
+
diff --git a/apps/api/api.go b/apps/api/api.go
new file mode 100644
index 0000000..624a1ea
--- /dev/null
+++ b/apps/api/api.go
@@ -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()
+}
diff --git a/apps/api/api.proto b/apps/api/api.proto
new file mode 100644
index 0000000..fd2098a
--- /dev/null
+++ b/apps/api/api.proto
@@ -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; // 到期时间
+}
diff --git a/apps/api/etc/api-api.yaml b/apps/api/etc/api-api.yaml
new file mode 100644
index 0000000..a5e6d6c
--- /dev/null
+++ b/apps/api/etc/api-api.yaml
@@ -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"
\ No newline at end of file
diff --git a/apps/api/internal/config/config.go b/apps/api/internal/config/config.go
new file mode 100644
index 0000000..329573b
--- /dev/null
+++ b/apps/api/internal/config/config.go
@@ -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
+}
diff --git a/apps/api/internal/handler/FLXG/flxg162ahandler.go b/apps/api/internal/handler/FLXG/flxg162ahandler.go
new file mode 100644
index 0000000..7cf79c9
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg162ahandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxg3d56handler.go b/apps/api/internal/handler/FLXG/flxg3d56handler.go
new file mode 100644
index 0000000..6a0fe73
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg3d56handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxg54f5handler.go b/apps/api/internal/handler/FLXG/flxg54f5handler.go
new file mode 100644
index 0000000..1abbda6
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg54f5handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxg5876handler.go b/apps/api/internal/handler/FLXG/flxg5876handler.go
new file mode 100644
index 0000000..552a766
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg5876handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxg75fehandler.go b/apps/api/internal/handler/FLXG/flxg75fehandler.go
new file mode 100644
index 0000000..ed5f47d
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg75fehandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxg9687handler.go b/apps/api/internal/handler/FLXG/flxg9687handler.go
new file mode 100644
index 0000000..c44b101
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg9687handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxg970fhandler.go b/apps/api/internal/handler/FLXG/flxg970fhandler.go
new file mode 100644
index 0000000..95d5c12
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxg970fhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxgc9d1handler.go b/apps/api/internal/handler/FLXG/flxgc9d1handler.go
new file mode 100644
index 0000000..6092f2f
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxgc9d1handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxgca3dhandler.go b/apps/api/internal/handler/FLXG/flxgca3dhandler.go
new file mode 100644
index 0000000..8d8fe9f
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxgca3dhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/FLXG/flxgdec7handler.go b/apps/api/internal/handler/FLXG/flxgdec7handler.go
new file mode 100644
index 0000000..1d5b83f
--- /dev/null
+++ b/apps/api/internal/handler/FLXG/flxgdec7handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/IVYZ/ivyz0b03handler.go b/apps/api/internal/handler/IVYZ/ivyz0b03handler.go
new file mode 100644
index 0000000..503dbf2
--- /dev/null
+++ b/apps/api/internal/handler/IVYZ/ivyz0b03handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/IVYZ/ivyz2125handler.go b/apps/api/internal/handler/IVYZ/ivyz2125handler.go
new file mode 100644
index 0000000..f6bc070
--- /dev/null
+++ b/apps/api/internal/handler/IVYZ/ivyz2125handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/IVYZ/ivyz385ehandler.go b/apps/api/internal/handler/IVYZ/ivyz385ehandler.go
new file mode 100644
index 0000000..1eeca35
--- /dev/null
+++ b/apps/api/internal/handler/IVYZ/ivyz385ehandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/IVYZ/ivyz5733handler.go b/apps/api/internal/handler/IVYZ/ivyz5733handler.go
new file mode 100644
index 0000000..68553bd
--- /dev/null
+++ b/apps/api/internal/handler/IVYZ/ivyz5733handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/IVYZ/ivyz9363handler.go b/apps/api/internal/handler/IVYZ/ivyz9363handler.go
new file mode 100644
index 0000000..5e8b08b
--- /dev/null
+++ b/apps/api/internal/handler/IVYZ/ivyz9363handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/IVYZ/ivyzadeehandler.go b/apps/api/internal/handler/IVYZ/ivyzadeehandler.go
new file mode 100644
index 0000000..e2c507c
--- /dev/null
+++ b/apps/api/internal/handler/IVYZ/ivyzadeehandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/JRZQ/jrzq0a03handler.go b/apps/api/internal/handler/JRZQ/jrzq0a03handler.go
new file mode 100644
index 0000000..a7d4891
--- /dev/null
+++ b/apps/api/internal/handler/JRZQ/jrzq0a03handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/JRZQ/jrzq4aa8handler.go b/apps/api/internal/handler/JRZQ/jrzq4aa8handler.go
new file mode 100644
index 0000000..f8aaf19
--- /dev/null
+++ b/apps/api/internal/handler/JRZQ/jrzq4aa8handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/JRZQ/jrzq8203handler.go b/apps/api/internal/handler/JRZQ/jrzq8203handler.go
new file mode 100644
index 0000000..119b57c
--- /dev/null
+++ b/apps/api/internal/handler/JRZQ/jrzq8203handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/JRZQ/jrzqcee8handler.go b/apps/api/internal/handler/JRZQ/jrzqcee8handler.go
new file mode 100644
index 0000000..045317d
--- /dev/null
+++ b/apps/api/internal/handler/JRZQ/jrzqcee8handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/JRZQ/jrzqdcbehandler.go b/apps/api/internal/handler/JRZQ/jrzqdcbehandler.go
new file mode 100644
index 0000000..cafb36a
--- /dev/null
+++ b/apps/api/internal/handler/JRZQ/jrzqdcbehandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/JRZQ/jrzqfef8handler.go b/apps/api/internal/handler/JRZQ/jrzqfef8handler.go
new file mode 100644
index 0000000..dec78ab
--- /dev/null
+++ b/apps/api/internal/handler/JRZQ/jrzqfef8handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/QYGL/qygl2acdhandler.go b/apps/api/internal/handler/QYGL/qygl2acdhandler.go
new file mode 100644
index 0000000..22911fc
--- /dev/null
+++ b/apps/api/internal/handler/QYGL/qygl2acdhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/QYGL/qygl45bdhandler.go b/apps/api/internal/handler/QYGL/qygl45bdhandler.go
new file mode 100644
index 0000000..e091cc2
--- /dev/null
+++ b/apps/api/internal/handler/QYGL/qygl45bdhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/QYGL/qygl51bchandler.go b/apps/api/internal/handler/QYGL/qygl51bchandler.go
new file mode 100644
index 0000000..d07c2cf
--- /dev/null
+++ b/apps/api/internal/handler/QYGL/qygl51bchandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/QYGL/qygl6f2dhandler.go b/apps/api/internal/handler/QYGL/qygl6f2dhandler.go
new file mode 100644
index 0000000..b69c909
--- /dev/null
+++ b/apps/api/internal/handler/QYGL/qygl6f2dhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/QYGL/qygl8261handler.go b/apps/api/internal/handler/QYGL/qygl8261handler.go
new file mode 100644
index 0000000..6372c08
--- /dev/null
+++ b/apps/api/internal/handler/QYGL/qygl8261handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/QYGL/qyglb4c0handler.go b/apps/api/internal/handler/QYGL/qyglb4c0handler.go
new file mode 100644
index 0000000..d3e2a77
--- /dev/null
+++ b/apps/api/internal/handler/QYGL/qyglb4c0handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/YYSY/yysy09cdhandler.go b/apps/api/internal/handler/YYSY/yysy09cdhandler.go
new file mode 100644
index 0000000..acb54e4
--- /dev/null
+++ b/apps/api/internal/handler/YYSY/yysy09cdhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/YYSY/yysy4b37handler.go b/apps/api/internal/handler/YYSY/yysy4b37handler.go
new file mode 100644
index 0000000..5daa1c5
--- /dev/null
+++ b/apps/api/internal/handler/YYSY/yysy4b37handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/YYSY/yysy6f2ehandler.go b/apps/api/internal/handler/YYSY/yysy6f2ehandler.go
new file mode 100644
index 0000000..1743303
--- /dev/null
+++ b/apps/api/internal/handler/YYSY/yysy6f2ehandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/YYSY/yysybe08handler.go b/apps/api/internal/handler/YYSY/yysybe08handler.go
new file mode 100644
index 0000000..3a3e640
--- /dev/null
+++ b/apps/api/internal/handler/YYSY/yysybe08handler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/YYSY/yysyd50fhandler.go b/apps/api/internal/handler/YYSY/yysyd50fhandler.go
new file mode 100644
index 0000000..42a631f
--- /dev/null
+++ b/apps/api/internal/handler/YYSY/yysyd50fhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/YYSY/yysyf7dbhandler.go b/apps/api/internal/handler/YYSY/yysyf7dbhandler.go
new file mode 100644
index 0000000..a042ff1
--- /dev/null
+++ b/apps/api/internal/handler/YYSY/yysyf7dbhandler.go
@@ -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)
+ }
+ }
+}
diff --git a/apps/api/internal/handler/routes.go b/apps/api/internal/handler/routes.go
new file mode 100644
index 0000000..11ab2ed
--- /dev/null
+++ b/apps/api/internal/handler/routes.go
@@ -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"),
+ )
+}
diff --git a/apps/api/internal/logic/FLXG/flxg162alogic.go b/apps/api/internal/logic/FLXG/flxg162alogic.go
new file mode 100644
index 0000000..e3ebca7
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg162alogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxg3d56logic.go b/apps/api/internal/logic/FLXG/flxg3d56logic.go
new file mode 100644
index 0000000..c34e1e1
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg3d56logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxg54f5logic.go b/apps/api/internal/logic/FLXG/flxg54f5logic.go
new file mode 100644
index 0000000..bebfd55
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg54f5logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxg5876logic.go b/apps/api/internal/logic/FLXG/flxg5876logic.go
new file mode 100644
index 0000000..da9beb2
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg5876logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxg75felogic.go b/apps/api/internal/logic/FLXG/flxg75felogic.go
new file mode 100644
index 0000000..616d862
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg75felogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxg9687logic.go b/apps/api/internal/logic/FLXG/flxg9687logic.go
new file mode 100644
index 0000000..bb031c6
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg9687logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxg970flogic.go b/apps/api/internal/logic/FLXG/flxg970flogic.go
new file mode 100644
index 0000000..131d48d
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxg970flogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxgc9d1logic.go b/apps/api/internal/logic/FLXG/flxgc9d1logic.go
new file mode 100644
index 0000000..d6c0dff
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxgc9d1logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxgca3dlogic.go b/apps/api/internal/logic/FLXG/flxgca3dlogic.go
new file mode 100644
index 0000000..14a76eb
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxgca3dlogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/FLXG/flxgdec7logic.go b/apps/api/internal/logic/FLXG/flxgdec7logic.go
new file mode 100644
index 0000000..6e7f903
--- /dev/null
+++ b/apps/api/internal/logic/FLXG/flxgdec7logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/IVYZ/ivyz0b03logic.go b/apps/api/internal/logic/IVYZ/ivyz0b03logic.go
new file mode 100644
index 0000000..42b4d3f
--- /dev/null
+++ b/apps/api/internal/logic/IVYZ/ivyz0b03logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/IVYZ/ivyz2125logic.go b/apps/api/internal/logic/IVYZ/ivyz2125logic.go
new file mode 100644
index 0000000..71c699b
--- /dev/null
+++ b/apps/api/internal/logic/IVYZ/ivyz2125logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/IVYZ/ivyz385elogic.go b/apps/api/internal/logic/IVYZ/ivyz385elogic.go
new file mode 100644
index 0000000..362ac32
--- /dev/null
+++ b/apps/api/internal/logic/IVYZ/ivyz385elogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/IVYZ/ivyz5733logic.go b/apps/api/internal/logic/IVYZ/ivyz5733logic.go
new file mode 100644
index 0000000..621746d
--- /dev/null
+++ b/apps/api/internal/logic/IVYZ/ivyz5733logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/IVYZ/ivyz9363logic.go b/apps/api/internal/logic/IVYZ/ivyz9363logic.go
new file mode 100644
index 0000000..853234f
--- /dev/null
+++ b/apps/api/internal/logic/IVYZ/ivyz9363logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/IVYZ/ivyzadeelogic.go b/apps/api/internal/logic/IVYZ/ivyzadeelogic.go
new file mode 100644
index 0000000..54c669e
--- /dev/null
+++ b/apps/api/internal/logic/IVYZ/ivyzadeelogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/JRZQ/jrzq0a03logic.go b/apps/api/internal/logic/JRZQ/jrzq0a03logic.go
new file mode 100644
index 0000000..1808f75
--- /dev/null
+++ b/apps/api/internal/logic/JRZQ/jrzq0a03logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go b/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go
new file mode 100644
index 0000000..66ec21b
--- /dev/null
+++ b/apps/api/internal/logic/JRZQ/jrzq4aa8logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/JRZQ/jrzq8203logic.go b/apps/api/internal/logic/JRZQ/jrzq8203logic.go
new file mode 100644
index 0000000..831031c
--- /dev/null
+++ b/apps/api/internal/logic/JRZQ/jrzq8203logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/JRZQ/jrzqcee8logic.go b/apps/api/internal/logic/JRZQ/jrzqcee8logic.go
new file mode 100644
index 0000000..6e2f266
--- /dev/null
+++ b/apps/api/internal/logic/JRZQ/jrzqcee8logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go b/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go
new file mode 100644
index 0000000..8a218b3
--- /dev/null
+++ b/apps/api/internal/logic/JRZQ/jrzqdcbelogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/JRZQ/jrzqfef8logic.go b/apps/api/internal/logic/JRZQ/jrzqfef8logic.go
new file mode 100644
index 0000000..69aba52
--- /dev/null
+++ b/apps/api/internal/logic/JRZQ/jrzqfef8logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/QYGL/qygl2acdlogic.go b/apps/api/internal/logic/QYGL/qygl2acdlogic.go
new file mode 100644
index 0000000..5e00262
--- /dev/null
+++ b/apps/api/internal/logic/QYGL/qygl2acdlogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/QYGL/qygl45bdlogic.go b/apps/api/internal/logic/QYGL/qygl45bdlogic.go
new file mode 100644
index 0000000..63dde75
--- /dev/null
+++ b/apps/api/internal/logic/QYGL/qygl45bdlogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/QYGL/qygl51bclogic.go b/apps/api/internal/logic/QYGL/qygl51bclogic.go
new file mode 100644
index 0000000..1176f09
--- /dev/null
+++ b/apps/api/internal/logic/QYGL/qygl51bclogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/QYGL/qygl6f2dlogic.go b/apps/api/internal/logic/QYGL/qygl6f2dlogic.go
new file mode 100644
index 0000000..c98bd80
--- /dev/null
+++ b/apps/api/internal/logic/QYGL/qygl6f2dlogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/QYGL/qygl8261logic.go b/apps/api/internal/logic/QYGL/qygl8261logic.go
new file mode 100644
index 0000000..286eb1e
--- /dev/null
+++ b/apps/api/internal/logic/QYGL/qygl8261logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/QYGL/qyglb4c0logic.go b/apps/api/internal/logic/QYGL/qyglb4c0logic.go
new file mode 100644
index 0000000..625d174
--- /dev/null
+++ b/apps/api/internal/logic/QYGL/qyglb4c0logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/YYSY/yysy09cdlogic.go b/apps/api/internal/logic/YYSY/yysy09cdlogic.go
new file mode 100644
index 0000000..fb9345d
--- /dev/null
+++ b/apps/api/internal/logic/YYSY/yysy09cdlogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/YYSY/yysy4b37logic.go b/apps/api/internal/logic/YYSY/yysy4b37logic.go
new file mode 100644
index 0000000..bf18667
--- /dev/null
+++ b/apps/api/internal/logic/YYSY/yysy4b37logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/YYSY/yysy6f2elogic.go b/apps/api/internal/logic/YYSY/yysy6f2elogic.go
new file mode 100644
index 0000000..1375e41
--- /dev/null
+++ b/apps/api/internal/logic/YYSY/yysy6f2elogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/YYSY/yysybe08logic.go b/apps/api/internal/logic/YYSY/yysybe08logic.go
new file mode 100644
index 0000000..45715cf
--- /dev/null
+++ b/apps/api/internal/logic/YYSY/yysybe08logic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/YYSY/yysyd50flogic.go b/apps/api/internal/logic/YYSY/yysyd50flogic.go
new file mode 100644
index 0000000..591fbca
--- /dev/null
+++ b/apps/api/internal/logic/YYSY/yysyd50flogic.go
@@ -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
+}
diff --git a/apps/api/internal/logic/YYSY/yysyf7dblogic.go b/apps/api/internal/logic/YYSY/yysyf7dblogic.go
new file mode 100644
index 0000000..3b75272
--- /dev/null
+++ b/apps/api/internal/logic/YYSY/yysyf7dblogic.go
@@ -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
+}
diff --git a/apps/api/internal/middleware/apiauthinterceptormiddleware.go b/apps/api/internal/middleware/apiauthinterceptormiddleware.go
new file mode 100644
index 0000000..5e65ec2
--- /dev/null
+++ b/apps/api/internal/middleware/apiauthinterceptormiddleware.go
@@ -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))
+ }
+}
diff --git a/apps/api/internal/service/west_dex_service.go b/apps/api/internal/service/west_dex_service.go
new file mode 100644
index 0000000..3692771
--- /dev/null
+++ b/apps/api/internal/service/west_dex_service.go
@@ -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))
+}
diff --git a/apps/api/internal/svc/servicecontext.go b/apps/api/internal/svc/servicecontext.go
new file mode 100644
index 0000000..bd9e14e
--- /dev/null
+++ b/apps/api/internal/svc/servicecontext.go
@@ -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 中
+ }
+}
diff --git a/apps/api/internal/types/types.go b/apps/api/internal/types/types.go
new file mode 100644
index 0000000..00e9841
--- /dev/null
+++ b/apps/api/internal/types/types.go
@@ -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"`
+}
diff --git a/apps/api/internal/validator/error_messages.go b/apps/api/internal/validator/error_messages.go
new file mode 100644
index 0000000..cb35e2c
--- /dev/null
+++ b/apps/api/internal/validator/error_messages.go
@@ -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 "请输入正确格式的参数"
+}
diff --git a/apps/api/internal/validator/structs.go b/apps/api/internal/validator/structs.go
new file mode 100644
index 0000000..69ccd4f
--- /dev/null
+++ b/apps/api/internal/validator/structs.go
@@ -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
+}
diff --git a/apps/api/internal/validator/validator.go b/apps/api/internal/validator/validator.go
new file mode 100644
index 0000000..8fb24be
--- /dev/null
+++ b/apps/api/internal/validator/validator.go
@@ -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
+}
diff --git a/apps/api/internal/westmodel/response.go b/apps/api/internal/westmodel/response.go
new file mode 100644
index 0000000..d282ff2
--- /dev/null
+++ b/apps/api/internal/westmodel/response.go
@@ -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"`
+}
diff --git a/apps/gateway/Dockerfile b/apps/gateway/Dockerfile
new file mode 100644
index 0000000..25b9015
--- /dev/null
+++ b/apps/gateway/Dockerfile
@@ -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/gateway/etc /app/etc
+RUN go build -ldflags="-s -w" -o /app/gateway apps/gateway/.\gateway.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/gateway /app/gateway
+COPY --from=builder /app/etc /app/etc
+
+CMD ["./gateway", "-f", "etc/gateway-api.yaml"]
diff --git a/apps/gateway/etc/gateway-api.yaml b/apps/gateway/etc/gateway-api.yaml
new file mode 100644
index 0000000..92aadcd
--- /dev/null
+++ b/apps/gateway/etc/gateway-api.yaml
@@ -0,0 +1,38 @@
+Name: gateway-api
+Host: 0.0.0.0
+Port: 10001
+DataSource: "tianyuanapi:g3h98u0291j@tcp(127.0.0.1:3307)/tianyuanapi?charset=utf8mb4&parseTime=True&loc=Local"
+AuthJWT:
+ AccessSecret: "Mf5Xph3PoyKzVpRw0Zy1+X4uR/tM7JvGMEV/5p2M/tU="
+ AccessExpire: 86400 # JWT过期时间
+CacheRedis:
+ - Host: "127.0.0.1:6379"
+ Pass: "" # Redis 密码,如果未设置则留空
+ Type: "node" # 单节点模式
+VerifyCode:
+ AccessKeyID: "LTAI5tHKcV1RbC8t68UfsATy"
+ AccessKeySecret: "wLWjMBnAlchFMa9gC8B7ZVBKaew4t5"
+ EndpointURL: "dysmsapi.aliyuncs.com"
+ SignName: "天远查"
+ TemplateCode: "SMS_299200388"
+ ValidTime: 300
+Qiniu:
+ AccessKey: "AO6u6sDWi6L9TsPfr4awC7FYP85JTjt3bodZACCM"
+ SecretKey: "2fjxweGtSAEaUdVgDkWEmN7JbBxHBQDv1cLORb9_"
+ Bucket: "tianyuanapi"
+ Domain: "https://file.tianyuanapi.com"
+
+Baidu:
+ ApiKey: "aMsrBNGUJxgcgqdm3SEdcumm"
+ SecretKey: "sWlv2h2AWA3aAt5bjXCkE6WeA5AzpAAD"
+
+UserRpc:
+ Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: user.rpc
+SentinelRpc:
+ Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: sentinel.rpc
\ No newline at end of file
diff --git a/apps/gateway/gateway.api b/apps/gateway/gateway.api
new file mode 100644
index 0000000..8635ea8
--- /dev/null
+++ b/apps/gateway/gateway.api
@@ -0,0 +1,252 @@
+syntax = "console"
+
+//---------------------------- Base ------------------------
+type (
+ healthResp {
+ time string `json:"time"`
+ }
+)
+
+@server (
+ group: base
+ prefix: /api/console/base
+)
+service gateway-api {
+ @handler health
+ get /health returns (healthResp)
+}
+
+//--------------------------- Auth ------------------------
+type (
+ LoginReq {
+ username string `json:"username"`
+ password string `json:"password"`
+ }
+ phoneLoginReq {
+ phone string `json:"phone"`
+ code string `json:"code"`
+ }
+ RegisterReq {
+ username string `json:"username"`
+ password string `json:"password"`
+ confirmPassword string `json:"confirmPassword"`
+ phone string `json:"phone"`
+ code string `json:"code"`
+ }
+ GetVerifyCodeReq {
+ phone string `json:"phone"`
+ actionType string `json:"actionType"`
+ }
+)
+
+@server (
+ group: auth
+ prefix: /api/console/auth
+)
+service gateway-api {
+ @handler registerUser
+ post /register (RegisterReq)
+
+ @handler loginUser
+ post /login (LoginReq)
+
+ @handler phoneLoginUser
+ post /phoneLogin (phoneLoginReq)
+
+ @handler getVerifyCode
+ post /getVerifyCode (GetVerifyCodeReq)
+
+ @handler Logout
+ post /logout
+}
+
+//------------------------------ User -----------------------------
+type (
+ enterpriseAuthReq {
+ enterpriseName string `json:"enterpriseName"`
+ creditCode string `json:"creditCode"`
+ legalPerson string `json:"legalPerson"`
+ businessLicense string `json:"businessLicense"`
+ enterpriseContact string `json:"enterpriseContact"`
+ }
+ UserInfoResp {
+ username string `json:"username"`
+ phone string `json:"phone"`
+ enterpriseAuthStatus string `json:"enterpriseAuthStatus"`
+ enterpriseName string `json:"enterpriseName"`
+ creditCode string `json:"creditCode"`
+ legalPerson string `json:"legalPerson"`
+ }
+ UploadBusinessLicenseResp {
+ url string `json:"url"`
+ enterpriseName string `json:"enterpriseName"`
+ creditCode string `json:"creditCode"`
+ legalPerson string `json:"legalPerson"`
+ }
+ secretInfoResp {
+ AccessId string `json:"accessId"`
+ AccessKey string `json:"accessKey"`
+ }
+)
+
+@server (
+ group: user
+ prefix: /api/console/user
+ middleware: AuthInterceptor
+)
+service gateway-api {
+ @handler getUserInfo
+ get /info returns (UserInfoResp)
+
+ @handler enterpriseAuth
+ post /enterpriseAuth (enterpriseAuthReq)
+
+ @handler UploadBusinessLicense
+ post /businessLicenseUpload returns (UploadBusinessLicenseResp)
+
+ @handler GetSecretInfo
+ post /getSecretInfo returns (secretInfoResp)
+}
+
+type (
+ GetProductByIdReq {
+ ProductId int64 `path:"productId"`
+ }
+ GetProductByIdResp {
+ ProductItem
+ }
+ GetProductListReq {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+ }
+ GetProductListResp {
+ Total int64 `json:"total"`
+ List []ProductItem `json:"list"`
+ }
+ ProductItem {
+ ProductId int64 `json:"productId"`
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+ CreatedAt string `json:"createdAt"`
+ UpdatedAt string `json:"updatedAt"`
+ }
+)
+
+@server (
+ group: product
+ prefix: /api/console/product
+ middleware: AuthInterceptor
+)
+service gateway-api {
+ @handler getProductById
+ get /:productId (GetProductByIdReq) returns (GetProductByIdResp)
+
+ @handler getProductList
+ get /list (GetProductListReq) returns (GetProductListResp)
+}
+
+type (
+ // 添加用户产品请求
+ AddUserProductReq {
+ ProductId int64 `json:"productId"`
+ }
+ // 删除用户产品请求
+ DeleteUserProductReq {
+ Id int64 `json:"id"`
+ }
+ // 分页查询用户产品列表请求
+ GetUserProductListReq {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+ }
+ // 分页查询用户产品列表响应
+ GetUserProductListResp {
+ Total int64 `json:"total"`
+ List []UserProductItem `json:"list"`
+ }
+ // 用户产品条目
+ UserProductItem {
+ Id int64 `json:"id"` // 用户产品ID
+ ProductId int64 `json:"productId"` // 产品ID
+ ProductName string `json:"productName"` // 产品名称
+ ProductCode string `json:"productCode"` // 产品编号
+ ProductDescription string `json:"productDescription"` // 产品简介
+ ProductGroup string `json:"productGroup"` // 产品分类
+ ProductPrice float64 `json:"productPrice"` // 产品价格
+ CreatedAt string `json:"createdAt"` // 创建时间
+ UpdatedAt string `json:"updatedAt"` // 更新时间
+ }
+)
+
+@server (
+ group: userProduct
+ prefix: /api/console/user-product
+ middleware: AuthInterceptor
+)
+service gateway-api {
+ @handler getUserProductList
+ get /userProductList (GetUserProductListReq) returns (GetUserProductListResp)
+}
+@server (
+ group: userProduct
+ prefix: /api/console/user-product
+ middleware: AuthInterceptor,EntAuthInterceptor
+)
+service gateway-api {
+ @handler addUserProduct
+ post /userProductAdd (AddUserProductReq)
+
+ @handler deleteUserProduct
+ delete /userProductDel/:id (DeleteUserProductReq)
+
+}
+type (
+ AddWhitelistReq {
+ Ip string `json:"ip"`
+ }
+ DeleteWhitelistReq {
+ Id int64 `json:"id"`
+ }
+ GetWhitelistListReq {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+ }
+ GetWhitelistListResp {
+ Total int64 `json:"total"`
+ List []WhitelistItem `json:"list"`
+ }
+ WhitelistItem {
+ Id int64 `json:"id"` // 用户产品ID
+ WhitelistIp string `json:"whiteIp"` // 产品名称
+ CreatedAt string `json:"createdAt"` // 创建时间
+ UpdatedAt string `json:"updatedAt"` // 更新时间
+ }
+)
+
+@server (
+ group: whitelistr
+ prefix: /api/console/whitelist
+ middleware: AuthInterceptor
+)
+service gateway-api {
+ @handler getWhitelistList
+ get /getWhitelistList (GetWhitelistListReq) returns (GetUserProductListResp)
+}
+
+@server (
+ group: whitelistr
+ prefix: /api/console/whitelist
+ middleware: AuthInterceptor,EntAuthInterceptor
+)
+service gateway-api {
+ @handler addWhitelist
+ post /addWhitelist (AddWhitelistReq)
+
+ @handler deleteWhitelist
+ delete /delWhitelist (DeleteWhitelistReq)
+}
+
diff --git a/apps/gateway/gateway.go b/apps/gateway/gateway.go
new file mode 100644
index 0000000..18feacc
--- /dev/null
+++ b/apps/gateway/gateway.go
@@ -0,0 +1,31 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+
+ "tianyuan-api/apps/gateway/internal/config"
+ "tianyuan-api/apps/gateway/internal/handler"
+ "tianyuan-api/apps/gateway/internal/svc"
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/rest"
+)
+
+var configFile = flag.String("f", "etc/gateway-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()
+}
diff --git a/apps/gateway/internal/config/config.go b/apps/gateway/internal/config/config.go
new file mode 100644
index 0000000..f69ea3f
--- /dev/null
+++ b/apps/gateway/internal/config/config.go
@@ -0,0 +1,46 @@
+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 字符串
+ AuthJWT AuthConfig // JWT 鉴权相关配置
+ CacheRedis cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体
+ UserRpc zrpc.RpcClientConf
+ SentinelRpc zrpc.RpcClientConf
+ VerifyCode VerifyCode
+ Qiniu QiniuConfig
+ Baidu BaiduConfig
+}
+
+// AuthConfig 用于 JWT 鉴权配置
+type AuthConfig struct {
+ AccessSecret string // JWT 密钥,用于签发 Token
+ AccessExpire int64 // Token 过期时间,单位为秒
+}
+
+type VerifyCode struct {
+ AccessKeyID string
+ AccessKeySecret string
+ EndpointURL string
+ SignName string
+ TemplateCode string
+ ValidTime int
+}
+
+type QiniuConfig struct {
+ AccessKey string
+ SecretKey string
+ Bucket string
+ Domain string
+}
+
+type BaiduConfig struct {
+ ApiKey string
+ SecretKey string
+}
diff --git a/apps/gateway/internal/handler/auth/getverifycodehandler.go b/apps/gateway/internal/handler/auth/getverifycodehandler.go
new file mode 100644
index 0000000..8961ef3
--- /dev/null
+++ b/apps/gateway/internal/handler/auth/getverifycodehandler.go
@@ -0,0 +1,30 @@
+package auth
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/auth"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetVerifyCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetVerifyCodeReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := auth.NewGetVerifyCodeLogic(r.Context(), svcCtx)
+ err := l.GetVerifyCode(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/auth/loginuserhandler.go b/apps/gateway/internal/handler/auth/loginuserhandler.go
new file mode 100644
index 0000000..72e8e71
--- /dev/null
+++ b/apps/gateway/internal/handler/auth/loginuserhandler.go
@@ -0,0 +1,40 @@
+package auth
+
+import (
+ "net/http"
+ "time"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/auth"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func LoginUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.LoginReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := auth.NewLoginUserLogic(r.Context(), svcCtx)
+ token, err := l.LoginUser(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ http.SetCookie(w, &http.Cookie{
+ Name: "Authorization",
+ Value: token, // JWT 令牌
+ HttpOnly: true, // 防止 JavaScript 访问
+ Secure: false, // HTTPS 使用
+ SameSite: http.SameSiteLaxMode, // 防止 CSRF 攻击
+ Path: "/",
+ Expires: time.Now().Add(time.Duration(svcCtx.Config.AuthJWT.AccessExpire) * time.Second), // 过期时间
+ })
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/auth/logouthandler.go b/apps/gateway/internal/handler/auth/logouthandler.go
new file mode 100644
index 0000000..47d156c
--- /dev/null
+++ b/apps/gateway/internal/handler/auth/logouthandler.go
@@ -0,0 +1,23 @@
+package auth
+
+import (
+ "net/http"
+ "time"
+
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/gateway/internal/svc"
+)
+
+func LogoutHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ // 设置空的JWT Cookie,覆盖之前的JWT
+ http.SetCookie(w, &http.Cookie{
+ Name: "Authorization", // 你的JWT cookie名
+ Value: "", // 清空cookies
+ Path: "/",
+ HttpOnly: true,
+ Expires: time.Unix(0, 0), // 过期时间设置为过去
+ })
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+}
diff --git a/apps/gateway/internal/handler/auth/phoneloginuserhandler.go b/apps/gateway/internal/handler/auth/phoneloginuserhandler.go
new file mode 100644
index 0000000..a7253ee
--- /dev/null
+++ b/apps/gateway/internal/handler/auth/phoneloginuserhandler.go
@@ -0,0 +1,40 @@
+package auth
+
+import (
+ "net/http"
+ "time"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/auth"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func PhoneLoginUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.PhoneLoginReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := auth.NewPhoneLoginUserLogic(r.Context(), svcCtx)
+ token, err := l.PhoneLoginUser(&req)
+ http.SetCookie(w, &http.Cookie{
+ Name: "Authorization",
+ Value: token, // JWT 令牌
+ HttpOnly: true, // 防止 JavaScript 访问
+ Secure: false, // HTTPS 使用
+ SameSite: http.SameSiteLaxMode, // 防止 CSRF 攻击
+ Path: "/",
+ Expires: time.Now().Add(time.Duration(svcCtx.Config.AuthJWT.AccessExpire) * time.Second), // 过期时间
+ })
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/auth/registeruserhandler.go b/apps/gateway/internal/handler/auth/registeruserhandler.go
new file mode 100644
index 0000000..571f33e
--- /dev/null
+++ b/apps/gateway/internal/handler/auth/registeruserhandler.go
@@ -0,0 +1,30 @@
+package auth
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/auth"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func RegisterUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.RegisterReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := auth.NewRegisterUserLogic(r.Context(), svcCtx)
+ err := l.RegisterUser(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/base/healthhandler.go b/apps/gateway/internal/handler/base/healthhandler.go
new file mode 100644
index 0000000..f921a3a
--- /dev/null
+++ b/apps/gateway/internal/handler/base/healthhandler.go
@@ -0,0 +1,21 @@
+package base
+
+import (
+ "net/http"
+
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/gateway/internal/logic/base"
+ "tianyuan-api/apps/gateway/internal/svc"
+)
+
+func HealthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ l := base.NewHealthLogic(r.Context(), svcCtx)
+ resp, err := l.Health()
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/product/getproductbyidhandler.go b/apps/gateway/internal/handler/product/getproductbyidhandler.go
new file mode 100644
index 0000000..70e78d1
--- /dev/null
+++ b/apps/gateway/internal/handler/product/getproductbyidhandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/product"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetProductByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetProductByIdReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewGetProductByIdLogic(r.Context(), svcCtx)
+ resp, err := l.GetProductById(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/product/getproductlisthandler.go b/apps/gateway/internal/handler/product/getproductlisthandler.go
new file mode 100644
index 0000000..1eeed79
--- /dev/null
+++ b/apps/gateway/internal/handler/product/getproductlisthandler.go
@@ -0,0 +1,30 @@
+package product
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/product"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetProductListReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := product.NewGetProductListLogic(r.Context(), svcCtx)
+ resp, err := l.GetProductList(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/routes.go b/apps/gateway/internal/handler/routes.go
new file mode 100644
index 0000000..6568c80
--- /dev/null
+++ b/apps/gateway/internal/handler/routes.go
@@ -0,0 +1,167 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+
+package handler
+
+import (
+ "net/http"
+
+ auth "tianyuan-api/apps/gateway/internal/handler/auth"
+ base "tianyuan-api/apps/gateway/internal/handler/base"
+ product "tianyuan-api/apps/gateway/internal/handler/product"
+ user "tianyuan-api/apps/gateway/internal/handler/user"
+ userProduct "tianyuan-api/apps/gateway/internal/handler/userProduct"
+ whitelistr "tianyuan-api/apps/gateway/internal/handler/whitelistr"
+ "tianyuan-api/apps/gateway/internal/svc"
+
+ "github.com/zeromicro/go-zero/rest"
+)
+
+func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
+ server.AddRoutes(
+ []rest.Route{
+ {
+ Method: http.MethodPost,
+ Path: "/getVerifyCode",
+ Handler: auth.GetVerifyCodeHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/login",
+ Handler: auth.LoginUserHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/logout",
+ Handler: auth.LogoutHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/phoneLogin",
+ Handler: auth.PhoneLoginUserHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/register",
+ Handler: auth.RegisterUserHandler(serverCtx),
+ },
+ },
+ rest.WithPrefix("/api/console/auth"),
+ )
+
+ server.AddRoutes(
+ []rest.Route{
+ {
+ Method: http.MethodGet,
+ Path: "/health",
+ Handler: base.HealthHandler(serverCtx),
+ },
+ },
+ rest.WithPrefix("/api/console/base"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodGet,
+ Path: "/:productId",
+ Handler: product.GetProductByIdHandler(serverCtx),
+ },
+ {
+ Method: http.MethodGet,
+ Path: "/list",
+ Handler: product.GetProductListHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/console/product"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodPost,
+ Path: "/businessLicenseUpload",
+ Handler: user.UploadBusinessLicenseHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/enterpriseAuth",
+ Handler: user.EnterpriseAuthHandler(serverCtx),
+ },
+ {
+ Method: http.MethodPost,
+ Path: "/getSecretInfo",
+ Handler: user.GetSecretInfoHandler(serverCtx),
+ },
+ {
+ Method: http.MethodGet,
+ Path: "/info",
+ Handler: user.GetUserInfoHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/console/user"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodPost,
+ Path: "/userProductAdd",
+ Handler: userProduct.AddUserProductHandler(serverCtx),
+ },
+ {
+ Method: http.MethodDelete,
+ Path: "/userProductDel/:id",
+ Handler: userProduct.DeleteUserProductHandler(serverCtx),
+ },
+ {
+ Method: http.MethodGet,
+ Path: "/userProductList",
+ Handler: userProduct.GetUserProductListHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/console/user-product"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodGet,
+ Path: "/getWhitelistList",
+ Handler: whitelistr.GetWhitelistListHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/console/whitelist"),
+ )
+
+ server.AddRoutes(
+ rest.WithMiddlewares(
+ []rest.Middleware{serverCtx.AuthInterceptor, serverCtx.EntAuthInterceptor},
+ []rest.Route{
+ {
+ Method: http.MethodPost,
+ Path: "/addWhitelist",
+ Handler: whitelistr.AddWhitelistHandler(serverCtx),
+ },
+ {
+ Method: http.MethodDelete,
+ Path: "/delWhitelist",
+ Handler: whitelistr.DeleteWhitelistHandler(serverCtx),
+ },
+ }...,
+ ),
+ rest.WithPrefix("/api/console/whitelist"),
+ )
+}
diff --git a/apps/gateway/internal/handler/user/enterpriseauthhandler.go b/apps/gateway/internal/handler/user/enterpriseauthhandler.go
new file mode 100644
index 0000000..45fcca9
--- /dev/null
+++ b/apps/gateway/internal/handler/user/enterpriseauthhandler.go
@@ -0,0 +1,30 @@
+package user
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/user"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func EnterpriseAuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.EnterpriseAuthReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := user.NewEnterpriseAuthLogic(r.Context(), svcCtx)
+ err := l.EnterpriseAuth(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/user/getsecretinfohandler.go b/apps/gateway/internal/handler/user/getsecretinfohandler.go
new file mode 100644
index 0000000..48d96f2
--- /dev/null
+++ b/apps/gateway/internal/handler/user/getsecretinfohandler.go
@@ -0,0 +1,21 @@
+package user
+
+import (
+ "net/http"
+
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/gateway/internal/logic/user"
+ "tianyuan-api/apps/gateway/internal/svc"
+)
+
+func GetSecretInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ l := user.NewGetSecretInfoLogic(r.Context(), svcCtx)
+ resp, err := l.GetSecretInfo()
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/user/getuserinfohandler.go b/apps/gateway/internal/handler/user/getuserinfohandler.go
new file mode 100644
index 0000000..b35e8b9
--- /dev/null
+++ b/apps/gateway/internal/handler/user/getuserinfohandler.go
@@ -0,0 +1,21 @@
+package user
+
+import (
+ "net/http"
+
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/gateway/internal/logic/user"
+ "tianyuan-api/apps/gateway/internal/svc"
+)
+
+func GetUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ l := user.NewGetUserInfoLogic(r.Context(), svcCtx)
+ resp, err := l.GetUserInfo()
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/user/uploadbusinesslicensehandler.go b/apps/gateway/internal/handler/user/uploadbusinesslicensehandler.go
new file mode 100644
index 0000000..9ef17b2
--- /dev/null
+++ b/apps/gateway/internal/handler/user/uploadbusinesslicensehandler.go
@@ -0,0 +1,21 @@
+package user
+
+import (
+ "net/http"
+
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/gateway/internal/logic/user"
+ "tianyuan-api/apps/gateway/internal/svc"
+)
+
+func UploadBusinessLicenseHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ l := user.NewUploadBusinessLicenseLogic(r.Context(), svcCtx)
+ resp, err := l.UploadBusinessLicense(r)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/userProduct/adduserproducthandler.go b/apps/gateway/internal/handler/userProduct/adduserproducthandler.go
new file mode 100644
index 0000000..4756e2d
--- /dev/null
+++ b/apps/gateway/internal/handler/userProduct/adduserproducthandler.go
@@ -0,0 +1,30 @@
+package userProduct
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/userProduct"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func AddUserProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.AddUserProductReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := userProduct.NewAddUserProductLogic(r.Context(), svcCtx)
+ err := l.AddUserProduct(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/userProduct/deleteuserproducthandler.go b/apps/gateway/internal/handler/userProduct/deleteuserproducthandler.go
new file mode 100644
index 0000000..0f2de2c
--- /dev/null
+++ b/apps/gateway/internal/handler/userProduct/deleteuserproducthandler.go
@@ -0,0 +1,30 @@
+package userProduct
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/userProduct"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func DeleteUserProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.DeleteUserProductReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := userProduct.NewDeleteUserProductLogic(r.Context(), svcCtx)
+ err := l.DeleteUserProduct(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/userProduct/getuserproductlisthandler.go b/apps/gateway/internal/handler/userProduct/getuserproductlisthandler.go
new file mode 100644
index 0000000..62975a3
--- /dev/null
+++ b/apps/gateway/internal/handler/userProduct/getuserproductlisthandler.go
@@ -0,0 +1,30 @@
+package userProduct
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/userProduct"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetUserProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetUserProductListReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := userProduct.NewGetUserProductListLogic(r.Context(), svcCtx)
+ resp, err := l.GetUserProductList(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/whitelistr/addwhitelisthandler.go b/apps/gateway/internal/handler/whitelistr/addwhitelisthandler.go
new file mode 100644
index 0000000..53bdf15
--- /dev/null
+++ b/apps/gateway/internal/handler/whitelistr/addwhitelisthandler.go
@@ -0,0 +1,30 @@
+package whitelistr
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/whitelistr"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func AddWhitelistHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.AddWhitelistReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := whitelistr.NewAddWhitelistLogic(r.Context(), svcCtx)
+ err := l.AddWhitelist(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/whitelistr/deletewhitelisthandler.go b/apps/gateway/internal/handler/whitelistr/deletewhitelisthandler.go
new file mode 100644
index 0000000..ec7eeb1
--- /dev/null
+++ b/apps/gateway/internal/handler/whitelistr/deletewhitelisthandler.go
@@ -0,0 +1,30 @@
+package whitelistr
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/whitelistr"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func DeleteWhitelistHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.DeleteWhitelistReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := whitelistr.NewDeleteWhitelistLogic(r.Context(), svcCtx)
+ err := l.DeleteWhitelist(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
+ }
+ }
+}
diff --git a/apps/gateway/internal/handler/whitelistr/getwhitelistlisthandler.go b/apps/gateway/internal/handler/whitelistr/getwhitelistlisthandler.go
new file mode 100644
index 0000000..a75750c
--- /dev/null
+++ b/apps/gateway/internal/handler/whitelistr/getwhitelistlisthandler.go
@@ -0,0 +1,30 @@
+package whitelistr
+
+import (
+ "net/http"
+
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "tianyuan-api/apps/gateway/internal/logic/whitelistr"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ xhttp "github.com/zeromicro/x/http"
+)
+
+func GetWhitelistListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ var req types.GetWhitelistListReq
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ l := whitelistr.NewGetWhitelistListLogic(r.Context(), svcCtx)
+ resp, err := l.GetWhitelistList(&req)
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
+ }
+ }
+}
diff --git a/apps/gateway/internal/logic/auth/getverifycodelogic.go b/apps/gateway/internal/logic/auth/getverifycodelogic.go
new file mode 100644
index 0000000..14522ff
--- /dev/null
+++ b/apps/gateway/internal/logic/auth/getverifycodelogic.go
@@ -0,0 +1,95 @@
+package auth
+
+import (
+ "context"
+ "fmt"
+ openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client"
+ dysmsapi "github.com/alibabacloud-go/dysmsapi-20170525/v3/client"
+ "github.com/alibabacloud-go/tea-utils/v2/service"
+ "github.com/alibabacloud-go/tea/tea"
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+ "math/rand"
+ "time"
+)
+
+type GetVerifyCodeLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetVerifyCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetVerifyCodeLogic {
+ return &GetVerifyCodeLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetVerifyCodeLogic) GetVerifyCode(req *types.GetVerifyCodeReq) (err error) {
+ // 校验 actionType 参数的值是否为 "login" 或 "register"
+ if req.ActionType != "login" && req.ActionType != "register" {
+ return fmt.Errorf("action_type 参数只能是 'login' 或 'register'")
+ }
+ // 检查手机号是否在一分钟内已发送过验证码
+ redisKey := fmt.Sprintf("%s:%s", req.ActionType, req.Phone)
+ exists, err := l.svcCtx.Redis.Exists(redisKey)
+ if err != nil {
+ return err
+ }
+
+ if exists {
+ // 如果 Redis 中已经存在标记,说明在 1 分钟内请求过,返回错误
+ return fmt.Errorf("一分钟内不能重复发送验证码")
+ }
+ // 生成随机验证码
+ code := fmt.Sprintf("%06d", rand.New(rand.NewSource(time.Now().UnixNano())).Intn(1000000))
+
+ // 调用阿里云短信服务发送验证码
+ client, err := l.CreateClient()
+ if err != nil {
+ return err
+ }
+
+ sendSmsRequest := &dysmsapi.SendSmsRequest{
+ SignName: tea.String(l.svcCtx.Config.VerifyCode.SignName),
+ TemplateCode: tea.String(l.svcCtx.Config.VerifyCode.TemplateCode),
+ PhoneNumbers: tea.String(req.Phone),
+ TemplateParam: tea.String(fmt.Sprintf("{\"code\":\"%s\"}", code)),
+ }
+
+ runtime := &service.RuntimeOptions{}
+ // 这里使用 *dysmsapi.SendSmsResponse 接收返回值
+ smsResp, err := client.SendSmsWithOptions(sendSmsRequest, runtime)
+ if err != nil {
+ return err
+ }
+
+ if *smsResp.Body.Code != "OK" {
+ return fmt.Errorf("短信发送失败: %s", *smsResp.Body.Message)
+ }
+ // 将验证码保存到 Redis,设置过期时间
+ err = l.svcCtx.Redis.Setex(req.Phone, code, l.svcCtx.Config.VerifyCode.ValidTime) // 验证码有效期5分钟
+ if err != nil {
+ return err
+ }
+ // 在 Redis 中设置 1 分钟的标记,限制重复请求
+ err = l.svcCtx.Redis.Setex(redisKey, code, 60) // 标记 1 分钟内不能重复请求
+ if err != nil {
+ return err
+ }
+ // 构建返回给前端的响应
+ return nil
+}
+
+// 创建阿里云短信客户端
+func (l *GetVerifyCodeLogic) CreateClient() (*dysmsapi.Client, error) {
+ config := &openapi.Config{
+ AccessKeyId: &l.svcCtx.Config.VerifyCode.AccessKeyID,
+ AccessKeySecret: &l.svcCtx.Config.VerifyCode.AccessKeySecret,
+ }
+ config.Endpoint = tea.String(l.svcCtx.Config.VerifyCode.EndpointURL)
+ return dysmsapi.NewClient(config)
+}
diff --git a/apps/gateway/internal/logic/auth/loginuserlogic.go b/apps/gateway/internal/logic/auth/loginuserlogic.go
new file mode 100644
index 0000000..21705ea
--- /dev/null
+++ b/apps/gateway/internal/logic/auth/loginuserlogic.go
@@ -0,0 +1,35 @@
+package auth
+
+import (
+ "context"
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+ "tianyuan-api/apps/user/user"
+)
+
+type LoginUserLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewLoginUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginUserLogic {
+ return &LoginUserLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *LoginUserLogic) LoginUser(req *types.LoginReq) (token string, err error) {
+ loginResp, err := l.svcCtx.AuthRpc.LoginUser(l.ctx, &user.LoginReq{
+ Username: req.Username,
+ Password: req.Password,
+ })
+ if err != nil {
+ return "", err
+ }
+ // 返回成功的登录响应
+ return loginResp.Token, nil
+}
diff --git a/apps/gateway/internal/logic/auth/logoutlogic.go b/apps/gateway/internal/logic/auth/logoutlogic.go
new file mode 100644
index 0000000..e1b5ab0
--- /dev/null
+++ b/apps/gateway/internal/logic/auth/logoutlogic.go
@@ -0,0 +1,28 @@
+package auth
+
+import (
+ "context"
+
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/gateway/internal/svc"
+)
+
+type LogoutLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewLogoutLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LogoutLogic {
+ return &LogoutLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *LogoutLogic) Logout() error {
+ // todo: add your logic here and delete this line
+
+ return nil
+}
diff --git a/apps/gateway/internal/logic/auth/phoneloginuserlogic.go b/apps/gateway/internal/logic/auth/phoneloginuserlogic.go
new file mode 100644
index 0000000..c761a25
--- /dev/null
+++ b/apps/gateway/internal/logic/auth/phoneloginuserlogic.go
@@ -0,0 +1,35 @@
+package auth
+
+import (
+ "context"
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+ "tianyuan-api/apps/user/user"
+)
+
+type PhoneLoginUserLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewPhoneLoginUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PhoneLoginUserLogic {
+ return &PhoneLoginUserLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *PhoneLoginUserLogic) PhoneLoginUser(req *types.PhoneLoginReq) (token string, err error) {
+ loginResp, err := l.svcCtx.AuthRpc.PhoneLoginUser(l.ctx, &user.PhoneLoginReq{
+ Phone: req.Phone,
+ Code: req.Code,
+ })
+ if err != nil {
+ return "", err
+ }
+ // 返回成功的登录响应
+ return loginResp.Token, nil
+}
diff --git a/apps/gateway/internal/logic/auth/registeruserlogic.go b/apps/gateway/internal/logic/auth/registeruserlogic.go
new file mode 100644
index 0000000..07e0642
--- /dev/null
+++ b/apps/gateway/internal/logic/auth/registeruserlogic.go
@@ -0,0 +1,32 @@
+package auth
+
+import (
+ "context"
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+ "tianyuan-api/apps/user/user"
+)
+
+type RegisterUserLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewRegisterUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegisterUserLogic {
+ return &RegisterUserLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *RegisterUserLogic) RegisterUser(req *types.RegisterReq) error {
+ _, err := l.svcCtx.AuthRpc.RegisterUser(l.ctx, &user.RegisterReq{Username: req.Username, Password: req.Password, ConfirmPassword: req.ConfirmPassword, Phone: req.Phone, Code: req.Code})
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/apps/gateway/internal/logic/base/healthlogic.go b/apps/gateway/internal/logic/base/healthlogic.go
new file mode 100644
index 0000000..c5de770
--- /dev/null
+++ b/apps/gateway/internal/logic/base/healthlogic.go
@@ -0,0 +1,33 @@
+package base
+
+import (
+ "context"
+ "time"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type HealthLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewHealthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HealthLogic {
+ return &HealthLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *HealthLogic) Health() (resp *types.HealthResp, err error) {
+ nowTime := time.Now()
+ resp = &types.HealthResp{
+ Time: nowTime.Format("2006-01-02 15:04:05"),
+ }
+ return
+}
diff --git a/apps/gateway/internal/logic/product/getproductbyidlogic.go b/apps/gateway/internal/logic/product/getproductbyidlogic.go
new file mode 100644
index 0000000..6c6482f
--- /dev/null
+++ b/apps/gateway/internal/logic/product/getproductbyidlogic.go
@@ -0,0 +1,48 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetProductByIdLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetProductByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductByIdLogic {
+ return &GetProductByIdLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetProductByIdLogic) GetProductById(req *types.GetProductByIdReq) (resp *types.GetProductByIdResp, err error) {
+ productResp, err := l.svcCtx.ProductRpc.GetProductById(l.ctx, &product.GetRecordByIdRequest{
+ Id: req.ProductId,
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ return &types.GetProductByIdResp{
+ ProductItem: types.ProductItem{
+ ProductId: productResp.Id,
+ ProductName: productResp.ProductName,
+ ProductCode: productResp.ProductCode,
+ ProductDescription: productResp.ProductDescription,
+ ProductContent: productResp.ProductContent,
+ ProductGroup: productResp.ProductGroup,
+ ProductPrice: productResp.ProductPrice,
+ },
+ }, nil
+
+ return
+}
diff --git a/apps/gateway/internal/logic/product/getproductlistlogic.go b/apps/gateway/internal/logic/product/getproductlistlogic.go
new file mode 100644
index 0000000..a49cef6
--- /dev/null
+++ b/apps/gateway/internal/logic/product/getproductlistlogic.go
@@ -0,0 +1,51 @@
+package product
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/product"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetProductListLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductListLogic {
+ return &GetProductListLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq) (resp *types.GetProductListResp, err error) {
+ productList, err := l.svcCtx.ProductRpc.GetProductPageList(l.ctx, &product.PageListRequest{Page: req.Page, PageSize: req.PageSize})
+ if err != nil {
+ return nil, err
+ }
+ var list []types.ProductItem
+
+ for _, p := range productList.Products {
+ list = append(list, types.ProductItem{
+ ProductId: p.Id,
+ ProductName: p.ProductName,
+ ProductCode: p.ProductCode,
+ ProductDescription: p.ProductDescription,
+ ProductPrice: p.ProductPrice,
+ ProductGroup: p.ProductGroup,
+ CreatedAt: p.CreatedAt,
+ UpdatedAt: p.UpdatedAt,
+ })
+ }
+ resp = &types.GetProductListResp{
+ Total: productList.Total,
+ List: list,
+ }
+ return resp, nil
+}
diff --git a/apps/gateway/internal/logic/user/enterpriseauthlogic.go b/apps/gateway/internal/logic/user/enterpriseauthlogic.go
new file mode 100644
index 0000000..bd158c6
--- /dev/null
+++ b/apps/gateway/internal/logic/user/enterpriseauthlogic.go
@@ -0,0 +1,40 @@
+package user
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/user/user"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type EnterpriseAuthLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewEnterpriseAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EnterpriseAuthLogic {
+ return &EnterpriseAuthLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *EnterpriseAuthLogic) EnterpriseAuth(req *types.EnterpriseAuthReq) error {
+ // 从上下文中解析 JWT,获取用户ID
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return errors.New("无法获取 userId")
+ }
+ _, err := l.svcCtx.EntRpc.CreateEnterpriseAuth(l.ctx, &user.EnterpriseAuthReq{UserId: userId, EnterpriseName: req.EnterpriseName, EnterpriseContact: req.EnterpriseContact, CreditCode: req.CreditCode, LegalPerson: req.LegalPerson, BusinessLicense: req.BusinessLicense})
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/apps/gateway/internal/logic/user/getsecretinfologic.go b/apps/gateway/internal/logic/user/getsecretinfologic.go
new file mode 100644
index 0000000..da69d72
--- /dev/null
+++ b/apps/gateway/internal/logic/user/getsecretinfologic.go
@@ -0,0 +1,44 @@
+package user
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetSecretInfoLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetSecretInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSecretInfoLogic {
+ return &GetSecretInfoLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetSecretInfoLogic) GetSecretInfo() (resp *types.SecretInfoResp, err error) {
+ // 从上下文中解析 JWT,获取用户ID
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return nil, errors.New("无法获取 userId")
+ }
+ secret, err := l.svcCtx.SecretRpc.GetSecretByUserId(l.ctx, &sentinel.GetRecordByIdRequest{
+ Id: userId,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return &types.SecretInfoResp{
+ AccessId: secret.SecretId,
+ AccessKey: secret.AesKey,
+ }, nil
+}
diff --git a/apps/gateway/internal/logic/user/getuserinfologic.go b/apps/gateway/internal/logic/user/getuserinfologic.go
new file mode 100644
index 0000000..55d74c6
--- /dev/null
+++ b/apps/gateway/internal/logic/user/getuserinfologic.go
@@ -0,0 +1,48 @@
+package user
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserInfoLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
+ return &GetUserInfoLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetUserInfoLogic) GetUserInfo() (resp *types.UserInfoResp, err error) {
+
+ // 从上下文中解析 JWT,获取用户ID
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return nil, errors.New("无法获取 userId")
+ }
+
+ info, err := l.svcCtx.UserRpc.UserInfo(l.ctx, &user.UserInfoReq{UserId: userId})
+ if err != nil {
+ return nil, err
+ }
+ // 如果查到了企业信息,连带企业信息一起返回
+ return &types.UserInfoResp{
+ Username: info.Username,
+ Phone: info.Phone,
+ EnterpriseAuthStatus: info.EnterpriseAuthStatus,
+ EnterpriseName: info.EnterpriseName,
+ CreditCode: info.CreditCode,
+ LegalPerson: info.LegalPerson,
+ }, nil
+}
diff --git a/apps/gateway/internal/logic/user/uploadbusinesslicenselogic.go b/apps/gateway/internal/logic/user/uploadbusinesslicenselogic.go
new file mode 100644
index 0000000..768160f
--- /dev/null
+++ b/apps/gateway/internal/logic/user/uploadbusinesslicenselogic.go
@@ -0,0 +1,249 @@
+package user
+
+import (
+ "context"
+ "crypto/rand"
+ "encoding/base64"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "github.com/qiniu/go-sdk/v7/storagev2/credentials"
+ "github.com/qiniu/go-sdk/v7/storagev2/http_client"
+ "github.com/qiniu/go-sdk/v7/storagev2/uploader"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+ "io"
+ "math/big"
+ "net/http"
+ "net/url"
+ "os"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type UploadBusinessLicenseLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewUploadBusinessLicenseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadBusinessLicenseLogic {
+ return &UploadBusinessLicenseLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+func (l *UploadBusinessLicenseLogic) UploadBusinessLicense(r *http.Request) (resp *types.UploadBusinessLicenseResp, err error) {
+ // 1. 解析文件上传表单,限制文件大小
+ err = r.ParseMultipartForm(4 << 20) // 限制最大文件大小为4MB
+ if err != nil {
+ return nil, errors.New("图片不能超过4MB")
+ }
+
+ // 2. 获取上传的文件
+ file, handler, err := r.FormFile("file")
+ if err != nil {
+ return nil, err
+ }
+ defer file.Close()
+
+ // 3. 创建临时文件保存上传的内容
+ tempFile, err := os.CreateTemp("", "upload-*.jpg")
+ if err != nil {
+ return nil, fmt.Errorf("创建临时文件失败: %v", err)
+ }
+ defer tempFile.Close()
+
+ // 4. 将文件内容保存到临时文件
+ _, err = io.Copy(tempFile, file)
+ if err != nil {
+ return nil, fmt.Errorf("保存文件失败: %v", err)
+ }
+
+ // 5. 调用百度智能云进行营业执照识别
+ tempFilePath := tempFile.Name()
+ fileBytes, err := os.ReadFile(tempFilePath)
+ if err != nil {
+ return nil, fmt.Errorf("读取临时文件失败: %v", err)
+ }
+
+ licenseInfo, err := l.RecognizeBusinessLicense(fileBytes)
+ if err != nil {
+ return nil, fmt.Errorf("营业执照识别失败: %v", err)
+ }
+
+ // 6. 生成新的文件名
+ newFileName := l.GenerateFileName("business_license_", handler.Filename)
+
+ // 7. 确认是营业执照后,将图片上传到七牛云
+ imageUrl, err := l.UploadToQiniu(tempFilePath, newFileName)
+ if err != nil {
+ return nil, fmt.Errorf("上传图片到七牛云失败: %v", err)
+ }
+
+ // 8. 返回百度智能云的识别信息和图片URL给前端
+ return &types.UploadBusinessLicenseResp{
+ Url: imageUrl,
+ EnterpriseName: licenseInfo["company_name"],
+ CreditCode: licenseInfo["credit_code"],
+ LegalPerson: licenseInfo["legal_person"],
+ }, nil
+}
+
+// 百度智能云营业执照识别
+func (l *UploadBusinessLicenseLogic) RecognizeBusinessLicense(fileBytes []byte) (map[string]string, error) {
+ // 获取百度智能云Access Token
+ accessToken := l.GetAccessToken()
+ if accessToken == "" {
+ return nil, errors.New("获取百度智能云Access Token失败")
+ }
+
+ // 调用百度智能云营业执照识别接口
+ baiduUrl := "https://aip.baidubce.com/rest/2.0/ocr/v1/business_license?access_token=" + accessToken
+
+ // 将图片文件进行Base64编码
+ fileBase64 := base64.StdEncoding.EncodeToString(fileBytes)
+ fileBase64UrlEncoded := url.QueryEscape(fileBase64)
+ // 准备POST请求的Payload
+ payload := strings.NewReader(fmt.Sprintf("image=%s", fileBase64UrlEncoded))
+
+ req, err := http.NewRequest("POST", baiduUrl, payload)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
+ client := &http.Client{}
+ res, err := client.Do(req)
+ if err != nil {
+ return nil, err
+ }
+ defer res.Body.Close()
+
+ body, err := io.ReadAll(res.Body)
+ if err != nil {
+ return nil, err
+ }
+
+ // 解析响应体
+ var result map[string]interface{}
+ if err := json.Unmarshal(body, &result); err != nil {
+ return nil, fmt.Errorf("解析响应失败: %v", err)
+ }
+
+ // 检查是否有错误码
+ if _, exists := result["error_code"]; exists {
+ return nil, fmt.Errorf("图片解析失败,请上传清晰正确的图片")
+ }
+
+ // 成功,提取所需的字段
+ wordsResult := result["words_result"].(map[string]interface{})
+ companyName := wordsResult["单位名称"].(map[string]interface{})["words"].(string)
+ socialCreditCode := wordsResult["社会信用代码"].(map[string]interface{})["words"].(string)
+ legalPerson := wordsResult["法人"].(map[string]interface{})["words"].(string)
+
+ // 返回提取的信息
+ return map[string]string{
+ "company_name": companyName,
+ "credit_code": socialCreditCode,
+ "legal_person": legalPerson,
+ }, nil
+}
+
+// 获取百度智能云Access Token
+func (l *UploadBusinessLicenseLogic) GetAccessToken() string {
+ apiKey := l.svcCtx.Config.Baidu.ApiKey
+ secretKey := l.svcCtx.Config.Baidu.SecretKey
+
+ baiduUrl := "https://aip.baidubce.com/oauth/2.0/token"
+ postData := fmt.Sprintf("grant_type=client_credentials&client_id=%s&client_secret=%s", apiKey, secretKey)
+ resp, err := http.Post(baiduUrl, "application/x-www-form-urlencoded", strings.NewReader(postData))
+ if err != nil {
+ return ""
+ }
+ defer resp.Body.Close()
+
+ body, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return ""
+ }
+
+ accessTokenObj := map[string]interface{}{}
+ _ = json.Unmarshal(body, &accessTokenObj)
+ return accessTokenObj["access_token"].(string)
+}
+
+// 七牛云上传图片
+func (l *UploadBusinessLicenseLogic) UploadToQiniu(localFilePath string, fileName string) (string, error) {
+ // 从配置中获取七牛云的AccessKey和SecretKey
+ accessKey := l.svcCtx.Config.Qiniu.AccessKey
+ secretKey := l.svcCtx.Config.Qiniu.SecretKey
+ bucket := l.svcCtx.Config.Qiniu.Bucket
+ domain := l.svcCtx.Config.Qiniu.Domain
+
+ // 1. 构建上传凭证
+ mac := credentials.NewCredentials(accessKey, secretKey)
+
+ // 2. 构建上传管理器
+ options := uploader.UploadManagerOptions{
+ Options: http_client.Options{
+ Credentials: mac, // 这里传入认证信息
+ },
+ }
+
+ uploadManager := uploader.NewUploadManager(&options)
+
+ objectOptions := &uploader.ObjectOptions{
+ BucketName: bucket,
+ ObjectName: &fileName,
+ FileName: fileName,
+ }
+
+ // 3. 执行文件上传
+ err := uploadManager.UploadFile(context.Background(), localFilePath, objectOptions, nil)
+
+ if err != nil {
+ return "", err
+ }
+
+ // 返回文件的URL地址
+ fileUrl := fmt.Sprintf("%s/%s", domain, fileName)
+ return fileUrl, nil
+}
+
+// 生成新的文件名,包含前缀、时间戳和随机数
+func (l *UploadBusinessLicenseLogic) GenerateFileName(prefix, originalFileName string) string {
+ timestamp := time.Now().Format("20060102150405") // 生成时间戳
+ randomNumber := l.GenerateRandomNumber(4) // 生成4位随机数
+ fileExtension := l.GetFileExtension(originalFileName) // 获取原文件扩展名
+
+ // 返回生成的文件名
+ return fmt.Sprintf("%s%s_%s%s", prefix, timestamp, randomNumber, fileExtension)
+}
+
+// 生成指定长度的随机数
+func (l *UploadBusinessLicenseLogic) GenerateRandomNumber(length int) string {
+ var digits = "0123456789"
+ result := make([]byte, length)
+ for i := range result {
+ n, _ := rand.Int(rand.Reader, big.NewInt(int64(len(digits))))
+ result[i] = digits[n.Int64()]
+ }
+ return string(result)
+}
+
+// 获取文件扩展名
+func (l *UploadBusinessLicenseLogic) GetFileExtension(fileName string) string {
+ if len(fileName) > 0 {
+ for i := len(fileName) - 1; i >= 0 && fileName[i] != '.'; i-- {
+ if i == 0 {
+ return "" // 无扩展名
+ }
+ }
+ return fileName[strings.LastIndex(fileName, "."):]
+ }
+ return ""
+}
diff --git a/apps/gateway/internal/logic/userProduct/adduserproductlogic.go b/apps/gateway/internal/logic/userProduct/adduserproductlogic.go
new file mode 100644
index 0000000..42f71f5
--- /dev/null
+++ b/apps/gateway/internal/logic/userProduct/adduserproductlogic.go
@@ -0,0 +1,41 @@
+package userProduct
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/client/userproduct"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type AddUserProductLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewAddUserProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddUserProductLogic {
+ return &AddUserProductLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *AddUserProductLogic) AddUserProduct(req *types.AddUserProductReq) error {
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return errors.New("无法获取 userId")
+ }
+ _, err := l.svcCtx.UserProductRpc.CreateUserProduct(l.ctx, &userproduct.CreateUserProductRequest{
+ UserId: userId,
+ ProductId: req.ProductId,
+ })
+ if err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/apps/gateway/internal/logic/userProduct/deleteuserproductlogic.go b/apps/gateway/internal/logic/userProduct/deleteuserproductlogic.go
new file mode 100644
index 0000000..4d00643
--- /dev/null
+++ b/apps/gateway/internal/logic/userProduct/deleteuserproductlogic.go
@@ -0,0 +1,40 @@
+package userProduct
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteUserProductLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewDeleteUserProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserProductLogic {
+ return &DeleteUserProductLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *DeleteUserProductLogic) DeleteUserProduct(req *types.DeleteUserProductReq) error {
+ return errors.New("not implements")
+ // 未完善,应加上判断是否该用户订阅后删除,id也不是这个id,暂不开放,开放也没用
+ //_, ok := l.ctx.Value("userId").(int64)
+ //if !ok {
+ // return errors.New("无法获取 userId")
+ //}
+ //_, err := l.svcCtx.UserProductRpc.DeleteUserProduct(l.ctx, &userproduct.DeleteUserProductRequest{
+ // Id: req.Id,
+ //})
+ //if err != nil {
+ // return err
+ //}
+ //return nil
+}
diff --git a/apps/gateway/internal/logic/userProduct/getuserproductlistlogic.go b/apps/gateway/internal/logic/userProduct/getuserproductlistlogic.go
new file mode 100644
index 0000000..d0711f1
--- /dev/null
+++ b/apps/gateway/internal/logic/userProduct/getuserproductlistlogic.go
@@ -0,0 +1,60 @@
+package userProduct
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/client/userproduct"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserProductListLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetUserProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProductListLogic {
+ return &GetUserProductListLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetUserProductListLogic) GetUserProductList(req *types.GetUserProductListReq) (resp *types.GetUserProductListResp, err error) {
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return nil, errors.New("无法获取 userId")
+ }
+ userProductPageListResp, err := l.svcCtx.UserProductRpc.GetUserProductPageList(l.ctx, &userproduct.UserProuctPageListRequest{
+ UserId: userId,
+ Page: req.Page,
+ PageSize: req.PageSize,
+ })
+ if err != nil {
+ return nil, err
+ }
+ var list []types.UserProductItem
+ for _, up := range userProductPageListResp.UserProducts {
+ list = append(list, types.UserProductItem{
+ Id: up.Id,
+ ProductId: up.ProductId,
+ ProductName: up.ProductName,
+ ProductPrice: up.ProductPrice,
+ ProductGroup: up.ProductGroup,
+ ProductCode: up.ProductCode,
+ ProductDescription: up.ProductDescription,
+ CreatedAt: up.CreatedAt,
+ UpdatedAt: up.UpdatedAt,
+ })
+ }
+ resp = &types.GetUserProductListResp{
+ Total: userProductPageListResp.Total,
+ List: list,
+ }
+ return resp, nil
+}
diff --git a/apps/gateway/internal/logic/whitelistr/addwhitelistlogic.go b/apps/gateway/internal/logic/whitelistr/addwhitelistlogic.go
new file mode 100644
index 0000000..af322f6
--- /dev/null
+++ b/apps/gateway/internal/logic/whitelistr/addwhitelistlogic.go
@@ -0,0 +1,46 @@
+package whitelistr
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/gateway/internal/validator"
+ "tianyuan-api/apps/sentinel/client/whitelist"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type AddWhitelistLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewAddWhitelistLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddWhitelistLogic {
+ return &AddWhitelistLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *AddWhitelistLogic) AddWhitelist(req *types.AddWhitelistReq) error {
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return errors.New("无法获取 userId")
+ }
+ isIp := validator.IsValidIPAddress(req.Ip)
+ if !isIp {
+ return errors.New("请输入正确的IP地址")
+ }
+ _, err := l.svcCtx.WhitelistRpc.CreateWhitelist(l.ctx, &whitelist.CreateWhitelistRequest{
+ UserId: userId,
+ WhitelistIp: req.Ip,
+ })
+ if err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/apps/gateway/internal/logic/whitelistr/deletewhitelistlogic.go b/apps/gateway/internal/logic/whitelistr/deletewhitelistlogic.go
new file mode 100644
index 0000000..875b34f
--- /dev/null
+++ b/apps/gateway/internal/logic/whitelistr/deletewhitelistlogic.go
@@ -0,0 +1,35 @@
+package whitelistr
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/whitelist"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteWhitelistLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewDeleteWhitelistLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteWhitelistLogic {
+ return &DeleteWhitelistLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *DeleteWhitelistLogic) DeleteWhitelist(req *types.DeleteWhitelistReq) error {
+ _, err := l.svcCtx.WhitelistRpc.DeleteWhitelist(l.ctx, &whitelist.DeleteWhitelistRequest{
+ Id: req.Id,
+ })
+ if err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/apps/gateway/internal/logic/whitelistr/getwhitelistlistlogic.go b/apps/gateway/internal/logic/whitelistr/getwhitelistlistlogic.go
new file mode 100644
index 0000000..fe34277
--- /dev/null
+++ b/apps/gateway/internal/logic/whitelistr/getwhitelistlistlogic.go
@@ -0,0 +1,55 @@
+package whitelistr
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/client/whitelist"
+
+ "tianyuan-api/apps/gateway/internal/svc"
+ "tianyuan-api/apps/gateway/internal/types"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetWhitelistListLogic struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewGetWhitelistListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWhitelistListLogic {
+ return &GetWhitelistListLogic{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *GetWhitelistListLogic) GetWhitelistList(req *types.GetWhitelistListReq) (resp *types.GetWhitelistListResp, err error) {
+ userId, ok := l.ctx.Value("userId").(int64)
+ if !ok {
+ return nil, errors.New("无法获取 userId")
+ }
+ whitelistPageResp, err := l.svcCtx.WhitelistRpc.GetWhitePageList(l.ctx, &whitelist.WhitePageListRequest{
+ UserId: userId,
+ Page: req.Page,
+ PageSize: req.PageSize,
+ })
+ if err != nil {
+ return nil, err
+ }
+ var list []types.WhitelistItem
+ for _, up := range whitelistPageResp.Whitelists {
+ list = append(list, types.WhitelistItem{
+ Id: up.Id,
+ WhitelistIp: up.WhitelistIp,
+ CreatedAt: up.CreatedAt,
+ UpdatedAt: up.UpdatedAt,
+ })
+ }
+ resp = &types.GetWhitelistListResp{
+ Total: whitelistPageResp.Total,
+ List: list,
+ }
+ return resp, nil
+}
diff --git a/apps/gateway/internal/middleware/authinterceptormiddleware.go b/apps/gateway/internal/middleware/authinterceptormiddleware.go
new file mode 100644
index 0000000..5c8ebd1
--- /dev/null
+++ b/apps/gateway/internal/middleware/authinterceptormiddleware.go
@@ -0,0 +1,54 @@
+package middleware
+
+import (
+ "context"
+ "errors"
+ "github.com/zeromicro/go-zero/core/logx"
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/gateway/internal/config"
+ jwtx "tianyuan-api/pkg/jwt"
+ "net/http"
+ "time"
+)
+
+type AuthInterceptorMiddleware struct {
+ Config config.Config
+}
+
+func NewAuthInterceptorMiddleware(c config.Config) *AuthInterceptorMiddleware {
+ return &AuthInterceptorMiddleware{
+ Config: c,
+ }
+}
+
+func (m *AuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ // 从 Cookie 中获取 JWT
+ cookie, err := r.Cookie("Authorization")
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("用户未登录"))
+ return
+ }
+
+ tokenStr := cookie.Value
+ // 验证并解析 JWT
+ userId, err := jwtx.ParseJwtToken(tokenStr, m.Config.AuthJWT.AccessSecret)
+ if err != nil {
+ // 设置过期的 Cookie 来删除无效的 Token
+ http.SetCookie(w, &http.Cookie{
+ Name: "Authorization",
+ Value: "",
+ Path: "/",
+ HttpOnly: true,
+ Expires: time.Unix(0, 0), // 过期时间设置为过去
+ })
+ logx.Error("Invalid JWT: ", err)
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("未经授权的访问"))
+ return
+ }
+
+ // 将 userId 存入 context,供后续逻辑使用
+ ctx := context.WithValue(r.Context(), "userId", userId)
+ next(w, r.WithContext(ctx))
+ }
+}
diff --git a/apps/gateway/internal/middleware/entauthinterceptormiddleware.go b/apps/gateway/internal/middleware/entauthinterceptormiddleware.go
new file mode 100644
index 0000000..c44e9ed
--- /dev/null
+++ b/apps/gateway/internal/middleware/entauthinterceptormiddleware.go
@@ -0,0 +1,39 @@
+package middleware
+
+import (
+ "errors"
+ "github.com/zeromicro/go-zero/core/logx"
+ xhttp "github.com/zeromicro/x/http"
+ "tianyuan-api/apps/user/user"
+ "net/http"
+)
+
+type EntAuthInterceptorMiddleware struct {
+ UserRpc user.UserClient
+}
+
+func NewEntAuthInterceptorMiddleware(userRpc user.UserClient) *EntAuthInterceptorMiddleware {
+ return &EntAuthInterceptorMiddleware{
+ UserRpc: userRpc,
+ }
+}
+
+func (m *EntAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ userId, ok := r.Context().Value("userId").(int64)
+ if !ok {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("无法获取 userId"))
+ }
+ status, err := m.UserRpc.GetEnterpriseAuthStatus(r.Context(), &user.GetEnterpriseAuthStatusReq{UserId: userId})
+ if err != nil {
+ logx.Error("校验认证状态错误: %v", err)
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误"))
+ return
+ }
+ if !status.IsAuth {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("请先通过企业认证"))
+ return
+ }
+ next(w, r)
+ }
+}
diff --git a/apps/gateway/internal/svc/servicecontext.go b/apps/gateway/internal/svc/servicecontext.go
new file mode 100644
index 0000000..d14ab1f
--- /dev/null
+++ b/apps/gateway/internal/svc/servicecontext.go
@@ -0,0 +1,57 @@
+package svc
+
+import (
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/rest"
+ "github.com/zeromicro/go-zero/zrpc"
+ "tianyuan-api/apps/gateway/internal/config"
+ "tianyuan-api/apps/gateway/internal/middleware"
+ "tianyuan-api/apps/sentinel/sentinel"
+ "tianyuan-api/apps/user/user"
+)
+
+type ServiceContext struct {
+ Config config.Config
+ AuthInterceptor rest.Middleware
+ EntAuthInterceptor rest.Middleware
+ Redis *redis.Redis
+ AuthRpc user.AuthClient
+ EntRpc user.EnterpriseClient
+ UserRpc user.UserClient
+ ProductRpc sentinel.ProductClient
+ UserProductRpc sentinel.UserProductClient
+ WhitelistRpc sentinel.WhitelistClient
+ SecretRpc sentinel.SecretClient
+}
+
+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)
+ authRpc := user.NewAuthClient(zrpc.MustNewClient(c.UserRpc).Conn())
+ entRpc := user.NewEnterpriseClient(zrpc.MustNewClient(c.UserRpc).Conn())
+ userRpc := user.NewUserClient(zrpc.MustNewClient(c.UserRpc).Conn())
+ 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,
+ AuthInterceptor: middleware.NewAuthInterceptorMiddleware(c).Handle,
+ EntAuthInterceptor: middleware.NewEntAuthInterceptorMiddleware(userRpc).Handle,
+ Redis: rds, // 单独使用的 Redis 客户端
+ AuthRpc: authRpc,
+ EntRpc: entRpc,
+ UserRpc: userRpc,
+ ProductRpc: productRpc,
+ UserProductRpc: userProductRpc,
+ WhitelistRpc: whitelistRpc,
+ SecretRpc: secretRpc,
+ }
+}
diff --git a/apps/gateway/internal/types/types.go b/apps/gateway/internal/types/types.go
new file mode 100644
index 0000000..7182d99
--- /dev/null
+++ b/apps/gateway/internal/types/types.go
@@ -0,0 +1,145 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+
+package types
+
+type AddUserProductReq struct {
+ ProductId int64 `json:"productId"`
+}
+
+type AddWhitelistReq struct {
+ Ip string `json:"ip"`
+}
+
+type DeleteUserProductReq struct {
+ Id int64 `json:"id"`
+}
+
+type DeleteWhitelistReq struct {
+ Id int64 `json:"id"`
+}
+
+type GetProductByIdReq struct {
+ ProductId int64 `path:"productId"`
+}
+
+type GetProductByIdResp struct {
+ ProductItem
+}
+
+type GetProductListReq struct {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+}
+
+type GetProductListResp struct {
+ Total int64 `json:"total"`
+ List []ProductItem `json:"list"`
+}
+
+type GetUserProductListReq struct {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+}
+
+type GetUserProductListResp struct {
+ Total int64 `json:"total"`
+ List []UserProductItem `json:"list"`
+}
+
+type GetVerifyCodeReq struct {
+ Phone string `json:"phone"`
+ ActionType string `json:"actionType"`
+}
+
+type GetWhitelistListReq struct {
+ Page int64 `form:"page"`
+ PageSize int64 `form:"pageSize"`
+}
+
+type GetWhitelistListResp struct {
+ Total int64 `json:"total"`
+ List []WhitelistItem `json:"list"`
+}
+
+type LoginReq struct {
+ Username string `json:"username"`
+ Password string `json:"password"`
+}
+
+type ProductItem struct {
+ ProductId int64 `json:"productId"`
+ ProductName string `json:"productName"`
+ ProductCode string `json:"productCode"`
+ ProductDescription string `json:"productDescription"`
+ ProductContent string `json:"productContent"`
+ ProductGroup string `json:"productGroup"`
+ ProductPrice float64 `json:"productPrice"`
+ CreatedAt string `json:"createdAt"`
+ UpdatedAt string `json:"updatedAt"`
+}
+
+type RegisterReq struct {
+ Username string `json:"username"`
+ Password string `json:"password"`
+ ConfirmPassword string `json:"confirmPassword"`
+ Phone string `json:"phone"`
+ Code string `json:"code"`
+}
+
+type UploadBusinessLicenseResp struct {
+ Url string `json:"url"`
+ EnterpriseName string `json:"enterpriseName"`
+ CreditCode string `json:"creditCode"`
+ LegalPerson string `json:"legalPerson"`
+}
+
+type UserInfoResp struct {
+ Username string `json:"username"`
+ Phone string `json:"phone"`
+ EnterpriseAuthStatus string `json:"enterpriseAuthStatus"`
+ EnterpriseName string `json:"enterpriseName"`
+ CreditCode string `json:"creditCode"`
+ LegalPerson string `json:"legalPerson"`
+}
+
+type UserProductItem struct {
+ Id int64 `json:"id"` // 用户产品ID
+ ProductId int64 `json:"productId"` // 产品ID
+ ProductName string `json:"productName"` // 产品名称
+ ProductCode string `json:"productCode"` // 产品编号
+ ProductDescription string `json:"productDescription"` // 产品简介
+ ProductGroup string `json:"productGroup"` // 产品分类
+ ProductPrice float64 `json:"productPrice"` // 产品价格
+ CreatedAt string `json:"createdAt"` // 创建时间
+ UpdatedAt string `json:"updatedAt"` // 更新时间
+}
+
+type WhitelistItem struct {
+ Id int64 `json:"id"` // 用户产品ID
+ WhitelistIp string `json:"whiteIp"` // 产品名称
+ CreatedAt string `json:"createdAt"` // 创建时间
+ UpdatedAt string `json:"updatedAt"` // 更新时间
+}
+
+type EnterpriseAuthReq struct {
+ EnterpriseName string `json:"enterpriseName"`
+ CreditCode string `json:"creditCode"`
+ LegalPerson string `json:"legalPerson"`
+ BusinessLicense string `json:"businessLicense"`
+ EnterpriseContact string `json:"enterpriseContact"`
+}
+
+type HealthResp struct {
+ Time string `json:"time"`
+}
+
+type PhoneLoginReq struct {
+ Phone string `json:"phone"`
+ Code string `json:"code"`
+}
+
+type SecretInfoResp struct {
+ AccessId string `json:"accessId"`
+ AccessKey string `json:"accessKey"`
+}
diff --git a/apps/gateway/internal/types/validator.go b/apps/gateway/internal/types/validator.go
new file mode 100644
index 0000000..5b43074
--- /dev/null
+++ b/apps/gateway/internal/types/validator.go
@@ -0,0 +1,20 @@
+package types
+
+import (
+ "tianyuan-api/apps/gateway/internal/validator"
+)
+
+func (l *RegisterReq) Validate() error {
+ if err := validator.ValidateUsername(l.Username); err != nil {
+ return err
+ }
+ if err := validator.ValidatePassword(l.Password); err != nil {
+ return err
+ }
+ if err := validator.ValidatePhoneNumber(l.Phone); err != nil {
+ return err
+ }
+
+ // 其他逻辑
+ return nil
+}
diff --git a/apps/gateway/internal/validator/validator.go b/apps/gateway/internal/validator/validator.go
new file mode 100644
index 0000000..8d85a83
--- /dev/null
+++ b/apps/gateway/internal/validator/validator.go
@@ -0,0 +1,72 @@
+// internal/validator/validation.go
+
+package validator
+
+import (
+ "errors"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "regexp"
+ "unicode/utf8"
+)
+
+func ValidateUsername(username string) error {
+ if utf8.RuneCountInString(username) < 2 {
+ return errors.New("用户名长度不能少于2个中文或4个英文字符")
+ }
+ return nil
+}
+
+func ValidatePassword(password string) error {
+ if len(password) < 8 {
+ return errors.New("密码长度不能少于8位")
+ }
+ return nil
+}
+
+func ValidatePhoneNumber(phone string) error {
+ phoneRegex := `^1[3-9]\d{9}$`
+ re := regexp.MustCompile(phoneRegex)
+ if !re.MatchString(phone) {
+ return errors.New("手机号格式不正确")
+ }
+ return nil
+}
+func ValidateVerifyCode(redisClient *redis.Redis, phone, code string) error {
+ // 从 Redis 获取验证码
+ savedCode, err := redisClient.Get(phone)
+ if err != nil {
+ if errors.Is(err, redis.Nil) {
+ return errors.New("验证码已过期")
+ }
+ return err
+ }
+
+ // 验证码不匹配
+ if savedCode != code {
+ return errors.New("验证码不正确")
+ }
+
+ return nil
+}
+func IsValidIPAddress(ip string) bool {
+ // 正则表达式:匹配 IPv4 地址格式
+ var ipRegex = regexp.MustCompile(`^([0-9]{1,3}\.){3}[0-9]{1,3}$`)
+
+ // 判断格式是否匹配
+ if !ipRegex.MatchString(ip) {
+ return false
+ }
+
+ // 验证每个段是否在 0 到 255 之间
+ var segments = ipRegex.FindStringSubmatch(ip)
+ for _, segment := range segments {
+ var num int
+ fmt.Sscanf(segment, "%d", &num)
+ if num < 0 || num > 255 {
+ return false
+ }
+ }
+
+ return true
+}
diff --git a/apps/mqs/Dockerfile b/apps/mqs/Dockerfile
new file mode 100644
index 0000000..48f6015
--- /dev/null
+++ b/apps/mqs/Dockerfile
@@ -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/mqs/etc /app/etc
+RUN go build -ldflags="-s -w" -o /app/main apps/mqs/.\main.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/main /app/main
+COPY --from=builder /app/etc /app/etc
+
+CMD ["./main", "-f", "etc/mqs.yaml"]
diff --git a/apps/mqs/etc/mqs.yaml b/apps/mqs/etc/mqs.yaml
new file mode 100644
index 0000000..5905924
--- /dev/null
+++ b/apps/mqs/etc/mqs.yaml
@@ -0,0 +1,25 @@
+Name: mq
+Host: 0.0.0.0
+Port: 12001
+
+# kq 消费者组1 - 用于记录
+KqConsumerLog:
+ Name: kqConsumerLog
+ Brokers:
+ - 127.0.0.1:9092
+ Group: logGroup
+ Topic: apirequest
+ Offset: first
+ Consumers: 2 # 为了避免资源争夺,分配2个消费者
+ Processors: 2
+
+# kq 消费者组2 - 用于扣款
+KqConsumerCharge:
+ Name: kqConsumerCharge
+ Brokers:
+ - 127.0.0.1:9092
+ Group: chargeGroup
+ Topic: apirequest
+ Offset: first
+ Consumers: 2 # 同样分配2个消费者
+ Processors: 2
\ No newline at end of file
diff --git a/apps/mqs/internal/config/config.go b/apps/mqs/internal/config/config.go
new file mode 100644
index 0000000..f301ead
--- /dev/null
+++ b/apps/mqs/internal/config/config.go
@@ -0,0 +1,12 @@
+package config
+
+import (
+ "github.com/zeromicro/go-queue/kq"
+ "github.com/zeromicro/go-zero/rest"
+)
+
+type Config struct {
+ rest.RestConf
+ KqConsumerLog kq.KqConf
+ KqConsumerCharge kq.KqConf
+}
diff --git a/apps/mqs/internal/mqs/apirequest/charge.go b/apps/mqs/internal/mqs/apirequest/charge.go
new file mode 100644
index 0000000..5cebeca
--- /dev/null
+++ b/apps/mqs/internal/mqs/apirequest/charge.go
@@ -0,0 +1,24 @@
+package apirequest
+
+import (
+ "context"
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/mqs/internal/svc"
+)
+
+type Charge struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewCharge(ctx context.Context, svcCtx *svc.ServiceContext) *Charge {
+ return &Charge{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *Charge) Consume(ctx context.Context, key, val string) error {
+ logx.Infof("Charge key :%s , val :%s", key, val)
+ return nil
+}
diff --git a/apps/mqs/internal/mqs/apirequest/log.go b/apps/mqs/internal/mqs/apirequest/log.go
new file mode 100644
index 0000000..e8349eb
--- /dev/null
+++ b/apps/mqs/internal/mqs/apirequest/log.go
@@ -0,0 +1,24 @@
+package apirequest
+
+import (
+ "context"
+ "github.com/zeromicro/go-zero/core/logx"
+ "tianyuan-api/apps/mqs/internal/svc"
+)
+
+type Log struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+func NewLog(ctx context.Context, svcCtx *svc.ServiceContext) *Log {
+ return &Log{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *Log) Consume(ctx context.Context, key, val string) error {
+ logx.Infof("log key :%s , val :%s", key, val)
+ return nil
+}
diff --git a/apps/mqs/internal/mqs/mqs.go b/apps/mqs/internal/mqs/mqs.go
new file mode 100644
index 0000000..43a06c0
--- /dev/null
+++ b/apps/mqs/internal/mqs/mqs.go
@@ -0,0 +1,18 @@
+package mqs
+
+import (
+ "context"
+ "tianyuan-api/apps/mqs/internal/config"
+ "tianyuan-api/apps/mqs/internal/mqs/apirequest"
+ "tianyuan-api/apps/mqs/internal/svc"
+
+ "github.com/zeromicro/go-queue/kq"
+ "github.com/zeromicro/go-zero/core/service"
+)
+
+func Consumers(c config.Config, ctx context.Context, svcContext *svc.ServiceContext) []service.Service {
+ return []service.Service{
+ kq.MustNewQueue(c.KqConsumerLog, apirequest.NewLog(ctx, svcContext)),
+ kq.MustNewQueue(c.KqConsumerCharge, apirequest.NewCharge(ctx, svcContext)),
+ }
+}
diff --git a/apps/mqs/internal/svc/servicecontext.go b/apps/mqs/internal/svc/servicecontext.go
new file mode 100644
index 0000000..41d74c5
--- /dev/null
+++ b/apps/mqs/internal/svc/servicecontext.go
@@ -0,0 +1,13 @@
+package svc
+
+import "tianyuan-api/apps/mqs/internal/config"
+
+type ServiceContext struct {
+ Config config.Config
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+ return &ServiceContext{
+ Config: c,
+ }
+}
diff --git a/apps/mqs/main.go b/apps/mqs/main.go
new file mode 100644
index 0000000..48d576d
--- /dev/null
+++ b/apps/mqs/main.go
@@ -0,0 +1,36 @@
+package main
+
+import (
+ "context"
+ "flag"
+ "github.com/zeromicro/go-zero/core/service"
+ "tianyuan-api/apps/mqs/internal/config"
+ "tianyuan-api/apps/mqs/internal/mqs"
+ "tianyuan-api/apps/mqs/internal/svc"
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/rest"
+)
+
+var configFile = flag.String("f", "etc/mqs.yaml", "the config file")
+
+func main() {
+ flag.Parse()
+
+ var c config.Config
+ conf.MustLoad(*configFile, &c)
+
+ server := rest.MustNewServer(c.RestConf)
+ defer server.Stop()
+
+ svcCtx := svc.NewServiceContext(c)
+ ctx := context.Background()
+ serviceGroup := service.NewServiceGroup()
+ defer serviceGroup.Stop()
+
+ for _, mq := range mqs.Consumers(c, ctx, svcCtx) {
+ serviceGroup.Add(mq)
+ }
+
+ serviceGroup.Start()
+}
diff --git a/apps/sentinel/Dockerfile b/apps/sentinel/Dockerfile
new file mode 100644
index 0000000..4a680c5
--- /dev/null
+++ b/apps/sentinel/Dockerfile
@@ -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/sentinel/etc /app/etc
+RUN go build -ldflags="-s -w" -o /app/sentinel apps/sentinel/.\sentinel.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/sentinel /app/sentinel
+COPY --from=builder /app/etc /app/etc
+
+CMD ["./sentinel", "-f", "etc/sentinel.yaml"]
diff --git a/apps/sentinel/client/product/product.go b/apps/sentinel/client/product/product.go
new file mode 100644
index 0000000..29886e9
--- /dev/null
+++ b/apps/sentinel/client/product/product.go
@@ -0,0 +1,91 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package product
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ CreateProductRequest = sentinel.CreateProductRequest
+ CreateSecretRequest = sentinel.CreateSecretRequest
+ CreateUserProductRequest = sentinel.CreateUserProductRequest
+ CreateWhitelistRequest = sentinel.CreateWhitelistRequest
+ DeleteProductRequest = sentinel.DeleteProductRequest
+ DeleteSecretRequest = sentinel.DeleteSecretRequest
+ DeleteUserProductRequest = sentinel.DeleteUserProductRequest
+ DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest
+ GetRecordByIdRequest = sentinel.GetRecordByIdRequest
+ GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest
+ MatchResponse = sentinel.MatchResponse
+ MatchWhitelistByIpRequest = sentinel.MatchWhitelistByIpRequest
+ MatchingUserIdProductCodeRequest = sentinel.MatchingUserIdProductCodeRequest
+ PageListRequest = sentinel.PageListRequest
+ Product = sentinel.Product
+ ProductResponse = sentinel.ProductResponse
+ Secret = sentinel.Secret
+ SecretResponse = sentinel.SecretResponse
+ UpdateProductRequest = sentinel.UpdateProductRequest
+ UpdateSecretRequest = sentinel.UpdateSecretRequest
+ UpdateUserProductRequest = sentinel.UpdateUserProductRequest
+ UpdateWhitelistRequest = sentinel.UpdateWhitelistRequest
+ UserProductEmptyResponse = sentinel.UserProductEmptyResponse
+ UserProductItem = sentinel.UserProductItem
+ UserProductResponse = sentinel.UserProductResponse
+ UserProuctPageListRequest = sentinel.UserProuctPageListRequest
+ WhitePageListRequest = sentinel.WhitePageListRequest
+ Whitelist = sentinel.Whitelist
+ WhitelistResponse = sentinel.WhitelistResponse
+
+ ProductZrpcClient interface {
+ // Product methods
+ CreateProduct(ctx context.Context, in *CreateProductRequest, opts ...grpc.CallOption) (*Product, error)
+ UpdateProduct(ctx context.Context, in *UpdateProductRequest, opts ...grpc.CallOption) (*Product, error)
+ DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*Product, error)
+ GetProductPageList(ctx context.Context, in *PageListRequest, opts ...grpc.CallOption) (*ProductResponse, error)
+ GetProductById(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Product, error)
+ }
+
+ defaultProductZrpcClient struct {
+ cli zrpc.Client
+ }
+)
+
+func NewProductZrpcClient(cli zrpc.Client) ProductZrpcClient {
+ return &defaultProductZrpcClient{
+ cli: cli,
+ }
+}
+
+// Product methods
+func (m *defaultProductZrpcClient) CreateProduct(ctx context.Context, in *CreateProductRequest, opts ...grpc.CallOption) (*Product, error) {
+ client := sentinel.NewProductClient(m.cli.Conn())
+ return client.CreateProduct(ctx, in, opts...)
+}
+
+func (m *defaultProductZrpcClient) UpdateProduct(ctx context.Context, in *UpdateProductRequest, opts ...grpc.CallOption) (*Product, error) {
+ client := sentinel.NewProductClient(m.cli.Conn())
+ return client.UpdateProduct(ctx, in, opts...)
+}
+
+func (m *defaultProductZrpcClient) DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*Product, error) {
+ client := sentinel.NewProductClient(m.cli.Conn())
+ return client.DeleteProduct(ctx, in, opts...)
+}
+
+func (m *defaultProductZrpcClient) GetProductPageList(ctx context.Context, in *PageListRequest, opts ...grpc.CallOption) (*ProductResponse, error) {
+ client := sentinel.NewProductClient(m.cli.Conn())
+ return client.GetProductPageList(ctx, in, opts...)
+}
+
+func (m *defaultProductZrpcClient) GetProductById(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Product, error) {
+ client := sentinel.NewProductClient(m.cli.Conn())
+ return client.GetProductById(ctx, in, opts...)
+}
diff --git a/apps/sentinel/client/secret/secret.go b/apps/sentinel/client/secret/secret.go
new file mode 100644
index 0000000..4a7e943
--- /dev/null
+++ b/apps/sentinel/client/secret/secret.go
@@ -0,0 +1,79 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package secret
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ CreateProductRequest = sentinel.CreateProductRequest
+ CreateSecretRequest = sentinel.CreateSecretRequest
+ CreateUserProductRequest = sentinel.CreateUserProductRequest
+ CreateWhitelistRequest = sentinel.CreateWhitelistRequest
+ DeleteProductRequest = sentinel.DeleteProductRequest
+ DeleteSecretRequest = sentinel.DeleteSecretRequest
+ DeleteUserProductRequest = sentinel.DeleteUserProductRequest
+ DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest
+ GetRecordByIdRequest = sentinel.GetRecordByIdRequest
+ GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest
+ MatchResponse = sentinel.MatchResponse
+ MatchWhitelistByIpRequest = sentinel.MatchWhitelistByIpRequest
+ MatchingUserIdProductCodeRequest = sentinel.MatchingUserIdProductCodeRequest
+ PageListRequest = sentinel.PageListRequest
+ Product = sentinel.Product
+ ProductResponse = sentinel.ProductResponse
+ Secret = sentinel.Secret
+ SecretResponse = sentinel.SecretResponse
+ UpdateProductRequest = sentinel.UpdateProductRequest
+ UpdateSecretRequest = sentinel.UpdateSecretRequest
+ UpdateUserProductRequest = sentinel.UpdateUserProductRequest
+ UpdateWhitelistRequest = sentinel.UpdateWhitelistRequest
+ UserProductEmptyResponse = sentinel.UserProductEmptyResponse
+ UserProductItem = sentinel.UserProductItem
+ UserProductResponse = sentinel.UserProductResponse
+ UserProuctPageListRequest = sentinel.UserProuctPageListRequest
+ WhitePageListRequest = sentinel.WhitePageListRequest
+ Whitelist = sentinel.Whitelist
+ WhitelistResponse = sentinel.WhitelistResponse
+
+ SecretZrpcClient interface {
+ // Secret methods
+ CreateSecret(ctx context.Context, in *CreateSecretRequest, opts ...grpc.CallOption) (*Secret, error)
+ GetSecretByUserId(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Secret, error)
+ GetSecretBySecretId(ctx context.Context, in *GetSecretBySecretIdRequest, opts ...grpc.CallOption) (*Secret, error)
+ }
+
+ defaultSecretZrpcClient struct {
+ cli zrpc.Client
+ }
+)
+
+func NewSecretZrpcClient(cli zrpc.Client) SecretZrpcClient {
+ return &defaultSecretZrpcClient{
+ cli: cli,
+ }
+}
+
+// Secret methods
+func (m *defaultSecretZrpcClient) CreateSecret(ctx context.Context, in *CreateSecretRequest, opts ...grpc.CallOption) (*Secret, error) {
+ client := sentinel.NewSecretClient(m.cli.Conn())
+ return client.CreateSecret(ctx, in, opts...)
+}
+
+func (m *defaultSecretZrpcClient) GetSecretByUserId(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Secret, error) {
+ client := sentinel.NewSecretClient(m.cli.Conn())
+ return client.GetSecretByUserId(ctx, in, opts...)
+}
+
+func (m *defaultSecretZrpcClient) GetSecretBySecretId(ctx context.Context, in *GetSecretBySecretIdRequest, opts ...grpc.CallOption) (*Secret, error) {
+ client := sentinel.NewSecretClient(m.cli.Conn())
+ return client.GetSecretBySecretId(ctx, in, opts...)
+}
diff --git a/apps/sentinel/client/userproduct/userproduct.go b/apps/sentinel/client/userproduct/userproduct.go
new file mode 100644
index 0000000..25eec9d
--- /dev/null
+++ b/apps/sentinel/client/userproduct/userproduct.go
@@ -0,0 +1,79 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package userproduct
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ CreateProductRequest = sentinel.CreateProductRequest
+ CreateSecretRequest = sentinel.CreateSecretRequest
+ CreateUserProductRequest = sentinel.CreateUserProductRequest
+ CreateWhitelistRequest = sentinel.CreateWhitelistRequest
+ DeleteProductRequest = sentinel.DeleteProductRequest
+ DeleteSecretRequest = sentinel.DeleteSecretRequest
+ DeleteUserProductRequest = sentinel.DeleteUserProductRequest
+ DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest
+ GetRecordByIdRequest = sentinel.GetRecordByIdRequest
+ GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest
+ MatchResponse = sentinel.MatchResponse
+ MatchWhitelistByIpRequest = sentinel.MatchWhitelistByIpRequest
+ MatchingUserIdProductCodeRequest = sentinel.MatchingUserIdProductCodeRequest
+ PageListRequest = sentinel.PageListRequest
+ Product = sentinel.Product
+ ProductResponse = sentinel.ProductResponse
+ Secret = sentinel.Secret
+ SecretResponse = sentinel.SecretResponse
+ UpdateProductRequest = sentinel.UpdateProductRequest
+ UpdateSecretRequest = sentinel.UpdateSecretRequest
+ UpdateUserProductRequest = sentinel.UpdateUserProductRequest
+ UpdateWhitelistRequest = sentinel.UpdateWhitelistRequest
+ UserProductEmptyResponse = sentinel.UserProductEmptyResponse
+ UserProductItem = sentinel.UserProductItem
+ UserProductResponse = sentinel.UserProductResponse
+ UserProuctPageListRequest = sentinel.UserProuctPageListRequest
+ WhitePageListRequest = sentinel.WhitePageListRequest
+ Whitelist = sentinel.Whitelist
+ WhitelistResponse = sentinel.WhitelistResponse
+
+ UserProduct interface {
+ // UserProduct methods
+ CreateUserProduct(ctx context.Context, in *CreateUserProductRequest, opts ...grpc.CallOption) (*UserProductEmptyResponse, error)
+ GetUserProductPageList(ctx context.Context, in *UserProuctPageListRequest, opts ...grpc.CallOption) (*UserProductResponse, error)
+ MatchingUserIdProductCode(ctx context.Context, in *MatchingUserIdProductCodeRequest, opts ...grpc.CallOption) (*MatchResponse, error)
+ }
+
+ defaultUserProduct struct {
+ cli zrpc.Client
+ }
+)
+
+func NewUserProduct(cli zrpc.Client) UserProduct {
+ return &defaultUserProduct{
+ cli: cli,
+ }
+}
+
+// UserProduct methods
+func (m *defaultUserProduct) CreateUserProduct(ctx context.Context, in *CreateUserProductRequest, opts ...grpc.CallOption) (*UserProductEmptyResponse, error) {
+ client := sentinel.NewUserProductClient(m.cli.Conn())
+ return client.CreateUserProduct(ctx, in, opts...)
+}
+
+func (m *defaultUserProduct) GetUserProductPageList(ctx context.Context, in *UserProuctPageListRequest, opts ...grpc.CallOption) (*UserProductResponse, error) {
+ client := sentinel.NewUserProductClient(m.cli.Conn())
+ return client.GetUserProductPageList(ctx, in, opts...)
+}
+
+func (m *defaultUserProduct) MatchingUserIdProductCode(ctx context.Context, in *MatchingUserIdProductCodeRequest, opts ...grpc.CallOption) (*MatchResponse, error) {
+ client := sentinel.NewUserProductClient(m.cli.Conn())
+ return client.MatchingUserIdProductCode(ctx, in, opts...)
+}
diff --git a/apps/sentinel/client/whitelist/whitelist.go b/apps/sentinel/client/whitelist/whitelist.go
new file mode 100644
index 0000000..966b17f
--- /dev/null
+++ b/apps/sentinel/client/whitelist/whitelist.go
@@ -0,0 +1,91 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package whitelist
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ CreateProductRequest = sentinel.CreateProductRequest
+ CreateSecretRequest = sentinel.CreateSecretRequest
+ CreateUserProductRequest = sentinel.CreateUserProductRequest
+ CreateWhitelistRequest = sentinel.CreateWhitelistRequest
+ DeleteProductRequest = sentinel.DeleteProductRequest
+ DeleteSecretRequest = sentinel.DeleteSecretRequest
+ DeleteUserProductRequest = sentinel.DeleteUserProductRequest
+ DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest
+ GetRecordByIdRequest = sentinel.GetRecordByIdRequest
+ GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest
+ MatchResponse = sentinel.MatchResponse
+ MatchWhitelistByIpRequest = sentinel.MatchWhitelistByIpRequest
+ MatchingUserIdProductCodeRequest = sentinel.MatchingUserIdProductCodeRequest
+ PageListRequest = sentinel.PageListRequest
+ Product = sentinel.Product
+ ProductResponse = sentinel.ProductResponse
+ Secret = sentinel.Secret
+ SecretResponse = sentinel.SecretResponse
+ UpdateProductRequest = sentinel.UpdateProductRequest
+ UpdateSecretRequest = sentinel.UpdateSecretRequest
+ UpdateUserProductRequest = sentinel.UpdateUserProductRequest
+ UpdateWhitelistRequest = sentinel.UpdateWhitelistRequest
+ UserProductEmptyResponse = sentinel.UserProductEmptyResponse
+ UserProductItem = sentinel.UserProductItem
+ UserProductResponse = sentinel.UserProductResponse
+ UserProuctPageListRequest = sentinel.UserProuctPageListRequest
+ WhitePageListRequest = sentinel.WhitePageListRequest
+ Whitelist = sentinel.Whitelist
+ WhitelistResponse = sentinel.WhitelistResponse
+
+ WhitelistZrpcClient interface {
+ // Whitelist methods
+ CreateWhitelist(ctx context.Context, in *CreateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error)
+ UpdateWhitelist(ctx context.Context, in *UpdateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error)
+ DeleteWhitelist(ctx context.Context, in *DeleteWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error)
+ GetWhitePageList(ctx context.Context, in *WhitePageListRequest, opts ...grpc.CallOption) (*WhitelistResponse, error)
+ MatchWhitelistByIp(ctx context.Context, in *MatchWhitelistByIpRequest, opts ...grpc.CallOption) (*MatchResponse, error)
+ }
+
+ defaultWhitelistZrpcClient struct {
+ cli zrpc.Client
+ }
+)
+
+func NewWhitelistZrpcClient(cli zrpc.Client) WhitelistZrpcClient {
+ return &defaultWhitelistZrpcClient{
+ cli: cli,
+ }
+}
+
+// Whitelist methods
+func (m *defaultWhitelistZrpcClient) CreateWhitelist(ctx context.Context, in *CreateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error) {
+ client := sentinel.NewWhitelistClient(m.cli.Conn())
+ return client.CreateWhitelist(ctx, in, opts...)
+}
+
+func (m *defaultWhitelistZrpcClient) UpdateWhitelist(ctx context.Context, in *UpdateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error) {
+ client := sentinel.NewWhitelistClient(m.cli.Conn())
+ return client.UpdateWhitelist(ctx, in, opts...)
+}
+
+func (m *defaultWhitelistZrpcClient) DeleteWhitelist(ctx context.Context, in *DeleteWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error) {
+ client := sentinel.NewWhitelistClient(m.cli.Conn())
+ return client.DeleteWhitelist(ctx, in, opts...)
+}
+
+func (m *defaultWhitelistZrpcClient) GetWhitePageList(ctx context.Context, in *WhitePageListRequest, opts ...grpc.CallOption) (*WhitelistResponse, error) {
+ client := sentinel.NewWhitelistClient(m.cli.Conn())
+ return client.GetWhitePageList(ctx, in, opts...)
+}
+
+func (m *defaultWhitelistZrpcClient) MatchWhitelistByIp(ctx context.Context, in *MatchWhitelistByIpRequest, opts ...grpc.CallOption) (*MatchResponse, error) {
+ client := sentinel.NewWhitelistClient(m.cli.Conn())
+ return client.MatchWhitelistByIp(ctx, in, opts...)
+}
diff --git a/apps/sentinel/etc/sentinel.yaml b/apps/sentinel/etc/sentinel.yaml
new file mode 100644
index 0000000..b1ede84
--- /dev/null
+++ b/apps/sentinel/etc/sentinel.yaml
@@ -0,0 +1,11 @@
+Name: sentinel.rpc
+ListenOn: 0.0.0.0:11002
+Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: sentinel.rpc
+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" # 单节点模式
\ No newline at end of file
diff --git a/apps/sentinel/internal/config/config.go b/apps/sentinel/internal/config/config.go
new file mode 100644
index 0000000..c31c308
--- /dev/null
+++ b/apps/sentinel/internal/config/config.go
@@ -0,0 +1,12 @@
+package config
+
+import (
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/zrpc"
+)
+
+type Config struct {
+ zrpc.RpcServerConf
+ DataSource string // 数据库连接的 DSN 字符串
+ CacheRedis cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体
+}
diff --git a/apps/sentinel/internal/logic/product/createproductlogic.go b/apps/sentinel/internal/logic/product/createproductlogic.go
new file mode 100644
index 0000000..a36acbb
--- /dev/null
+++ b/apps/sentinel/internal/logic/product/createproductlogic.go
@@ -0,0 +1,42 @@
+package productlogic
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/internal/model"
+ "tianyuan-api/pkg/sqlutil"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateProductLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewCreateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateProductLogic {
+ return &CreateProductLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// Product methods
+func (l *CreateProductLogic) CreateProduct(in *sentinel.CreateProductRequest) (*sentinel.Product, error) {
+ _, err := l.svcCtx.ProductsModel.Insert(l.ctx, &model.Products{
+ ProductName: in.ProductName,
+ ProductCode: in.ProductCode,
+ ProductDescription: sqlutil.StringToNullString(in.ProductDescription),
+ ProductContent: sqlutil.StringToNullString(in.ProductContent),
+ ProductGroup: in.ProductGroup,
+ ProductPrice: in.ProductPrice,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return &sentinel.Product{}, nil
+}
diff --git a/apps/sentinel/internal/logic/product/deleteproductlogic.go b/apps/sentinel/internal/logic/product/deleteproductlogic.go
new file mode 100644
index 0000000..4c165c3
--- /dev/null
+++ b/apps/sentinel/internal/logic/product/deleteproductlogic.go
@@ -0,0 +1,30 @@
+package productlogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteProductLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewDeleteProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProductLogic {
+ return &DeleteProductLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *DeleteProductLogic) DeleteProduct(in *sentinel.DeleteProductRequest) (*sentinel.Product, error) {
+ // todo: add your logic here and delete this line
+
+ return &sentinel.Product{}, nil
+}
diff --git a/apps/sentinel/internal/logic/product/getproductbyidlogic.go b/apps/sentinel/internal/logic/product/getproductbyidlogic.go
new file mode 100644
index 0000000..f786ff3
--- /dev/null
+++ b/apps/sentinel/internal/logic/product/getproductbyidlogic.go
@@ -0,0 +1,42 @@
+package productlogic
+
+import (
+ "context"
+ "tianyuan-api/pkg/sqlutil"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetProductByIdLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetProductByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductByIdLogic {
+ return &GetProductByIdLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetProductByIdLogic) GetProductById(in *sentinel.GetRecordByIdRequest) (*sentinel.Product, error) {
+ product, err := l.svcCtx.ProductsModel.FindOne(l.ctx, in.Id)
+ if err != nil {
+ return nil, err
+ }
+
+ return &sentinel.Product{
+ Id: product.Id,
+ ProductName: product.ProductName,
+ ProductCode: product.ProductCode,
+ ProductPrice: product.ProductPrice,
+ ProductDescription: sqlutil.NullStringToString(product.ProductDescription),
+ ProductContent: sqlutil.NullStringToString(product.ProductContent),
+ ProductGroup: product.ProductGroup,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/product/getproductpagelistlogic.go b/apps/sentinel/internal/logic/product/getproductpagelistlogic.go
new file mode 100644
index 0000000..79e5050
--- /dev/null
+++ b/apps/sentinel/internal/logic/product/getproductpagelistlogic.go
@@ -0,0 +1,47 @@
+package productlogic
+
+import (
+ "context"
+ "tianyuan-api/pkg/sqlutil"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetProductPageListLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetProductPageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductPageListLogic {
+ return &GetProductPageListLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetProductPageListLogic) GetProductPageList(in *sentinel.PageListRequest) (*sentinel.ProductResponse, error) {
+ products, total, err := l.svcCtx.ProductsModel.FindProductsList(l.ctx, in.Page, in.PageSize)
+ if err != nil {
+ return nil, err
+ }
+ var list []*sentinel.Product
+ for _, p := range products {
+ list = append(list, &sentinel.Product{
+ Id: p.Id,
+ ProductName: p.ProductName,
+ ProductCode: p.ProductCode,
+ ProductDescription: sqlutil.NullStringToString(p.ProductDescription),
+ ProductGroup: p.ProductGroup,
+ ProductPrice: p.ProductPrice,
+ })
+ }
+ return &sentinel.ProductResponse{
+ Total: total,
+ Products: list,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/product/updateproductlogic.go b/apps/sentinel/internal/logic/product/updateproductlogic.go
new file mode 100644
index 0000000..311acb4
--- /dev/null
+++ b/apps/sentinel/internal/logic/product/updateproductlogic.go
@@ -0,0 +1,30 @@
+package productlogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type UpdateProductLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewUpdateProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateProductLogic {
+ return &UpdateProductLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *UpdateProductLogic) UpdateProduct(in *sentinel.UpdateProductRequest) (*sentinel.Product, error) {
+ // todo: add your logic here and delete this line
+
+ return &sentinel.Product{}, nil
+}
diff --git a/apps/sentinel/internal/logic/secret/createsecretlogic.go b/apps/sentinel/internal/logic/secret/createsecretlogic.go
new file mode 100644
index 0000000..7bd5fba
--- /dev/null
+++ b/apps/sentinel/internal/logic/secret/createsecretlogic.go
@@ -0,0 +1,46 @@
+package secretlogic
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/internal/model"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+ "tianyuan-api/pkg/crypto"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateSecretLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewCreateSecretLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateSecretLogic {
+ return &CreateSecretLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// Secret methods
+func (l *CreateSecretLogic) CreateSecret(in *sentinel.CreateSecretRequest) (*sentinel.Secret, error) {
+ secretId, err := crypto.GenerateSecretId()
+ if err != nil {
+ return nil, err
+ }
+ aesKey, err := crypto.GenerateSecretKey()
+ if err != nil {
+ return nil, err
+ }
+ _, err = l.svcCtx.SecretsModel.Insert(l.ctx, &model.Secrets{
+ UserId: in.UserId,
+ SecretId: secretId,
+ AesKey: aesKey,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return &sentinel.Secret{}, nil
+}
diff --git a/apps/sentinel/internal/logic/secret/getsecretbysecretidlogic.go b/apps/sentinel/internal/logic/secret/getsecretbysecretidlogic.go
new file mode 100644
index 0000000..a977813
--- /dev/null
+++ b/apps/sentinel/internal/logic/secret/getsecretbysecretidlogic.go
@@ -0,0 +1,43 @@
+package secretlogic
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/internal/model"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetSecretBySecretIdLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetSecretBySecretIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSecretBySecretIdLogic {
+ return &GetSecretBySecretIdLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetSecretBySecretIdLogic) GetSecretBySecretId(in *sentinel.GetSecretBySecretIdRequest) (*sentinel.Secret, error) {
+ secret, err := l.svcCtx.SecretsModel.FindOneBySecretId(l.ctx, in.SecretId)
+ if err != nil {
+ if errors.Is(err, model.ErrNotFound) {
+ return nil, nil
+ } else {
+ return nil, err
+
+ }
+ }
+ return &sentinel.Secret{
+ Id: secret.Id,
+ UserId: secret.UserId,
+ SecretId: secret.SecretId,
+ AesKey: secret.AesKey,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/secret/getsecretbyuseridlogic.go b/apps/sentinel/internal/logic/secret/getsecretbyuseridlogic.go
new file mode 100644
index 0000000..5625799
--- /dev/null
+++ b/apps/sentinel/internal/logic/secret/getsecretbyuseridlogic.go
@@ -0,0 +1,40 @@
+package secretlogic
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/internal/model"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetSecretByUserIdLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetSecretByUserIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSecretByUserIdLogic {
+ return &GetSecretByUserIdLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetSecretByUserIdLogic) GetSecretByUserId(in *sentinel.GetRecordByIdRequest) (*sentinel.Secret, error) {
+ secretModel, err := l.svcCtx.SecretsModel.FindOneByUserId(l.ctx, in.Id)
+ if err != nil {
+ if err == model.ErrNotFound {
+ return nil, errors.New("请先进行企业认证")
+ }
+ return nil, err
+ }
+
+ return &sentinel.Secret{
+ SecretId: secretModel.SecretId,
+ AesKey: secretModel.AesKey,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/userproduct/createuserproductlogic.go b/apps/sentinel/internal/logic/userproduct/createuserproductlogic.go
new file mode 100644
index 0000000..3520fcc
--- /dev/null
+++ b/apps/sentinel/internal/logic/userproduct/createuserproductlogic.go
@@ -0,0 +1,54 @@
+package userproductlogic
+
+import (
+ "context"
+ "errors"
+ "tianyuan-api/apps/sentinel/internal/model"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateUserProductLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewCreateUserProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserProductLogic {
+ return &CreateUserProductLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// UserProduct methods
+func (l *CreateUserProductLogic) CreateUserProduct(in *sentinel.CreateUserProductRequest) (*sentinel.UserProductEmptyResponse, error) {
+ isExist, err := l.IsUserProductAssociated(l.ctx, in.UserId, in.ProductId)
+ if err != nil {
+ return nil, err
+ }
+ if isExist {
+ return nil, errors.New("该产品已定阅读,无法重复订阅")
+ }
+ _, err = l.svcCtx.UserProductsModel.Insert(l.ctx, &model.UserProducts{UserId: in.UserId, ProductId: in.ProductId})
+ if err != nil {
+ return nil, err
+ }
+
+ return &sentinel.UserProductEmptyResponse{}, nil
+}
+func (l *CreateUserProductLogic) IsUserProductAssociated(ctx context.Context, userId, productId int64) (bool, error) {
+ _, err := l.svcCtx.UserProductsModel.FindOneUserProduct(ctx, userId, productId)
+ if err != nil {
+ if err == model.ErrNotFound {
+ return false, nil
+ }
+ return false, err
+ }
+
+ return true, nil
+}
diff --git a/apps/sentinel/internal/logic/userproduct/getuserproductpagelistlogic.go b/apps/sentinel/internal/logic/userproduct/getuserproductpagelistlogic.go
new file mode 100644
index 0000000..b1bd290
--- /dev/null
+++ b/apps/sentinel/internal/logic/userproduct/getuserproductpagelistlogic.go
@@ -0,0 +1,52 @@
+package userproductlogic
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/client/product"
+ "tianyuan-api/pkg/sqlutil"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetUserProductPageListLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetUserProductPageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserProductPageListLogic {
+ return &GetUserProductPageListLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetUserProductPageListLogic) GetUserProductPageList(in *sentinel.UserProuctPageListRequest) (*sentinel.UserProductResponse, error) {
+ list, total, err := l.svcCtx.UserProductsModel.FindUserProductsList(l.ctx, in.UserId, in.Page, in.PageSize)
+ if err != nil {
+ return nil, err
+ }
+
+ var userProducts []*product.UserProductItem
+ for _, up := range list {
+ userProducts = append(userProducts, &product.UserProductItem{
+ Id: up.Id,
+ ProductId: up.ProductId,
+ ProductName: up.ProductName,
+ ProductPrice: up.ProductPrice,
+ ProductGroup: up.ProductGroup,
+ ProductDescription: sqlutil.NullStringToString(up.ProductDescription),
+ ProductCode: up.ProductCode,
+ CreatedAt: up.CreatedAt.Format("2006-01-02 15:04:05"),
+ UpdatedAt: up.UpdatedAt.Format("2006-01-02 15:04:05"),
+ })
+ }
+ return &sentinel.UserProductResponse{
+ Total: total,
+ UserProducts: userProducts,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/userproduct/matchinguseridproductcodelogic.go b/apps/sentinel/internal/logic/userproduct/matchinguseridproductcodelogic.go
new file mode 100644
index 0000000..257834a
--- /dev/null
+++ b/apps/sentinel/internal/logic/userproduct/matchinguseridproductcodelogic.go
@@ -0,0 +1,35 @@
+package userproductlogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type MatchingUserIdProductCodeLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewMatchingUserIdProductCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MatchingUserIdProductCodeLogic {
+ return &MatchingUserIdProductCodeLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *MatchingUserIdProductCodeLogic) MatchingUserIdProductCode(in *sentinel.MatchingUserIdProductCodeRequest) (*sentinel.MatchResponse, error) {
+ match, err := l.svcCtx.UserProductsModel.FindMatchUserProductCode(l.ctx, in.Id, in.ProductCode)
+ if err != nil {
+ return nil, err
+ }
+
+ return &sentinel.MatchResponse{
+ Match: match,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/whitelist/createwhitelistlogic.go b/apps/sentinel/internal/logic/whitelist/createwhitelistlogic.go
new file mode 100644
index 0000000..fa62c69
--- /dev/null
+++ b/apps/sentinel/internal/logic/whitelist/createwhitelistlogic.go
@@ -0,0 +1,38 @@
+package whitelistlogic
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/internal/model"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateWhitelistLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewCreateWhitelistLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateWhitelistLogic {
+ return &CreateWhitelistLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// Whitelist methods
+func (l *CreateWhitelistLogic) CreateWhitelist(in *sentinel.CreateWhitelistRequest) (*sentinel.Whitelist, error) {
+ white := model.Whitelist{
+ UserId: in.UserId,
+ WhitelistIp: in.WhitelistIp,
+ }
+ _, err := l.svcCtx.WhitelistModel.Insert(l.ctx, &white)
+ if err != nil {
+ return nil, err
+ }
+
+ return &sentinel.Whitelist{}, nil
+}
diff --git a/apps/sentinel/internal/logic/whitelist/deletewhitelistlogic.go b/apps/sentinel/internal/logic/whitelist/deletewhitelistlogic.go
new file mode 100644
index 0000000..ba17d45
--- /dev/null
+++ b/apps/sentinel/internal/logic/whitelist/deletewhitelistlogic.go
@@ -0,0 +1,33 @@
+package whitelistlogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteWhitelistLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewDeleteWhitelistLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteWhitelistLogic {
+ return &DeleteWhitelistLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *DeleteWhitelistLogic) DeleteWhitelist(in *sentinel.DeleteWhitelistRequest) (*sentinel.Whitelist, error) {
+ err := l.svcCtx.WhitelistModel.Delete(l.ctx, in.Id)
+ if err != nil {
+ return nil, err
+ }
+
+ return &sentinel.Whitelist{}, nil
+}
diff --git a/apps/sentinel/internal/logic/whitelist/getwhitepagelistlogic.go b/apps/sentinel/internal/logic/whitelist/getwhitepagelistlogic.go
new file mode 100644
index 0000000..35a369d
--- /dev/null
+++ b/apps/sentinel/internal/logic/whitelist/getwhitepagelistlogic.go
@@ -0,0 +1,44 @@
+package whitelistlogic
+
+import (
+ "context"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetWhitePageListLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetWhitePageListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWhitePageListLogic {
+ return &GetWhitePageListLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetWhitePageListLogic) GetWhitePageList(in *sentinel.WhitePageListRequest) (*sentinel.WhitelistResponse, error) {
+ whitelists, total, err := l.svcCtx.WhitelistModel.FindWhitelistList(l.ctx, in.UserId, in.Page, in.PageSize)
+ if err != nil {
+ return nil, err
+ }
+ var list []*sentinel.Whitelist
+ for _, w := range whitelists {
+ list = append(list, &sentinel.Whitelist{
+ Id: w.Id,
+ UserId: w.UserId,
+ WhitelistIp: w.WhitelistIp,
+ CreatedAt: w.CreatedAt.Format("2006-01-02 15:04:05"),
+ UpdatedAt: w.UpdatedAt.Format("2006-01-02 15:04:05"),
+ })
+ }
+ return &sentinel.WhitelistResponse{
+ Total: total,
+ Whitelists: list,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/whitelist/matchwhitelistbyiplogic.go b/apps/sentinel/internal/logic/whitelist/matchwhitelistbyiplogic.go
new file mode 100644
index 0000000..b8505ac
--- /dev/null
+++ b/apps/sentinel/internal/logic/whitelist/matchwhitelistbyiplogic.go
@@ -0,0 +1,35 @@
+package whitelistlogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type MatchWhitelistByIpLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewMatchWhitelistByIpLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MatchWhitelistByIpLogic {
+ return &MatchWhitelistByIpLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *MatchWhitelistByIpLogic) MatchWhitelistByIp(in *sentinel.MatchWhitelistByIpRequest) (*sentinel.MatchResponse, error) {
+ isMatch, err := l.svcCtx.WhitelistModel.IsIpInWhitelist(l.ctx, in.Ip)
+ if err != nil {
+ return nil, err
+ }
+
+ return &sentinel.MatchResponse{
+ Match: isMatch,
+ }, nil
+}
diff --git a/apps/sentinel/internal/logic/whitelist/updatewhitelistlogic.go b/apps/sentinel/internal/logic/whitelist/updatewhitelistlogic.go
new file mode 100644
index 0000000..dc952fd
--- /dev/null
+++ b/apps/sentinel/internal/logic/whitelist/updatewhitelistlogic.go
@@ -0,0 +1,30 @@
+package whitelistlogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type UpdateWhitelistLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewUpdateWhitelistLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateWhitelistLogic {
+ return &UpdateWhitelistLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *UpdateWhitelistLogic) UpdateWhitelist(in *sentinel.UpdateWhitelistRequest) (*sentinel.Whitelist, error) {
+ // todo: add your logic here and delete this line
+
+ return &sentinel.Whitelist{}, nil
+}
diff --git a/apps/sentinel/internal/model/productsmodel.go b/apps/sentinel/internal/model/productsmodel.go
new file mode 100644
index 0000000..221bd0c
--- /dev/null
+++ b/apps/sentinel/internal/model/productsmodel.go
@@ -0,0 +1,53 @@
+package model
+
+import (
+ "context"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+ "strings"
+)
+
+var _ ProductsModel = (*customProductsModel)(nil)
+var productsRowsWithoutContent = strings.Join(stringx.Remove(productsFieldNames, "`ProductContent`"), ",")
+
+type (
+ // ProductsModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customProductsModel.
+ ProductsModel interface {
+ productsModel
+ FindProductsList(ctx context.Context, page, pageSize int64) ([]*Products, int64, error)
+ }
+
+ customProductsModel struct {
+ *defaultProductsModel
+ }
+)
+
+// NewProductsModel returns a model for the database table.
+func NewProductsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) ProductsModel {
+ return &customProductsModel{
+ defaultProductsModel: newProductsModel(conn, c, opts...),
+ }
+}
+func (m *defaultProductsModel) FindProductsList(ctx context.Context, page, pageSize int64) ([]*Products, int64, error) {
+ offset := (page - 1) * pageSize
+ var products []*Products
+
+ query := fmt.Sprintf("SELECT %s FROM %s ORDER BY created_at DESC LIMIT ?,?", productsRowsWithoutContent, m.table)
+ err := m.QueryRowsNoCacheCtx(ctx, &products, query, offset, pageSize)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ // 查询总数量
+ var total int64
+ countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s", m.table)
+ err = m.QueryRowNoCacheCtx(ctx, &total, countQuery)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ return products, total, nil
+}
diff --git a/apps/sentinel/internal/model/productsmodel_gen.go b/apps/sentinel/internal/model/productsmodel_gen.go
new file mode 100644
index 0000000..b91510b
--- /dev/null
+++ b/apps/sentinel/internal/model/productsmodel_gen.go
@@ -0,0 +1,153 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ productsFieldNames = builder.RawFieldNames(&Products{})
+ productsRows = strings.Join(productsFieldNames, ",")
+ productsRowsExpectAutoSet = strings.Join(stringx.Remove(productsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ productsRowsWithPlaceHolder = strings.Join(stringx.Remove(productsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheProductsIdPrefix = "cache:products:id:"
+ cacheProductsProductCodePrefix = "cache:products:productCode:"
+)
+
+type (
+ productsModel interface {
+ Insert(ctx context.Context, data *Products) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*Products, error)
+ FindOneByProductCode(ctx context.Context, productCode string) (*Products, error)
+ Update(ctx context.Context, data *Products) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultProductsModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ Products struct {
+ Id int64 `db:"id"` // 产品ID
+ ProductName string `db:"product_name"` // 产品名称
+ ProductCode string `db:"product_code"` // 产品编号
+ ProductDescription sql.NullString `db:"product_description"` // 产品简介
+ ProductContent sql.NullString `db:"product_content"` // 产品内容
+ ProductGroup string `db:"product_group"` // 产品分类
+ ProductPrice float64 `db:"product_price"` // 产品价格
+ CreatedAt time.Time `db:"created_at"` // 创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 更新时间
+ }
+)
+
+func newProductsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultProductsModel {
+ return &defaultProductsModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`products`",
+ }
+}
+
+func (m *defaultProductsModel) Delete(ctx context.Context, id int64) error {
+ data, err := m.FindOne(ctx, id)
+ if err != nil {
+ return err
+ }
+
+ productsIdKey := fmt.Sprintf("%s%v", cacheProductsIdPrefix, id)
+ productsProductCodeKey := fmt.Sprintf("%s%v", cacheProductsProductCodePrefix, data.ProductCode)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, productsIdKey, productsProductCodeKey)
+ return err
+}
+
+func (m *defaultProductsModel) FindOne(ctx context.Context, id int64) (*Products, error) {
+ productsIdKey := fmt.Sprintf("%s%v", cacheProductsIdPrefix, id)
+ var resp Products
+ err := m.QueryRowCtx(ctx, &resp, productsIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", productsRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultProductsModel) FindOneByProductCode(ctx context.Context, productCode string) (*Products, error) {
+ productsProductCodeKey := fmt.Sprintf("%s%v", cacheProductsProductCodePrefix, productCode)
+ var resp Products
+ err := m.QueryRowIndexCtx(ctx, &resp, productsProductCodeKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `product_code` = ? limit 1", productsRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, productCode); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultProductsModel) Insert(ctx context.Context, data *Products) (sql.Result, error) {
+ productsIdKey := fmt.Sprintf("%s%v", cacheProductsIdPrefix, data.Id)
+ productsProductCodeKey := fmt.Sprintf("%s%v", cacheProductsProductCodePrefix, data.ProductCode)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?)", m.table, productsRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.ProductName, data.ProductCode, data.ProductDescription, data.ProductContent, data.ProductGroup, data.ProductPrice)
+ }, productsIdKey, productsProductCodeKey)
+ return ret, err
+}
+
+func (m *defaultProductsModel) Update(ctx context.Context, newData *Products) error {
+ data, err := m.FindOne(ctx, newData.Id)
+ if err != nil {
+ return err
+ }
+
+ productsIdKey := fmt.Sprintf("%s%v", cacheProductsIdPrefix, data.Id)
+ productsProductCodeKey := fmt.Sprintf("%s%v", cacheProductsProductCodePrefix, data.ProductCode)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, productsRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, newData.ProductName, newData.ProductCode, newData.ProductDescription, newData.ProductContent, newData.ProductGroup, newData.ProductPrice, newData.Id)
+ }, productsIdKey, productsProductCodeKey)
+ return err
+}
+
+func (m *defaultProductsModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheProductsIdPrefix, primary)
+}
+
+func (m *defaultProductsModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", productsRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultProductsModel) tableName() string {
+ return m.table
+}
diff --git a/apps/sentinel/internal/model/secretsmodel.go b/apps/sentinel/internal/model/secretsmodel.go
new file mode 100644
index 0000000..af864c7
--- /dev/null
+++ b/apps/sentinel/internal/model/secretsmodel.go
@@ -0,0 +1,27 @@
+package model
+
+import (
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+)
+
+var _ SecretsModel = (*customSecretsModel)(nil)
+
+type (
+ // SecretsModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customSecretsModel.
+ SecretsModel interface {
+ secretsModel
+ }
+
+ customSecretsModel struct {
+ *defaultSecretsModel
+ }
+)
+
+// NewSecretsModel returns a model for the database table.
+func NewSecretsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) SecretsModel {
+ return &customSecretsModel{
+ defaultSecretsModel: newSecretsModel(conn, c, opts...),
+ }
+}
diff --git a/apps/sentinel/internal/model/secretsmodel_gen.go b/apps/sentinel/internal/model/secretsmodel_gen.go
new file mode 100644
index 0000000..63c889e
--- /dev/null
+++ b/apps/sentinel/internal/model/secretsmodel_gen.go
@@ -0,0 +1,175 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ secretsFieldNames = builder.RawFieldNames(&Secrets{})
+ secretsRows = strings.Join(secretsFieldNames, ",")
+ secretsRowsExpectAutoSet = strings.Join(stringx.Remove(secretsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ secretsRowsWithPlaceHolder = strings.Join(stringx.Remove(secretsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheSecretsIdPrefix = "cache:secrets:id:"
+ cacheSecretsSecretIdPrefix = "cache:secrets:secretId:"
+ cacheSecretsUserIdPrefix = "cache:secrets:userId:"
+)
+
+type (
+ secretsModel interface {
+ Insert(ctx context.Context, data *Secrets) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*Secrets, error)
+ FindOneBySecretId(ctx context.Context, secretId string) (*Secrets, error)
+ FindOneByUserId(ctx context.Context, userId int64) (*Secrets, error)
+ Update(ctx context.Context, data *Secrets) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultSecretsModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ Secrets struct {
+ Id int64 `db:"id"` // 密钥ID
+ UserId int64 `db:"user_id"` // 用户ID
+ SecretId string `db:"secret_id"` // 密钥ID
+ AesKey string `db:"aes_key"` // AES 128位密钥
+ CreatedAt time.Time `db:"created_at"` // 创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 更新时间
+ }
+)
+
+func newSecretsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultSecretsModel {
+ return &defaultSecretsModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`secrets`",
+ }
+}
+
+func (m *defaultSecretsModel) Delete(ctx context.Context, id int64) error {
+ data, err := m.FindOne(ctx, id)
+ if err != nil {
+ return err
+ }
+
+ secretsIdKey := fmt.Sprintf("%s%v", cacheSecretsIdPrefix, id)
+ secretsSecretIdKey := fmt.Sprintf("%s%v", cacheSecretsSecretIdPrefix, data.SecretId)
+ secretsUserIdKey := fmt.Sprintf("%s%v", cacheSecretsUserIdPrefix, data.UserId)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, secretsIdKey, secretsSecretIdKey, secretsUserIdKey)
+ return err
+}
+
+func (m *defaultSecretsModel) FindOne(ctx context.Context, id int64) (*Secrets, error) {
+ secretsIdKey := fmt.Sprintf("%s%v", cacheSecretsIdPrefix, id)
+ var resp Secrets
+ err := m.QueryRowCtx(ctx, &resp, secretsIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", secretsRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultSecretsModel) FindOneBySecretId(ctx context.Context, secretId string) (*Secrets, error) {
+ secretsSecretIdKey := fmt.Sprintf("%s%v", cacheSecretsSecretIdPrefix, secretId)
+ var resp Secrets
+ err := m.QueryRowIndexCtx(ctx, &resp, secretsSecretIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `secret_id` = ? limit 1", secretsRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, secretId); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultSecretsModel) FindOneByUserId(ctx context.Context, userId int64) (*Secrets, error) {
+ secretsUserIdKey := fmt.Sprintf("%s%v", cacheSecretsUserIdPrefix, userId)
+ var resp Secrets
+ err := m.QueryRowIndexCtx(ctx, &resp, secretsUserIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `user_id` = ? limit 1", secretsRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, userId); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultSecretsModel) Insert(ctx context.Context, data *Secrets) (sql.Result, error) {
+ secretsIdKey := fmt.Sprintf("%s%v", cacheSecretsIdPrefix, data.Id)
+ secretsSecretIdKey := fmt.Sprintf("%s%v", cacheSecretsSecretIdPrefix, data.SecretId)
+ secretsUserIdKey := fmt.Sprintf("%s%v", cacheSecretsUserIdPrefix, data.UserId)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?)", m.table, secretsRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.UserId, data.SecretId, data.AesKey)
+ }, secretsIdKey, secretsSecretIdKey, secretsUserIdKey)
+ return ret, err
+}
+
+func (m *defaultSecretsModel) Update(ctx context.Context, newData *Secrets) error {
+ data, err := m.FindOne(ctx, newData.Id)
+ if err != nil {
+ return err
+ }
+
+ secretsIdKey := fmt.Sprintf("%s%v", cacheSecretsIdPrefix, data.Id)
+ secretsSecretIdKey := fmt.Sprintf("%s%v", cacheSecretsSecretIdPrefix, data.SecretId)
+ secretsUserIdKey := fmt.Sprintf("%s%v", cacheSecretsUserIdPrefix, data.UserId)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, secretsRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, newData.UserId, newData.SecretId, newData.AesKey, newData.Id)
+ }, secretsIdKey, secretsSecretIdKey, secretsUserIdKey)
+ return err
+}
+
+func (m *defaultSecretsModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheSecretsIdPrefix, primary)
+}
+
+func (m *defaultSecretsModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", secretsRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultSecretsModel) tableName() string {
+ return m.table
+}
diff --git a/apps/sentinel/internal/model/userproductsmodel.go b/apps/sentinel/internal/model/userproductsmodel.go
new file mode 100644
index 0000000..137b455
--- /dev/null
+++ b/apps/sentinel/internal/model/userproductsmodel.go
@@ -0,0 +1,154 @@
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "time"
+)
+
+var _ UserProductsModel = (*customUserProductsModel)(nil)
+
+type UserProductItem struct {
+ Id int64 `db:"id"`
+ UserId int64 `db:"user_id"`
+ ProductId int64 `db:"product_id"`
+ ProductName string `db:"product_name"`
+ ProductCode string `db:"product_code"`
+ ProductDescription sql.NullString `db:"product_description"`
+ ProductGroup string `db:"product_group"`
+ ProductPrice float64 `db:"product_price"`
+ CreatedAt time.Time `db:"created_at"`
+ UpdatedAt time.Time `db:"updated_at"`
+}
+type (
+ // UserProductsModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customUserProductsModel.
+ UserProductsModel interface {
+ userProductsModel
+ FindUserProductsList(ctx context.Context, userId, page, pageSize int64) ([]*UserProductItem, int64, error)
+ FindOneUserProduct(ctx context.Context, userId, productId int64) (*UserProducts, error)
+ FindMatchUserProductCode(ctx context.Context, userId int64, productCode string) (bool, error)
+ }
+
+ customUserProductsModel struct {
+ *defaultUserProductsModel
+ rds *redis.Redis
+ }
+)
+
+// NewUserProductsModel returns a model for the database table.
+func NewUserProductsModel(rds *redis.Redis, conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) UserProductsModel {
+ return &customUserProductsModel{
+ rds: rds,
+ defaultUserProductsModel: newUserProductsModel(conn, c, opts...),
+ }
+}
+func (m *defaultUserProductsModel) FindUserProductsList(ctx context.Context, userId, page, pageSize int64) ([]*UserProductItem, int64, error) {
+ offset := (page - 1) * pageSize
+ var userProducts []*UserProductItem
+ // SQL查询语句,手动选择需要的products字段
+ query := `
+ SELECT
+ up.id AS user_product_id,
+ up.user_id,
+ p.id AS product_id,
+ p.product_name,
+ p.product_code,
+ COALESCE(p.product_description, '') AS product_description,
+ p.product_group,
+ p.product_price,
+ up.created_at,
+ up.updated_at
+ FROM user_products up
+ JOIN products p ON up.product_id = p.id
+ WHERE up.user_id = ?
+ ORDER BY up.created_at DESC
+ LIMIT ?, ?`
+
+ // 执行查询
+ err := m.QueryRowsNoCacheCtx(ctx, &userProducts, query, userId, offset, pageSize)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ // 查询总数量
+ var total int64
+ countQuery := "SELECT COUNT(*) FROM user_products WHERE user_id = ?"
+ err = m.QueryRowNoCacheCtx(ctx, &total, countQuery, userId)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ return userProducts, total, nil
+}
+func (m *customUserProductsModel) FindOneUserProduct(ctx context.Context, userId, productId int64) (*UserProducts, error) {
+ // 定义 Redis 缓存 Set 键
+ redisKey := fmt.Sprintf("user_products:%d", userId)
+
+ // 检查 Redis Set 中是否存在用户与产品的关联
+ isMember, err := m.rds.SismemberCtx(ctx, redisKey, productId)
+ if err == nil && isMember {
+ // 如果 Redis Set 中存在,返回空,因为不需要重复查询
+ return nil, nil
+ }
+
+ var userProduct UserProducts
+ query := fmt.Sprintf("SELECT %s FROM %s WHERE `user_id` = ? AND `product_id` = ? LIMIT 1", userProductsRows, m.table)
+ err = m.QueryRowNoCacheCtx(ctx, &userProduct, query, userId, productId)
+ switch err {
+ case nil:
+ // 将用户产品的关联写入 Redis Set
+ _, err = m.rds.SaddCtx(ctx, redisKey, productId)
+ if err != nil {
+ return nil, err
+ }
+ return &userProduct, nil
+ case sqlc.ErrNotFound:
+ // 返回未找到的错误
+ return nil, ErrNotFound
+ default:
+ // 其他错误
+ return nil, err
+ }
+}
+func (m *customUserProductsModel) FindMatchUserProductCode(ctx context.Context, userId int64, productCode string) (bool, error) {
+ // 定义 Redis 缓存 Set 键
+ redisKey := fmt.Sprintf("user_products:%d", userId)
+
+ // 1. 检查 Redis Set 中是否存在用户与产品的关联
+ isMember, err := m.rds.SismemberCtx(ctx, redisKey, productCode)
+ if err == nil && isMember {
+ // 如果 Redis Set 中存在,表示关联已存在,返回 true
+ return true, nil
+ }
+
+ // 2. 如果 Redis 中没有匹配,则查询数据库
+ query := `
+ SELECT COUNT(*)
+ FROM user_products up
+ JOIN products p ON up.product_id = p.id
+ WHERE up.user_id = ? AND p.product_code = ?`
+ var count int
+ err = m.QueryRowNoCacheCtx(ctx, &count, query, userId, productCode)
+ if err != nil {
+ // 如果数据库查询出错,返回错误
+ return false, err
+ }
+
+ // 3. 如果数据库查询成功且有记录,更新 Redis Set 并返回 true
+ if count > 0 {
+ _, redisErr := m.rds.SaddCtx(ctx, redisKey, productCode)
+ if redisErr != nil {
+ return false, redisErr // Redis 更新失败
+ }
+ return true, nil
+ }
+
+ // 4. 如果没有找到匹配的关联,返回 false
+ return false, nil
+}
diff --git a/apps/sentinel/internal/model/userproductsmodel_gen.go b/apps/sentinel/internal/model/userproductsmodel_gen.go
new file mode 100644
index 0000000..67cf9f7
--- /dev/null
+++ b/apps/sentinel/internal/model/userproductsmodel_gen.go
@@ -0,0 +1,114 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ userProductsFieldNames = builder.RawFieldNames(&UserProducts{})
+ userProductsRows = strings.Join(userProductsFieldNames, ",")
+ userProductsRowsExpectAutoSet = strings.Join(stringx.Remove(userProductsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ userProductsRowsWithPlaceHolder = strings.Join(stringx.Remove(userProductsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheUserProductsIdPrefix = "cache:userProducts:id:"
+)
+
+type (
+ userProductsModel interface {
+ Insert(ctx context.Context, data *UserProducts) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*UserProducts, error)
+ Update(ctx context.Context, data *UserProducts) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultUserProductsModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ UserProducts struct {
+ Id int64 `db:"id"` // 用户产品ID
+ UserId int64 `db:"user_id"` // 用户ID
+ ProductId int64 `db:"product_id"` // 产品ID
+ CreatedAt time.Time `db:"created_at"` // 创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 更新时间
+ }
+)
+
+func newUserProductsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultUserProductsModel {
+ return &defaultUserProductsModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`user_products`",
+ }
+}
+
+func (m *defaultUserProductsModel) Delete(ctx context.Context, id int64) error {
+ userProductsIdKey := fmt.Sprintf("%s%v", cacheUserProductsIdPrefix, id)
+ _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, userProductsIdKey)
+ return err
+}
+
+func (m *defaultUserProductsModel) FindOne(ctx context.Context, id int64) (*UserProducts, error) {
+ userProductsIdKey := fmt.Sprintf("%s%v", cacheUserProductsIdPrefix, id)
+ var resp UserProducts
+ err := m.QueryRowCtx(ctx, &resp, userProductsIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", userProductsRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultUserProductsModel) Insert(ctx context.Context, data *UserProducts) (sql.Result, error) {
+ userProductsIdKey := fmt.Sprintf("%s%v", cacheUserProductsIdPrefix, data.Id)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?)", m.table, userProductsRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.UserId, data.ProductId)
+ }, userProductsIdKey)
+ return ret, err
+}
+
+func (m *defaultUserProductsModel) Update(ctx context.Context, data *UserProducts) error {
+ userProductsIdKey := fmt.Sprintf("%s%v", cacheUserProductsIdPrefix, data.Id)
+ _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, userProductsRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, data.UserId, data.ProductId, data.Id)
+ }, userProductsIdKey)
+ return err
+}
+
+func (m *defaultUserProductsModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheUserProductsIdPrefix, primary)
+}
+
+func (m *defaultUserProductsModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", userProductsRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultUserProductsModel) tableName() string {
+ return m.table
+}
diff --git a/apps/sentinel/internal/model/vars.go b/apps/sentinel/internal/model/vars.go
new file mode 100644
index 0000000..69ca814
--- /dev/null
+++ b/apps/sentinel/internal/model/vars.go
@@ -0,0 +1,5 @@
+package model
+
+import "github.com/zeromicro/go-zero/core/stores/sqlx"
+
+var ErrNotFound = sqlx.ErrNotFound
diff --git a/apps/sentinel/internal/model/whitelistmodel.go b/apps/sentinel/internal/model/whitelistmodel.go
new file mode 100644
index 0000000..8d1400e
--- /dev/null
+++ b/apps/sentinel/internal/model/whitelistmodel.go
@@ -0,0 +1,87 @@
+package model
+
+import (
+ "context"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+)
+
+var _ WhitelistModel = (*customWhitelistModel)(nil)
+
+type (
+ // WhitelistModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customWhitelistModel.
+ WhitelistModel interface {
+ whitelistModel
+ IsIpInWhitelist(ctx context.Context, ip string) (bool, error)
+ FindWhitelistList(ctx context.Context, userId, page, pageSize int64) ([]*Whitelist, int64, error)
+ }
+
+ customWhitelistModel struct {
+ *defaultWhitelistModel
+ rds *redis.Redis
+ }
+)
+
+// NewWhitelistModel returns a model for the database table.
+func NewWhitelistModel(rds *redis.Redis, conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) WhitelistModel {
+ return &customWhitelistModel{
+ rds: rds,
+ defaultWhitelistModel: newWhitelistModel(conn, c, opts...),
+ }
+}
+
+func (m *customWhitelistModel) IsIpInWhitelist(ctx context.Context, ip string) (bool, error) {
+ // 定义 Redis 缓存 Set 键,存储所有白名单 IP
+ redisKey := "whitelist_ips"
+
+ // 1. 检查 Redis Set 中是否有这个 IP
+ isMember, err := m.rds.SismemberCtx(ctx, redisKey, ip)
+ if err == nil && isMember {
+ // 如果 Redis Set 中存在,表示 IP 已在白名单中
+ return true, nil
+ }
+
+ // 2. 如果 Redis 中没有匹配,查询数据库
+ query := `SELECT whitelist_ip FROM whitelist WHERE whitelist_ip = ? LIMIT 1`
+ var dbIp string
+ err = m.QueryRowNoCacheCtx(ctx, &dbIp, query, ip)
+ if err != nil {
+ // 如果数据库查询出错,返回错误
+ if err == sqlc.ErrNotFound {
+ return false, nil // 如果没有找到,返回 false
+ }
+ return false, err
+ }
+
+ // 3. 如果数据库查询成功,写入 Redis Set,并返回 true
+ _, redisErr := m.rds.SaddCtx(ctx, redisKey, ip)
+ if redisErr != nil {
+ return false, redisErr // Redis 更新失败
+ }
+
+ return true, nil
+}
+func (m *customWhitelistModel) FindWhitelistList(ctx context.Context, userId, page, pageSize int64) ([]*Whitelist, int64, error) {
+ offset := (page - 1) * pageSize
+ var whitelist []*Whitelist
+
+ query := fmt.Sprintf("SELECT %s FROM %s WHERE user_id = ? ORDER BY created_at DESC LIMIT ?,?", whitelistRows, m.table)
+ err := m.QueryRowsNoCacheCtx(ctx, &whitelist, query, userId, offset, pageSize)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ // 查询总数量
+ var total int64
+ countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s", m.table)
+ err = m.QueryRowNoCacheCtx(ctx, &total, countQuery)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ return whitelist, total, nil
+}
diff --git a/apps/sentinel/internal/model/whitelistmodel_gen.go b/apps/sentinel/internal/model/whitelistmodel_gen.go
new file mode 100644
index 0000000..a5387ca
--- /dev/null
+++ b/apps/sentinel/internal/model/whitelistmodel_gen.go
@@ -0,0 +1,114 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ whitelistFieldNames = builder.RawFieldNames(&Whitelist{})
+ whitelistRows = strings.Join(whitelistFieldNames, ",")
+ whitelistRowsExpectAutoSet = strings.Join(stringx.Remove(whitelistFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ whitelistRowsWithPlaceHolder = strings.Join(stringx.Remove(whitelistFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheWhitelistIdPrefix = "cache:whitelist:id:"
+)
+
+type (
+ whitelistModel interface {
+ Insert(ctx context.Context, data *Whitelist) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*Whitelist, error)
+ Update(ctx context.Context, data *Whitelist) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultWhitelistModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ Whitelist struct {
+ Id int64 `db:"id"` // 白名单ID
+ UserId int64 `db:"user_id"` // 用户ID
+ WhitelistIp string `db:"whitelist_ip"` // 白名单IP
+ CreatedAt time.Time `db:"created_at"` // 创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 更新时间
+ }
+)
+
+func newWhitelistModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultWhitelistModel {
+ return &defaultWhitelistModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`whitelist`",
+ }
+}
+
+func (m *defaultWhitelistModel) Delete(ctx context.Context, id int64) error {
+ whitelistIdKey := fmt.Sprintf("%s%v", cacheWhitelistIdPrefix, id)
+ _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, whitelistIdKey)
+ return err
+}
+
+func (m *defaultWhitelistModel) FindOne(ctx context.Context, id int64) (*Whitelist, error) {
+ whitelistIdKey := fmt.Sprintf("%s%v", cacheWhitelistIdPrefix, id)
+ var resp Whitelist
+ err := m.QueryRowCtx(ctx, &resp, whitelistIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", whitelistRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultWhitelistModel) Insert(ctx context.Context, data *Whitelist) (sql.Result, error) {
+ whitelistIdKey := fmt.Sprintf("%s%v", cacheWhitelistIdPrefix, data.Id)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?)", m.table, whitelistRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.UserId, data.WhitelistIp)
+ }, whitelistIdKey)
+ return ret, err
+}
+
+func (m *defaultWhitelistModel) Update(ctx context.Context, data *Whitelist) error {
+ whitelistIdKey := fmt.Sprintf("%s%v", cacheWhitelistIdPrefix, data.Id)
+ _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, whitelistRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, data.UserId, data.WhitelistIp, data.Id)
+ }, whitelistIdKey)
+ return err
+}
+
+func (m *defaultWhitelistModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheWhitelistIdPrefix, primary)
+}
+
+func (m *defaultWhitelistModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", whitelistRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultWhitelistModel) tableName() string {
+ return m.table
+}
diff --git a/apps/sentinel/internal/server/product/productserver.go b/apps/sentinel/internal/server/product/productserver.go
new file mode 100644
index 0000000..c070655
--- /dev/null
+++ b/apps/sentinel/internal/server/product/productserver.go
@@ -0,0 +1,50 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/logic/product"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+)
+
+type ProductServer struct {
+ svcCtx *svc.ServiceContext
+ sentinel.UnimplementedProductServer
+}
+
+func NewProductServer(svcCtx *svc.ServiceContext) *ProductServer {
+ return &ProductServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// Product methods
+func (s *ProductServer) CreateProduct(ctx context.Context, in *sentinel.CreateProductRequest) (*sentinel.Product, error) {
+ l := productlogic.NewCreateProductLogic(ctx, s.svcCtx)
+ return l.CreateProduct(in)
+}
+
+func (s *ProductServer) UpdateProduct(ctx context.Context, in *sentinel.UpdateProductRequest) (*sentinel.Product, error) {
+ l := productlogic.NewUpdateProductLogic(ctx, s.svcCtx)
+ return l.UpdateProduct(in)
+}
+
+func (s *ProductServer) DeleteProduct(ctx context.Context, in *sentinel.DeleteProductRequest) (*sentinel.Product, error) {
+ l := productlogic.NewDeleteProductLogic(ctx, s.svcCtx)
+ return l.DeleteProduct(in)
+}
+
+func (s *ProductServer) GetProductPageList(ctx context.Context, in *sentinel.PageListRequest) (*sentinel.ProductResponse, error) {
+ l := productlogic.NewGetProductPageListLogic(ctx, s.svcCtx)
+ return l.GetProductPageList(in)
+}
+
+func (s *ProductServer) GetProductById(ctx context.Context, in *sentinel.GetRecordByIdRequest) (*sentinel.Product, error) {
+ l := productlogic.NewGetProductByIdLogic(ctx, s.svcCtx)
+ return l.GetProductById(in)
+}
diff --git a/apps/sentinel/internal/server/secret/secretserver.go b/apps/sentinel/internal/server/secret/secretserver.go
new file mode 100644
index 0000000..f8bd030
--- /dev/null
+++ b/apps/sentinel/internal/server/secret/secretserver.go
@@ -0,0 +1,40 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/logic/secret"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+)
+
+type SecretServer struct {
+ svcCtx *svc.ServiceContext
+ sentinel.UnimplementedSecretServer
+}
+
+func NewSecretServer(svcCtx *svc.ServiceContext) *SecretServer {
+ return &SecretServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// Secret methods
+func (s *SecretServer) CreateSecret(ctx context.Context, in *sentinel.CreateSecretRequest) (*sentinel.Secret, error) {
+ l := secretlogic.NewCreateSecretLogic(ctx, s.svcCtx)
+ return l.CreateSecret(in)
+}
+
+func (s *SecretServer) GetSecretByUserId(ctx context.Context, in *sentinel.GetRecordByIdRequest) (*sentinel.Secret, error) {
+ l := secretlogic.NewGetSecretByUserIdLogic(ctx, s.svcCtx)
+ return l.GetSecretByUserId(in)
+}
+
+func (s *SecretServer) GetSecretBySecretId(ctx context.Context, in *sentinel.GetSecretBySecretIdRequest) (*sentinel.Secret, error) {
+ l := secretlogic.NewGetSecretBySecretIdLogic(ctx, s.svcCtx)
+ return l.GetSecretBySecretId(in)
+}
diff --git a/apps/sentinel/internal/server/userproduct/userproductserver.go b/apps/sentinel/internal/server/userproduct/userproductserver.go
new file mode 100644
index 0000000..fe22436
--- /dev/null
+++ b/apps/sentinel/internal/server/userproduct/userproductserver.go
@@ -0,0 +1,40 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/logic/userproduct"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+)
+
+type UserProductServer struct {
+ svcCtx *svc.ServiceContext
+ sentinel.UnimplementedUserProductServer
+}
+
+func NewUserProductServer(svcCtx *svc.ServiceContext) *UserProductServer {
+ return &UserProductServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// UserProduct methods
+func (s *UserProductServer) CreateUserProduct(ctx context.Context, in *sentinel.CreateUserProductRequest) (*sentinel.UserProductEmptyResponse, error) {
+ l := userproductlogic.NewCreateUserProductLogic(ctx, s.svcCtx)
+ return l.CreateUserProduct(in)
+}
+
+func (s *UserProductServer) GetUserProductPageList(ctx context.Context, in *sentinel.UserProuctPageListRequest) (*sentinel.UserProductResponse, error) {
+ l := userproductlogic.NewGetUserProductPageListLogic(ctx, s.svcCtx)
+ return l.GetUserProductPageList(in)
+}
+
+func (s *UserProductServer) MatchingUserIdProductCode(ctx context.Context, in *sentinel.MatchingUserIdProductCodeRequest) (*sentinel.MatchResponse, error) {
+ l := userproductlogic.NewMatchingUserIdProductCodeLogic(ctx, s.svcCtx)
+ return l.MatchingUserIdProductCode(in)
+}
diff --git a/apps/sentinel/internal/server/whitelist/whitelistserver.go b/apps/sentinel/internal/server/whitelist/whitelistserver.go
new file mode 100644
index 0000000..93f3f41
--- /dev/null
+++ b/apps/sentinel/internal/server/whitelist/whitelistserver.go
@@ -0,0 +1,50 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: sentinel.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/sentinel/internal/logic/whitelist"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+)
+
+type WhitelistServer struct {
+ svcCtx *svc.ServiceContext
+ sentinel.UnimplementedWhitelistServer
+}
+
+func NewWhitelistServer(svcCtx *svc.ServiceContext) *WhitelistServer {
+ return &WhitelistServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// Whitelist methods
+func (s *WhitelistServer) CreateWhitelist(ctx context.Context, in *sentinel.CreateWhitelistRequest) (*sentinel.Whitelist, error) {
+ l := whitelistlogic.NewCreateWhitelistLogic(ctx, s.svcCtx)
+ return l.CreateWhitelist(in)
+}
+
+func (s *WhitelistServer) UpdateWhitelist(ctx context.Context, in *sentinel.UpdateWhitelistRequest) (*sentinel.Whitelist, error) {
+ l := whitelistlogic.NewUpdateWhitelistLogic(ctx, s.svcCtx)
+ return l.UpdateWhitelist(in)
+}
+
+func (s *WhitelistServer) DeleteWhitelist(ctx context.Context, in *sentinel.DeleteWhitelistRequest) (*sentinel.Whitelist, error) {
+ l := whitelistlogic.NewDeleteWhitelistLogic(ctx, s.svcCtx)
+ return l.DeleteWhitelist(in)
+}
+
+func (s *WhitelistServer) GetWhitePageList(ctx context.Context, in *sentinel.WhitePageListRequest) (*sentinel.WhitelistResponse, error) {
+ l := whitelistlogic.NewGetWhitePageListLogic(ctx, s.svcCtx)
+ return l.GetWhitePageList(in)
+}
+
+func (s *WhitelistServer) MatchWhitelistByIp(ctx context.Context, in *sentinel.MatchWhitelistByIpRequest) (*sentinel.MatchResponse, error) {
+ l := whitelistlogic.NewMatchWhitelistByIpLogic(ctx, s.svcCtx)
+ return l.MatchWhitelistByIp(in)
+}
diff --git a/apps/sentinel/internal/svc/servicecontext.go b/apps/sentinel/internal/svc/servicecontext.go
new file mode 100644
index 0000000..5206950
--- /dev/null
+++ b/apps/sentinel/internal/svc/servicecontext.go
@@ -0,0 +1,36 @@
+package svc
+
+import (
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "tianyuan-api/apps/sentinel/internal/config"
+ "tianyuan-api/apps/sentinel/internal/model"
+)
+
+type ServiceContext struct {
+ Config config.Config
+ Redis *redis.Redis
+ WhitelistModel model.WhitelistModel
+ SecretsModel model.SecretsModel
+ ProductsModel model.ProductsModel
+ UserProductsModel model.UserProductsModel
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+ db := sqlx.NewMysql(c.DataSource) // 创建数据库连接
+ 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)
+ return &ServiceContext{
+ Config: c,
+ Redis: rds,
+ WhitelistModel: model.NewWhitelistModel(rds, db, c.CacheRedis),
+ SecretsModel: model.NewSecretsModel(db, c.CacheRedis),
+ ProductsModel: model.NewProductsModel(db, c.CacheRedis),
+ UserProductsModel: model.NewUserProductsModel(rds, db, c.CacheRedis),
+ }
+}
diff --git a/apps/sentinel/sentinel.go b/apps/sentinel/sentinel.go
new file mode 100644
index 0000000..4d4ac46
--- /dev/null
+++ b/apps/sentinel/sentinel.go
@@ -0,0 +1,45 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+
+ "tianyuan-api/apps/sentinel/internal/config"
+ productServer "tianyuan-api/apps/sentinel/internal/server/product"
+ secretServer "tianyuan-api/apps/sentinel/internal/server/secret"
+ userproductServer "tianyuan-api/apps/sentinel/internal/server/userproduct"
+ whitelistServer "tianyuan-api/apps/sentinel/internal/server/whitelist"
+ "tianyuan-api/apps/sentinel/internal/svc"
+ "tianyuan-api/apps/sentinel/sentinel"
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/core/service"
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/reflection"
+)
+
+var configFile = flag.String("f", "etc/sentinel.yaml", "the config file")
+
+func main() {
+ flag.Parse()
+
+ var c config.Config
+ conf.MustLoad(*configFile, &c)
+ ctx := svc.NewServiceContext(c)
+
+ s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+ sentinel.RegisterWhitelistServer(grpcServer, whitelistServer.NewWhitelistServer(ctx))
+ sentinel.RegisterSecretServer(grpcServer, secretServer.NewSecretServer(ctx))
+ sentinel.RegisterProductServer(grpcServer, productServer.NewProductServer(ctx))
+ sentinel.RegisterUserProductServer(grpcServer, userproductServer.NewUserProductServer(ctx))
+
+ if c.Mode == service.DevMode || c.Mode == service.TestMode {
+ reflection.Register(grpcServer)
+ }
+ })
+ defer s.Stop()
+
+ fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+ s.Start()
+}
diff --git a/apps/sentinel/sentinel.proto b/apps/sentinel/sentinel.proto
new file mode 100644
index 0000000..616f4c0
--- /dev/null
+++ b/apps/sentinel/sentinel.proto
@@ -0,0 +1,195 @@
+syntax = "proto3";
+
+
+option go_package = "./sentinel";
+
+message PageListRequest {
+ int64 page = 2;
+ int64 page_size = 3;
+}
+message UserProuctPageListRequest {
+ int64 user_id = 1;
+ int64 page = 2;
+ int64 page_size = 3;
+}
+message WhitePageListRequest {
+ int64 user_id = 1;
+ int64 page = 2;
+ int64 page_size = 3;
+}
+
+message GetRecordByIdRequest {
+ int64 id = 1;
+}
+
+
+message Whitelist {
+ int64 id = 1;
+ int64 user_id = 2;
+ string whitelist_ip = 3;
+ string created_at = 4;
+ string updated_at = 5;
+}
+
+message CreateWhitelistRequest {
+ int64 user_id = 1;
+ string whitelist_ip = 2;
+}
+
+message UpdateWhitelistRequest {
+ int64 id = 1;
+ string whitelist_ip = 2;
+}
+
+message DeleteWhitelistRequest {
+ int64 id = 1;
+}
+
+message WhitelistResponse {
+ int64 total = 1;
+ repeated Whitelist whitelists = 2;
+}
+
+// Message for Secrets operations
+message Secret {
+ int64 id = 1;
+ int64 user_id = 2;
+ string secret_id = 3;
+ string aes_key = 4;
+ string created_at = 5;
+ string updated_at = 6;
+}
+message GetSecretBySecretIdRequest {
+ string secret_id = 1;
+}
+message CreateSecretRequest {
+ int64 user_id = 1;
+}
+
+message UpdateSecretRequest {
+ int64 id = 1;
+ string secret_id = 2;
+ string aes_key = 3;
+}
+
+message DeleteSecretRequest {
+ int64 id = 1;
+}
+
+message SecretResponse {
+ int64 total = 1;
+ repeated Secret secrets = 2;
+}
+
+// Message for Products operations
+message Product {
+ int64 id = 1;
+ string product_name = 2;
+ string product_code = 3;
+ string product_description = 4;
+ string product_content = 5;
+ string product_group = 6;
+ double product_price = 7;
+ string created_at = 8;
+ string updated_at = 9;
+}
+
+message CreateProductRequest {
+ string product_name = 1;
+ string product_code = 2;
+ string product_description = 3;
+ string product_group = 4;
+ string product_content = 5;
+ double product_price = 6;
+}
+
+message UpdateProductRequest {
+ int64 id = 1;
+ string product_name = 2;
+ string product_code = 3;
+ string product_description = 4;
+ string product_content = 5;
+ string product_group = 6;
+ double product_price = 7;
+}
+
+message DeleteProductRequest {
+ int64 id = 1;
+}
+
+message ProductResponse {
+ int64 total = 1;
+ repeated Product products = 2;
+}
+
+// Message for UserProducts operations
+message UserProductEmptyResponse {
+}
+message UserProductItem {
+ int64 id = 1; // 用户产品ID
+ int64 productId = 2; // 产品ID
+ string productName = 3; // 产品名称
+ string productCode = 4; // 产品编号
+ string productDescription = 5; // 产品简介
+ string productGroup = 6; // 产品分类
+ double productPrice = 7; // 产品价格
+ string createdAt = 8; // 创建时间
+ string updatedAt = 9; // 更新时间
+}
+message CreateUserProductRequest {
+ int64 user_id = 1;
+ int64 product_id = 2;
+}
+
+message UpdateUserProductRequest {
+ int64 id = 1;
+}
+
+message DeleteUserProductRequest {
+ int64 id = 1;
+}
+
+message UserProductResponse {
+ int64 total = 1;
+ repeated UserProductItem user_products = 2;
+}
+
+message matchingUserIdProductCodeRequest {
+ int64 id = 1;
+ string product_code = 2;
+}
+message matchResponse {
+ bool match = 1;
+}
+message MatchWhitelistByIpRequest{
+ string ip = 1;
+}
+// Service definitions for Whitelist, Secrets, Products, and UserProducts
+service whitelist {
+ // Whitelist methods
+ rpc CreateWhitelist(CreateWhitelistRequest) returns (Whitelist);
+ rpc UpdateWhitelist(UpdateWhitelistRequest) returns (Whitelist);
+ rpc DeleteWhitelist(DeleteWhitelistRequest) returns (Whitelist);
+ rpc GetWhitePageList(WhitePageListRequest) returns (WhitelistResponse);
+ rpc MatchWhitelistByIp(MatchWhitelistByIpRequest) returns (matchResponse);
+}
+service secret {
+ // Secret methods
+ rpc CreateSecret(CreateSecretRequest) returns (Secret);
+ rpc GetSecretByUserId(GetRecordByIdRequest) returns (Secret);
+ rpc GetSecretBySecretId(GetSecretBySecretIdRequest) returns (Secret);
+}
+service product {
+ // Product methods
+ rpc CreateProduct(CreateProductRequest) returns (Product);
+ rpc UpdateProduct(UpdateProductRequest) returns (Product);
+ rpc DeleteProduct(DeleteProductRequest) returns (Product);
+ rpc GetProductPageList(PageListRequest) returns (ProductResponse);
+ rpc GetProductById(GetRecordByIdRequest) returns (Product);
+}
+ service userProduct {
+ // UserProduct methods
+ rpc CreateUserProduct(CreateUserProductRequest) returns (UserProductEmptyResponse);
+ rpc GetUserProductPageList(UserProuctPageListRequest) returns (UserProductResponse);
+ rpc MatchingUserIdProductCode(matchingUserIdProductCodeRequest) returns (matchResponse);
+ }
diff --git a/apps/sentinel/sentinel.sql b/apps/sentinel/sentinel.sql
new file mode 100644
index 0000000..d4474c5
--- /dev/null
+++ b/apps/sentinel/sentinel.sql
@@ -0,0 +1,40 @@
+CREATE TABLE `whitelist` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '白名单ID',
+ `user_id` INT(11) NOT NULL COMMENT '用户ID',
+ `whitelist_ip` VARCHAR(255) NOT NULL COMMENT '白名单IP',
+ `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='白名单表,存储用户的IP白名单';
+
+CREATE TABLE `secrets` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '密钥ID',
+ `user_id` INT(11) NOT NULL UNIQUE COMMENT '用户ID',
+ `secret_id` VARCHAR(64) NOT NULL UNIQUE COMMENT '密钥ID',
+ `aes_key` VARCHAR(32) NOT NULL COMMENT 'AES 128位密钥',
+ `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='密钥表,存储用户的密钥信息';
+
+CREATE TABLE `products` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '产品ID',
+ `product_name` VARCHAR(255) NOT NULL COMMENT '产品名称',
+ `product_code` VARCHAR(64) NOT NULL UNIQUE COMMENT '产品编号',
+ `product_description` TEXT COMMENT '产品简介',
+ `product_content` TEXT COMMENT '产品内容',
+ `product_group` VARCHAR(32) NOT NULL COMMENT '产品分类',
+ `product_price` DECIMAL(10, 2) NOT NULL COMMENT '产品价格',
+ `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品表,存储产品的详细信息';
+
+CREATE TABLE `user_products` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户产品ID',
+ `user_id` INT(11) NOT NULL COMMENT '用户ID',
+ `product_id` INT(11) NOT NULL COMMENT '产品ID',
+ `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+ `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户产品表,存储用户开通的产品记录';
diff --git a/apps/sentinel/sentinel/sentinel.pb.go b/apps/sentinel/sentinel/sentinel.pb.go
new file mode 100644
index 0000000..4366699
--- /dev/null
+++ b/apps/sentinel/sentinel/sentinel.pb.go
@@ -0,0 +1,2507 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.34.2
+// protoc v3.19.4
+// source: sentinel.proto
+
+package sentinel
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type PageListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Page int64 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
+ PageSize int64 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+}
+
+func (x *PageListRequest) Reset() {
+ *x = PageListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PageListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PageListRequest) ProtoMessage() {}
+
+func (x *PageListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PageListRequest.ProtoReflect.Descriptor instead.
+func (*PageListRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *PageListRequest) GetPage() int64 {
+ if x != nil {
+ return x.Page
+ }
+ return 0
+}
+
+func (x *PageListRequest) GetPageSize() int64 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+type UserProuctPageListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ Page int64 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
+ PageSize int64 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+}
+
+func (x *UserProuctPageListRequest) Reset() {
+ *x = UserProuctPageListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserProuctPageListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserProuctPageListRequest) ProtoMessage() {}
+
+func (x *UserProuctPageListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserProuctPageListRequest.ProtoReflect.Descriptor instead.
+func (*UserProuctPageListRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *UserProuctPageListRequest) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *UserProuctPageListRequest) GetPage() int64 {
+ if x != nil {
+ return x.Page
+ }
+ return 0
+}
+
+func (x *UserProuctPageListRequest) GetPageSize() int64 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+type WhitePageListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ Page int64 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"`
+ PageSize int64 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+}
+
+func (x *WhitePageListRequest) Reset() {
+ *x = WhitePageListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *WhitePageListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*WhitePageListRequest) ProtoMessage() {}
+
+func (x *WhitePageListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use WhitePageListRequest.ProtoReflect.Descriptor instead.
+func (*WhitePageListRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *WhitePageListRequest) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *WhitePageListRequest) GetPage() int64 {
+ if x != nil {
+ return x.Page
+ }
+ return 0
+}
+
+func (x *WhitePageListRequest) GetPageSize() int64 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+type GetRecordByIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+}
+
+func (x *GetRecordByIdRequest) Reset() {
+ *x = GetRecordByIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetRecordByIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetRecordByIdRequest) ProtoMessage() {}
+
+func (x *GetRecordByIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetRecordByIdRequest.ProtoReflect.Descriptor instead.
+func (*GetRecordByIdRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetRecordByIdRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+type Whitelist struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ WhitelistIp string `protobuf:"bytes,3,opt,name=whitelist_ip,json=whitelistIp,proto3" json:"whitelist_ip,omitempty"`
+ CreatedAt string `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt string `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Whitelist) Reset() {
+ *x = Whitelist{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Whitelist) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Whitelist) ProtoMessage() {}
+
+func (x *Whitelist) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Whitelist.ProtoReflect.Descriptor instead.
+func (*Whitelist) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *Whitelist) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *Whitelist) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *Whitelist) GetWhitelistIp() string {
+ if x != nil {
+ return x.WhitelistIp
+ }
+ return ""
+}
+
+func (x *Whitelist) GetCreatedAt() string {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return ""
+}
+
+func (x *Whitelist) GetUpdatedAt() string {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return ""
+}
+
+type CreateWhitelistRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ WhitelistIp string `protobuf:"bytes,2,opt,name=whitelist_ip,json=whitelistIp,proto3" json:"whitelist_ip,omitempty"`
+}
+
+func (x *CreateWhitelistRequest) Reset() {
+ *x = CreateWhitelistRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateWhitelistRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateWhitelistRequest) ProtoMessage() {}
+
+func (x *CreateWhitelistRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateWhitelistRequest.ProtoReflect.Descriptor instead.
+func (*CreateWhitelistRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *CreateWhitelistRequest) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *CreateWhitelistRequest) GetWhitelistIp() string {
+ if x != nil {
+ return x.WhitelistIp
+ }
+ return ""
+}
+
+type UpdateWhitelistRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ WhitelistIp string `protobuf:"bytes,2,opt,name=whitelist_ip,json=whitelistIp,proto3" json:"whitelist_ip,omitempty"`
+}
+
+func (x *UpdateWhitelistRequest) Reset() {
+ *x = UpdateWhitelistRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateWhitelistRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateWhitelistRequest) ProtoMessage() {}
+
+func (x *UpdateWhitelistRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateWhitelistRequest.ProtoReflect.Descriptor instead.
+func (*UpdateWhitelistRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *UpdateWhitelistRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *UpdateWhitelistRequest) GetWhitelistIp() string {
+ if x != nil {
+ return x.WhitelistIp
+ }
+ return ""
+}
+
+type DeleteWhitelistRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+}
+
+func (x *DeleteWhitelistRequest) Reset() {
+ *x = DeleteWhitelistRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteWhitelistRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteWhitelistRequest) ProtoMessage() {}
+
+func (x *DeleteWhitelistRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteWhitelistRequest.ProtoReflect.Descriptor instead.
+func (*DeleteWhitelistRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *DeleteWhitelistRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+type WhitelistResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
+ Whitelists []*Whitelist `protobuf:"bytes,2,rep,name=whitelists,proto3" json:"whitelists,omitempty"`
+}
+
+func (x *WhitelistResponse) Reset() {
+ *x = WhitelistResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *WhitelistResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*WhitelistResponse) ProtoMessage() {}
+
+func (x *WhitelistResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use WhitelistResponse.ProtoReflect.Descriptor instead.
+func (*WhitelistResponse) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *WhitelistResponse) GetTotal() int64 {
+ if x != nil {
+ return x.Total
+ }
+ return 0
+}
+
+func (x *WhitelistResponse) GetWhitelists() []*Whitelist {
+ if x != nil {
+ return x.Whitelists
+ }
+ return nil
+}
+
+// Message for Secrets operations
+type Secret struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ SecretId string `protobuf:"bytes,3,opt,name=secret_id,json=secretId,proto3" json:"secret_id,omitempty"`
+ AesKey string `protobuf:"bytes,4,opt,name=aes_key,json=aesKey,proto3" json:"aes_key,omitempty"`
+ CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt string `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Secret) Reset() {
+ *x = Secret{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Secret) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Secret) ProtoMessage() {}
+
+func (x *Secret) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Secret.ProtoReflect.Descriptor instead.
+func (*Secret) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *Secret) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *Secret) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *Secret) GetSecretId() string {
+ if x != nil {
+ return x.SecretId
+ }
+ return ""
+}
+
+func (x *Secret) GetAesKey() string {
+ if x != nil {
+ return x.AesKey
+ }
+ return ""
+}
+
+func (x *Secret) GetCreatedAt() string {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return ""
+}
+
+func (x *Secret) GetUpdatedAt() string {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return ""
+}
+
+type GetSecretBySecretIdRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SecretId string `protobuf:"bytes,1,opt,name=secret_id,json=secretId,proto3" json:"secret_id,omitempty"`
+}
+
+func (x *GetSecretBySecretIdRequest) Reset() {
+ *x = GetSecretBySecretIdRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSecretBySecretIdRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSecretBySecretIdRequest) ProtoMessage() {}
+
+func (x *GetSecretBySecretIdRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSecretBySecretIdRequest.ProtoReflect.Descriptor instead.
+func (*GetSecretBySecretIdRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *GetSecretBySecretIdRequest) GetSecretId() string {
+ if x != nil {
+ return x.SecretId
+ }
+ return ""
+}
+
+type CreateSecretRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+}
+
+func (x *CreateSecretRequest) Reset() {
+ *x = CreateSecretRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateSecretRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateSecretRequest) ProtoMessage() {}
+
+func (x *CreateSecretRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateSecretRequest.ProtoReflect.Descriptor instead.
+func (*CreateSecretRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *CreateSecretRequest) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+type UpdateSecretRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ SecretId string `protobuf:"bytes,2,opt,name=secret_id,json=secretId,proto3" json:"secret_id,omitempty"`
+ AesKey string `protobuf:"bytes,3,opt,name=aes_key,json=aesKey,proto3" json:"aes_key,omitempty"`
+}
+
+func (x *UpdateSecretRequest) Reset() {
+ *x = UpdateSecretRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateSecretRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateSecretRequest) ProtoMessage() {}
+
+func (x *UpdateSecretRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateSecretRequest.ProtoReflect.Descriptor instead.
+func (*UpdateSecretRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *UpdateSecretRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *UpdateSecretRequest) GetSecretId() string {
+ if x != nil {
+ return x.SecretId
+ }
+ return ""
+}
+
+func (x *UpdateSecretRequest) GetAesKey() string {
+ if x != nil {
+ return x.AesKey
+ }
+ return ""
+}
+
+type DeleteSecretRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+}
+
+func (x *DeleteSecretRequest) Reset() {
+ *x = DeleteSecretRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteSecretRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteSecretRequest) ProtoMessage() {}
+
+func (x *DeleteSecretRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteSecretRequest.ProtoReflect.Descriptor instead.
+func (*DeleteSecretRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *DeleteSecretRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+type SecretResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
+ Secrets []*Secret `protobuf:"bytes,2,rep,name=secrets,proto3" json:"secrets,omitempty"`
+}
+
+func (x *SecretResponse) Reset() {
+ *x = SecretResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SecretResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SecretResponse) ProtoMessage() {}
+
+func (x *SecretResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SecretResponse.ProtoReflect.Descriptor instead.
+func (*SecretResponse) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *SecretResponse) GetTotal() int64 {
+ if x != nil {
+ return x.Total
+ }
+ return 0
+}
+
+func (x *SecretResponse) GetSecrets() []*Secret {
+ if x != nil {
+ return x.Secrets
+ }
+ return nil
+}
+
+// Message for Products operations
+type Product struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ ProductName string `protobuf:"bytes,2,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"`
+ ProductCode string `protobuf:"bytes,3,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"`
+ ProductDescription string `protobuf:"bytes,4,opt,name=product_description,json=productDescription,proto3" json:"product_description,omitempty"`
+ ProductContent string `protobuf:"bytes,5,opt,name=product_content,json=productContent,proto3" json:"product_content,omitempty"`
+ ProductGroup string `protobuf:"bytes,6,opt,name=product_group,json=productGroup,proto3" json:"product_group,omitempty"`
+ ProductPrice float64 `protobuf:"fixed64,7,opt,name=product_price,json=productPrice,proto3" json:"product_price,omitempty"`
+ CreatedAt string `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt string `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *Product) Reset() {
+ *x = Product{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Product) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Product) ProtoMessage() {}
+
+func (x *Product) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Product.ProtoReflect.Descriptor instead.
+func (*Product) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *Product) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *Product) GetProductName() string {
+ if x != nil {
+ return x.ProductName
+ }
+ return ""
+}
+
+func (x *Product) GetProductCode() string {
+ if x != nil {
+ return x.ProductCode
+ }
+ return ""
+}
+
+func (x *Product) GetProductDescription() string {
+ if x != nil {
+ return x.ProductDescription
+ }
+ return ""
+}
+
+func (x *Product) GetProductContent() string {
+ if x != nil {
+ return x.ProductContent
+ }
+ return ""
+}
+
+func (x *Product) GetProductGroup() string {
+ if x != nil {
+ return x.ProductGroup
+ }
+ return ""
+}
+
+func (x *Product) GetProductPrice() float64 {
+ if x != nil {
+ return x.ProductPrice
+ }
+ return 0
+}
+
+func (x *Product) GetCreatedAt() string {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return ""
+}
+
+func (x *Product) GetUpdatedAt() string {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return ""
+}
+
+type CreateProductRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ProductName string `protobuf:"bytes,1,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"`
+ ProductCode string `protobuf:"bytes,2,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"`
+ ProductDescription string `protobuf:"bytes,3,opt,name=product_description,json=productDescription,proto3" json:"product_description,omitempty"`
+ ProductGroup string `protobuf:"bytes,4,opt,name=product_group,json=productGroup,proto3" json:"product_group,omitempty"`
+ ProductContent string `protobuf:"bytes,5,opt,name=product_content,json=productContent,proto3" json:"product_content,omitempty"`
+ ProductPrice float64 `protobuf:"fixed64,6,opt,name=product_price,json=productPrice,proto3" json:"product_price,omitempty"`
+}
+
+func (x *CreateProductRequest) Reset() {
+ *x = CreateProductRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateProductRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateProductRequest) ProtoMessage() {}
+
+func (x *CreateProductRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateProductRequest.ProtoReflect.Descriptor instead.
+func (*CreateProductRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *CreateProductRequest) GetProductName() string {
+ if x != nil {
+ return x.ProductName
+ }
+ return ""
+}
+
+func (x *CreateProductRequest) GetProductCode() string {
+ if x != nil {
+ return x.ProductCode
+ }
+ return ""
+}
+
+func (x *CreateProductRequest) GetProductDescription() string {
+ if x != nil {
+ return x.ProductDescription
+ }
+ return ""
+}
+
+func (x *CreateProductRequest) GetProductGroup() string {
+ if x != nil {
+ return x.ProductGroup
+ }
+ return ""
+}
+
+func (x *CreateProductRequest) GetProductContent() string {
+ if x != nil {
+ return x.ProductContent
+ }
+ return ""
+}
+
+func (x *CreateProductRequest) GetProductPrice() float64 {
+ if x != nil {
+ return x.ProductPrice
+ }
+ return 0
+}
+
+type UpdateProductRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ ProductName string `protobuf:"bytes,2,opt,name=product_name,json=productName,proto3" json:"product_name,omitempty"`
+ ProductCode string `protobuf:"bytes,3,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"`
+ ProductDescription string `protobuf:"bytes,4,opt,name=product_description,json=productDescription,proto3" json:"product_description,omitempty"`
+ ProductContent string `protobuf:"bytes,5,opt,name=product_content,json=productContent,proto3" json:"product_content,omitempty"`
+ ProductGroup string `protobuf:"bytes,6,opt,name=product_group,json=productGroup,proto3" json:"product_group,omitempty"`
+ ProductPrice float64 `protobuf:"fixed64,7,opt,name=product_price,json=productPrice,proto3" json:"product_price,omitempty"`
+}
+
+func (x *UpdateProductRequest) Reset() {
+ *x = UpdateProductRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateProductRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateProductRequest) ProtoMessage() {}
+
+func (x *UpdateProductRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[17]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateProductRequest.ProtoReflect.Descriptor instead.
+func (*UpdateProductRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *UpdateProductRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *UpdateProductRequest) GetProductName() string {
+ if x != nil {
+ return x.ProductName
+ }
+ return ""
+}
+
+func (x *UpdateProductRequest) GetProductCode() string {
+ if x != nil {
+ return x.ProductCode
+ }
+ return ""
+}
+
+func (x *UpdateProductRequest) GetProductDescription() string {
+ if x != nil {
+ return x.ProductDescription
+ }
+ return ""
+}
+
+func (x *UpdateProductRequest) GetProductContent() string {
+ if x != nil {
+ return x.ProductContent
+ }
+ return ""
+}
+
+func (x *UpdateProductRequest) GetProductGroup() string {
+ if x != nil {
+ return x.ProductGroup
+ }
+ return ""
+}
+
+func (x *UpdateProductRequest) GetProductPrice() float64 {
+ if x != nil {
+ return x.ProductPrice
+ }
+ return 0
+}
+
+type DeleteProductRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+}
+
+func (x *DeleteProductRequest) Reset() {
+ *x = DeleteProductRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteProductRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteProductRequest) ProtoMessage() {}
+
+func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[18]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteProductRequest.ProtoReflect.Descriptor instead.
+func (*DeleteProductRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{18}
+}
+
+func (x *DeleteProductRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+type ProductResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
+ Products []*Product `protobuf:"bytes,2,rep,name=products,proto3" json:"products,omitempty"`
+}
+
+func (x *ProductResponse) Reset() {
+ *x = ProductResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ProductResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ProductResponse) ProtoMessage() {}
+
+func (x *ProductResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[19]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ProductResponse.ProtoReflect.Descriptor instead.
+func (*ProductResponse) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *ProductResponse) GetTotal() int64 {
+ if x != nil {
+ return x.Total
+ }
+ return 0
+}
+
+func (x *ProductResponse) GetProducts() []*Product {
+ if x != nil {
+ return x.Products
+ }
+ return nil
+}
+
+// Message for UserProducts operations
+type UserProductEmptyResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *UserProductEmptyResponse) Reset() {
+ *x = UserProductEmptyResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserProductEmptyResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserProductEmptyResponse) ProtoMessage() {}
+
+func (x *UserProductEmptyResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserProductEmptyResponse.ProtoReflect.Descriptor instead.
+func (*UserProductEmptyResponse) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{20}
+}
+
+type UserProductItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 用户产品ID
+ ProductId int64 `protobuf:"varint,2,opt,name=productId,proto3" json:"productId,omitempty"` // 产品ID
+ ProductName string `protobuf:"bytes,3,opt,name=productName,proto3" json:"productName,omitempty"` // 产品名称
+ ProductCode string `protobuf:"bytes,4,opt,name=productCode,proto3" json:"productCode,omitempty"` // 产品编号
+ ProductDescription string `protobuf:"bytes,5,opt,name=productDescription,proto3" json:"productDescription,omitempty"` // 产品简介
+ ProductGroup string `protobuf:"bytes,6,opt,name=productGroup,proto3" json:"productGroup,omitempty"` // 产品分类
+ ProductPrice float64 `protobuf:"fixed64,7,opt,name=productPrice,proto3" json:"productPrice,omitempty"` // 产品价格
+ CreatedAt string `protobuf:"bytes,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"` // 创建时间
+ UpdatedAt string `protobuf:"bytes,9,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` // 更新时间
+}
+
+func (x *UserProductItem) Reset() {
+ *x = UserProductItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserProductItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserProductItem) ProtoMessage() {}
+
+func (x *UserProductItem) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserProductItem.ProtoReflect.Descriptor instead.
+func (*UserProductItem) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *UserProductItem) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *UserProductItem) GetProductId() int64 {
+ if x != nil {
+ return x.ProductId
+ }
+ return 0
+}
+
+func (x *UserProductItem) GetProductName() string {
+ if x != nil {
+ return x.ProductName
+ }
+ return ""
+}
+
+func (x *UserProductItem) GetProductCode() string {
+ if x != nil {
+ return x.ProductCode
+ }
+ return ""
+}
+
+func (x *UserProductItem) GetProductDescription() string {
+ if x != nil {
+ return x.ProductDescription
+ }
+ return ""
+}
+
+func (x *UserProductItem) GetProductGroup() string {
+ if x != nil {
+ return x.ProductGroup
+ }
+ return ""
+}
+
+func (x *UserProductItem) GetProductPrice() float64 {
+ if x != nil {
+ return x.ProductPrice
+ }
+ return 0
+}
+
+func (x *UserProductItem) GetCreatedAt() string {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return ""
+}
+
+func (x *UserProductItem) GetUpdatedAt() string {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return ""
+}
+
+type CreateUserProductRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
+ ProductId int64 `protobuf:"varint,2,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
+}
+
+func (x *CreateUserProductRequest) Reset() {
+ *x = CreateUserProductRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[22]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateUserProductRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateUserProductRequest) ProtoMessage() {}
+
+func (x *CreateUserProductRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[22]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateUserProductRequest.ProtoReflect.Descriptor instead.
+func (*CreateUserProductRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{22}
+}
+
+func (x *CreateUserProductRequest) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *CreateUserProductRequest) GetProductId() int64 {
+ if x != nil {
+ return x.ProductId
+ }
+ return 0
+}
+
+type UpdateUserProductRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+}
+
+func (x *UpdateUserProductRequest) Reset() {
+ *x = UpdateUserProductRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[23]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateUserProductRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateUserProductRequest) ProtoMessage() {}
+
+func (x *UpdateUserProductRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[23]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateUserProductRequest.ProtoReflect.Descriptor instead.
+func (*UpdateUserProductRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{23}
+}
+
+func (x *UpdateUserProductRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+type DeleteUserProductRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+}
+
+func (x *DeleteUserProductRequest) Reset() {
+ *x = DeleteUserProductRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[24]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteUserProductRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteUserProductRequest) ProtoMessage() {}
+
+func (x *DeleteUserProductRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[24]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteUserProductRequest.ProtoReflect.Descriptor instead.
+func (*DeleteUserProductRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{24}
+}
+
+func (x *DeleteUserProductRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+type UserProductResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
+ UserProducts []*UserProductItem `protobuf:"bytes,2,rep,name=user_products,json=userProducts,proto3" json:"user_products,omitempty"`
+}
+
+func (x *UserProductResponse) Reset() {
+ *x = UserProductResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[25]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserProductResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserProductResponse) ProtoMessage() {}
+
+func (x *UserProductResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[25]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserProductResponse.ProtoReflect.Descriptor instead.
+func (*UserProductResponse) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{25}
+}
+
+func (x *UserProductResponse) GetTotal() int64 {
+ if x != nil {
+ return x.Total
+ }
+ return 0
+}
+
+func (x *UserProductResponse) GetUserProducts() []*UserProductItem {
+ if x != nil {
+ return x.UserProducts
+ }
+ return nil
+}
+
+type MatchingUserIdProductCodeRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ ProductCode string `protobuf:"bytes,2,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"`
+}
+
+func (x *MatchingUserIdProductCodeRequest) Reset() {
+ *x = MatchingUserIdProductCodeRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[26]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MatchingUserIdProductCodeRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MatchingUserIdProductCodeRequest) ProtoMessage() {}
+
+func (x *MatchingUserIdProductCodeRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[26]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MatchingUserIdProductCodeRequest.ProtoReflect.Descriptor instead.
+func (*MatchingUserIdProductCodeRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{26}
+}
+
+func (x *MatchingUserIdProductCodeRequest) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *MatchingUserIdProductCodeRequest) GetProductCode() string {
+ if x != nil {
+ return x.ProductCode
+ }
+ return ""
+}
+
+type MatchResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Match bool `protobuf:"varint,1,opt,name=match,proto3" json:"match,omitempty"`
+}
+
+func (x *MatchResponse) Reset() {
+ *x = MatchResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[27]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MatchResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MatchResponse) ProtoMessage() {}
+
+func (x *MatchResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[27]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MatchResponse.ProtoReflect.Descriptor instead.
+func (*MatchResponse) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{27}
+}
+
+func (x *MatchResponse) GetMatch() bool {
+ if x != nil {
+ return x.Match
+ }
+ return false
+}
+
+type MatchWhitelistByIpRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"`
+}
+
+func (x *MatchWhitelistByIpRequest) Reset() {
+ *x = MatchWhitelistByIpRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_sentinel_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MatchWhitelistByIpRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MatchWhitelistByIpRequest) ProtoMessage() {}
+
+func (x *MatchWhitelistByIpRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_sentinel_proto_msgTypes[28]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MatchWhitelistByIpRequest.ProtoReflect.Descriptor instead.
+func (*MatchWhitelistByIpRequest) Descriptor() ([]byte, []int) {
+ return file_sentinel_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *MatchWhitelistByIpRequest) GetIp() string {
+ if x != nil {
+ return x.Ip
+ }
+ return ""
+}
+
+var File_sentinel_proto protoreflect.FileDescriptor
+
+var file_sentinel_proto_rawDesc = []byte{
+ 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x22, 0x42, 0x0a, 0x0f, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f,
+ 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65,
+ 0x53, 0x69, 0x7a, 0x65, 0x22, 0x65, 0x0a, 0x19, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x75,
+ 0x63, 0x74, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61,
+ 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b,
+ 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x60, 0x0a, 0x14, 0x57,
+ 0x68, 0x69, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04,
+ 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65,
+ 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x26, 0x0a,
+ 0x14, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x95, 0x01, 0x0a, 0x09, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c,
+ 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
+ 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c,
+ 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x70, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d,
+ 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x54, 0x0a,
+ 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
+ 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x69, 0x70,
+ 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73,
+ 0x74, 0x49, 0x70, 0x22, 0x4b, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x68, 0x69,
+ 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a,
+ 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a,
+ 0x0c, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x69, 0x70, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x49, 0x70,
+ 0x22, 0x28, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c,
+ 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x55, 0x0a, 0x11, 0x57, 0x68,
+ 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
+ 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2a, 0x0a, 0x0a, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69,
+ 0x73, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x68, 0x69, 0x74,
+ 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x0a, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74,
+ 0x73, 0x22, 0xa5, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07,
+ 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75,
+ 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f,
+ 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74,
+ 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x65, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x63,
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
+ 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x39, 0x0a, 0x1a, 0x47, 0x65, 0x74,
+ 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x42, 0x79, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x49, 0x64,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65,
+ 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x63, 0x72,
+ 0x65, 0x74, 0x49, 0x64, 0x22, 0x2e, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65,
+ 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75,
+ 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73,
+ 0x65, 0x72, 0x49, 0x64, 0x22, 0x5b, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65,
+ 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73,
+ 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+ 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x65, 0x73, 0x5f,
+ 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x65, 0x73, 0x4b, 0x65,
+ 0x79, 0x22, 0x25, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x63, 0x72, 0x65,
+ 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x49, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x72,
+ 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f,
+ 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c,
+ 0x12, 0x21, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x07, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x07, 0x73, 0x65, 0x63, 0x72,
+ 0x65, 0x74, 0x73, 0x22, 0xc1, 0x02, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12,
+ 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12,
+ 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61,
+ 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63, 0x6f,
+ 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12,
+ 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x47,
+ 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f,
+ 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x70, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63,
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61,
+ 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x80, 0x02, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61,
+ 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e,
+ 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63,
+ 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75,
+ 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x73, 0x63,
+ 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75,
+ 0x63, 0x74, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
+ 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x27, 0x0a, 0x0f,
+ 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f,
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x90, 0x02, 0x0a, 0x14, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
+ 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75,
+ 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x70, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44,
+ 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x6e, 0x74,
+ 0x65, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x67,
+ 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x52,
+ 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x26, 0x0a,
+ 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x4d, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61,
+ 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x24,
+ 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x08, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x22, 0xb7, 0x02, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+ 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49,
+ 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x61, 0x6d,
+ 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43,
+ 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75,
+ 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2e, 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x73, 0x63, 0x72,
+ 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x01,
+ 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c,
+ 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09,
+ 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x52, 0x0a, 0x18, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69,
+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x2a,
+ 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x18, 0x44, 0x65,
+ 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x62, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a,
+ 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f,
+ 0x74, 0x61, 0x6c, 0x12, 0x35, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x55, 0x73, 0x65,
+ 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x0c, 0x75, 0x73,
+ 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x22, 0x55, 0x0a, 0x20, 0x6d, 0x61,
+ 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x50, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e,
+ 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21,
+ 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64,
+ 0x65, 0x22, 0x25, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x05, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x22, 0x2b, 0x0a, 0x19, 0x4d, 0x61, 0x74, 0x63,
+ 0x68, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x49, 0x70, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x02, 0x69, 0x70, 0x32, 0xb4, 0x02, 0x0a, 0x09, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c,
+ 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x68, 0x69,
+ 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57,
+ 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x0a, 0x2e, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0f, 0x55,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x17,
+ 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0a, 0x2e, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c,
+ 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x68, 0x69,
+ 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57,
+ 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x0a, 0x2e, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x3d, 0x0a, 0x10, 0x47,
+ 0x65, 0x74, 0x57, 0x68, 0x69, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12,
+ 0x15, 0x2e, 0x57, 0x68, 0x69, 0x74, 0x65, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69,
+ 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x12, 0x4d, 0x61,
+ 0x74, 0x63, 0x68, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x49, 0x70,
+ 0x12, 0x1a, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x57, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73,
+ 0x74, 0x42, 0x79, 0x49, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x6d,
+ 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa9, 0x01, 0x0a,
+ 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x07, 0x2e,
+ 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63,
+ 0x72, 0x65, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x15, 0x2e, 0x47, 0x65,
+ 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x07, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x3b, 0x0a, 0x13, 0x47,
+ 0x65, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x42, 0x79, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74,
+ 0x49, 0x64, 0x12, 0x1b, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x42, 0x79,
+ 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x07, 0x2e, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x32, 0x8c, 0x02, 0x0a, 0x07, 0x70, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x74, 0x12, 0x30, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x15, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x08, 0x2e, 0x50,
+ 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x30, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x08,
+ 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x30, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65,
+ 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x15, 0x2e, 0x44, 0x65, 0x6c, 0x65,
+ 0x74, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x08, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x38, 0x0a, 0x12, 0x47, 0x65,
+ 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74,
+ 0x12, 0x10, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75,
+ 0x63, 0x74, 0x42, 0x79, 0x49, 0x64, 0x12, 0x15, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f,
+ 0x72, 0x64, 0x42, 0x79, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x08, 0x2e,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x32, 0xf4, 0x01, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x49, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x19, 0x2e, 0x43,
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72,
+ 0x6f, 0x64, 0x75, 0x63, 0x74, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f,
+ 0x64, 0x75, 0x63, 0x74, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x55,
+ 0x73, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x75, 0x63, 0x74, 0x50, 0x61, 0x67, 0x65, 0x4c, 0x69, 0x73,
+ 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50,
+ 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e,
+ 0x0a, 0x19, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64,
+ 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x21, 0x2e, 0x6d, 0x61,
+ 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x50, 0x72, 0x6f, 0x64,
+ 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e,
+ 0x2e, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0c,
+ 0x5a, 0x0a, 0x2e, 0x2f, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6e, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_sentinel_proto_rawDescOnce sync.Once
+ file_sentinel_proto_rawDescData = file_sentinel_proto_rawDesc
+)
+
+func file_sentinel_proto_rawDescGZIP() []byte {
+ file_sentinel_proto_rawDescOnce.Do(func() {
+ file_sentinel_proto_rawDescData = protoimpl.X.CompressGZIP(file_sentinel_proto_rawDescData)
+ })
+ return file_sentinel_proto_rawDescData
+}
+
+var file_sentinel_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
+var file_sentinel_proto_goTypes = []any{
+ (*PageListRequest)(nil), // 0: PageListRequest
+ (*UserProuctPageListRequest)(nil), // 1: UserProuctPageListRequest
+ (*WhitePageListRequest)(nil), // 2: WhitePageListRequest
+ (*GetRecordByIdRequest)(nil), // 3: GetRecordByIdRequest
+ (*Whitelist)(nil), // 4: Whitelist
+ (*CreateWhitelistRequest)(nil), // 5: CreateWhitelistRequest
+ (*UpdateWhitelistRequest)(nil), // 6: UpdateWhitelistRequest
+ (*DeleteWhitelistRequest)(nil), // 7: DeleteWhitelistRequest
+ (*WhitelistResponse)(nil), // 8: WhitelistResponse
+ (*Secret)(nil), // 9: Secret
+ (*GetSecretBySecretIdRequest)(nil), // 10: GetSecretBySecretIdRequest
+ (*CreateSecretRequest)(nil), // 11: CreateSecretRequest
+ (*UpdateSecretRequest)(nil), // 12: UpdateSecretRequest
+ (*DeleteSecretRequest)(nil), // 13: DeleteSecretRequest
+ (*SecretResponse)(nil), // 14: SecretResponse
+ (*Product)(nil), // 15: Product
+ (*CreateProductRequest)(nil), // 16: CreateProductRequest
+ (*UpdateProductRequest)(nil), // 17: UpdateProductRequest
+ (*DeleteProductRequest)(nil), // 18: DeleteProductRequest
+ (*ProductResponse)(nil), // 19: ProductResponse
+ (*UserProductEmptyResponse)(nil), // 20: UserProductEmptyResponse
+ (*UserProductItem)(nil), // 21: UserProductItem
+ (*CreateUserProductRequest)(nil), // 22: CreateUserProductRequest
+ (*UpdateUserProductRequest)(nil), // 23: UpdateUserProductRequest
+ (*DeleteUserProductRequest)(nil), // 24: DeleteUserProductRequest
+ (*UserProductResponse)(nil), // 25: UserProductResponse
+ (*MatchingUserIdProductCodeRequest)(nil), // 26: matchingUserIdProductCodeRequest
+ (*MatchResponse)(nil), // 27: matchResponse
+ (*MatchWhitelistByIpRequest)(nil), // 28: MatchWhitelistByIpRequest
+}
+var file_sentinel_proto_depIdxs = []int32{
+ 4, // 0: WhitelistResponse.whitelists:type_name -> Whitelist
+ 9, // 1: SecretResponse.secrets:type_name -> Secret
+ 15, // 2: ProductResponse.products:type_name -> Product
+ 21, // 3: UserProductResponse.user_products:type_name -> UserProductItem
+ 5, // 4: whitelist.CreateWhitelist:input_type -> CreateWhitelistRequest
+ 6, // 5: whitelist.UpdateWhitelist:input_type -> UpdateWhitelistRequest
+ 7, // 6: whitelist.DeleteWhitelist:input_type -> DeleteWhitelistRequest
+ 2, // 7: whitelist.GetWhitePageList:input_type -> WhitePageListRequest
+ 28, // 8: whitelist.MatchWhitelistByIp:input_type -> MatchWhitelistByIpRequest
+ 11, // 9: secret.CreateSecret:input_type -> CreateSecretRequest
+ 3, // 10: secret.GetSecretByUserId:input_type -> GetRecordByIdRequest
+ 10, // 11: secret.GetSecretBySecretId:input_type -> GetSecretBySecretIdRequest
+ 16, // 12: product.CreateProduct:input_type -> CreateProductRequest
+ 17, // 13: product.UpdateProduct:input_type -> UpdateProductRequest
+ 18, // 14: product.DeleteProduct:input_type -> DeleteProductRequest
+ 0, // 15: product.GetProductPageList:input_type -> PageListRequest
+ 3, // 16: product.GetProductById:input_type -> GetRecordByIdRequest
+ 22, // 17: userProduct.CreateUserProduct:input_type -> CreateUserProductRequest
+ 1, // 18: userProduct.GetUserProductPageList:input_type -> UserProuctPageListRequest
+ 26, // 19: userProduct.MatchingUserIdProductCode:input_type -> matchingUserIdProductCodeRequest
+ 4, // 20: whitelist.CreateWhitelist:output_type -> Whitelist
+ 4, // 21: whitelist.UpdateWhitelist:output_type -> Whitelist
+ 4, // 22: whitelist.DeleteWhitelist:output_type -> Whitelist
+ 8, // 23: whitelist.GetWhitePageList:output_type -> WhitelistResponse
+ 27, // 24: whitelist.MatchWhitelistByIp:output_type -> matchResponse
+ 9, // 25: secret.CreateSecret:output_type -> Secret
+ 9, // 26: secret.GetSecretByUserId:output_type -> Secret
+ 9, // 27: secret.GetSecretBySecretId:output_type -> Secret
+ 15, // 28: product.CreateProduct:output_type -> Product
+ 15, // 29: product.UpdateProduct:output_type -> Product
+ 15, // 30: product.DeleteProduct:output_type -> Product
+ 19, // 31: product.GetProductPageList:output_type -> ProductResponse
+ 15, // 32: product.GetProductById:output_type -> Product
+ 20, // 33: userProduct.CreateUserProduct:output_type -> UserProductEmptyResponse
+ 25, // 34: userProduct.GetUserProductPageList:output_type -> UserProductResponse
+ 27, // 35: userProduct.MatchingUserIdProductCode:output_type -> matchResponse
+ 20, // [20:36] is the sub-list for method output_type
+ 4, // [4:20] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
+}
+
+func init() { file_sentinel_proto_init() }
+func file_sentinel_proto_init() {
+ if File_sentinel_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_sentinel_proto_msgTypes[0].Exporter = func(v any, i int) any {
+ switch v := v.(*PageListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[1].Exporter = func(v any, i int) any {
+ switch v := v.(*UserProuctPageListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[2].Exporter = func(v any, i int) any {
+ switch v := v.(*WhitePageListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[3].Exporter = func(v any, i int) any {
+ switch v := v.(*GetRecordByIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[4].Exporter = func(v any, i int) any {
+ switch v := v.(*Whitelist); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[5].Exporter = func(v any, i int) any {
+ switch v := v.(*CreateWhitelistRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[6].Exporter = func(v any, i int) any {
+ switch v := v.(*UpdateWhitelistRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[7].Exporter = func(v any, i int) any {
+ switch v := v.(*DeleteWhitelistRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[8].Exporter = func(v any, i int) any {
+ switch v := v.(*WhitelistResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[9].Exporter = func(v any, i int) any {
+ switch v := v.(*Secret); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[10].Exporter = func(v any, i int) any {
+ switch v := v.(*GetSecretBySecretIdRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[11].Exporter = func(v any, i int) any {
+ switch v := v.(*CreateSecretRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[12].Exporter = func(v any, i int) any {
+ switch v := v.(*UpdateSecretRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[13].Exporter = func(v any, i int) any {
+ switch v := v.(*DeleteSecretRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[14].Exporter = func(v any, i int) any {
+ switch v := v.(*SecretResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[15].Exporter = func(v any, i int) any {
+ switch v := v.(*Product); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[16].Exporter = func(v any, i int) any {
+ switch v := v.(*CreateProductRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[17].Exporter = func(v any, i int) any {
+ switch v := v.(*UpdateProductRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[18].Exporter = func(v any, i int) any {
+ switch v := v.(*DeleteProductRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[19].Exporter = func(v any, i int) any {
+ switch v := v.(*ProductResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[20].Exporter = func(v any, i int) any {
+ switch v := v.(*UserProductEmptyResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[21].Exporter = func(v any, i int) any {
+ switch v := v.(*UserProductItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[22].Exporter = func(v any, i int) any {
+ switch v := v.(*CreateUserProductRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[23].Exporter = func(v any, i int) any {
+ switch v := v.(*UpdateUserProductRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[24].Exporter = func(v any, i int) any {
+ switch v := v.(*DeleteUserProductRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[25].Exporter = func(v any, i int) any {
+ switch v := v.(*UserProductResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[26].Exporter = func(v any, i int) any {
+ switch v := v.(*MatchingUserIdProductCodeRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[27].Exporter = func(v any, i int) any {
+ switch v := v.(*MatchResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_sentinel_proto_msgTypes[28].Exporter = func(v any, i int) any {
+ switch v := v.(*MatchWhitelistByIpRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_sentinel_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 29,
+ NumExtensions: 0,
+ NumServices: 4,
+ },
+ GoTypes: file_sentinel_proto_goTypes,
+ DependencyIndexes: file_sentinel_proto_depIdxs,
+ MessageInfos: file_sentinel_proto_msgTypes,
+ }.Build()
+ File_sentinel_proto = out.File
+ file_sentinel_proto_rawDesc = nil
+ file_sentinel_proto_goTypes = nil
+ file_sentinel_proto_depIdxs = nil
+}
diff --git a/apps/sentinel/sentinel/sentinel_grpc.pb.go b/apps/sentinel/sentinel/sentinel_grpc.pb.go
new file mode 100644
index 0000000..7941857
--- /dev/null
+++ b/apps/sentinel/sentinel/sentinel_grpc.pb.go
@@ -0,0 +1,851 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.4.0
+// - protoc v3.19.4
+// source: sentinel.proto
+
+package sentinel
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.62.0 or later.
+const _ = grpc.SupportPackageIsVersion8
+
+const (
+ Whitelist_CreateWhitelist_FullMethodName = "/whitelist/CreateWhitelist"
+ Whitelist_UpdateWhitelist_FullMethodName = "/whitelist/UpdateWhitelist"
+ Whitelist_DeleteWhitelist_FullMethodName = "/whitelist/DeleteWhitelist"
+ Whitelist_GetWhitePageList_FullMethodName = "/whitelist/GetWhitePageList"
+ Whitelist_MatchWhitelistByIp_FullMethodName = "/whitelist/MatchWhitelistByIp"
+)
+
+// WhitelistClient is the client API for Whitelist service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+//
+// Service definitions for Whitelist, Secrets, Products, and UserProducts
+type WhitelistClient interface {
+ // Whitelist methods
+ CreateWhitelist(ctx context.Context, in *CreateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error)
+ UpdateWhitelist(ctx context.Context, in *UpdateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error)
+ DeleteWhitelist(ctx context.Context, in *DeleteWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error)
+ GetWhitePageList(ctx context.Context, in *WhitePageListRequest, opts ...grpc.CallOption) (*WhitelistResponse, error)
+ MatchWhitelistByIp(ctx context.Context, in *MatchWhitelistByIpRequest, opts ...grpc.CallOption) (*MatchResponse, error)
+}
+
+type whitelistClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewWhitelistClient(cc grpc.ClientConnInterface) WhitelistClient {
+ return &whitelistClient{cc}
+}
+
+func (c *whitelistClient) CreateWhitelist(ctx context.Context, in *CreateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Whitelist)
+ err := c.cc.Invoke(ctx, Whitelist_CreateWhitelist_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *whitelistClient) UpdateWhitelist(ctx context.Context, in *UpdateWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Whitelist)
+ err := c.cc.Invoke(ctx, Whitelist_UpdateWhitelist_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *whitelistClient) DeleteWhitelist(ctx context.Context, in *DeleteWhitelistRequest, opts ...grpc.CallOption) (*Whitelist, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Whitelist)
+ err := c.cc.Invoke(ctx, Whitelist_DeleteWhitelist_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *whitelistClient) GetWhitePageList(ctx context.Context, in *WhitePageListRequest, opts ...grpc.CallOption) (*WhitelistResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(WhitelistResponse)
+ err := c.cc.Invoke(ctx, Whitelist_GetWhitePageList_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *whitelistClient) MatchWhitelistByIp(ctx context.Context, in *MatchWhitelistByIpRequest, opts ...grpc.CallOption) (*MatchResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(MatchResponse)
+ err := c.cc.Invoke(ctx, Whitelist_MatchWhitelistByIp_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// WhitelistServer is the server API for Whitelist service.
+// All implementations must embed UnimplementedWhitelistServer
+// for forward compatibility
+//
+// Service definitions for Whitelist, Secrets, Products, and UserProducts
+type WhitelistServer interface {
+ // Whitelist methods
+ CreateWhitelist(context.Context, *CreateWhitelistRequest) (*Whitelist, error)
+ UpdateWhitelist(context.Context, *UpdateWhitelistRequest) (*Whitelist, error)
+ DeleteWhitelist(context.Context, *DeleteWhitelistRequest) (*Whitelist, error)
+ GetWhitePageList(context.Context, *WhitePageListRequest) (*WhitelistResponse, error)
+ MatchWhitelistByIp(context.Context, *MatchWhitelistByIpRequest) (*MatchResponse, error)
+ mustEmbedUnimplementedWhitelistServer()
+}
+
+// UnimplementedWhitelistServer must be embedded to have forward compatible implementations.
+type UnimplementedWhitelistServer struct {
+}
+
+func (UnimplementedWhitelistServer) CreateWhitelist(context.Context, *CreateWhitelistRequest) (*Whitelist, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateWhitelist not implemented")
+}
+func (UnimplementedWhitelistServer) UpdateWhitelist(context.Context, *UpdateWhitelistRequest) (*Whitelist, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateWhitelist not implemented")
+}
+func (UnimplementedWhitelistServer) DeleteWhitelist(context.Context, *DeleteWhitelistRequest) (*Whitelist, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteWhitelist not implemented")
+}
+func (UnimplementedWhitelistServer) GetWhitePageList(context.Context, *WhitePageListRequest) (*WhitelistResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetWhitePageList not implemented")
+}
+func (UnimplementedWhitelistServer) MatchWhitelistByIp(context.Context, *MatchWhitelistByIpRequest) (*MatchResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method MatchWhitelistByIp not implemented")
+}
+func (UnimplementedWhitelistServer) mustEmbedUnimplementedWhitelistServer() {}
+
+// UnsafeWhitelistServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to WhitelistServer will
+// result in compilation errors.
+type UnsafeWhitelistServer interface {
+ mustEmbedUnimplementedWhitelistServer()
+}
+
+func RegisterWhitelistServer(s grpc.ServiceRegistrar, srv WhitelistServer) {
+ s.RegisterService(&Whitelist_ServiceDesc, srv)
+}
+
+func _Whitelist_CreateWhitelist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateWhitelistRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WhitelistServer).CreateWhitelist(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Whitelist_CreateWhitelist_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WhitelistServer).CreateWhitelist(ctx, req.(*CreateWhitelistRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Whitelist_UpdateWhitelist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateWhitelistRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WhitelistServer).UpdateWhitelist(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Whitelist_UpdateWhitelist_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WhitelistServer).UpdateWhitelist(ctx, req.(*UpdateWhitelistRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Whitelist_DeleteWhitelist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteWhitelistRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WhitelistServer).DeleteWhitelist(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Whitelist_DeleteWhitelist_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WhitelistServer).DeleteWhitelist(ctx, req.(*DeleteWhitelistRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Whitelist_GetWhitePageList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(WhitePageListRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WhitelistServer).GetWhitePageList(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Whitelist_GetWhitePageList_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WhitelistServer).GetWhitePageList(ctx, req.(*WhitePageListRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Whitelist_MatchWhitelistByIp_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MatchWhitelistByIpRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WhitelistServer).MatchWhitelistByIp(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Whitelist_MatchWhitelistByIp_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WhitelistServer).MatchWhitelistByIp(ctx, req.(*MatchWhitelistByIpRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Whitelist_ServiceDesc is the grpc.ServiceDesc for Whitelist service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Whitelist_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "whitelist",
+ HandlerType: (*WhitelistServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateWhitelist",
+ Handler: _Whitelist_CreateWhitelist_Handler,
+ },
+ {
+ MethodName: "UpdateWhitelist",
+ Handler: _Whitelist_UpdateWhitelist_Handler,
+ },
+ {
+ MethodName: "DeleteWhitelist",
+ Handler: _Whitelist_DeleteWhitelist_Handler,
+ },
+ {
+ MethodName: "GetWhitePageList",
+ Handler: _Whitelist_GetWhitePageList_Handler,
+ },
+ {
+ MethodName: "MatchWhitelistByIp",
+ Handler: _Whitelist_MatchWhitelistByIp_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "sentinel.proto",
+}
+
+const (
+ Secret_CreateSecret_FullMethodName = "/secret/CreateSecret"
+ Secret_GetSecretByUserId_FullMethodName = "/secret/GetSecretByUserId"
+ Secret_GetSecretBySecretId_FullMethodName = "/secret/GetSecretBySecretId"
+)
+
+// SecretClient is the client API for Secret service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type SecretClient interface {
+ // Secret methods
+ CreateSecret(ctx context.Context, in *CreateSecretRequest, opts ...grpc.CallOption) (*Secret, error)
+ GetSecretByUserId(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Secret, error)
+ GetSecretBySecretId(ctx context.Context, in *GetSecretBySecretIdRequest, opts ...grpc.CallOption) (*Secret, error)
+}
+
+type secretClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewSecretClient(cc grpc.ClientConnInterface) SecretClient {
+ return &secretClient{cc}
+}
+
+func (c *secretClient) CreateSecret(ctx context.Context, in *CreateSecretRequest, opts ...grpc.CallOption) (*Secret, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Secret)
+ err := c.cc.Invoke(ctx, Secret_CreateSecret_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *secretClient) GetSecretByUserId(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Secret, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Secret)
+ err := c.cc.Invoke(ctx, Secret_GetSecretByUserId_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *secretClient) GetSecretBySecretId(ctx context.Context, in *GetSecretBySecretIdRequest, opts ...grpc.CallOption) (*Secret, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Secret)
+ err := c.cc.Invoke(ctx, Secret_GetSecretBySecretId_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// SecretServer is the server API for Secret service.
+// All implementations must embed UnimplementedSecretServer
+// for forward compatibility
+type SecretServer interface {
+ // Secret methods
+ CreateSecret(context.Context, *CreateSecretRequest) (*Secret, error)
+ GetSecretByUserId(context.Context, *GetRecordByIdRequest) (*Secret, error)
+ GetSecretBySecretId(context.Context, *GetSecretBySecretIdRequest) (*Secret, error)
+ mustEmbedUnimplementedSecretServer()
+}
+
+// UnimplementedSecretServer must be embedded to have forward compatible implementations.
+type UnimplementedSecretServer struct {
+}
+
+func (UnimplementedSecretServer) CreateSecret(context.Context, *CreateSecretRequest) (*Secret, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateSecret not implemented")
+}
+func (UnimplementedSecretServer) GetSecretByUserId(context.Context, *GetRecordByIdRequest) (*Secret, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetSecretByUserId not implemented")
+}
+func (UnimplementedSecretServer) GetSecretBySecretId(context.Context, *GetSecretBySecretIdRequest) (*Secret, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetSecretBySecretId not implemented")
+}
+func (UnimplementedSecretServer) mustEmbedUnimplementedSecretServer() {}
+
+// UnsafeSecretServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to SecretServer will
+// result in compilation errors.
+type UnsafeSecretServer interface {
+ mustEmbedUnimplementedSecretServer()
+}
+
+func RegisterSecretServer(s grpc.ServiceRegistrar, srv SecretServer) {
+ s.RegisterService(&Secret_ServiceDesc, srv)
+}
+
+func _Secret_CreateSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateSecretRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SecretServer).CreateSecret(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Secret_CreateSecret_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SecretServer).CreateSecret(ctx, req.(*CreateSecretRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Secret_GetSecretByUserId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetRecordByIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SecretServer).GetSecretByUserId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Secret_GetSecretByUserId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SecretServer).GetSecretByUserId(ctx, req.(*GetRecordByIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Secret_GetSecretBySecretId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetSecretBySecretIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SecretServer).GetSecretBySecretId(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Secret_GetSecretBySecretId_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SecretServer).GetSecretBySecretId(ctx, req.(*GetSecretBySecretIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Secret_ServiceDesc is the grpc.ServiceDesc for Secret service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Secret_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "secret",
+ HandlerType: (*SecretServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateSecret",
+ Handler: _Secret_CreateSecret_Handler,
+ },
+ {
+ MethodName: "GetSecretByUserId",
+ Handler: _Secret_GetSecretByUserId_Handler,
+ },
+ {
+ MethodName: "GetSecretBySecretId",
+ Handler: _Secret_GetSecretBySecretId_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "sentinel.proto",
+}
+
+const (
+ Product_CreateProduct_FullMethodName = "/product/CreateProduct"
+ Product_UpdateProduct_FullMethodName = "/product/UpdateProduct"
+ Product_DeleteProduct_FullMethodName = "/product/DeleteProduct"
+ Product_GetProductPageList_FullMethodName = "/product/GetProductPageList"
+ Product_GetProductById_FullMethodName = "/product/GetProductById"
+)
+
+// ProductClient is the client API for Product service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ProductClient interface {
+ // Product methods
+ CreateProduct(ctx context.Context, in *CreateProductRequest, opts ...grpc.CallOption) (*Product, error)
+ UpdateProduct(ctx context.Context, in *UpdateProductRequest, opts ...grpc.CallOption) (*Product, error)
+ DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*Product, error)
+ GetProductPageList(ctx context.Context, in *PageListRequest, opts ...grpc.CallOption) (*ProductResponse, error)
+ GetProductById(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Product, error)
+}
+
+type productClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewProductClient(cc grpc.ClientConnInterface) ProductClient {
+ return &productClient{cc}
+}
+
+func (c *productClient) CreateProduct(ctx context.Context, in *CreateProductRequest, opts ...grpc.CallOption) (*Product, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Product)
+ err := c.cc.Invoke(ctx, Product_CreateProduct_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *productClient) UpdateProduct(ctx context.Context, in *UpdateProductRequest, opts ...grpc.CallOption) (*Product, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Product)
+ err := c.cc.Invoke(ctx, Product_UpdateProduct_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *productClient) DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*Product, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Product)
+ err := c.cc.Invoke(ctx, Product_DeleteProduct_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *productClient) GetProductPageList(ctx context.Context, in *PageListRequest, opts ...grpc.CallOption) (*ProductResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(ProductResponse)
+ err := c.cc.Invoke(ctx, Product_GetProductPageList_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *productClient) GetProductById(ctx context.Context, in *GetRecordByIdRequest, opts ...grpc.CallOption) (*Product, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Product)
+ err := c.cc.Invoke(ctx, Product_GetProductById_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ProductServer is the server API for Product service.
+// All implementations must embed UnimplementedProductServer
+// for forward compatibility
+type ProductServer interface {
+ // Product methods
+ CreateProduct(context.Context, *CreateProductRequest) (*Product, error)
+ UpdateProduct(context.Context, *UpdateProductRequest) (*Product, error)
+ DeleteProduct(context.Context, *DeleteProductRequest) (*Product, error)
+ GetProductPageList(context.Context, *PageListRequest) (*ProductResponse, error)
+ GetProductById(context.Context, *GetRecordByIdRequest) (*Product, error)
+ mustEmbedUnimplementedProductServer()
+}
+
+// UnimplementedProductServer must be embedded to have forward compatible implementations.
+type UnimplementedProductServer struct {
+}
+
+func (UnimplementedProductServer) CreateProduct(context.Context, *CreateProductRequest) (*Product, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateProduct not implemented")
+}
+func (UnimplementedProductServer) UpdateProduct(context.Context, *UpdateProductRequest) (*Product, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateProduct not implemented")
+}
+func (UnimplementedProductServer) DeleteProduct(context.Context, *DeleteProductRequest) (*Product, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteProduct not implemented")
+}
+func (UnimplementedProductServer) GetProductPageList(context.Context, *PageListRequest) (*ProductResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetProductPageList not implemented")
+}
+func (UnimplementedProductServer) GetProductById(context.Context, *GetRecordByIdRequest) (*Product, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetProductById not implemented")
+}
+func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {}
+
+// UnsafeProductServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ProductServer will
+// result in compilation errors.
+type UnsafeProductServer interface {
+ mustEmbedUnimplementedProductServer()
+}
+
+func RegisterProductServer(s grpc.ServiceRegistrar, srv ProductServer) {
+ s.RegisterService(&Product_ServiceDesc, srv)
+}
+
+func _Product_CreateProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateProductRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ProductServer).CreateProduct(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Product_CreateProduct_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ProductServer).CreateProduct(ctx, req.(*CreateProductRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Product_UpdateProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateProductRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ProductServer).UpdateProduct(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Product_UpdateProduct_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ProductServer).UpdateProduct(ctx, req.(*UpdateProductRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Product_DeleteProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteProductRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ProductServer).DeleteProduct(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Product_DeleteProduct_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ProductServer).DeleteProduct(ctx, req.(*DeleteProductRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Product_GetProductPageList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(PageListRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ProductServer).GetProductPageList(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Product_GetProductPageList_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ProductServer).GetProductPageList(ctx, req.(*PageListRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Product_GetProductById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetRecordByIdRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ProductServer).GetProductById(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Product_GetProductById_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ProductServer).GetProductById(ctx, req.(*GetRecordByIdRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Product_ServiceDesc is the grpc.ServiceDesc for Product service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Product_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "product",
+ HandlerType: (*ProductServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateProduct",
+ Handler: _Product_CreateProduct_Handler,
+ },
+ {
+ MethodName: "UpdateProduct",
+ Handler: _Product_UpdateProduct_Handler,
+ },
+ {
+ MethodName: "DeleteProduct",
+ Handler: _Product_DeleteProduct_Handler,
+ },
+ {
+ MethodName: "GetProductPageList",
+ Handler: _Product_GetProductPageList_Handler,
+ },
+ {
+ MethodName: "GetProductById",
+ Handler: _Product_GetProductById_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "sentinel.proto",
+}
+
+const (
+ UserProduct_CreateUserProduct_FullMethodName = "/userProduct/CreateUserProduct"
+ UserProduct_GetUserProductPageList_FullMethodName = "/userProduct/GetUserProductPageList"
+ UserProduct_MatchingUserIdProductCode_FullMethodName = "/userProduct/MatchingUserIdProductCode"
+)
+
+// UserProductClient is the client API for UserProduct service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type UserProductClient interface {
+ // UserProduct methods
+ CreateUserProduct(ctx context.Context, in *CreateUserProductRequest, opts ...grpc.CallOption) (*UserProductEmptyResponse, error)
+ GetUserProductPageList(ctx context.Context, in *UserProuctPageListRequest, opts ...grpc.CallOption) (*UserProductResponse, error)
+ MatchingUserIdProductCode(ctx context.Context, in *MatchingUserIdProductCodeRequest, opts ...grpc.CallOption) (*MatchResponse, error)
+}
+
+type userProductClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewUserProductClient(cc grpc.ClientConnInterface) UserProductClient {
+ return &userProductClient{cc}
+}
+
+func (c *userProductClient) CreateUserProduct(ctx context.Context, in *CreateUserProductRequest, opts ...grpc.CallOption) (*UserProductEmptyResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UserProductEmptyResponse)
+ err := c.cc.Invoke(ctx, UserProduct_CreateUserProduct_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *userProductClient) GetUserProductPageList(ctx context.Context, in *UserProuctPageListRequest, opts ...grpc.CallOption) (*UserProductResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UserProductResponse)
+ err := c.cc.Invoke(ctx, UserProduct_GetUserProductPageList_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *userProductClient) MatchingUserIdProductCode(ctx context.Context, in *MatchingUserIdProductCodeRequest, opts ...grpc.CallOption) (*MatchResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(MatchResponse)
+ err := c.cc.Invoke(ctx, UserProduct_MatchingUserIdProductCode_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// UserProductServer is the server API for UserProduct service.
+// All implementations must embed UnimplementedUserProductServer
+// for forward compatibility
+type UserProductServer interface {
+ // UserProduct methods
+ CreateUserProduct(context.Context, *CreateUserProductRequest) (*UserProductEmptyResponse, error)
+ GetUserProductPageList(context.Context, *UserProuctPageListRequest) (*UserProductResponse, error)
+ MatchingUserIdProductCode(context.Context, *MatchingUserIdProductCodeRequest) (*MatchResponse, error)
+ mustEmbedUnimplementedUserProductServer()
+}
+
+// UnimplementedUserProductServer must be embedded to have forward compatible implementations.
+type UnimplementedUserProductServer struct {
+}
+
+func (UnimplementedUserProductServer) CreateUserProduct(context.Context, *CreateUserProductRequest) (*UserProductEmptyResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateUserProduct not implemented")
+}
+func (UnimplementedUserProductServer) GetUserProductPageList(context.Context, *UserProuctPageListRequest) (*UserProductResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetUserProductPageList not implemented")
+}
+func (UnimplementedUserProductServer) MatchingUserIdProductCode(context.Context, *MatchingUserIdProductCodeRequest) (*MatchResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method MatchingUserIdProductCode not implemented")
+}
+func (UnimplementedUserProductServer) mustEmbedUnimplementedUserProductServer() {}
+
+// UnsafeUserProductServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to UserProductServer will
+// result in compilation errors.
+type UnsafeUserProductServer interface {
+ mustEmbedUnimplementedUserProductServer()
+}
+
+func RegisterUserProductServer(s grpc.ServiceRegistrar, srv UserProductServer) {
+ s.RegisterService(&UserProduct_ServiceDesc, srv)
+}
+
+func _UserProduct_CreateUserProduct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CreateUserProductRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserProductServer).CreateUserProduct(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserProduct_CreateUserProduct_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserProductServer).CreateUserProduct(ctx, req.(*CreateUserProductRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _UserProduct_GetUserProductPageList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UserProuctPageListRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserProductServer).GetUserProductPageList(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserProduct_GetUserProductPageList_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserProductServer).GetUserProductPageList(ctx, req.(*UserProuctPageListRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _UserProduct_MatchingUserIdProductCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(MatchingUserIdProductCodeRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserProductServer).MatchingUserIdProductCode(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: UserProduct_MatchingUserIdProductCode_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserProductServer).MatchingUserIdProductCode(ctx, req.(*MatchingUserIdProductCodeRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// UserProduct_ServiceDesc is the grpc.ServiceDesc for UserProduct service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var UserProduct_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "userProduct",
+ HandlerType: (*UserProductServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "CreateUserProduct",
+ Handler: _UserProduct_CreateUserProduct_Handler,
+ },
+ {
+ MethodName: "GetUserProductPageList",
+ Handler: _UserProduct_GetUserProductPageList_Handler,
+ },
+ {
+ MethodName: "MatchingUserIdProductCode",
+ Handler: _UserProduct_MatchingUserIdProductCode_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "sentinel.proto",
+}
diff --git a/apps/user/Dockerfile b/apps/user/Dockerfile
new file mode 100644
index 0000000..95b56c1
--- /dev/null
+++ b/apps/user/Dockerfile
@@ -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/user/etc /app/etc
+RUN go build -ldflags="-s -w" -o /app/user apps/user/.\user.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/user /app/user
+COPY --from=builder /app/etc /app/etc
+
+CMD ["./user", "-f", "etc/user.yaml"]
diff --git a/apps/user/client/auth/auth.go b/apps/user/client/auth/auth.go
new file mode 100644
index 0000000..d859268
--- /dev/null
+++ b/apps/user/client/auth/auth.go
@@ -0,0 +1,68 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: user.proto
+
+package auth
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ EmptyResponse = user.EmptyResponse
+ EnterpriseAuthReq = user.EnterpriseAuthReq
+ EnterpriseItem = user.EnterpriseItem
+ GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq
+ GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp
+ GetPendingEnterpriseReq = user.GetPendingEnterpriseReq
+ GetPendingEnterpriseResp = user.GetPendingEnterpriseResp
+ LoginReq = user.LoginReq
+ LoginResp = user.LoginResp
+ PhoneLoginReq = user.PhoneLoginReq
+ RegisterReq = user.RegisterReq
+ ReviewEnterpriseReq = user.ReviewEnterpriseReq
+ UserInfoReq = user.UserInfoReq
+ UserInfoResp = user.UserInfoResp
+
+ Auth interface {
+ // 注册接口
+ RegisterUser(ctx context.Context, in *RegisterReq, opts ...grpc.CallOption) (*EmptyResponse, error)
+ // 登录接口
+ LoginUser(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
+ // 手机登录接口
+ PhoneLoginUser(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*LoginResp, error)
+ }
+
+ defaultAuth struct {
+ cli zrpc.Client
+ }
+)
+
+func NewAuth(cli zrpc.Client) Auth {
+ return &defaultAuth{
+ cli: cli,
+ }
+}
+
+// 注册接口
+func (m *defaultAuth) RegisterUser(ctx context.Context, in *RegisterReq, opts ...grpc.CallOption) (*EmptyResponse, error) {
+ client := user.NewAuthClient(m.cli.Conn())
+ return client.RegisterUser(ctx, in, opts...)
+}
+
+// 登录接口
+func (m *defaultAuth) LoginUser(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
+ client := user.NewAuthClient(m.cli.Conn())
+ return client.LoginUser(ctx, in, opts...)
+}
+
+// 手机登录接口
+func (m *defaultAuth) PhoneLoginUser(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
+ client := user.NewAuthClient(m.cli.Conn())
+ return client.PhoneLoginUser(ctx, in, opts...)
+}
diff --git a/apps/user/client/enterprise/enterprise.go b/apps/user/client/enterprise/enterprise.go
new file mode 100644
index 0000000..b38ac6f
--- /dev/null
+++ b/apps/user/client/enterprise/enterprise.go
@@ -0,0 +1,68 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: user.proto
+
+package enterprise
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ EmptyResponse = user.EmptyResponse
+ EnterpriseAuthReq = user.EnterpriseAuthReq
+ EnterpriseItem = user.EnterpriseItem
+ GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq
+ GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp
+ GetPendingEnterpriseReq = user.GetPendingEnterpriseReq
+ GetPendingEnterpriseResp = user.GetPendingEnterpriseResp
+ LoginReq = user.LoginReq
+ LoginResp = user.LoginResp
+ PhoneLoginReq = user.PhoneLoginReq
+ RegisterReq = user.RegisterReq
+ ReviewEnterpriseReq = user.ReviewEnterpriseReq
+ UserInfoReq = user.UserInfoReq
+ UserInfoResp = user.UserInfoResp
+
+ Enterprise interface {
+ // 获取待审核企业列表
+ GetPendingEnterprise(ctx context.Context, in *GetPendingEnterpriseReq, opts ...grpc.CallOption) (*GetPendingEnterpriseResp, error)
+ // 审核企业
+ ReviewEnterprise(ctx context.Context, in *ReviewEnterpriseReq, opts ...grpc.CallOption) (*EmptyResponse, error)
+ // 提交审核
+ CreateEnterpriseAuth(ctx context.Context, in *EnterpriseAuthReq, opts ...grpc.CallOption) (*EmptyResponse, error)
+ }
+
+ defaultEnterprise struct {
+ cli zrpc.Client
+ }
+)
+
+func NewEnterprise(cli zrpc.Client) Enterprise {
+ return &defaultEnterprise{
+ cli: cli,
+ }
+}
+
+// 获取待审核企业列表
+func (m *defaultEnterprise) GetPendingEnterprise(ctx context.Context, in *GetPendingEnterpriseReq, opts ...grpc.CallOption) (*GetPendingEnterpriseResp, error) {
+ client := user.NewEnterpriseClient(m.cli.Conn())
+ return client.GetPendingEnterprise(ctx, in, opts...)
+}
+
+// 审核企业
+func (m *defaultEnterprise) ReviewEnterprise(ctx context.Context, in *ReviewEnterpriseReq, opts ...grpc.CallOption) (*EmptyResponse, error) {
+ client := user.NewEnterpriseClient(m.cli.Conn())
+ return client.ReviewEnterprise(ctx, in, opts...)
+}
+
+// 提交审核
+func (m *defaultEnterprise) CreateEnterpriseAuth(ctx context.Context, in *EnterpriseAuthReq, opts ...grpc.CallOption) (*EmptyResponse, error) {
+ client := user.NewEnterpriseClient(m.cli.Conn())
+ return client.CreateEnterpriseAuth(ctx, in, opts...)
+}
diff --git a/apps/user/client/user/user.go b/apps/user/client/user/user.go
new file mode 100644
index 0000000..d6449fb
--- /dev/null
+++ b/apps/user/client/user/user.go
@@ -0,0 +1,58 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: user.proto
+
+package user
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ EmptyResponse = user.EmptyResponse
+ EnterpriseAuthReq = user.EnterpriseAuthReq
+ EnterpriseItem = user.EnterpriseItem
+ GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq
+ GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp
+ GetPendingEnterpriseReq = user.GetPendingEnterpriseReq
+ GetPendingEnterpriseResp = user.GetPendingEnterpriseResp
+ LoginReq = user.LoginReq
+ LoginResp = user.LoginResp
+ PhoneLoginReq = user.PhoneLoginReq
+ RegisterReq = user.RegisterReq
+ ReviewEnterpriseReq = user.ReviewEnterpriseReq
+ UserInfoReq = user.UserInfoReq
+ UserInfoResp = user.UserInfoResp
+
+ User interface {
+ // 获取用户信息
+ UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*UserInfoResp, error)
+ GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpriseAuthStatusReq, opts ...grpc.CallOption) (*GetEnterpriseAuthStatusResp, error)
+ }
+
+ defaultUser struct {
+ cli zrpc.Client
+ }
+)
+
+func NewUser(cli zrpc.Client) User {
+ return &defaultUser{
+ cli: cli,
+ }
+}
+
+// 获取用户信息
+func (m *defaultUser) UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*UserInfoResp, error) {
+ client := user.NewUserClient(m.cli.Conn())
+ return client.UserInfo(ctx, in, opts...)
+}
+
+func (m *defaultUser) GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpriseAuthStatusReq, opts ...grpc.CallOption) (*GetEnterpriseAuthStatusResp, error) {
+ client := user.NewUserClient(m.cli.Conn())
+ return client.GetEnterpriseAuthStatus(ctx, in, opts...)
+}
diff --git a/apps/user/etc/user.yaml b/apps/user/etc/user.yaml
new file mode 100644
index 0000000..4e0800a
--- /dev/null
+++ b/apps/user/etc/user.yaml
@@ -0,0 +1,19 @@
+Name: user.rpc
+ListenOn: 0.0.0.0:11001
+Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: user.rpc
+DataSource: "tianyuanapi:g3h98u0291j@tcp(127.0.0.1:3307)/tianyuanapi?charset=utf8mb4&parseTime=True&loc=Local"
+AuthJWT:
+ AccessSecret: "Mf5Xph3PoyKzVpRw0Zy1+X4uR/tM7JvGMEV/5p2M/tU="
+ AccessExpire: 86400 # JWT过期时间
+CacheRedis:
+ - Host: "127.0.0.1:6379"
+ Pass: "" # Redis 密码,如果未设置则留空
+ Type: "node" # 单节点模式
+SentinelRpc:
+ Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: sentinel.rpc
\ No newline at end of file
diff --git a/apps/user/internal/config/config.go b/apps/user/internal/config/config.go
new file mode 100644
index 0000000..2fd8fb9
--- /dev/null
+++ b/apps/user/internal/config/config.go
@@ -0,0 +1,20 @@
+package config
+
+import (
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/zrpc"
+)
+
+type Config struct {
+ zrpc.RpcServerConf
+ AuthJWT AuthConfig // JWT 鉴权相关配置
+ DataSource string // 数据库连接的 DSN 字符串
+ CacheRedis cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体
+ SentinelRpc zrpc.RpcClientConf
+}
+
+// AuthConfig 用于 JWT 鉴权配置
+type AuthConfig struct {
+ AccessSecret string // JWT 密钥,用于签发 Token
+ AccessExpire int64 // Token 过期时间,单位为秒
+}
diff --git a/apps/user/internal/logic/auth/loginuserlogic.go b/apps/user/internal/logic/auth/loginuserlogic.go
new file mode 100644
index 0000000..64c2764
--- /dev/null
+++ b/apps/user/internal/logic/auth/loginuserlogic.go
@@ -0,0 +1,60 @@
+package authlogic
+
+import (
+ "context"
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ jwtx "tianyuan-api/pkg/jwt"
+
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type LoginUserLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewLoginUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LoginUserLogic {
+ return &LoginUserLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// 登录接口
+func (l *LoginUserLogic) LoginUser(in *user.LoginReq) (*user.LoginResp, error) {
+ if in.Username == "" || in.Password == "" {
+ return nil, errors.New("用户名或密码不能为空")
+ }
+ // 使用 FindOneByUsername 查找用户
+ users, err := l.svcCtx.UserModel.FindOneByUsername(l.ctx, in.Username)
+ if err != nil {
+ return nil, errors.New("用户未注册")
+ }
+
+ // 验证密码
+ if hashPassword(in.Password) != users.Password {
+ return nil, errors.New("密码错误")
+ }
+
+ // 生成 JWT token,调用封装好的函数
+ token, err := jwtx.GenerateJwtToken(users.Id, l.svcCtx.Config.AuthJWT.AccessSecret, l.svcCtx.Config.AuthJWT.AccessExpire)
+ if err != nil {
+ return nil, err
+ }
+
+ return &user.LoginResp{
+ Token: token,
+ }, nil
+}
+func hashPassword(password string) string {
+ h := sha256.New()
+ h.Write([]byte(password))
+ return hex.EncodeToString(h.Sum(nil))
+}
diff --git a/apps/user/internal/logic/auth/phoneloginuserlogic.go b/apps/user/internal/logic/auth/phoneloginuserlogic.go
new file mode 100644
index 0000000..3a11d0a
--- /dev/null
+++ b/apps/user/internal/logic/auth/phoneloginuserlogic.go
@@ -0,0 +1,62 @@
+package authlogic
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ jwtx "tianyuan-api/pkg/jwt"
+
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type PhoneLoginUserLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewPhoneLoginUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PhoneLoginUserLogic {
+ return &PhoneLoginUserLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// 手机登录接口
+func (l *PhoneLoginUserLogic) PhoneLoginUser(in *user.PhoneLoginReq) (*user.LoginResp, error) {
+ // 从 Redis 获取验证码
+ savedCode, err := l.svcCtx.Redis.Get(fmt.Sprintf("login:%s", in.Phone))
+ if err != nil {
+ if errors.Is(err, redis.Nil) {
+ return nil, errors.New("验证码已过期")
+ }
+ return nil, err
+ }
+
+ // 验证码不匹配
+ if savedCode != in.Code {
+ return nil, errors.New("验证码不正确")
+ }
+ // 查询用户是否存在,如果不存在则注册新用户
+ users, err := l.svcCtx.UserModel.FindOneByPhone(l.ctx, in.Phone)
+ if errors.Is(err, sqlx.ErrNotFound) {
+ return nil, errors.New("手机号未注册")
+ } else if err != nil {
+ return nil, err
+ }
+
+ token, err := jwtx.GenerateJwtToken(users.Id, l.svcCtx.Config.AuthJWT.AccessSecret, l.svcCtx.Config.AuthJWT.AccessExpire)
+ if err != nil {
+ return nil, err
+ }
+
+ return &user.LoginResp{
+ Token: token,
+ }, nil
+}
diff --git a/apps/user/internal/logic/auth/registeruserlogic.go b/apps/user/internal/logic/auth/registeruserlogic.go
new file mode 100644
index 0000000..8507729
--- /dev/null
+++ b/apps/user/internal/logic/auth/registeruserlogic.go
@@ -0,0 +1,136 @@
+package authlogic
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "tianyuan-api/apps/user/internal/model"
+ "regexp"
+ "strings"
+
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type RegisterUserLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewRegisterUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegisterUserLogic {
+ return &RegisterUserLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// 注册接口
+func (l *RegisterUserLogic) RegisterUser(in *user.RegisterReq) (*user.EmptyResponse, error) {
+ // 检查密码是否一致
+ if in.Password != in.ConfirmPassword {
+ return nil, errors.New("密码不一致")
+ }
+ // 检查密码强度
+ if err := checkPasswordStrength(in.Password); err != nil {
+ return nil, err
+ }
+ // 校验手机号码
+ err := validatePhoneNumber(in.Phone)
+ if err != nil {
+ return nil, err
+ }
+ // 从 Redis 获取验证码
+ savedCode, err := l.svcCtx.Redis.Get(fmt.Sprintf("register:%s", in.Phone))
+ if err != nil {
+ if errors.Is(err, redis.Nil) {
+ return nil, errors.New("验证码已过期")
+ }
+ return nil, err
+ }
+
+ // 验证码不匹配
+ if savedCode != in.Code {
+ return nil, errors.New("验证码不正确")
+ }
+ // 检查用户名是否已经存在
+ existingUser, err := l.svcCtx.UserModel.FindOneByUsername(l.ctx, in.Username)
+ if err != nil && err != sqlc.ErrNotFound {
+ // 如果发生其他错误,返回错误
+ return nil, err
+ }
+ if existingUser != nil {
+ // 用户名已经存在,返回错误
+ return nil, errors.New("用户名已存在,请选择其他用户名")
+ }
+
+ // 检查手机号是否已经存在
+ existingPhone, err := l.svcCtx.UserModel.FindOneByPhone(l.ctx, in.Phone)
+ if err != nil && err != sqlc.ErrNotFound {
+ // 如果发生其他错误,返回错误
+ return nil, err
+ }
+ if existingPhone != nil {
+ // 用户名已经存在,返回错误
+ return nil, errors.New("手机号码已存在,请选择其他用户名")
+ }
+ // 加密密码
+ hashedPassword := hashPassword(in.Password)
+
+ // 构建 Users 结构体
+ users := &model.Users{
+ Username: in.Username,
+ Password: hashedPassword,
+ Phone: in.Phone,
+ AuthStatus: "unverified",
+ }
+
+ // 调用 Insert 方法插入用户数据
+ _, err = l.svcCtx.UserModel.Insert(l.ctx, users)
+ if err != nil {
+ return nil, err
+ }
+
+ return &user.EmptyResponse{}, nil
+}
+
+// 密码强度检查
+func checkPasswordStrength(password string) error {
+ // 检查密码长度是否不少于8位
+ if len(password) < 8 {
+ return errors.New("密码长度不能少于8位")
+ }
+
+ // 检查密码是否为简单重复的字符(如"11111111" 或 "aaaaaaaa"等)
+ firstChar := password[0]
+ if strings.Count(password, string(firstChar)) == len(password) {
+ return errors.New("密码不能是重复的字符")
+ }
+
+ // 正则表达式:密码必须包含数字或字母,不能是全符号
+ var passwordRegex = `^[A-Za-z0-9]+$`
+ match, _ := regexp.MatchString(passwordRegex, password)
+ if !match {
+ return errors.New("密码只能包含字母和数字")
+ }
+
+ return nil
+}
+
+// 校验手机号码的函数
+func validatePhoneNumber(phone string) error {
+ // 定义正则表达式,匹配中国大陆的手机号格式
+ var phoneRegex = `^1[3-9]\d{9}$`
+
+ // 检查手机号是否匹配正则表达式
+ match, _ := regexp.MatchString(phoneRegex, phone)
+ if !match {
+ return errors.New("手机号码格式不正确")
+ }
+ return nil
+}
diff --git a/apps/user/internal/logic/enterprise/createenterpriseauthlogic.go b/apps/user/internal/logic/enterprise/createenterpriseauthlogic.go
new file mode 100644
index 0000000..dd84a2b
--- /dev/null
+++ b/apps/user/internal/logic/enterprise/createenterpriseauthlogic.go
@@ -0,0 +1,67 @@
+package enterpriselogic
+
+import (
+ "context"
+ "errors"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "tianyuan-api/apps/user/internal/model"
+
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateEnterpriseAuthLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewCreateEnterpriseAuthLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateEnterpriseAuthLogic {
+ return &CreateEnterpriseAuthLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *CreateEnterpriseAuthLogic) CreateEnterpriseAuth(in *user.EnterpriseAuthReq) (*user.EmptyResponse, error) {
+
+ users, err := l.svcCtx.UserModel.FindOne(l.ctx, in.UserId)
+ if err != nil || users == nil {
+ return nil, errors.New("查询用户错误")
+ }
+
+ if users.AuthStatus == "approved" || users.AuthStatus == "pending" {
+ return nil, errors.New("当前企业认证已审核通过或正在审核中,无法重复认证")
+ }
+
+ // 构建企业认证对象
+ var enterpriseAuth model.EnterpriseAuth
+ enterpriseAuth.UserId = in.UserId
+ enterpriseAuth.EnterpriseName = in.EnterpriseName
+ enterpriseAuth.EnterpriseContact = in.EnterpriseContact
+ enterpriseAuth.AuthStatus = "pending"
+ enterpriseAuth.BusinessLicense = in.BusinessLicense
+ enterpriseAuth.LegalPerson = in.LegalPerson
+ enterpriseAuth.CreditCode = in.CreditCode
+ users.AuthStatus = "pending"
+ // 使用事务更新企业认证和用户认证状态
+ err = l.svcCtx.EnterpriseAuthModel.TransCtx(l.ctx, func(ctx context.Context, session sqlx.Session) error {
+ // 插入和更新操作放在事务中
+ if _, err := l.svcCtx.EnterpriseAuthModel.InsertEnterpriseAuthTrans(ctx, &enterpriseAuth, session); err != nil {
+ return err
+ }
+ _, err = l.svcCtx.UserModel.UpdateUserTrans(ctx, users, session)
+ if err != nil {
+ return err
+ }
+ return nil
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ return &user.EmptyResponse{}, nil
+}
diff --git a/apps/user/internal/logic/enterprise/getpendingenterpriselogic.go b/apps/user/internal/logic/enterprise/getpendingenterpriselogic.go
new file mode 100644
index 0000000..3ebf5d7
--- /dev/null
+++ b/apps/user/internal/logic/enterprise/getpendingenterpriselogic.go
@@ -0,0 +1,54 @@
+package enterpriselogic
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetPendingEnterpriseLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetPendingEnterpriseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetPendingEnterpriseLogic {
+ return &GetPendingEnterpriseLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// 获取待审核企业列表
+func (l *GetPendingEnterpriseLogic) GetPendingEnterprise() (*user.GetPendingEnterpriseResp, error) {
+ // 调用 Model 层获取待审核企业列表
+ enterprises, total, err := l.svcCtx.EnterpriseAuthModel.FindPendingList(l.ctx, in.Page, in.PageSize)
+ if err != nil {
+ return nil, err
+ }
+
+ // 构造返回的企业列表
+ var list []*user.EnterpriseItem
+ for _, e := range enterprises {
+ list = append(list, &user.EnterpriseItem{
+ Id: e.Id,
+ EnterpriseName: e.EnterpriseName,
+ CreditCode: e.CreditCode,
+ LegalPerson: e.LegalPerson,
+ EnterpriseContact: e.EnterpriseContact,
+ AuthStatus: e.AuthStatus,
+ BusinessLicense: e.BusinessLicense,
+ CreatedAt: e.CreatedAt.Format("2006-01-02 15:04:05"),
+ UpdatedAt: e.UpdatedAt.Format("2006-01-02 15:04:05"),
+ })
+ }
+
+ return &user.GetPendingEnterpriseResp{
+ Total: total,
+ List: list,
+ }, nil
+}
diff --git a/apps/user/internal/logic/enterprise/reviewenterpriselogic.go b/apps/user/internal/logic/enterprise/reviewenterpriselogic.go
new file mode 100644
index 0000000..e120386
--- /dev/null
+++ b/apps/user/internal/logic/enterprise/reviewenterpriselogic.go
@@ -0,0 +1,91 @@
+package enterpriselogic
+
+import (
+ "context"
+ "errors"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "tianyuan-api/apps/sentinel/client/secret"
+ "tianyuan-api/apps/user/internal/model"
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type ReviewEnterpriseLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewReviewEnterpriseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReviewEnterpriseLogic {
+ return &ReviewEnterpriseLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// 审核企业
+func (l *ReviewEnterpriseLogic) ReviewEnterprise(in *user.ReviewEnterpriseReq) (*user.EmptyResponse, error) {
+ enterpriseAuth, err := l.svcCtx.EnterpriseAuthModel.FindOne(l.ctx, in.EnterpriseId)
+ if err != nil {
+ return nil, err
+ }
+ if enterpriseAuth == nil {
+ return nil, errors.New("无ID相关认证")
+ }
+ if enterpriseAuth.AuthStatus != "pending" {
+ return nil, errors.New("该认证不需要审核")
+ }
+ enterpriseAuth.AuthStatus = in.Status
+ err = l.svcCtx.EnterpriseAuthModel.TransCtx(l.ctx, func(ctx context.Context, session sqlx.Session) error {
+ // 更新 EnterpriseAuth
+ _, updateAuthErr := l.svcCtx.EnterpriseAuthModel.UpdateEnterpriseAuthTrans(ctx, enterpriseAuth, session)
+ if updateAuthErr != nil {
+ return updateAuthErr
+ }
+
+ // 查询用户信息
+ users, findUserErr := l.svcCtx.UserModel.FindOneTrans(l.ctx, enterpriseAuth.UserId, session)
+ if findUserErr != nil {
+ return findUserErr
+ }
+ users.AuthStatus = in.Status
+ // 更新用户信息
+ _, updateUserErr := l.svcCtx.UserModel.UpdateUserTrans(ctx, users, session)
+ if updateUserErr != nil {
+ return updateUserErr
+ }
+
+ if in.Status == "approved" {
+ //审核通过
+ var enterpriseInfo = model.EnterpriseInfo{
+ UserId: enterpriseAuth.UserId,
+ EnterpriseName: enterpriseAuth.EnterpriseName,
+ EnterpriseContact: enterpriseAuth.EnterpriseContact,
+ CreditCode: enterpriseAuth.CreditCode,
+ LegalPerson: enterpriseAuth.LegalPerson,
+ BusinessLicense: enterpriseAuth.BusinessLicense,
+ }
+ _, insertEnterpriseErr := l.svcCtx.EnterpriseModel.InsertEnterpriseInfoTrans(l.ctx, &enterpriseInfo, session)
+ if insertEnterpriseErr != nil {
+ return insertEnterpriseErr
+ }
+
+ _, createSecretErr := l.svcCtx.SecretRpc.CreateSecret(l.ctx, &secret.CreateSecretRequest{
+ UserId: enterpriseAuth.UserId,
+ })
+ if err != nil {
+ return createSecretErr
+ }
+ }
+
+ return nil
+ })
+
+ if err != nil {
+ return nil, err
+ }
+ return &user.EmptyResponse{}, nil
+}
diff --git a/apps/user/internal/logic/user/getenterpriseauthstatuslogic.go b/apps/user/internal/logic/user/getenterpriseauthstatuslogic.go
new file mode 100644
index 0000000..1fb7085
--- /dev/null
+++ b/apps/user/internal/logic/user/getenterpriseauthstatuslogic.go
@@ -0,0 +1,48 @@
+package userlogic
+
+import (
+ "context"
+ "errors"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetEnterpriseAuthStatusLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewGetEnterpriseAuthStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEnterpriseAuthStatusLogic {
+ return &GetEnterpriseAuthStatusLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+func (l *GetEnterpriseAuthStatusLogic) GetEnterpriseAuthStatus(in *user.GetEnterpriseAuthStatusReq) (*user.GetEnterpriseAuthStatusResp, error) {
+ // 查询企业信息
+ enterprise, err := l.svcCtx.EnterpriseModel.FindOneByUserId(l.ctx, in.UserId)
+ if err != nil {
+ if errors.Is(err, sqlc.ErrNotFound) {
+ return &user.GetEnterpriseAuthStatusResp{
+ IsAuth: false,
+ }, nil
+ }
+ return nil, err
+ }
+
+ if enterprise == nil {
+ return &user.GetEnterpriseAuthStatusResp{
+ IsAuth: false,
+ }, nil
+ }
+ return &user.GetEnterpriseAuthStatusResp{
+ IsAuth: true,
+ }, nil
+}
diff --git a/apps/user/internal/logic/user/userinfologic.go b/apps/user/internal/logic/user/userinfologic.go
new file mode 100644
index 0000000..e56b8cc
--- /dev/null
+++ b/apps/user/internal/logic/user/userinfologic.go
@@ -0,0 +1,58 @@
+package userlogic
+
+import (
+ "context"
+ "database/sql"
+ "errors"
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type UserInfoLogic struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func NewUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserInfoLogic {
+ return &UserInfoLogic{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+
+// 获取用户信息
+func (l *UserInfoLogic) UserInfo(in *user.UserInfoReq) (*user.UserInfoResp, error) {
+ // 查询用户信息
+ users, err := l.svcCtx.UserModel.FindOne(l.ctx, in.UserId)
+ if err != nil {
+ return nil, errors.New("用户不存在")
+ }
+
+ // 查询企业信息
+ enterprise, err := l.svcCtx.EnterpriseModel.FindOneByUserId(l.ctx, users.Id)
+ if err != nil && !errors.Is(err, sql.ErrNoRows) {
+ return nil, errors.New("failed to query enterprise auth info")
+ }
+
+ if enterprise == nil {
+ return &user.UserInfoResp{
+ Username: users.Username,
+ Phone: users.Phone,
+ EnterpriseAuthStatus: users.AuthStatus,
+ }, nil
+ }
+
+ // 正常返回用户和企业信息
+ return &user.UserInfoResp{
+ Username: users.Username,
+ Phone: users.Phone,
+ EnterpriseAuthStatus: users.AuthStatus,
+ EnterpriseName: enterprise.EnterpriseName,
+ CreditCode: enterprise.CreditCode,
+ LegalPerson: enterprise.LegalPerson,
+ }, nil
+}
diff --git a/apps/user/internal/model/enterpriseauthmodel.go b/apps/user/internal/model/enterpriseauthmodel.go
new file mode 100644
index 0000000..46270f6
--- /dev/null
+++ b/apps/user/internal/model/enterpriseauthmodel.go
@@ -0,0 +1,102 @@
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+)
+
+var _ EnterpriseAuthModel = (*customEnterpriseAuthModel)(nil)
+
+type (
+ // EnterpriseAuthModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customEnterpriseAuthModel.
+ EnterpriseAuthModel interface {
+ enterpriseAuthModel
+ FindLatestByUserId(ctx context.Context, userId int64) (*EnterpriseAuth, error)
+ TransCtx(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error
+ InsertEnterpriseAuthTrans(ctx context.Context, auth *EnterpriseAuth, session sqlx.Session) (sql.Result, error)
+ UpdateEnterpriseAuthTrans(ctx context.Context, auth *EnterpriseAuth, session sqlx.Session) (sql.Result, error)
+ FindPendingList(ctx context.Context, page, pageSize int64) ([]EnterpriseAuth, int64, error)
+ }
+
+ customEnterpriseAuthModel struct {
+ *defaultEnterpriseAuthModel
+ }
+)
+
+// NewEnterpriseAuthModel returns a model for the database table.
+func NewEnterpriseAuthModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) EnterpriseAuthModel {
+ return &customEnterpriseAuthModel{
+ defaultEnterpriseAuthModel: newEnterpriseAuthModel(conn, c, opts...),
+ }
+}
+func (m *defaultEnterpriseAuthModel) FindLatestByUserId(ctx context.Context, userId int64) (*EnterpriseAuth, error) {
+ query := fmt.Sprintf("SELECT * FROM %s WHERE user_id = ? ORDER BY created_at DESC LIMIT 1", m.table)
+ var resp EnterpriseAuth
+ err := m.QueryRowsNoCacheCtx(ctx, &resp, query, userId)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sql.ErrNoRows:
+ return nil, sql.ErrNoRows
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultEnterpriseAuthModel) TransCtx(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error {
+ // 使用带 ctx 的事务处理
+ err := m.TransactCtx(ctx, func(ctx context.Context, session sqlx.Session) error {
+ return fn(ctx, session)
+ })
+ return err
+}
+
+func (m *defaultEnterpriseAuthModel) InsertEnterpriseAuthTrans(ctx context.Context, auth *EnterpriseAuth, session sqlx.Session) (sql.Result, error) {
+ enterpriseAuthIdKey := fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, auth.Id)
+
+ query := fmt.Sprintf("INSERT INTO %s (user_id, enterprise_name, credit_code, legal_person, business_license, enterprise_contact, auth_status) VALUES (?, ?, ?, ?, ?, ?, ?)", m.table)
+ ret, err := session.ExecCtx(ctx, query, auth.UserId, auth.EnterpriseName, auth.CreditCode, auth.LegalPerson, auth.BusinessLicense, auth.EnterpriseContact, auth.AuthStatus)
+ if err == nil {
+ err = m.DelCacheCtx(ctx, enterpriseAuthIdKey)
+ if err != nil {
+ return nil, err
+ }
+ }
+ return ret, err
+}
+func (m *defaultEnterpriseAuthModel) UpdateEnterpriseAuthTrans(ctx context.Context, auth *EnterpriseAuth, session sqlx.Session) (sql.Result, error) {
+ enterpriseAuthIdKey := fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, auth.Id)
+ query := fmt.Sprintf("UPDATE %s SET %s WHERE `id` = ?", m.table, enterpriseAuthRowsWithPlaceHolder)
+ ret, err := session.ExecCtx(ctx, query, auth.UserId, auth.EnterpriseName, auth.CreditCode, auth.LegalPerson, auth.BusinessLicense, auth.EnterpriseContact, auth.AuthStatus, auth.Id)
+ if err == nil {
+ err = m.DelCacheCtx(ctx, enterpriseAuthIdKey)
+ if err != nil {
+ return nil, err
+ }
+ }
+ return ret, err
+}
+func (m *defaultEnterpriseAuthModel) FindPendingList(ctx context.Context, page, pageSize int64) ([]EnterpriseAuth, int64, error) {
+ offset := (page - 1) * pageSize
+ var enterprises []EnterpriseAuth
+
+ query := fmt.Sprintf("SELECT * FROM %s WHERE auth_status = 'pending' ORDER BY created_at DESC LIMIT ?,?", m.table)
+ err := m.QueryRowsNoCacheCtx(ctx, &enterprises, query, offset, pageSize)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ // 查询总数量
+ var total int64
+ countQuery := fmt.Sprintf("SELECT COUNT(*) FROM %s WHERE auth_status = 'pending'", m.table)
+ err = m.QueryRowNoCacheCtx(ctx, &total, countQuery)
+ if err != nil {
+ return nil, 0, err
+ }
+
+ return enterprises, total, nil
+}
diff --git a/apps/user/internal/model/enterpriseauthmodel_gen.go b/apps/user/internal/model/enterpriseauthmodel_gen.go
new file mode 100644
index 0000000..d949e0e
--- /dev/null
+++ b/apps/user/internal/model/enterpriseauthmodel_gen.go
@@ -0,0 +1,119 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ enterpriseAuthFieldNames = builder.RawFieldNames(&EnterpriseAuth{})
+ enterpriseAuthRows = strings.Join(enterpriseAuthFieldNames, ",")
+ enterpriseAuthRowsExpectAutoSet = strings.Join(stringx.Remove(enterpriseAuthFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ enterpriseAuthRowsWithPlaceHolder = strings.Join(stringx.Remove(enterpriseAuthFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheEnterpriseAuthIdPrefix = "cache:enterpriseAuth:id:"
+)
+
+type (
+ enterpriseAuthModel interface {
+ Insert(ctx context.Context, data *EnterpriseAuth) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*EnterpriseAuth, error)
+ Update(ctx context.Context, data *EnterpriseAuth) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultEnterpriseAuthModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ EnterpriseAuth struct {
+ Id int64 `db:"id"` // 认证ID
+ UserId int64 `db:"user_id"` // 关联的用户ID
+ EnterpriseName string `db:"enterprise_name"` // 企业名称
+ CreditCode string `db:"credit_code"` // 企业统一信用代码
+ LegalPerson string `db:"legal_person"` // 法人代表
+ BusinessLicense string `db:"business_license"` // 营业执照存储路径
+ EnterpriseContact string `db:"enterprise_contact"` // 企业联系方式
+ AuthStatus string `db:"auth_status"` // 认证状态:unverified=未提交,pending=待审核,approved=审核通过,rejected=审核拒绝
+ CreatedAt time.Time `db:"created_at"` // 认证创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 认证更新时间
+ }
+)
+
+func newEnterpriseAuthModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultEnterpriseAuthModel {
+ return &defaultEnterpriseAuthModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`enterprise_auth`",
+ }
+}
+
+func (m *defaultEnterpriseAuthModel) Delete(ctx context.Context, id int64) error {
+ enterpriseAuthIdKey := fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, id)
+ _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, enterpriseAuthIdKey)
+ return err
+}
+
+func (m *defaultEnterpriseAuthModel) FindOne(ctx context.Context, id int64) (*EnterpriseAuth, error) {
+ enterpriseAuthIdKey := fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, id)
+ var resp EnterpriseAuth
+ err := m.QueryRowCtx(ctx, &resp, enterpriseAuthIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", enterpriseAuthRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultEnterpriseAuthModel) Insert(ctx context.Context, data *EnterpriseAuth) (sql.Result, error) {
+ enterpriseAuthIdKey := fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, data.Id)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?)", m.table, enterpriseAuthRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.UserId, data.EnterpriseName, data.CreditCode, data.LegalPerson, data.BusinessLicense, data.EnterpriseContact, data.AuthStatus)
+ }, enterpriseAuthIdKey)
+ return ret, err
+}
+
+func (m *defaultEnterpriseAuthModel) Update(ctx context.Context, data *EnterpriseAuth) error {
+ enterpriseAuthIdKey := fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, data.Id)
+ _, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, enterpriseAuthRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, data.UserId, data.EnterpriseName, data.CreditCode, data.LegalPerson, data.BusinessLicense, data.EnterpriseContact, data.AuthStatus, data.Id)
+ }, enterpriseAuthIdKey)
+ return err
+}
+
+func (m *defaultEnterpriseAuthModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheEnterpriseAuthIdPrefix, primary)
+}
+
+func (m *defaultEnterpriseAuthModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", enterpriseAuthRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultEnterpriseAuthModel) tableName() string {
+ return m.table
+}
diff --git a/apps/user/internal/model/enterpriseinfomodel.go b/apps/user/internal/model/enterpriseinfomodel.go
new file mode 100644
index 0000000..ddaa068
--- /dev/null
+++ b/apps/user/internal/model/enterpriseinfomodel.go
@@ -0,0 +1,60 @@
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+)
+
+var _ EnterpriseInfoModel = (*customEnterpriseInfoModel)(nil)
+
+type (
+ // EnterpriseInfoModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customEnterpriseInfoModel.
+ EnterpriseInfoModel interface {
+ enterpriseInfoModel
+ InsertEnterpriseInfoTrans(ctx context.Context, enterpriseInfo *EnterpriseInfo, session sqlx.Session) (sql.Result, error)
+ }
+
+ customEnterpriseInfoModel struct {
+ *defaultEnterpriseInfoModel
+ }
+)
+
+// NewEnterpriseInfoModel returns a model for the database table.
+func NewEnterpriseInfoModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) EnterpriseInfoModel {
+ return &customEnterpriseInfoModel{
+ defaultEnterpriseInfoModel: newEnterpriseInfoModel(conn, c, opts...),
+ }
+}
+func (m *defaultEnterpriseInfoModel) InsertEnterpriseInfoTrans(ctx context.Context, enterpriseInfo *EnterpriseInfo, session sqlx.Session) (sql.Result, error) {
+
+ enterpriseInfoCreditCodeKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoCreditCodePrefix, enterpriseInfo.CreditCode)
+ enterpriseInfoEnterpriseNameKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoEnterpriseNamePrefix, enterpriseInfo.EnterpriseName)
+ enterpriseInfoIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoIdPrefix, enterpriseInfo.Id)
+ enterpriseInfoUserIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoUserIdPrefix, enterpriseInfo.UserId)
+
+ query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (?, ?, ?, ?, ?, ?)", m.table, enterpriseInfoRowsExpectAutoSet)
+ ret, err := session.ExecCtx(ctx, query, enterpriseInfo.UserId, enterpriseInfo.EnterpriseName, enterpriseInfo.CreditCode, enterpriseInfo.LegalPerson, enterpriseInfo.BusinessLicense, enterpriseInfo.EnterpriseContact)
+ if err != nil {
+ return nil, err
+ }
+
+ // 2. 更新缓存,保证所有缓存操作成功
+ cacheKeys := []string{enterpriseInfoCreditCodeKey, enterpriseInfoEnterpriseNameKey, enterpriseInfoIdKey, enterpriseInfoUserIdKey}
+ cacheErrors := make([]error, len(cacheKeys))
+
+ cacheErrors[0] = m.DelCacheCtx(ctx, enterpriseInfoCreditCodeKey)
+ cacheErrors[1] = m.DelCacheCtx(ctx, enterpriseInfoEnterpriseNameKey)
+ cacheErrors[2] = m.DelCacheCtx(ctx, enterpriseInfoIdKey)
+ cacheErrors[3] = m.DelCacheCtx(ctx, enterpriseInfoUserIdKey)
+ // 3. 检查缓存操作是否全部成功
+ for _, cacheErr := range cacheErrors {
+ if cacheErr != nil {
+ return nil, cacheErr // 返回第一个缓存更新失败的错误
+ }
+ }
+ return ret, err
+}
diff --git a/apps/user/internal/model/enterpriseinfomodel_gen.go b/apps/user/internal/model/enterpriseinfomodel_gen.go
new file mode 100644
index 0000000..2ff9f05
--- /dev/null
+++ b/apps/user/internal/model/enterpriseinfomodel_gen.go
@@ -0,0 +1,203 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ enterpriseInfoFieldNames = builder.RawFieldNames(&EnterpriseInfo{})
+ enterpriseInfoRows = strings.Join(enterpriseInfoFieldNames, ",")
+ enterpriseInfoRowsExpectAutoSet = strings.Join(stringx.Remove(enterpriseInfoFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ enterpriseInfoRowsWithPlaceHolder = strings.Join(stringx.Remove(enterpriseInfoFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheEnterpriseInfoIdPrefix = "cache:enterpriseInfo:id:"
+ cacheEnterpriseInfoCreditCodePrefix = "cache:enterpriseInfo:creditCode:"
+ cacheEnterpriseInfoEnterpriseNamePrefix = "cache:enterpriseInfo:enterpriseName:"
+ cacheEnterpriseInfoUserIdPrefix = "cache:enterpriseInfo:userId:"
+)
+
+type (
+ enterpriseInfoModel interface {
+ Insert(ctx context.Context, data *EnterpriseInfo) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*EnterpriseInfo, error)
+ FindOneByCreditCode(ctx context.Context, creditCode string) (*EnterpriseInfo, error)
+ FindOneByEnterpriseName(ctx context.Context, enterpriseName string) (*EnterpriseInfo, error)
+ FindOneByUserId(ctx context.Context, userId int64) (*EnterpriseInfo, error)
+ Update(ctx context.Context, data *EnterpriseInfo) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultEnterpriseInfoModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ EnterpriseInfo struct {
+ Id int64 `db:"id"` // 企业信息ID
+ UserId int64 `db:"user_id"` // 关联的用户ID
+ EnterpriseName string `db:"enterprise_name"` // 企业名称
+ CreditCode string `db:"credit_code"` // 企业统一信用代码
+ LegalPerson string `db:"legal_person"` // 法人代表
+ BusinessLicense string `db:"business_license"` // 营业执照存储路径
+ EnterpriseContact string `db:"enterprise_contact"` // 企业联系方式
+ CreatedAt time.Time `db:"created_at"` // 企业信息创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 企业信息更新时间
+ }
+)
+
+func newEnterpriseInfoModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultEnterpriseInfoModel {
+ return &defaultEnterpriseInfoModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`enterprise_info`",
+ }
+}
+
+func (m *defaultEnterpriseInfoModel) Delete(ctx context.Context, id int64) error {
+ data, err := m.FindOne(ctx, id)
+ if err != nil {
+ return err
+ }
+
+ enterpriseInfoCreditCodeKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoCreditCodePrefix, data.CreditCode)
+ enterpriseInfoEnterpriseNameKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoEnterpriseNamePrefix, data.EnterpriseName)
+ enterpriseInfoIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoIdPrefix, id)
+ enterpriseInfoUserIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoUserIdPrefix, data.UserId)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, enterpriseInfoCreditCodeKey, enterpriseInfoEnterpriseNameKey, enterpriseInfoIdKey, enterpriseInfoUserIdKey)
+ return err
+}
+
+func (m *defaultEnterpriseInfoModel) FindOne(ctx context.Context, id int64) (*EnterpriseInfo, error) {
+ enterpriseInfoIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoIdPrefix, id)
+ var resp EnterpriseInfo
+ err := m.QueryRowCtx(ctx, &resp, enterpriseInfoIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", enterpriseInfoRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultEnterpriseInfoModel) FindOneByCreditCode(ctx context.Context, creditCode string) (*EnterpriseInfo, error) {
+ enterpriseInfoCreditCodeKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoCreditCodePrefix, creditCode)
+ var resp EnterpriseInfo
+ err := m.QueryRowIndexCtx(ctx, &resp, enterpriseInfoCreditCodeKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `credit_code` = ? limit 1", enterpriseInfoRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, creditCode); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultEnterpriseInfoModel) FindOneByEnterpriseName(ctx context.Context, enterpriseName string) (*EnterpriseInfo, error) {
+ enterpriseInfoEnterpriseNameKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoEnterpriseNamePrefix, enterpriseName)
+ var resp EnterpriseInfo
+ err := m.QueryRowIndexCtx(ctx, &resp, enterpriseInfoEnterpriseNameKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `enterprise_name` = ? limit 1", enterpriseInfoRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, enterpriseName); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultEnterpriseInfoModel) FindOneByUserId(ctx context.Context, userId int64) (*EnterpriseInfo, error) {
+ enterpriseInfoUserIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoUserIdPrefix, userId)
+ var resp EnterpriseInfo
+ err := m.QueryRowIndexCtx(ctx, &resp, enterpriseInfoUserIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `user_id` = ? limit 1", enterpriseInfoRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, userId); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultEnterpriseInfoModel) Insert(ctx context.Context, data *EnterpriseInfo) (sql.Result, error) {
+ enterpriseInfoCreditCodeKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoCreditCodePrefix, data.CreditCode)
+ enterpriseInfoEnterpriseNameKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoEnterpriseNamePrefix, data.EnterpriseName)
+ enterpriseInfoIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoIdPrefix, data.Id)
+ enterpriseInfoUserIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoUserIdPrefix, data.UserId)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?)", m.table, enterpriseInfoRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.UserId, data.EnterpriseName, data.CreditCode, data.LegalPerson, data.BusinessLicense, data.EnterpriseContact)
+ }, enterpriseInfoCreditCodeKey, enterpriseInfoEnterpriseNameKey, enterpriseInfoIdKey, enterpriseInfoUserIdKey)
+ return ret, err
+}
+
+func (m *defaultEnterpriseInfoModel) Update(ctx context.Context, newData *EnterpriseInfo) error {
+ data, err := m.FindOne(ctx, newData.Id)
+ if err != nil {
+ return err
+ }
+
+ enterpriseInfoCreditCodeKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoCreditCodePrefix, data.CreditCode)
+ enterpriseInfoEnterpriseNameKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoEnterpriseNamePrefix, data.EnterpriseName)
+ enterpriseInfoIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoIdPrefix, data.Id)
+ enterpriseInfoUserIdKey := fmt.Sprintf("%s%v", cacheEnterpriseInfoUserIdPrefix, data.UserId)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, enterpriseInfoRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, newData.UserId, newData.EnterpriseName, newData.CreditCode, newData.LegalPerson, newData.BusinessLicense, newData.EnterpriseContact, newData.Id)
+ }, enterpriseInfoCreditCodeKey, enterpriseInfoEnterpriseNameKey, enterpriseInfoIdKey, enterpriseInfoUserIdKey)
+ return err
+}
+
+func (m *defaultEnterpriseInfoModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheEnterpriseInfoIdPrefix, primary)
+}
+
+func (m *defaultEnterpriseInfoModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", enterpriseInfoRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultEnterpriseInfoModel) tableName() string {
+ return m.table
+}
diff --git a/apps/user/internal/model/usersmodel.go b/apps/user/internal/model/usersmodel.go
new file mode 100644
index 0000000..fefebea
--- /dev/null
+++ b/apps/user/internal/model/usersmodel.go
@@ -0,0 +1,78 @@
+package model
+
+import (
+ "context"
+ "database/sql"
+ "errors"
+ "fmt"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+)
+
+var _ UsersModel = (*customUsersModel)(nil)
+
+type (
+ // UsersModel is an interface to be customized, add more methods here,
+ // and implement the added methods in customUsersModel.
+ UsersModel interface {
+ usersModel
+ UpdateUserTrans(ctx context.Context, user *Users, session sqlx.Session) (sql.Result, error)
+ FindOneTrans(ctx context.Context, userId int64, session sqlx.Session) (*Users, error)
+ }
+
+ customUsersModel struct {
+ *defaultUsersModel
+ }
+)
+
+// NewUsersModel returns a model for the database table.
+func NewUsersModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) UsersModel {
+ return &customUsersModel{
+ defaultUsersModel: newUsersModel(conn, c, opts...),
+ }
+}
+
+func (m *defaultUsersModel) UpdateUserTrans(ctx context.Context, user *Users, session sqlx.Session) (sql.Result, error) {
+ userIdKey := fmt.Sprintf("%s%v", cacheUsersIdPrefix, user.Id)
+ usersPhoneKey := fmt.Sprintf("%s%v", cacheUsersPhonePrefix, user.Phone)
+ usersUsernameKey := fmt.Sprintf("%s%v", cacheUsersUsernamePrefix, user.Username)
+ query := fmt.Sprintf("UPDATE %s SET %s WHERE `id` = ?", m.table, usersRowsWithPlaceHolder)
+ ret, err := session.ExecCtx(ctx, query, user.Username, user.Password, user.Phone, user.AuthStatus, user.Id)
+ if err != nil {
+ return nil, err
+ }
+
+ // 2. 删除缓存,保证所有缓存操作成功
+ cacheKeys := []string{userIdKey, usersPhoneKey, usersUsernameKey}
+ cacheErrors := make([]error, len(cacheKeys))
+
+ cacheErrors[0] = m.DelCacheCtx(ctx, userIdKey)
+ cacheErrors[1] = m.DelCacheCtx(ctx, usersPhoneKey)
+ cacheErrors[2] = m.DelCacheCtx(ctx, usersUsernameKey)
+
+ // 3. 检查缓存操作是否全部成功
+ for _, cacheErr := range cacheErrors {
+ if cacheErr != nil {
+ return nil, cacheErr // 返回第一个缓存更新失败的错误
+ }
+ }
+ return ret, err
+}
+func (m *defaultUsersModel) FindOneTrans(ctx context.Context, userId int64, session sqlx.Session) (*Users, error) {
+ // 定义 SQL 查询语句
+ query := fmt.Sprintf("SELECT %s FROM %s WHERE `id` = ? LIMIT 1", usersRows, m.table)
+
+ var user Users
+ // 在事务上下文中执行查询
+ err := session.QueryRowCtx(ctx, &user, query, userId)
+ if err != nil {
+ if errors.Is(err, sql.ErrNoRows) {
+ // 如果没有找到记录,返回 nil 和 ErrNotFound 错误
+ return nil, ErrNotFound
+ }
+ return nil, err
+ }
+
+ // 返回查询结果
+ return &user, nil
+}
diff --git a/apps/user/internal/model/usersmodel_gen.go b/apps/user/internal/model/usersmodel_gen.go
new file mode 100644
index 0000000..c088fa7
--- /dev/null
+++ b/apps/user/internal/model/usersmodel_gen.go
@@ -0,0 +1,176 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package model
+
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ "time"
+
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+)
+
+var (
+ usersFieldNames = builder.RawFieldNames(&Users{})
+ usersRows = strings.Join(usersFieldNames, ",")
+ usersRowsExpectAutoSet = strings.Join(stringx.Remove(usersFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",")
+ usersRowsWithPlaceHolder = strings.Join(stringx.Remove(usersFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?"
+
+ cacheUsersIdPrefix = "cache:users:id:"
+ cacheUsersPhonePrefix = "cache:users:phone:"
+ cacheUsersUsernamePrefix = "cache:users:username:"
+)
+
+type (
+ usersModel interface {
+ Insert(ctx context.Context, data *Users) (sql.Result, error)
+ FindOne(ctx context.Context, id int64) (*Users, error)
+ FindOneByPhone(ctx context.Context, phone string) (*Users, error)
+ FindOneByUsername(ctx context.Context, username string) (*Users, error)
+ Update(ctx context.Context, data *Users) error
+ Delete(ctx context.Context, id int64) error
+ }
+
+ defaultUsersModel struct {
+ sqlc.CachedConn
+ table string
+ }
+
+ Users struct {
+ Id int64 `db:"id"` // 用户ID
+ Username string `db:"username"` // 用户名
+ Password string `db:"password"` // 用户密码
+ Phone string `db:"phone"` // 用户手机号
+ AuthStatus string `db:"auth_status"` // 认证状态:unverified=未提交,pending=待审核,approved=审核通过,rejected=审核拒绝
+ CreatedAt time.Time `db:"created_at"` // 用户创建时间
+ UpdatedAt time.Time `db:"updated_at"` // 用户更新时间
+ }
+)
+
+func newUsersModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultUsersModel {
+ return &defaultUsersModel{
+ CachedConn: sqlc.NewConn(conn, c, opts...),
+ table: "`users`",
+ }
+}
+
+func (m *defaultUsersModel) Delete(ctx context.Context, id int64) error {
+ data, err := m.FindOne(ctx, id)
+ if err != nil {
+ return err
+ }
+
+ usersIdKey := fmt.Sprintf("%s%v", cacheUsersIdPrefix, id)
+ usersPhoneKey := fmt.Sprintf("%s%v", cacheUsersPhonePrefix, data.Phone)
+ usersUsernameKey := fmt.Sprintf("%s%v", cacheUsersUsernamePrefix, data.Username)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where `id` = ?", m.table)
+ return conn.ExecCtx(ctx, query, id)
+ }, usersIdKey, usersPhoneKey, usersUsernameKey)
+ return err
+}
+
+func (m *defaultUsersModel) FindOne(ctx context.Context, id int64) (*Users, error) {
+ usersIdKey := fmt.Sprintf("%s%v", cacheUsersIdPrefix, id)
+ var resp Users
+ err := m.QueryRowCtx(ctx, &resp, usersIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", usersRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, id)
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultUsersModel) FindOneByPhone(ctx context.Context, phone string) (*Users, error) {
+ usersPhoneKey := fmt.Sprintf("%s%v", cacheUsersPhonePrefix, phone)
+ var resp Users
+ err := m.QueryRowIndexCtx(ctx, &resp, usersPhoneKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `phone` = ? limit 1", usersRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, phone); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultUsersModel) FindOneByUsername(ctx context.Context, username string) (*Users, error) {
+ usersUsernameKey := fmt.Sprintf("%s%v", cacheUsersUsernamePrefix, username)
+ var resp Users
+ err := m.QueryRowIndexCtx(ctx, &resp, usersUsernameKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where `username` = ? limit 1", usersRows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, username); err != nil {
+ return nil, err
+ }
+ return resp.Id, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *defaultUsersModel) Insert(ctx context.Context, data *Users) (sql.Result, error) {
+ usersIdKey := fmt.Sprintf("%s%v", cacheUsersIdPrefix, data.Id)
+ usersPhoneKey := fmt.Sprintf("%s%v", cacheUsersPhonePrefix, data.Phone)
+ usersUsernameKey := fmt.Sprintf("%s%v", cacheUsersUsernamePrefix, data.Username)
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?)", m.table, usersRowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, data.Username, data.Password, data.Phone, data.AuthStatus)
+ }, usersIdKey, usersPhoneKey, usersUsernameKey)
+ return ret, err
+}
+
+func (m *defaultUsersModel) Update(ctx context.Context, newData *Users) error {
+ data, err := m.FindOne(ctx, newData.Id)
+ if err != nil {
+ return err
+ }
+
+ usersIdKey := fmt.Sprintf("%s%v", cacheUsersIdPrefix, data.Id)
+ usersPhoneKey := fmt.Sprintf("%s%v", cacheUsersPhonePrefix, data.Phone)
+ usersUsernameKey := fmt.Sprintf("%s%v", cacheUsersUsernamePrefix, data.Username)
+ _, err = m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, usersRowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, newData.Username, newData.Password, newData.Phone, newData.AuthStatus, newData.Id)
+ }, usersIdKey, usersPhoneKey, usersUsernameKey)
+ return err
+}
+
+func (m *defaultUsersModel) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", cacheUsersIdPrefix, primary)
+}
+
+func (m *defaultUsersModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", usersRows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
+
+func (m *defaultUsersModel) tableName() string {
+ return m.table
+}
diff --git a/apps/user/internal/model/vars.go b/apps/user/internal/model/vars.go
new file mode 100644
index 0000000..69ca814
--- /dev/null
+++ b/apps/user/internal/model/vars.go
@@ -0,0 +1,5 @@
+package model
+
+import "github.com/zeromicro/go-zero/core/stores/sqlx"
+
+var ErrNotFound = sqlx.ErrNotFound
diff --git a/apps/user/internal/server/auth/authserver.go b/apps/user/internal/server/auth/authserver.go
new file mode 100644
index 0000000..d515dd3
--- /dev/null
+++ b/apps/user/internal/server/auth/authserver.go
@@ -0,0 +1,42 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: user.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/internal/logic/auth"
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+)
+
+type AuthServer struct {
+ svcCtx *svc.ServiceContext
+ user.UnimplementedAuthServer
+}
+
+func NewAuthServer(svcCtx *svc.ServiceContext) *AuthServer {
+ return &AuthServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// 注册接口
+func (s *AuthServer) RegisterUser(ctx context.Context, in *user.RegisterReq) (*user.EmptyResponse, error) {
+ l := authlogic.NewRegisterUserLogic(ctx, s.svcCtx)
+ return l.RegisterUser(in)
+}
+
+// 登录接口
+func (s *AuthServer) LoginUser(ctx context.Context, in *user.LoginReq) (*user.LoginResp, error) {
+ l := authlogic.NewLoginUserLogic(ctx, s.svcCtx)
+ return l.LoginUser(in)
+}
+
+// 手机登录接口
+func (s *AuthServer) PhoneLoginUser(ctx context.Context, in *user.PhoneLoginReq) (*user.LoginResp, error) {
+ l := authlogic.NewPhoneLoginUserLogic(ctx, s.svcCtx)
+ return l.PhoneLoginUser(in)
+}
diff --git a/apps/user/internal/server/enterprise/enterpriseserver.go b/apps/user/internal/server/enterprise/enterpriseserver.go
new file mode 100644
index 0000000..4e19fd4
--- /dev/null
+++ b/apps/user/internal/server/enterprise/enterpriseserver.go
@@ -0,0 +1,42 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: user.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/internal/logic/enterprise"
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+)
+
+type EnterpriseServer struct {
+ svcCtx *svc.ServiceContext
+ user.UnimplementedEnterpriseServer
+}
+
+func NewEnterpriseServer(svcCtx *svc.ServiceContext) *EnterpriseServer {
+ return &EnterpriseServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// 获取待审核企业列表
+func (s *EnterpriseServer) GetPendingEnterprise(ctx context.Context, in *user.GetPendingEnterpriseReq) (*user.GetPendingEnterpriseResp, error) {
+ l := enterpriselogic.NewGetPendingEnterpriseLogic(ctx, s.svcCtx)
+ return l.GetPendingEnterprise()
+}
+
+// 审核企业
+func (s *EnterpriseServer) ReviewEnterprise(ctx context.Context, in *user.ReviewEnterpriseReq) (*user.EmptyResponse, error) {
+ l := enterpriselogic.NewReviewEnterpriseLogic(ctx, s.svcCtx)
+ return l.ReviewEnterprise(in)
+}
+
+// 提交审核
+func (s *EnterpriseServer) CreateEnterpriseAuth(ctx context.Context, in *user.EnterpriseAuthReq) (*user.EmptyResponse, error) {
+ l := enterpriselogic.NewCreateEnterpriseAuthLogic(ctx, s.svcCtx)
+ return l.CreateEnterpriseAuth(in)
+}
diff --git a/apps/user/internal/server/user/userserver.go b/apps/user/internal/server/user/userserver.go
new file mode 100644
index 0000000..902ae30
--- /dev/null
+++ b/apps/user/internal/server/user/userserver.go
@@ -0,0 +1,35 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl 1.7.2
+// Source: user.proto
+
+package server
+
+import (
+ "context"
+
+ "tianyuan-api/apps/user/internal/logic/user"
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+)
+
+type UserServer struct {
+ svcCtx *svc.ServiceContext
+ user.UnimplementedUserServer
+}
+
+func NewUserServer(svcCtx *svc.ServiceContext) *UserServer {
+ return &UserServer{
+ svcCtx: svcCtx,
+ }
+}
+
+// 获取用户信息
+func (s *UserServer) UserInfo(ctx context.Context, in *user.UserInfoReq) (*user.UserInfoResp, error) {
+ l := userlogic.NewUserInfoLogic(ctx, s.svcCtx)
+ return l.UserInfo(in)
+}
+
+func (s *UserServer) GetEnterpriseAuthStatus(ctx context.Context, in *user.GetEnterpriseAuthStatusReq) (*user.GetEnterpriseAuthStatusResp, error) {
+ l := userlogic.NewGetEnterpriseAuthStatusLogic(ctx, s.svcCtx)
+ return l.GetEnterpriseAuthStatus(in)
+}
diff --git a/apps/user/internal/svc/servicecontext.go b/apps/user/internal/svc/servicecontext.go
new file mode 100644
index 0000000..49c246d
--- /dev/null
+++ b/apps/user/internal/svc/servicecontext.go
@@ -0,0 +1,39 @@
+package svc
+
+import (
+ "github.com/zeromicro/go-zero/core/stores/redis"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/zrpc"
+ "tianyuan-api/apps/sentinel/sentinel"
+ "tianyuan-api/apps/user/internal/config"
+ "tianyuan-api/apps/user/internal/model"
+)
+
+type ServiceContext struct {
+ Config config.Config
+ Redis *redis.Redis
+ UserModel model.UsersModel // 用户表的模型
+ EnterpriseModel model.EnterpriseInfoModel
+ EnterpriseAuthModel model.EnterpriseAuthModel
+ SecretRpc sentinel.SecretClient
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+ db := sqlx.NewMysql(c.DataSource) // 创建数据库连接
+ 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)
+ return &ServiceContext{
+ Config: c,
+ Redis: rds, // 单独使用的 Redis 客户端
+ UserModel: model.NewUsersModel(db, c.CacheRedis), // 注入UserModel
+ EnterpriseModel: model.NewEnterpriseInfoModel(db, c.CacheRedis),
+ EnterpriseAuthModel: model.NewEnterpriseAuthModel(db, c.CacheRedis),
+ SecretRpc: sentinel.NewSecretClient(zrpc.MustNewClient(c.SentinelRpc).Conn()),
+ }
+}
diff --git a/apps/user/user.go b/apps/user/user.go
new file mode 100644
index 0000000..a5bbfcb
--- /dev/null
+++ b/apps/user/user.go
@@ -0,0 +1,43 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+
+ "tianyuan-api/apps/user/internal/config"
+ authServer "tianyuan-api/apps/user/internal/server/auth"
+ enterpriseServer "tianyuan-api/apps/user/internal/server/enterprise"
+ userServer "tianyuan-api/apps/user/internal/server/user"
+ "tianyuan-api/apps/user/internal/svc"
+ "tianyuan-api/apps/user/user"
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/core/service"
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/reflection"
+)
+
+var configFile = flag.String("f", "etc/user.yaml", "the config file")
+
+func main() {
+ flag.Parse()
+
+ var c config.Config
+ conf.MustLoad(*configFile, &c)
+ ctx := svc.NewServiceContext(c)
+
+ s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+ user.RegisterEnterpriseServer(grpcServer, enterpriseServer.NewEnterpriseServer(ctx))
+ user.RegisterAuthServer(grpcServer, authServer.NewAuthServer(ctx))
+ user.RegisterUserServer(grpcServer, userServer.NewUserServer(ctx))
+
+ if c.Mode == service.DevMode || c.Mode == service.TestMode {
+ reflection.Register(grpcServer)
+ }
+ })
+ defer s.Stop()
+
+ fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+ s.Start()
+}
diff --git a/apps/user/user.proto b/apps/user/user.proto
new file mode 100644
index 0000000..b793c1e
--- /dev/null
+++ b/apps/user/user.proto
@@ -0,0 +1,126 @@
+syntax = "proto3";
+
+
+option go_package = "./user";
+
+
+//-------------------------global message -----------------------
+message EmptyResponse {}
+
+//------------------------ enterprise ------------------------
+// 请求获取待审核企业列表
+message GetPendingEnterpriseReq {
+ int64 page = 1;
+ int64 page_size = 2;
+}
+
+
+message EnterpriseItem {
+ int64 id = 1;
+ string enterprise_name = 2;
+ string credit_code = 3;
+ string legal_person = 4;
+ string enterprise_contact = 5;
+ string auth_status = 6;
+ string business_license = 7;
+ string created_at = 8;
+ string updated_at = 9;
+}
+
+message GetPendingEnterpriseResp {
+ int64 total = 1;
+ repeated EnterpriseItem list = 2;
+}
+
+// 审核企业请求
+message ReviewEnterpriseReq {
+ int64 enterprise_id = 1;
+ string status = 2;
+ string remarks = 3;
+}
+message EnterpriseAuthReq {
+ int64 userId = 1;
+ string enterprise_name = 2; // 企业名称
+ string credit_code = 3; // 信用代码
+ string legal_person = 4; // 法人
+ string business_license = 5; // 营业执照
+ string enterprise_contact = 6; // 联系人
+}
+
+// 定义服务
+service Enterprise {
+ // 获取待审核企业列表
+ rpc GetPendingEnterprise(GetPendingEnterpriseReq) returns (GetPendingEnterpriseResp);
+
+ // 审核企业
+ rpc ReviewEnterprise(ReviewEnterpriseReq) returns (EmptyResponse);
+
+ // 提交审核
+ rpc CreateEnterpriseAuth(EnterpriseAuthReq) returns (EmptyResponse);
+}
+
+//------------------------ User Auth ------------------------
+// 定义注册请求
+message RegisterReq {
+ string username = 1;
+ string password = 2;
+ string confirmPassword = 3;
+ string phone = 4;
+ string code = 5;
+}
+
+// 定义登录请求
+message LoginReq {
+ string username = 1;
+ string password = 2;
+}
+
+// 定义手机登录请求
+message PhoneLoginReq {
+ string phone = 1;
+ string code = 2;
+}
+
+message LoginResp{
+ string token = 1;
+}
+
+
+
+// 定义认证服务
+service Auth {
+ // 注册接口
+ rpc RegisterUser(RegisterReq) returns (EmptyResponse);
+
+ // 登录接口
+ rpc LoginUser(LoginReq) returns (LoginResp);
+
+ // 手机登录接口
+ rpc PhoneLoginUser(PhoneLoginReq) returns (LoginResp);
+}
+
+// 定义手机登录请求
+message UserInfoReq {
+ int64 userId = 1;
+}
+
+message UserInfoResp{
+ string username = 1;
+ string phone = 2;
+ string enterpriseAuthStatus = 3;
+ string enterpriseName = 4;
+ string creditCode = 5;
+ string legalPerson = 6;
+}
+
+message GetEnterpriseAuthStatusReq {
+ int64 userId = 1;
+}
+message GetEnterpriseAuthStatusResp {
+ bool isAuth = 1;
+}
+service User {
+ // 获取用户信息
+ rpc UserInfo(UserInfoReq) returns (UserInfoResp);
+ rpc GetEnterpriseAuthStatus(GetEnterpriseAuthStatusReq) returns (GetEnterpriseAuthStatusResp);
+}
\ No newline at end of file
diff --git a/apps/user/user.sql b/apps/user/user.sql
new file mode 100644
index 0000000..7afa790
--- /dev/null
+++ b/apps/user/user.sql
@@ -0,0 +1,37 @@
+CREATE TABLE users (
+ id INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
+ username VARCHAR(100) NOT NULL UNIQUE COMMENT '用户名',
+ password VARCHAR(100) NOT NULL COMMENT '用户密码',
+ phone VARCHAR(15) NOT NULL UNIQUE COMMENT '用户手机号',
+ auth_status ENUM('unverified','pending', 'approved', 'rejected') DEFAULT 'unverified' COMMENT '认证状态:unverified=未提交,pending=待审核,approved=审核通过,rejected=审核拒绝',
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '用户创建时间',
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '用户更新时间',
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表,存储用户的基本信息';
+
+CREATE TABLE enterprise_info (
+ id INT(11) NOT NULL AUTO_INCREMENT COMMENT '企业信息ID',
+ user_id BIGINT NOT NULL UNIQUE COMMENT '关联的用户ID',
+ enterprise_name VARCHAR(150) NOT NULL UNIQUE COMMENT '企业名称',
+ credit_code VARCHAR(150) NOT NULL UNIQUE COMMENT '企业统一信用代码',
+ legal_person VARCHAR(150) NOT NULL COMMENT '法人代表',
+ business_license VARCHAR(1024) NOT NULL COMMENT '营业执照存储路径',
+ enterprise_contact VARCHAR(100) NOT NULL COMMENT '企业联系方式',
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '企业信息创建时间',
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '企业信息更新时间',
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业信息表,存储认证通过的企业详细信息';
+
+CREATE TABLE enterprise_auth (
+ id INT(11) NOT NULL AUTO_INCREMENT COMMENT '认证ID',
+ user_id INT(11) NOT NULL COMMENT '关联的用户ID',
+ enterprise_name VARCHAR(150) NOT NULL COMMENT '企业名称',
+ credit_code VARCHAR(150) NOT NULL COMMENT '企业统一信用代码',
+ legal_person VARCHAR(150) NOT NULL COMMENT '法人代表',
+ business_license VARCHAR(1000) NOT NULL COMMENT '营业执照存储路径',
+ enterprise_contact VARCHAR(100) NOT NULL COMMENT '企业联系方式',
+ auth_status ENUM('unverified','pending', 'approved', 'rejected') DEFAULT 'unverified' COMMENT '认证状态:unverified=未提交,pending=待审核,approved=审核通过,rejected=审核拒绝',
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '认证创建时间',
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '认证更新时间',
+ PRIMARY KEY (id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业认证表,存储企业认证的相关信息';
diff --git a/apps/user/user/user.pb.go b/apps/user/user/user.pb.go
new file mode 100644
index 0000000..79b5820
--- /dev/null
+++ b/apps/user/user/user.pb.go
@@ -0,0 +1,1287 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.34.2
+// protoc v3.19.4
+// source: user.proto
+
+package user
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// -------------------------global message -----------------------
+type EmptyResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *EmptyResponse) Reset() {
+ *x = EmptyResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *EmptyResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EmptyResponse) ProtoMessage() {}
+
+func (x *EmptyResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use EmptyResponse.ProtoReflect.Descriptor instead.
+func (*EmptyResponse) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{0}
+}
+
+// ------------------------ enterprise ------------------------
+// 请求获取待审核企业列表
+type GetPendingEnterpriseReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
+ PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+}
+
+func (x *GetPendingEnterpriseReq) Reset() {
+ *x = GetPendingEnterpriseReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetPendingEnterpriseReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetPendingEnterpriseReq) ProtoMessage() {}
+
+func (x *GetPendingEnterpriseReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetPendingEnterpriseReq.ProtoReflect.Descriptor instead.
+func (*GetPendingEnterpriseReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *GetPendingEnterpriseReq) GetPage() int64 {
+ if x != nil {
+ return x.Page
+ }
+ return 0
+}
+
+func (x *GetPendingEnterpriseReq) GetPageSize() int64 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+type EnterpriseItem struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
+ EnterpriseName string `protobuf:"bytes,2,opt,name=enterprise_name,json=enterpriseName,proto3" json:"enterprise_name,omitempty"`
+ CreditCode string `protobuf:"bytes,3,opt,name=credit_code,json=creditCode,proto3" json:"credit_code,omitempty"`
+ LegalPerson string `protobuf:"bytes,4,opt,name=legal_person,json=legalPerson,proto3" json:"legal_person,omitempty"`
+ EnterpriseContact string `protobuf:"bytes,5,opt,name=enterprise_contact,json=enterpriseContact,proto3" json:"enterprise_contact,omitempty"`
+ AuthStatus string `protobuf:"bytes,6,opt,name=auth_status,json=authStatus,proto3" json:"auth_status,omitempty"`
+ BusinessLicense string `protobuf:"bytes,7,opt,name=business_license,json=businessLicense,proto3" json:"business_license,omitempty"`
+ CreatedAt string `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
+ UpdatedAt string `protobuf:"bytes,9,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
+}
+
+func (x *EnterpriseItem) Reset() {
+ *x = EnterpriseItem{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *EnterpriseItem) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EnterpriseItem) ProtoMessage() {}
+
+func (x *EnterpriseItem) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use EnterpriseItem.ProtoReflect.Descriptor instead.
+func (*EnterpriseItem) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *EnterpriseItem) GetId() int64 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+func (x *EnterpriseItem) GetEnterpriseName() string {
+ if x != nil {
+ return x.EnterpriseName
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetCreditCode() string {
+ if x != nil {
+ return x.CreditCode
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetLegalPerson() string {
+ if x != nil {
+ return x.LegalPerson
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetEnterpriseContact() string {
+ if x != nil {
+ return x.EnterpriseContact
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetAuthStatus() string {
+ if x != nil {
+ return x.AuthStatus
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetBusinessLicense() string {
+ if x != nil {
+ return x.BusinessLicense
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetCreatedAt() string {
+ if x != nil {
+ return x.CreatedAt
+ }
+ return ""
+}
+
+func (x *EnterpriseItem) GetUpdatedAt() string {
+ if x != nil {
+ return x.UpdatedAt
+ }
+ return ""
+}
+
+type GetPendingEnterpriseResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
+ List []*EnterpriseItem `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"`
+}
+
+func (x *GetPendingEnterpriseResp) Reset() {
+ *x = GetPendingEnterpriseResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetPendingEnterpriseResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetPendingEnterpriseResp) ProtoMessage() {}
+
+func (x *GetPendingEnterpriseResp) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetPendingEnterpriseResp.ProtoReflect.Descriptor instead.
+func (*GetPendingEnterpriseResp) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *GetPendingEnterpriseResp) GetTotal() int64 {
+ if x != nil {
+ return x.Total
+ }
+ return 0
+}
+
+func (x *GetPendingEnterpriseResp) GetList() []*EnterpriseItem {
+ if x != nil {
+ return x.List
+ }
+ return nil
+}
+
+// 审核企业请求
+type ReviewEnterpriseReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ EnterpriseId int64 `protobuf:"varint,1,opt,name=enterprise_id,json=enterpriseId,proto3" json:"enterprise_id,omitempty"`
+ Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
+ Remarks string `protobuf:"bytes,3,opt,name=remarks,proto3" json:"remarks,omitempty"`
+}
+
+func (x *ReviewEnterpriseReq) Reset() {
+ *x = ReviewEnterpriseReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ReviewEnterpriseReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ReviewEnterpriseReq) ProtoMessage() {}
+
+func (x *ReviewEnterpriseReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ReviewEnterpriseReq.ProtoReflect.Descriptor instead.
+func (*ReviewEnterpriseReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *ReviewEnterpriseReq) GetEnterpriseId() int64 {
+ if x != nil {
+ return x.EnterpriseId
+ }
+ return 0
+}
+
+func (x *ReviewEnterpriseReq) GetStatus() string {
+ if x != nil {
+ return x.Status
+ }
+ return ""
+}
+
+func (x *ReviewEnterpriseReq) GetRemarks() string {
+ if x != nil {
+ return x.Remarks
+ }
+ return ""
+}
+
+type EnterpriseAuthReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"`
+ EnterpriseName string `protobuf:"bytes,2,opt,name=enterprise_name,json=enterpriseName,proto3" json:"enterprise_name,omitempty"` // 企业名称
+ CreditCode string `protobuf:"bytes,3,opt,name=credit_code,json=creditCode,proto3" json:"credit_code,omitempty"` // 信用代码
+ LegalPerson string `protobuf:"bytes,4,opt,name=legal_person,json=legalPerson,proto3" json:"legal_person,omitempty"` // 法人
+ BusinessLicense string `protobuf:"bytes,5,opt,name=business_license,json=businessLicense,proto3" json:"business_license,omitempty"` // 营业执照
+ EnterpriseContact string `protobuf:"bytes,6,opt,name=enterprise_contact,json=enterpriseContact,proto3" json:"enterprise_contact,omitempty"` // 联系人
+}
+
+func (x *EnterpriseAuthReq) Reset() {
+ *x = EnterpriseAuthReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *EnterpriseAuthReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EnterpriseAuthReq) ProtoMessage() {}
+
+func (x *EnterpriseAuthReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use EnterpriseAuthReq.ProtoReflect.Descriptor instead.
+func (*EnterpriseAuthReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *EnterpriseAuthReq) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+func (x *EnterpriseAuthReq) GetEnterpriseName() string {
+ if x != nil {
+ return x.EnterpriseName
+ }
+ return ""
+}
+
+func (x *EnterpriseAuthReq) GetCreditCode() string {
+ if x != nil {
+ return x.CreditCode
+ }
+ return ""
+}
+
+func (x *EnterpriseAuthReq) GetLegalPerson() string {
+ if x != nil {
+ return x.LegalPerson
+ }
+ return ""
+}
+
+func (x *EnterpriseAuthReq) GetBusinessLicense() string {
+ if x != nil {
+ return x.BusinessLicense
+ }
+ return ""
+}
+
+func (x *EnterpriseAuthReq) GetEnterpriseContact() string {
+ if x != nil {
+ return x.EnterpriseContact
+ }
+ return ""
+}
+
+// ------------------------ User Auth ------------------------
+// 定义注册请求
+type RegisterReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
+ Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+ ConfirmPassword string `protobuf:"bytes,3,opt,name=confirmPassword,proto3" json:"confirmPassword,omitempty"`
+ Phone string `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
+ Code string `protobuf:"bytes,5,opt,name=code,proto3" json:"code,omitempty"`
+}
+
+func (x *RegisterReq) Reset() {
+ *x = RegisterReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RegisterReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RegisterReq) ProtoMessage() {}
+
+func (x *RegisterReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RegisterReq.ProtoReflect.Descriptor instead.
+func (*RegisterReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *RegisterReq) GetUsername() string {
+ if x != nil {
+ return x.Username
+ }
+ return ""
+}
+
+func (x *RegisterReq) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+func (x *RegisterReq) GetConfirmPassword() string {
+ if x != nil {
+ return x.ConfirmPassword
+ }
+ return ""
+}
+
+func (x *RegisterReq) GetPhone() string {
+ if x != nil {
+ return x.Phone
+ }
+ return ""
+}
+
+func (x *RegisterReq) GetCode() string {
+ if x != nil {
+ return x.Code
+ }
+ return ""
+}
+
+// 定义登录请求
+type LoginReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
+ Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+}
+
+func (x *LoginReq) Reset() {
+ *x = LoginReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LoginReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LoginReq) ProtoMessage() {}
+
+func (x *LoginReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead.
+func (*LoginReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *LoginReq) GetUsername() string {
+ if x != nil {
+ return x.Username
+ }
+ return ""
+}
+
+func (x *LoginReq) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+// 定义手机登录请求
+type PhoneLoginReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Phone string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty"`
+ Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
+}
+
+func (x *PhoneLoginReq) Reset() {
+ *x = PhoneLoginReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PhoneLoginReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PhoneLoginReq) ProtoMessage() {}
+
+func (x *PhoneLoginReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use PhoneLoginReq.ProtoReflect.Descriptor instead.
+func (*PhoneLoginReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *PhoneLoginReq) GetPhone() string {
+ if x != nil {
+ return x.Phone
+ }
+ return ""
+}
+
+func (x *PhoneLoginReq) GetCode() string {
+ if x != nil {
+ return x.Code
+ }
+ return ""
+}
+
+type LoginResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
+}
+
+func (x *LoginResp) Reset() {
+ *x = LoginResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LoginResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LoginResp) ProtoMessage() {}
+
+func (x *LoginResp) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LoginResp.ProtoReflect.Descriptor instead.
+func (*LoginResp) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *LoginResp) GetToken() string {
+ if x != nil {
+ return x.Token
+ }
+ return ""
+}
+
+// 定义手机登录请求
+type UserInfoReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"`
+}
+
+func (x *UserInfoReq) Reset() {
+ *x = UserInfoReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserInfoReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserInfoReq) ProtoMessage() {}
+
+func (x *UserInfoReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserInfoReq.ProtoReflect.Descriptor instead.
+func (*UserInfoReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *UserInfoReq) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+type UserInfoResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
+ Phone string `protobuf:"bytes,2,opt,name=phone,proto3" json:"phone,omitempty"`
+ EnterpriseAuthStatus string `protobuf:"bytes,3,opt,name=enterpriseAuthStatus,proto3" json:"enterpriseAuthStatus,omitempty"`
+ EnterpriseName string `protobuf:"bytes,4,opt,name=enterpriseName,proto3" json:"enterpriseName,omitempty"`
+ CreditCode string `protobuf:"bytes,5,opt,name=creditCode,proto3" json:"creditCode,omitempty"`
+ LegalPerson string `protobuf:"bytes,6,opt,name=legalPerson,proto3" json:"legalPerson,omitempty"`
+}
+
+func (x *UserInfoResp) Reset() {
+ *x = UserInfoResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UserInfoResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UserInfoResp) ProtoMessage() {}
+
+func (x *UserInfoResp) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UserInfoResp.ProtoReflect.Descriptor instead.
+func (*UserInfoResp) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *UserInfoResp) GetUsername() string {
+ if x != nil {
+ return x.Username
+ }
+ return ""
+}
+
+func (x *UserInfoResp) GetPhone() string {
+ if x != nil {
+ return x.Phone
+ }
+ return ""
+}
+
+func (x *UserInfoResp) GetEnterpriseAuthStatus() string {
+ if x != nil {
+ return x.EnterpriseAuthStatus
+ }
+ return ""
+}
+
+func (x *UserInfoResp) GetEnterpriseName() string {
+ if x != nil {
+ return x.EnterpriseName
+ }
+ return ""
+}
+
+func (x *UserInfoResp) GetCreditCode() string {
+ if x != nil {
+ return x.CreditCode
+ }
+ return ""
+}
+
+func (x *UserInfoResp) GetLegalPerson() string {
+ if x != nil {
+ return x.LegalPerson
+ }
+ return ""
+}
+
+type GetEnterpriseAuthStatusReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"`
+}
+
+func (x *GetEnterpriseAuthStatusReq) Reset() {
+ *x = GetEnterpriseAuthStatusReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetEnterpriseAuthStatusReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetEnterpriseAuthStatusReq) ProtoMessage() {}
+
+func (x *GetEnterpriseAuthStatusReq) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetEnterpriseAuthStatusReq.ProtoReflect.Descriptor instead.
+func (*GetEnterpriseAuthStatusReq) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *GetEnterpriseAuthStatusReq) GetUserId() int64 {
+ if x != nil {
+ return x.UserId
+ }
+ return 0
+}
+
+type GetEnterpriseAuthStatusResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsAuth bool `protobuf:"varint,1,opt,name=isAuth,proto3" json:"isAuth,omitempty"`
+}
+
+func (x *GetEnterpriseAuthStatusResp) Reset() {
+ *x = GetEnterpriseAuthStatusResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_user_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetEnterpriseAuthStatusResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetEnterpriseAuthStatusResp) ProtoMessage() {}
+
+func (x *GetEnterpriseAuthStatusResp) ProtoReflect() protoreflect.Message {
+ mi := &file_user_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetEnterpriseAuthStatusResp.ProtoReflect.Descriptor instead.
+func (*GetEnterpriseAuthStatusResp) Descriptor() ([]byte, []int) {
+ return file_user_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *GetEnterpriseAuthStatusResp) GetIsAuth() bool {
+ if x != nil {
+ return x.IsAuth
+ }
+ return false
+}
+
+var File_user_proto protoreflect.FileDescriptor
+
+var file_user_proto_rawDesc = []byte{
+ 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d,
+ 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4a, 0x0a,
+ 0x17, 0x47, 0x65, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x65, 0x72,
+ 0x70, 0x72, 0x69, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09,
+ 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
+ 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xc6, 0x02, 0x0a, 0x0e, 0x45, 0x6e,
+ 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02,
+ 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x27, 0x0a, 0x0f,
+ 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73,
+ 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f,
+ 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64,
+ 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f,
+ 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x65,
+ 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x12, 0x65, 0x6e, 0x74,
+ 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73,
+ 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x68,
+ 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61,
+ 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x62, 0x75, 0x73,
+ 0x69, 0x6e, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x07, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x63,
+ 0x65, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f,
+ 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61,
+ 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
+ 0x41, 0x74, 0x22, 0x55, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67,
+ 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14,
+ 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74,
+ 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x23, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03,
+ 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x49,
+ 0x74, 0x65, 0x6d, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x6c, 0x0a, 0x13, 0x52, 0x65, 0x76,
+ 0x69, 0x65, 0x77, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x52, 0x65, 0x71,
+ 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x5f, 0x69,
+ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,
+ 0x69, 0x73, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a,
+ 0x07, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
+ 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x22, 0xf2, 0x01, 0x0a, 0x11, 0x45, 0x6e, 0x74, 0x65,
+ 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a,
+ 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75,
+ 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,
+ 0x69, 0x73, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e,
+ 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f,
+ 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12,
+ 0x21, 0x0a, 0x0c, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73,
+ 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x62, 0x75, 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x5f, 0x6c,
+ 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x75,
+ 0x73, 0x69, 0x6e, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x63, 0x65, 0x6e, 0x73, 0x65, 0x12, 0x2d, 0x0a,
+ 0x12, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74,
+ 0x61, 0x63, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x65, 0x6e, 0x74, 0x65, 0x72,
+ 0x70, 0x72, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x22, 0x99, 0x01, 0x0a,
+ 0x0b, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08,
+ 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+ 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73,
+ 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73,
+ 0x77, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50,
+ 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63,
+ 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x14,
+ 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70,
+ 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x42, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69,
+ 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65,
+ 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x39, 0x0a, 0x0d,
+ 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a,
+ 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68,
+ 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x21, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
+ 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x25, 0x0a, 0x0b, 0x55, 0x73,
+ 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65,
+ 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
+ 0x64, 0x22, 0xde, 0x01, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
+ 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14,
+ 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70,
+ 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x32, 0x0a, 0x14, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69,
+ 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x14, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75,
+ 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x65, 0x6e, 0x74, 0x65,
+ 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0e, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65,
+ 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65,
+ 0x12, 0x20, 0x0a, 0x0b, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18,
+ 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73,
+ 0x6f, 0x6e, 0x22, 0x34, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72,
+ 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
+ 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+ 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x45,
+ 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61,
+ 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x41, 0x75, 0x74,
+ 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x41, 0x75, 0x74, 0x68, 0x32,
+ 0xcf, 0x01, 0x0a, 0x0a, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x12, 0x4b,
+ 0x0a, 0x14, 0x47, 0x65, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x65,
+ 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x6e, 0x64,
+ 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x52, 0x65, 0x71,
+ 0x1a, 0x19, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74,
+ 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x10, 0x52,
+ 0x65, 0x76, 0x69, 0x65, 0x77, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x12,
+ 0x14, 0x2e, 0x52, 0x65, 0x76, 0x69, 0x65, 0x77, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69,
+ 0x73, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45,
+ 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x12, 0x2e,
+ 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65,
+ 0x71, 0x1a, 0x0e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x32, 0x86, 0x01, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x0c, 0x52, 0x65,
+ 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x52, 0x65, 0x67,
+ 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x09, 0x4c, 0x6f, 0x67, 0x69,
+ 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71,
+ 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x0e,
+ 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e,
+ 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a,
+ 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x32, 0x85, 0x01, 0x0a, 0x04, 0x55,
+ 0x73, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12,
+ 0x0c, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e,
+ 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x54, 0x0a, 0x17,
+ 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74,
+ 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74,
+ 0x65, 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75,
+ 0x73, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x70,
+ 0x72, 0x69, 0x73, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65,
+ 0x73, 0x70, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_user_proto_rawDescOnce sync.Once
+ file_user_proto_rawDescData = file_user_proto_rawDesc
+)
+
+func file_user_proto_rawDescGZIP() []byte {
+ file_user_proto_rawDescOnce.Do(func() {
+ file_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_proto_rawDescData)
+ })
+ return file_user_proto_rawDescData
+}
+
+var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
+var file_user_proto_goTypes = []any{
+ (*EmptyResponse)(nil), // 0: EmptyResponse
+ (*GetPendingEnterpriseReq)(nil), // 1: GetPendingEnterpriseReq
+ (*EnterpriseItem)(nil), // 2: EnterpriseItem
+ (*GetPendingEnterpriseResp)(nil), // 3: GetPendingEnterpriseResp
+ (*ReviewEnterpriseReq)(nil), // 4: ReviewEnterpriseReq
+ (*EnterpriseAuthReq)(nil), // 5: EnterpriseAuthReq
+ (*RegisterReq)(nil), // 6: RegisterReq
+ (*LoginReq)(nil), // 7: LoginReq
+ (*PhoneLoginReq)(nil), // 8: PhoneLoginReq
+ (*LoginResp)(nil), // 9: LoginResp
+ (*UserInfoReq)(nil), // 10: UserInfoReq
+ (*UserInfoResp)(nil), // 11: UserInfoResp
+ (*GetEnterpriseAuthStatusReq)(nil), // 12: GetEnterpriseAuthStatusReq
+ (*GetEnterpriseAuthStatusResp)(nil), // 13: GetEnterpriseAuthStatusResp
+}
+var file_user_proto_depIdxs = []int32{
+ 2, // 0: GetPendingEnterpriseResp.list:type_name -> EnterpriseItem
+ 1, // 1: Enterprise.GetPendingEnterprise:input_type -> GetPendingEnterpriseReq
+ 4, // 2: Enterprise.ReviewEnterprise:input_type -> ReviewEnterpriseReq
+ 5, // 3: Enterprise.CreateEnterpriseAuth:input_type -> EnterpriseAuthReq
+ 6, // 4: Auth.RegisterUser:input_type -> RegisterReq
+ 7, // 5: Auth.LoginUser:input_type -> LoginReq
+ 8, // 6: Auth.PhoneLoginUser:input_type -> PhoneLoginReq
+ 10, // 7: User.UserInfo:input_type -> UserInfoReq
+ 12, // 8: User.GetEnterpriseAuthStatus:input_type -> GetEnterpriseAuthStatusReq
+ 3, // 9: Enterprise.GetPendingEnterprise:output_type -> GetPendingEnterpriseResp
+ 0, // 10: Enterprise.ReviewEnterprise:output_type -> EmptyResponse
+ 0, // 11: Enterprise.CreateEnterpriseAuth:output_type -> EmptyResponse
+ 0, // 12: Auth.RegisterUser:output_type -> EmptyResponse
+ 9, // 13: Auth.LoginUser:output_type -> LoginResp
+ 9, // 14: Auth.PhoneLoginUser:output_type -> LoginResp
+ 11, // 15: User.UserInfo:output_type -> UserInfoResp
+ 13, // 16: User.GetEnterpriseAuthStatus:output_type -> GetEnterpriseAuthStatusResp
+ 9, // [9:17] is the sub-list for method output_type
+ 1, // [1:9] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
+}
+
+func init() { file_user_proto_init() }
+func file_user_proto_init() {
+ if File_user_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_user_proto_msgTypes[0].Exporter = func(v any, i int) any {
+ switch v := v.(*EmptyResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[1].Exporter = func(v any, i int) any {
+ switch v := v.(*GetPendingEnterpriseReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[2].Exporter = func(v any, i int) any {
+ switch v := v.(*EnterpriseItem); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[3].Exporter = func(v any, i int) any {
+ switch v := v.(*GetPendingEnterpriseResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[4].Exporter = func(v any, i int) any {
+ switch v := v.(*ReviewEnterpriseReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[5].Exporter = func(v any, i int) any {
+ switch v := v.(*EnterpriseAuthReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[6].Exporter = func(v any, i int) any {
+ switch v := v.(*RegisterReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[7].Exporter = func(v any, i int) any {
+ switch v := v.(*LoginReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[8].Exporter = func(v any, i int) any {
+ switch v := v.(*PhoneLoginReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[9].Exporter = func(v any, i int) any {
+ switch v := v.(*LoginResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[10].Exporter = func(v any, i int) any {
+ switch v := v.(*UserInfoReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[11].Exporter = func(v any, i int) any {
+ switch v := v.(*UserInfoResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[12].Exporter = func(v any, i int) any {
+ switch v := v.(*GetEnterpriseAuthStatusReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_user_proto_msgTypes[13].Exporter = func(v any, i int) any {
+ switch v := v.(*GetEnterpriseAuthStatusResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_user_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 14,
+ NumExtensions: 0,
+ NumServices: 3,
+ },
+ GoTypes: file_user_proto_goTypes,
+ DependencyIndexes: file_user_proto_depIdxs,
+ MessageInfos: file_user_proto_msgTypes,
+ }.Build()
+ File_user_proto = out.File
+ file_user_proto_rawDesc = nil
+ file_user_proto_goTypes = nil
+ file_user_proto_depIdxs = nil
+}
diff --git a/apps/user/user/user_grpc.pb.go b/apps/user/user/user_grpc.pb.go
new file mode 100644
index 0000000..90a82c8
--- /dev/null
+++ b/apps/user/user/user_grpc.pb.go
@@ -0,0 +1,504 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.4.0
+// - protoc v3.19.4
+// source: user.proto
+
+package user
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.62.0 or later.
+const _ = grpc.SupportPackageIsVersion8
+
+const (
+ Enterprise_GetPendingEnterprise_FullMethodName = "/Enterprise/GetPendingEnterprise"
+ Enterprise_ReviewEnterprise_FullMethodName = "/Enterprise/ReviewEnterprise"
+ Enterprise_CreateEnterpriseAuth_FullMethodName = "/Enterprise/CreateEnterpriseAuth"
+)
+
+// EnterpriseClient is the client API for Enterprise service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+//
+// 定义服务
+type EnterpriseClient interface {
+ // 获取待审核企业列表
+ GetPendingEnterprise(ctx context.Context, in *GetPendingEnterpriseReq, opts ...grpc.CallOption) (*GetPendingEnterpriseResp, error)
+ // 审核企业
+ ReviewEnterprise(ctx context.Context, in *ReviewEnterpriseReq, opts ...grpc.CallOption) (*EmptyResponse, error)
+ // 提交审核
+ CreateEnterpriseAuth(ctx context.Context, in *EnterpriseAuthReq, opts ...grpc.CallOption) (*EmptyResponse, error)
+}
+
+type enterpriseClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewEnterpriseClient(cc grpc.ClientConnInterface) EnterpriseClient {
+ return &enterpriseClient{cc}
+}
+
+func (c *enterpriseClient) GetPendingEnterprise(ctx context.Context, in *GetPendingEnterpriseReq, opts ...grpc.CallOption) (*GetPendingEnterpriseResp, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(GetPendingEnterpriseResp)
+ err := c.cc.Invoke(ctx, Enterprise_GetPendingEnterprise_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *enterpriseClient) ReviewEnterprise(ctx context.Context, in *ReviewEnterpriseReq, opts ...grpc.CallOption) (*EmptyResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(EmptyResponse)
+ err := c.cc.Invoke(ctx, Enterprise_ReviewEnterprise_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *enterpriseClient) CreateEnterpriseAuth(ctx context.Context, in *EnterpriseAuthReq, opts ...grpc.CallOption) (*EmptyResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(EmptyResponse)
+ err := c.cc.Invoke(ctx, Enterprise_CreateEnterpriseAuth_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// EnterpriseServer is the server API for Enterprise service.
+// All implementations must embed UnimplementedEnterpriseServer
+// for forward compatibility
+//
+// 定义服务
+type EnterpriseServer interface {
+ // 获取待审核企业列表
+ GetPendingEnterprise(context.Context, *GetPendingEnterpriseReq) (*GetPendingEnterpriseResp, error)
+ // 审核企业
+ ReviewEnterprise(context.Context, *ReviewEnterpriseReq) (*EmptyResponse, error)
+ // 提交审核
+ CreateEnterpriseAuth(context.Context, *EnterpriseAuthReq) (*EmptyResponse, error)
+ mustEmbedUnimplementedEnterpriseServer()
+}
+
+// UnimplementedEnterpriseServer must be embedded to have forward compatible implementations.
+type UnimplementedEnterpriseServer struct {
+}
+
+func (UnimplementedEnterpriseServer) GetPendingEnterprise(context.Context, *GetPendingEnterpriseReq) (*GetPendingEnterpriseResp, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetPendingEnterprise not implemented")
+}
+func (UnimplementedEnterpriseServer) ReviewEnterprise(context.Context, *ReviewEnterpriseReq) (*EmptyResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ReviewEnterprise not implemented")
+}
+func (UnimplementedEnterpriseServer) CreateEnterpriseAuth(context.Context, *EnterpriseAuthReq) (*EmptyResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CreateEnterpriseAuth not implemented")
+}
+func (UnimplementedEnterpriseServer) mustEmbedUnimplementedEnterpriseServer() {}
+
+// UnsafeEnterpriseServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to EnterpriseServer will
+// result in compilation errors.
+type UnsafeEnterpriseServer interface {
+ mustEmbedUnimplementedEnterpriseServer()
+}
+
+func RegisterEnterpriseServer(s grpc.ServiceRegistrar, srv EnterpriseServer) {
+ s.RegisterService(&Enterprise_ServiceDesc, srv)
+}
+
+func _Enterprise_GetPendingEnterprise_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetPendingEnterpriseReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(EnterpriseServer).GetPendingEnterprise(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Enterprise_GetPendingEnterprise_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(EnterpriseServer).GetPendingEnterprise(ctx, req.(*GetPendingEnterpriseReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Enterprise_ReviewEnterprise_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ReviewEnterpriseReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(EnterpriseServer).ReviewEnterprise(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Enterprise_ReviewEnterprise_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(EnterpriseServer).ReviewEnterprise(ctx, req.(*ReviewEnterpriseReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Enterprise_CreateEnterpriseAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(EnterpriseAuthReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(EnterpriseServer).CreateEnterpriseAuth(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Enterprise_CreateEnterpriseAuth_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(EnterpriseServer).CreateEnterpriseAuth(ctx, req.(*EnterpriseAuthReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Enterprise_ServiceDesc is the grpc.ServiceDesc for Enterprise service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Enterprise_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "Enterprise",
+ HandlerType: (*EnterpriseServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "GetPendingEnterprise",
+ Handler: _Enterprise_GetPendingEnterprise_Handler,
+ },
+ {
+ MethodName: "ReviewEnterprise",
+ Handler: _Enterprise_ReviewEnterprise_Handler,
+ },
+ {
+ MethodName: "CreateEnterpriseAuth",
+ Handler: _Enterprise_CreateEnterpriseAuth_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "user.proto",
+}
+
+const (
+ Auth_RegisterUser_FullMethodName = "/Auth/RegisterUser"
+ Auth_LoginUser_FullMethodName = "/Auth/LoginUser"
+ Auth_PhoneLoginUser_FullMethodName = "/Auth/PhoneLoginUser"
+)
+
+// AuthClient is the client API for Auth service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+//
+// 定义认证服务
+type AuthClient interface {
+ // 注册接口
+ RegisterUser(ctx context.Context, in *RegisterReq, opts ...grpc.CallOption) (*EmptyResponse, error)
+ // 登录接口
+ LoginUser(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
+ // 手机登录接口
+ PhoneLoginUser(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*LoginResp, error)
+}
+
+type authClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewAuthClient(cc grpc.ClientConnInterface) AuthClient {
+ return &authClient{cc}
+}
+
+func (c *authClient) RegisterUser(ctx context.Context, in *RegisterReq, opts ...grpc.CallOption) (*EmptyResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(EmptyResponse)
+ err := c.cc.Invoke(ctx, Auth_RegisterUser_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *authClient) LoginUser(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(LoginResp)
+ err := c.cc.Invoke(ctx, Auth_LoginUser_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *authClient) PhoneLoginUser(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(LoginResp)
+ err := c.cc.Invoke(ctx, Auth_PhoneLoginUser_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// AuthServer is the server API for Auth service.
+// All implementations must embed UnimplementedAuthServer
+// for forward compatibility
+//
+// 定义认证服务
+type AuthServer interface {
+ // 注册接口
+ RegisterUser(context.Context, *RegisterReq) (*EmptyResponse, error)
+ // 登录接口
+ LoginUser(context.Context, *LoginReq) (*LoginResp, error)
+ // 手机登录接口
+ PhoneLoginUser(context.Context, *PhoneLoginReq) (*LoginResp, error)
+ mustEmbedUnimplementedAuthServer()
+}
+
+// UnimplementedAuthServer must be embedded to have forward compatible implementations.
+type UnimplementedAuthServer struct {
+}
+
+func (UnimplementedAuthServer) RegisterUser(context.Context, *RegisterReq) (*EmptyResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method RegisterUser not implemented")
+}
+func (UnimplementedAuthServer) LoginUser(context.Context, *LoginReq) (*LoginResp, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method LoginUser not implemented")
+}
+func (UnimplementedAuthServer) PhoneLoginUser(context.Context, *PhoneLoginReq) (*LoginResp, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method PhoneLoginUser not implemented")
+}
+func (UnimplementedAuthServer) mustEmbedUnimplementedAuthServer() {}
+
+// UnsafeAuthServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to AuthServer will
+// result in compilation errors.
+type UnsafeAuthServer interface {
+ mustEmbedUnimplementedAuthServer()
+}
+
+func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer) {
+ s.RegisterService(&Auth_ServiceDesc, srv)
+}
+
+func _Auth_RegisterUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RegisterReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AuthServer).RegisterUser(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Auth_RegisterUser_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AuthServer).RegisterUser(ctx, req.(*RegisterReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Auth_LoginUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(LoginReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AuthServer).LoginUser(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Auth_LoginUser_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AuthServer).LoginUser(ctx, req.(*LoginReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Auth_PhoneLoginUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(PhoneLoginReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AuthServer).PhoneLoginUser(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Auth_PhoneLoginUser_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AuthServer).PhoneLoginUser(ctx, req.(*PhoneLoginReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Auth_ServiceDesc is the grpc.ServiceDesc for Auth service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Auth_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "Auth",
+ HandlerType: (*AuthServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "RegisterUser",
+ Handler: _Auth_RegisterUser_Handler,
+ },
+ {
+ MethodName: "LoginUser",
+ Handler: _Auth_LoginUser_Handler,
+ },
+ {
+ MethodName: "PhoneLoginUser",
+ Handler: _Auth_PhoneLoginUser_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "user.proto",
+}
+
+const (
+ User_UserInfo_FullMethodName = "/User/UserInfo"
+ User_GetEnterpriseAuthStatus_FullMethodName = "/User/GetEnterpriseAuthStatus"
+)
+
+// UserClient is the client API for User service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type UserClient interface {
+ // 获取用户信息
+ UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*UserInfoResp, error)
+ GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpriseAuthStatusReq, opts ...grpc.CallOption) (*GetEnterpriseAuthStatusResp, error)
+}
+
+type userClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewUserClient(cc grpc.ClientConnInterface) UserClient {
+ return &userClient{cc}
+}
+
+func (c *userClient) UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*UserInfoResp, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(UserInfoResp)
+ err := c.cc.Invoke(ctx, User_UserInfo_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *userClient) GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpriseAuthStatusReq, opts ...grpc.CallOption) (*GetEnterpriseAuthStatusResp, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(GetEnterpriseAuthStatusResp)
+ err := c.cc.Invoke(ctx, User_GetEnterpriseAuthStatus_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// UserServer is the server API for User service.
+// All implementations must embed UnimplementedUserServer
+// for forward compatibility
+type UserServer interface {
+ // 获取用户信息
+ UserInfo(context.Context, *UserInfoReq) (*UserInfoResp, error)
+ GetEnterpriseAuthStatus(context.Context, *GetEnterpriseAuthStatusReq) (*GetEnterpriseAuthStatusResp, error)
+ mustEmbedUnimplementedUserServer()
+}
+
+// UnimplementedUserServer must be embedded to have forward compatible implementations.
+type UnimplementedUserServer struct {
+}
+
+func (UnimplementedUserServer) UserInfo(context.Context, *UserInfoReq) (*UserInfoResp, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UserInfo not implemented")
+}
+func (UnimplementedUserServer) GetEnterpriseAuthStatus(context.Context, *GetEnterpriseAuthStatusReq) (*GetEnterpriseAuthStatusResp, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetEnterpriseAuthStatus not implemented")
+}
+func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
+
+// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to UserServer will
+// result in compilation errors.
+type UnsafeUserServer interface {
+ mustEmbedUnimplementedUserServer()
+}
+
+func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
+ s.RegisterService(&User_ServiceDesc, srv)
+}
+
+func _User_UserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UserInfoReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServer).UserInfo(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: User_UserInfo_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServer).UserInfo(ctx, req.(*UserInfoReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _User_GetEnterpriseAuthStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetEnterpriseAuthStatusReq)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UserServer).GetEnterpriseAuthStatus(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: User_GetEnterpriseAuthStatus_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UserServer).GetEnterpriseAuthStatus(ctx, req.(*GetEnterpriseAuthStatusReq))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// User_ServiceDesc is the grpc.ServiceDesc for User service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var User_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "User",
+ HandlerType: (*UserServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "UserInfo",
+ Handler: _User_UserInfo_Handler,
+ },
+ {
+ MethodName: "GetEnterpriseAuthStatus",
+ Handler: _User_GetEnterpriseAuthStatus_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "user.proto",
+}
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..f862c73
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,157 @@
+version: '3'
+services:
+ etcd:
+ image: bitnami/etcd
+ container_name: etcd
+ environment:
+ - TZ=${TZ}
+ - ALLOW_NONE_AUTHENTICATION=yes
+ #- ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
+ - ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379
+ ports:
+ - "2379:2379" # 宿主机可以通过127.0.0.1:2379访问etcd服务
+ restart: always
+
+ etcdManage:
+ image: evildecay/etcdkeeper
+ container_name: etcdManage
+ environment:
+ - TZ=${TZ}
+ ports:
+ - "7000:8080" # 将容器的8080端口映射到宿主机的7000端口,便于web访问
+ depends_on:
+ - etcd # 确保etcd容器先启动
+ restart: always
+ zookeeper:
+ image: wurstmeister/zookeeper
+ ports:
+ - "2181:2181"
+
+ kafka:
+ image: wurstmeister/kafka
+ ports:
+ - "9092:9092"
+ environment:
+ KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
+ KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
+ KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+
+ redis:
+ image: redis:7.4.0
+ ports:
+ - "6379:6379"
+ restart: always
+
+ mysql:
+ image: mysql:8.0.34
+ environment:
+ - MYSQL_ROOT_PASSWORD=rootpassword
+ - MYSQL_DATABASE=tianyuanapi
+ - MYSQL_USER=tianyuanapi
+ - MYSQL_PASSWORD=g3h98u0291j
+ ports:
+ - "3307:3306"
+ volumes:
+ - mysql_data:/var/lib/mysql
+ restart: always
+
+ # Gateway service
+ gateway:
+ build:
+ context: ./apps/gateway
+ dockerfile: Dockerfile
+ ports:
+ - "10001:10001"
+ environment:
+ - ENV=production
+ depends_on:
+ - etcd
+ - redis
+ - mysql
+ - user
+ - sentinel
+
+ # Admin service
+ admin:
+ build:
+ context: ./apps/admin
+ dockerfile: Dockerfile
+ ports:
+ - "10002:10002"
+ environment:
+ - ENV=production
+ depends_on:
+ - etcd
+ - redis
+ - mysql
+ - user
+ - sentinel
+
+ # API service
+ api:
+ build:
+ context: ./apps/api
+ dockerfile: Dockerfile
+ ports:
+ - "10003:10003"
+ environment:
+ - ENV=production
+ depends_on:
+ - etcd
+ - redis
+ - mysql
+ - user
+ - sentinel
+ - mqs
+ - kafka
+
+ # MQS service
+ mqs:
+ build:
+ context: ./apps/mqs
+ dockerfile: Dockerfile
+ ports:
+ - "12001:12001"
+ environment:
+ - ENV=production
+ depends_on:
+ - kafka
+ - etcd
+ - redis
+ - user
+ - sentinel
+ - kafka
+
+ # Sentinel service
+ sentinel:
+ build:
+ context: ./apps/sentinel
+ dockerfile: Dockerfile
+ ports:
+ - "11002:11002"
+ environment:
+ - ENV=production
+ depends_on:
+ - redis
+ - mysql
+ - etcd
+
+ # User service
+ user:
+ build:
+ context: ./apps/user
+ dockerfile: Dockerfile
+ ports:
+ - "11001:11001"
+ environment:
+ - ENV=production
+ depends_on:
+ - mysql
+ - redis
+ - etcd
+
+volumes:
+ mysql_data:
+ driver: local
\ No newline at end of file
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..ee58277
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,128 @@
+module tianyuan-api
+
+go 1.22.4
+
+require (
+ github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9
+ github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.6
+ github.com/alibabacloud-go/tea v1.2.2
+ github.com/alibabacloud-go/tea-utils/v2 v2.0.7
+ github.com/golang-jwt/jwt/v4 v4.5.0
+ github.com/qiniu/go-sdk/v7 v7.22.0
+ github.com/zeromicro/go-queue v1.2.2
+ github.com/zeromicro/go-zero v1.7.2
+ github.com/zeromicro/x v0.0.0-20240408115609-8224c482b07e
+ google.golang.org/grpc v1.65.0
+ google.golang.org/protobuf v1.34.2
+)
+
+require (
+ filippo.io/edwards25519 v1.1.0 // indirect
+ github.com/BurntSushi/toml v1.3.2 // indirect
+ github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect
+ github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
+ github.com/alibabacloud-go/debug v1.0.0 // indirect
+ github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
+ github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
+ github.com/alibabacloud-go/tea-utils v1.3.1 // indirect
+ github.com/alibabacloud-go/tea-xml v1.1.3 // indirect
+ github.com/aliyun/credentials-go v1.3.1 // indirect
+ github.com/beorn7/perks v1.0.1 // indirect
+ github.com/cenkalti/backoff/v4 v4.3.0 // indirect
+ github.com/cespare/xxhash/v2 v2.3.0 // indirect
+ github.com/clbanning/mxj/v2 v2.5.5 // indirect
+ github.com/coreos/go-semver v0.3.1 // indirect
+ github.com/coreos/go-systemd/v22 v22.5.0 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
+ github.com/elastic/go-sysinfo v1.14.1 // indirect
+ github.com/elastic/go-windows v1.0.2 // indirect
+ github.com/emicklei/go-restful/v3 v3.11.0 // indirect
+ github.com/fatih/color v1.17.0 // indirect
+ github.com/gabriel-vasile/mimetype v1.4.3 // indirect
+ github.com/go-logr/logr v1.4.2 // indirect
+ github.com/go-logr/stdr v1.2.2 // indirect
+ github.com/go-openapi/jsonpointer v0.19.6 // indirect
+ github.com/go-openapi/jsonreference v0.20.2 // indirect
+ github.com/go-openapi/swag v0.22.4 // indirect
+ github.com/go-playground/locales v0.14.1 // indirect
+ github.com/go-playground/universal-translator v0.18.1 // indirect
+ github.com/go-playground/validator/v10 v10.22.1 // indirect
+ github.com/go-sql-driver/mysql v1.8.1 // indirect
+ github.com/gofrs/flock v0.8.1 // indirect
+ github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/golang/mock v1.6.0 // indirect
+ github.com/golang/protobuf v1.5.4 // indirect
+ github.com/google/gnostic-models v0.6.8 // indirect
+ github.com/google/go-cmp v0.6.0 // indirect
+ github.com/google/gofuzz v1.2.0 // indirect
+ github.com/google/uuid v1.6.0 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
+ github.com/josharian/intern v1.0.0 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
+ github.com/klauspost/compress v1.17.9 // indirect
+ github.com/leodido/go-urn v1.4.0 // indirect
+ github.com/mailru/easyjson v0.7.7 // indirect
+ github.com/mattn/go-colorable v0.1.13 // indirect
+ github.com/mattn/go-isatty v0.0.20 // indirect
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
+ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
+ github.com/openzipkin/zipkin-go v0.4.3 // indirect
+ github.com/pelletier/go-toml/v2 v2.2.2 // indirect
+ github.com/pierrec/lz4/v4 v4.1.21 // indirect
+ github.com/prometheus/client_golang v1.20.2 // indirect
+ github.com/prometheus/client_model v0.6.1 // indirect
+ github.com/prometheus/common v0.55.0 // indirect
+ github.com/prometheus/procfs v0.15.1 // indirect
+ github.com/redis/go-redis/v9 v9.6.1 // indirect
+ github.com/segmentio/kafka-go v0.4.47 // indirect
+ github.com/spaolacci/murmur3 v1.1.0 // indirect
+ github.com/tjfoc/gmsm v1.3.2 // indirect
+ github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
+ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
+ github.com/xeipuuv/gojsonschema v1.2.0 // indirect
+ go.etcd.io/etcd/api/v3 v3.5.15 // indirect
+ go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect
+ go.etcd.io/etcd/client/v3 v3.5.15 // indirect
+ go.opentelemetry.io/otel v1.24.0 // indirect
+ go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 // indirect
+ go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 // indirect
+ go.opentelemetry.io/otel/exporters/zipkin v1.24.0 // indirect
+ go.opentelemetry.io/otel/metric v1.24.0 // indirect
+ go.opentelemetry.io/otel/sdk v1.24.0 // indirect
+ go.opentelemetry.io/otel/trace v1.24.0 // indirect
+ go.opentelemetry.io/proto/otlp v1.3.1 // indirect
+ go.uber.org/atomic v1.10.0 // indirect
+ go.uber.org/automaxprocs v1.5.3 // indirect
+ go.uber.org/multierr v1.9.0 // indirect
+ go.uber.org/zap v1.24.0 // indirect
+ golang.org/x/crypto v0.26.0 // indirect
+ golang.org/x/net v0.28.0 // indirect
+ golang.org/x/oauth2 v0.21.0 // indirect
+ golang.org/x/sync v0.8.0 // indirect
+ golang.org/x/sys v0.25.0 // indirect
+ golang.org/x/term v0.23.0 // indirect
+ golang.org/x/text v0.17.0 // indirect
+ golang.org/x/time v0.6.0 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
+ gopkg.in/inf.v0 v0.9.1 // indirect
+ gopkg.in/ini.v1 v1.56.0 // indirect
+ gopkg.in/yaml.v2 v2.4.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+ howett.net/plist v1.0.1 // indirect
+ k8s.io/api v0.29.3 // indirect
+ k8s.io/apimachinery v0.29.4 // indirect
+ k8s.io/client-go v0.29.3 // indirect
+ k8s.io/klog/v2 v2.110.1 // indirect
+ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
+ k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
+ modernc.org/fileutil v1.3.0 // indirect
+ sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
+ sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
+ sigs.k8s.io/yaml v1.3.0 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..2d8b6e8
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,486 @@
+filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
+filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
+github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
+github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
+github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
+github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
+github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 h1:7dONQ3WNZ1zy960TmkxJPuwoolZwL7xKtpcM04MBnt4=
+github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82/go.mod h1:nLnM0KdK1CmygvjpDUO6m1TjSsiQtL61juhNsvV/JVI=
+github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 h1:iC9YFYKDGEy3n/FtqJnOkZsene9olVspKmkX5A2YBEo=
+github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc=
+github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.2/go.mod h1:5JHVmnHvGzR2wNdgaW1zDLQG8kOC4Uec8ubkMogW7OQ=
+github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9 h1:fxMCrZatZfXq5nLcgkmWBXmU3FLC1OR+m/SqVtMqflk=
+github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.9/go.mod h1:bb+Io8Sn2RuM3/Rpme6ll86jMyFSrD1bxeV/+v61KeU=
+github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY=
+github.com/alibabacloud-go/debug v1.0.0 h1:3eIEQWfay1fB24PQIEzXAswlVJtdQok8f3EVN5VrBnA=
+github.com/alibabacloud-go/debug v1.0.0/go.mod h1:8gfgZCCAC3+SCzjWtY053FrOcd4/qlH6IHTI4QyICOc=
+github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.6 h1:UTl97mt2qfavxveqCkaVg4tKaZUPzA9RKbFIRaIdtdg=
+github.com/alibabacloud-go/dysmsapi-20170525/v3 v3.0.6/go.mod h1:UWpcGrWwTbES9QW7OQ7xDffukMJ/l7lzioixIz8+lgY=
+github.com/alibabacloud-go/endpoint-util v1.1.0 h1:r/4D3VSw888XGaeNpP994zDUaxdgTSHBbVfZlzf6b5Q=
+github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE=
+github.com/alibabacloud-go/openapi-util v0.0.11/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
+github.com/alibabacloud-go/openapi-util v0.1.0 h1:0z75cIULkDrdEhkLWgi9tnLe+KhAFE/r5Pb3312/eAY=
+github.com/alibabacloud-go/openapi-util v0.1.0/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws=
+github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg=
+github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
+github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4=
+github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
+github.com/alibabacloud-go/tea v1.1.19/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A=
+github.com/alibabacloud-go/tea v1.2.1/go.mod h1:qbzof29bM/IFhLMtJPrgTGK3eauV5J2wSyEUo4OEmnA=
+github.com/alibabacloud-go/tea v1.2.2 h1:aTsR6Rl3ANWPfqeQugPglfurloyBJY85eFy7Gc1+8oU=
+github.com/alibabacloud-go/tea v1.2.2/go.mod h1:CF3vOzEMAG+bR4WOql8gc2G9H3EkH3ZLAQdpmpXMgwk=
+github.com/alibabacloud-go/tea-utils v1.3.1 h1:iWQeRzRheqCMuiF3+XkfybB3kTgUXkXX+JMrqfLeB2I=
+github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE=
+github.com/alibabacloud-go/tea-utils/v2 v2.0.0/go.mod h1:U5MTY10WwlquGPS34DOeomUGBB0gXbLueiq5Trwu0C4=
+github.com/alibabacloud-go/tea-utils/v2 v2.0.3/go.mod h1:sj1PbjPodAVTqGTA3olprfeeqqmwD0A5OQz94o9EuXQ=
+github.com/alibabacloud-go/tea-utils/v2 v2.0.6/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I=
+github.com/alibabacloud-go/tea-utils/v2 v2.0.7 h1:WDx5qW3Xa5ZgJ1c8NfqJkF6w+AU5wB8835UdhPr6Ax0=
+github.com/alibabacloud-go/tea-utils/v2 v2.0.7/go.mod h1:qxn986l+q33J5VkialKMqT/TTs3E+U9MJpd001iWQ9I=
+github.com/alibabacloud-go/tea-xml v1.1.2/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8=
+github.com/alibabacloud-go/tea-xml v1.1.3 h1:7LYnm+JbOq2B+T/B0fHC4Ies4/FofC4zHzYtqw7dgt0=
+github.com/alibabacloud-go/tea-xml v1.1.3/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8=
+github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE=
+github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
+github.com/alicebob/miniredis/v2 v2.33.0 h1:uvTF0EDeu9RLnUEG27Db5I68ESoIxTiXbNUiji6lZrA=
+github.com/alicebob/miniredis/v2 v2.33.0/go.mod h1:MhP4a3EU7aENRi9aO+tHfTBZicLqQevyi/DJpoj6mi0=
+github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
+github.com/aliyun/credentials-go v1.3.1 h1:uq/0v7kWrxmoLGpqjx7vtQ/s03f0zR//0br/xWDTE28=
+github.com/aliyun/credentials-go v1.3.1/go.mod h1:8jKYhQuDawt8x2+fusqa1Y6mPxemTsBEN04dgcAcYz0=
+github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
+github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
+github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
+github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
+github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
+github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
+github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
+github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
+github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/clbanning/mxj/v2 v2.5.5 h1:oT81vUeEiQQ/DcHbzSytRngP6Ky9O+L+0Bw0zSJag9E=
+github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s=
+github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
+github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
+github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
+github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
+github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+github.com/dave/jennifer v1.6.1/go.mod h1:nXbxhEmQfOZhWml3D1cDK5M1FLnMSozpbFN/m3RmGZc=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
+github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
+github.com/elastic/go-sysinfo v1.0.2/go.mod h1:O/D5m1VpYLwGjCYzEt63g3Z1uO3jXfwyzzjiW90t8cY=
+github.com/elastic/go-sysinfo v1.14.1 h1:BpY/Utfz75oKSpsQnbAJmmlnT3gBV9WFsopBEYgjhZY=
+github.com/elastic/go-sysinfo v1.14.1/go.mod h1:FKUXnZWhnYI0ueO7jhsGV3uQJ5hiz8OqM5b3oGyaRr8=
+github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU=
+github.com/elastic/go-windows v1.0.2 h1:yoLLsAsV5cfg9FLhZ9EXZ2n2sQFKeDYrHenkcivY4vI=
+github.com/elastic/go-windows v1.0.2/go.mod h1:bGcDpBzXgYSqM0Gx3DM4+UxFj300SZLixie9u9ixLM8=
+github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
+github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
+github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
+github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
+github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
+github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
+github.com/gammazero/toposort v0.1.1/go.mod h1:H2cozTnNpMw0hg2VHAYsAxmkHXBYroNangj2NTBQDvw=
+github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
+github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
+github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
+github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
+github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
+github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
+github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
+github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
+github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
+github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
+github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
+github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
+github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
+github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
+github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
+github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
+github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
+github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
+github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
+github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
+github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
+github.com/go-playground/validator/v10 v10.7.0/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk=
+github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
+github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
+github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
+github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
+github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
+github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
+github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
+github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw=
+github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
+github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
+github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
+github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
+github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
+github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
+github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
+github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
+github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
+github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
+github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
+github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y=
+github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
+github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
+github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0=
+github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
+github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
+github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
+github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
+github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
+github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
+github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
+github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
+github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
+github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
+github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
+github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
+github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
+github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
+github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
+github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
+github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
+github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
+github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
+github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
+github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
+github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
+github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
+github.com/matishsiao/goInfo v0.0.0-20210923090445-da2e3fa8d45f/go.mod h1:aEt7p9Rvh67BYApmZwNDPpgircTO2kgdmDUoF/1QmwA=
+github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
+github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
+github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
+github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
+github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
+github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
+github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
+github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4=
+github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
+github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
+github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
+github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
+github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
+github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
+github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
+github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
+github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
+github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
+github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
+github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
+github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
+github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
+github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
+github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
+github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
+github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
+github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
+github.com/qiniu/dyn v1.3.0/go.mod h1:E8oERcm8TtwJiZvkQPbcAh0RL8jO1G0VXJMW3FAWdkk=
+github.com/qiniu/go-sdk/v7 v7.22.0 h1:NiRj6+beSkKsPBr4XN9OdjPJQKhERtOwOwu3HJtzcWQ=
+github.com/qiniu/go-sdk/v7 v7.22.0/go.mod h1:44lnyCs6gflCxMUV1yTBlZhPEB4ZO6LIDHkMV8Rofms=
+github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
+github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4=
+github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA=
+github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
+github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
+github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
+github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
+github.com/segmentio/kafka-go v0.4.47 h1:IqziR4pA3vrZq7YdRxaT3w1/5fvIH5qpCwstUanQQB0=
+github.com/segmentio/kafka-go v0.4.47/go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0=
+github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
+github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
+github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
+github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
+github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
+github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
+github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
+github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
+github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
+github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
+github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
+github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
+github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
+github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
+github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
+github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
+github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
+github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
+github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
+github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
+github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
+github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
+github.com/zeromicro/go-queue v1.2.2 h1:3TMhRlI/8lZy13Sj6FBBWWRXlsQhGCchRxY2itfV1Is=
+github.com/zeromicro/go-queue v1.2.2/go.mod h1:5HiNTEw1tACi9itho0JYQ1+EpIGpSFM4tOQ4bit+yKM=
+github.com/zeromicro/go-zero v1.7.2 h1:a8lyVOG3KXG4LrAy6ZmtJTJtisX4Ostc4Pst4fE704I=
+github.com/zeromicro/go-zero v1.7.2/go.mod h1:WFXfF92Exw0O7WECifS6r99JSzv4KEN49x9RhAfgkMc=
+github.com/zeromicro/x v0.0.0-20240408115609-8224c482b07e h1:F5waakzloTfbJg2lcO1xvrzO6ssn7jQ38lXIDBz+nbQ=
+github.com/zeromicro/x v0.0.0-20240408115609-8224c482b07e/go.mod h1:5TP11tc1RHPCi5C/KDL0kIB0KgJAb9FB3ChpT/qM/jA=
+go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk=
+go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM=
+go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA=
+go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU=
+go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4=
+go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU=
+go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
+go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
+go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
+go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 h1:t6wl9SPayj+c7lEIFgm4ooDBZVb01IhLB4InpomhRw8=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0/go.mod h1:iSDOcsnSA5INXzZtwaBPrKp/lWu/V14Dd+llD0oI2EA=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 h1:Mw5xcxMwlqoJd97vwPxA8isEaIoxsta9/Q51+TTJLGE=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0/go.mod h1:CQNu9bj7o7mC6U7+CA/schKEYakYXWr79ucDHTMGhCM=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0 h1:Xw8U6u2f8DK2XAkGRFV7BBLENgnTGX9i4rQRxJf+/vs=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0/go.mod h1:6KW1Fm6R/s6Z3PGXwSJN2K4eT6wQB3vXX6CVnYX9NmM=
+go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0 h1:s0PHtIkN+3xrbDOpt2M8OTG92cWqUESvzh2MxiR5xY8=
+go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.24.0/go.mod h1:hZlFbDbRt++MMPCCfSJfmhkGIWnX1h3XjkfxZUjLrIA=
+go.opentelemetry.io/otel/exporters/zipkin v1.24.0 h1:3evrL5poBuh1KF51D9gO/S+N/1msnm4DaBqs/rpXUqY=
+go.opentelemetry.io/otel/exporters/zipkin v1.24.0/go.mod h1:0EHgD8R0+8yRhUYJOGR8Hfg2dpiJQxDOszd5smVO9wM=
+go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
+go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
+go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
+go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
+go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
+go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
+go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0=
+go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8=
+go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
+go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
+go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
+go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
+go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
+go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
+go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
+go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
+go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
+go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
+golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
+golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
+golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
+golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
+golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.6.0-dev/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
+golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
+golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
+golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
+golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
+golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
+golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
+golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190425145619-16072639606e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
+golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
+golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
+golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
+golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
+golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
+golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
+golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
+golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
+golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
+golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
+golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
+golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY=
+google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY=
+google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
+google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
+google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
+google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
+gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
+gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
+gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
+gopkg.in/ini.v1 v1.56.0 h1:DPMeDvGTM54DXbPkVIZsp19fp/I2K7zwA/itHYHKo8Y=
+gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
+gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
+howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM=
+howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
+k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw=
+k8s.io/api v0.29.3/go.mod h1:y2yg2NTyHUUkIoTC+phinTnEa3KFM6RZ3szxt014a80=
+k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q=
+k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y=
+k8s.io/client-go v0.29.3 h1:R/zaZbEAxqComZ9FHeQwOh3Y1ZUs7FaHKZdQtIc2WZg=
+k8s.io/client-go v0.29.3/go.mod h1:tkDisCvgPfiRpxGnOORfkljmS+UrW+WtXAy2fTvXJB0=
+k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
+k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
+k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
+k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
+k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
+k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
+modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
+modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
+modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
+sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
+sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
+sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
+sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
+sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
+sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
diff --git a/pkg/crypto/crypto.go b/pkg/crypto/crypto.go
new file mode 100644
index 0000000..f6350c0
--- /dev/null
+++ b/pkg/crypto/crypto.go
@@ -0,0 +1,88 @@
+package crypto
+
+import (
+ "bytes"
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/rand"
+ "encoding/base64"
+ "errors"
+ "io"
+)
+
+// PKCS7填充
+func PKCS7Padding(ciphertext []byte, blockSize int) []byte {
+ padding := blockSize - len(ciphertext)%blockSize
+ padtext := bytes.Repeat([]byte{byte(padding)}, padding)
+ return append(ciphertext, padtext...)
+}
+
+// 去除PKCS7填充
+func PKCS7UnPadding(origData []byte) ([]byte, error) {
+ length := len(origData)
+ if length == 0 {
+ return nil, errors.New("input data error")
+ }
+ unpadding := int(origData[length-1])
+ if unpadding > length {
+ return nil, errors.New("unpadding size is invalid")
+ }
+ return origData[:(length - unpadding)], nil
+}
+
+// AES CBC模式加密,Base64传入传出
+func AesEncrypt(plainText, key []byte) (string, error) {
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return "", err
+ }
+ blockSize := block.BlockSize()
+ plainText = PKCS7Padding(plainText, blockSize)
+
+ cipherText := make([]byte, blockSize+len(plainText))
+ iv := cipherText[:blockSize] // 使用前blockSize字节作为IV
+ _, err = io.ReadFull(rand.Reader, iv)
+ if err != nil {
+ return "", err
+ }
+
+ mode := cipher.NewCBCEncrypter(block, iv)
+ mode.CryptBlocks(cipherText[blockSize:], plainText)
+
+ return base64.StdEncoding.EncodeToString(cipherText), nil
+}
+
+// AES CBC模式解密,Base64传入传出
+func AesDecrypt(cipherTextBase64 string, key []byte) ([]byte, error) {
+ cipherText, err := base64.StdEncoding.DecodeString(cipherTextBase64)
+ if err != nil {
+ return nil, err
+ }
+
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+
+ blockSize := block.BlockSize()
+ if len(cipherText) < blockSize {
+ return nil, errors.New("ciphertext too short")
+ }
+
+ iv := cipherText[:blockSize]
+ cipherText = cipherText[blockSize:]
+
+ if len(cipherText)%blockSize != 0 {
+ return nil, errors.New("ciphertext is not a multiple of the block size")
+ }
+
+ mode := cipher.NewCBCDecrypter(block, iv)
+ mode.CryptBlocks(cipherText, cipherText)
+
+ plainText, err := PKCS7UnPadding(cipherText)
+ if err != nil {
+ return nil, err
+ }
+
+ return plainText, nil
+}
diff --git a/pkg/crypto/generate.go b/pkg/crypto/generate.go
new file mode 100644
index 0000000..e4d7437
--- /dev/null
+++ b/pkg/crypto/generate.go
@@ -0,0 +1,31 @@
+package crypto
+
+import (
+ "crypto/rand"
+ "encoding/hex"
+ "io"
+)
+
+// 生成AES-128密钥的函数,符合市面规范
+func GenerateSecretKey() (string, error) {
+ key := make([]byte, 16) // 16字节密钥
+ _, err := io.ReadFull(rand.Reader, key)
+ if err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(key), nil
+}
+
+func GenerateSecretId() (string, error) {
+ // 创建一个字节数组,用于存储随机数据
+ bytes := make([]byte, 8) // 因为每个字节表示两个16进制字符
+
+ // 读取随机字节到数组中
+ _, err := rand.Read(bytes)
+ if err != nil {
+ return "", err
+ }
+
+ // 将字节数组转换为16进制字符串
+ return hex.EncodeToString(bytes), nil
+}
diff --git a/pkg/crypto/west_crypto.go b/pkg/crypto/west_crypto.go
new file mode 100644
index 0000000..71d8a41
--- /dev/null
+++ b/pkg/crypto/west_crypto.go
@@ -0,0 +1,150 @@
+package crypto
+
+import (
+ "bytes"
+ "crypto/aes"
+ "crypto/cipher"
+ "crypto/sha1"
+ "encoding/base64"
+)
+
+const (
+ KEY_SIZE = 16 // AES-128, 16 bytes
+)
+
+// Encrypt encrypts the given data using AES encryption in ECB mode with PKCS5 padding
+func WestDexEncrypt(data, secretKey string) (string, error) {
+ key := generateAESKey(KEY_SIZE*8, []byte(secretKey))
+ ciphertext, err := aesEncrypt([]byte(data), key)
+ if err != nil {
+ return "", err
+ }
+ return base64.StdEncoding.EncodeToString(ciphertext), nil
+}
+
+// Decrypt decrypts the given base64-encoded string using AES encryption in ECB mode with PKCS5 padding
+func WestDexDecrypt(encodedData, secretKey string) ([]byte, error) {
+ ciphertext, err := base64.StdEncoding.DecodeString(encodedData)
+ if err != nil {
+ return nil, err
+ }
+ key := generateAESKey(KEY_SIZE*8, []byte(secretKey))
+ plaintext, err := aesDecrypt(ciphertext, key)
+ if err != nil {
+ return nil, err
+ }
+ return plaintext, nil
+}
+
+// generateAESKey generates a key for AES encryption using a SHA-1 based PRNG
+func generateAESKey(length int, password []byte) []byte {
+ h := sha1.New()
+ h.Write(password)
+ state := h.Sum(nil)
+
+ keyBytes := make([]byte, 0, length/8)
+ for len(keyBytes) < length/8 {
+ h := sha1.New()
+ h.Write(state)
+ state = h.Sum(nil)
+ keyBytes = append(keyBytes, state...)
+ }
+
+ return keyBytes[:length/8]
+}
+
+// aesEncrypt encrypts plaintext using AES in ECB mode with PKCS5 padding
+func aesEncrypt(plaintext, key []byte) ([]byte, error) {
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+ paddedPlaintext := pkcs5Padding(plaintext, block.BlockSize())
+ ciphertext := make([]byte, len(paddedPlaintext))
+ mode := newECBEncrypter(block)
+ mode.CryptBlocks(ciphertext, paddedPlaintext)
+ return ciphertext, nil
+}
+
+// aesDecrypt decrypts ciphertext using AES in ECB mode with PKCS5 padding
+func aesDecrypt(ciphertext, key []byte) ([]byte, error) {
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return nil, err
+ }
+ plaintext := make([]byte, len(ciphertext))
+ mode := newECBDecrypter(block)
+ mode.CryptBlocks(plaintext, ciphertext)
+ return pkcs5Unpadding(plaintext), nil
+}
+
+// pkcs5Padding pads the input to a multiple of the block size using PKCS5 padding
+func pkcs5Padding(src []byte, blockSize int) []byte {
+ padding := blockSize - len(src)%blockSize
+ padtext := bytes.Repeat([]byte{byte(padding)}, padding)
+ return append(src, padtext...)
+}
+
+// pkcs5Unpadding removes PKCS5 padding from the input
+func pkcs5Unpadding(src []byte) []byte {
+ length := len(src)
+ unpadding := int(src[length-1])
+ return src[:(length - unpadding)]
+}
+
+// ECB mode encryption/decryption
+type ecb struct {
+ b cipher.Block
+ blockSize int
+}
+
+func newECB(b cipher.Block) *ecb {
+ return &ecb{
+ b: b,
+ blockSize: b.BlockSize(),
+ }
+}
+
+type ecbEncrypter ecb
+
+func newECBEncrypter(b cipher.Block) cipher.BlockMode {
+ return (*ecbEncrypter)(newECB(b))
+}
+
+func (x *ecbEncrypter) BlockSize() int { return x.blockSize }
+
+func (x *ecbEncrypter) CryptBlocks(dst, src []byte) {
+ if len(src)%x.blockSize != 0 {
+ panic("crypto/cipher: input not full blocks")
+ }
+ if len(dst) < len(src) {
+ panic("crypto/cipher: output smaller than input")
+ }
+ for len(src) > 0 {
+ x.b.Encrypt(dst, src[:x.blockSize])
+ src = src[x.blockSize:]
+ dst = dst[x.blockSize:]
+ }
+}
+
+type ecbDecrypter ecb
+
+func newECBDecrypter(b cipher.Block) cipher.BlockMode {
+ return (*ecbDecrypter)(newECB(b))
+}
+
+func (x *ecbDecrypter) BlockSize() int { return x.blockSize }
+
+func (x *ecbDecrypter) CryptBlocks(dst, src []byte) {
+ if len(src)%x.blockSize != 0 {
+ panic("crypto/cipher: input not full blocks")
+ }
+ if len(dst) < len(src) {
+ panic("crypto/cipher: output smaller than input")
+ }
+ for len(src) > 0 {
+ x.b.Decrypt(dst, src[:x.blockSize])
+ src = src[x.blockSize:]
+ dst = dst[x.blockSize:]
+ }
+}
diff --git a/pkg/jwt/jwtx.go b/pkg/jwt/jwtx.go
new file mode 100644
index 0000000..bae8de9
--- /dev/null
+++ b/pkg/jwt/jwtx.go
@@ -0,0 +1,68 @@
+package jwtx
+
+import (
+ "errors"
+ "github.com/golang-jwt/jwt/v4"
+ "strconv"
+ "time"
+)
+
+// Token 生成逻辑的函数,接收 userId、过期时间和密钥,返回生成的 token
+func GenerateJwtToken(userId int64, secret string, expireTime int64) (string, error) {
+ // 获取当前时间戳
+ now := time.Now().Unix()
+ // 定义 JWT Claims
+ claims := jwt.MapClaims{
+ "exp": now + expireTime, // token 过期时间
+ "iat": now, // 签发时间
+ "userId": userId, // 用户ID
+ }
+
+ // 创建新的 JWT token
+ token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
+
+ // 使用密钥对 token 签名
+ signedToken, err := token.SignedString([]byte(secret))
+ if err != nil {
+ return "", err
+ }
+
+ return signedToken, nil
+}
+func ParseJwtToken(tokenStr string, secret string) (int64, error) {
+ token, err := jwt.Parse(tokenStr, func(token *jwt.Token) (interface{}, error) {
+ return []byte(secret), nil
+ })
+
+ if err != nil || !token.Valid {
+ return 0, errors.New("invalid JWT")
+ }
+
+ claims, ok := token.Claims.(jwt.MapClaims)
+ if !ok || !token.Valid {
+ return 0, errors.New("invalid JWT claims")
+ }
+
+ // 从 claims 中提取 userId
+ userIdRaw, ok := claims["userId"]
+ if !ok {
+ return 0, errors.New("userId not found in JWT")
+ }
+
+ // 处理不同类型的 userId,确保它被转换为 int64
+ switch userId := userIdRaw.(type) {
+ case float64:
+ return int64(userId), nil
+ case int64:
+ return userId, nil
+ case string:
+ // 如果 userId 是字符串,可以尝试将其转换为 int64
+ parsedId, err := strconv.ParseInt(userId, 10, 64)
+ if err != nil {
+ return 0, errors.New("invalid userId in JWT")
+ }
+ return parsedId, nil
+ default:
+ return 0, errors.New("unsupported userId type in JWT")
+ }
+}
diff --git a/pkg/response/response.go b/pkg/response/response.go
new file mode 100644
index 0000000..fc591ee
--- /dev/null
+++ b/pkg/response/response.go
@@ -0,0 +1,69 @@
+package response
+
+import (
+ "github.com/zeromicro/go-zero/rest/httpx"
+ "net/http"
+)
+
+// 定义通用的响应结构
+type Response struct {
+ Code int `json:"code"`
+ Data interface{} `json:"data,omitempty"`
+ Message string `json:"message"`
+}
+
+// 定义分页响应结构
+type PageResult struct {
+ List interface{} `json:"list"`
+ Total int64 `json:"total"`
+ Page int `json:"page"`
+ PageSize int `json:"pageSize"`
+}
+
+// 响应成功
+func Success(w http.ResponseWriter, data interface{}) {
+ result := Response{
+ Code: http.StatusOK,
+ Data: data,
+ Message: "操作成功",
+ }
+ httpx.OkJson(w, result)
+}
+
+// 响应失败
+func Fail(w http.ResponseWriter, code int, message string) {
+ result := Response{
+ Code: code,
+ Message: message,
+ }
+ httpx.WriteJson(w, code, result)
+}
+
+// 无权限
+func Unauthorized(w http.ResponseWriter, message string) {
+ result := Response{
+ Code: http.StatusUnauthorized,
+ Message: message,
+ }
+ httpx.WriteJson(w, http.StatusUnauthorized, result)
+}
+
+// 响应分页数据
+func Page(w http.ResponseWriter, list interface{}, total int64, page int, pageSize int) {
+ result := Response{
+ Code: http.StatusOK,
+ Data: PageResult{List: list, Total: total, Page: page, PageSize: pageSize},
+ Message: "查询成功",
+ }
+ httpx.OkJson(w, result)
+}
+
+// 自定义错误响应
+func CustomError(w http.ResponseWriter, code int, message string, data interface{}) {
+ result := Response{
+ Code: code,
+ Data: data,
+ Message: message,
+ }
+ httpx.WriteJson(w, code, result)
+}
diff --git a/pkg/schema/schemaVerify.go b/pkg/schema/schemaVerify.go
new file mode 100644
index 0000000..919c599
--- /dev/null
+++ b/pkg/schema/schemaVerify.go
@@ -0,0 +1,86 @@
+package schema
+
+import (
+ "encoding/json"
+ "fmt"
+ "github.com/xeipuuv/gojsonschema"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+// ValidationResult 结构用于保存校验结果
+type ValidationResult struct {
+ Valid bool
+ Data map[string]interface{}
+ Errors string
+}
+
+// 校验函数:接受 schema 文件路径和 JSON 数据
+func ValidateJSONWithSchema(schemaFileName string, data []byte) (ValidationResult, error) {
+ // 获取项目根目录
+ rootPath, err := os.Getwd()
+ if err != nil {
+ return ValidationResult{}, fmt.Errorf("无法获取项目根目录: %v", err)
+ }
+
+ // 构建本地 Schema 文件路径
+ schemaPath := filepath.Join(rootPath, "internal", "schema", schemaFileName)
+
+ // 将文件路径转换为 file:// URI 格式
+ schemaURI := "file:///" + filepath.ToSlash(schemaPath)
+
+ // 读取 schema 文件,通过 URI 加载
+ schemaLoader := gojsonschema.NewReferenceLoader(schemaURI)
+
+ // 将传入的 []byte 数据转为 JSON Loader
+ jsonLoader := gojsonschema.NewBytesLoader(data)
+
+ // 执行校验
+ result, err := gojsonschema.Validate(schemaLoader, jsonLoader)
+ if err != nil {
+ return ValidationResult{}, fmt.Errorf("校验过程中出错: %v", err)
+ }
+
+ // 初始化返回结果
+ validationResult := ValidationResult{
+ Valid: result.Valid(),
+ Data: make(map[string]interface{}),
+ Errors: "",
+ }
+
+ // 如果校验失败,收集并自定义错误信息
+ if !result.Valid() {
+ errorMessages := collectErrors(result.Errors())
+ validationResult.Errors = formatErrors(errorMessages)
+ return validationResult, nil
+ }
+
+ // 校验成功,解析 JSON
+ if err := json.Unmarshal(data, &validationResult.Data); err != nil {
+ return validationResult, fmt.Errorf("JSON 解析出错: %v", err)
+ }
+
+ return validationResult, nil
+}
+
+// collectErrors 自定义处理错误信息
+func collectErrors(errors []gojsonschema.ResultError) []string {
+ var errorMessages []string
+ for _, err := range errors {
+ // 从 Details() 中获取真正的字段名
+ details := err.Details()
+ fieldName, ok := details["property"].(string)
+ if !ok {
+ fieldName = err.Field() // 默认使用 err.Field(),如果 property 不存在
+ }
+
+ errorMessages = append(errorMessages, fmt.Sprintf("%s: %s", fieldName, err.Description()))
+ }
+ return errorMessages
+}
+
+// formatErrors 将错误列表格式化为美观的字符串
+func formatErrors(errors []string) string {
+ return strings.Join(errors, ", ") // 用换行符连接每个错误信息
+}
diff --git a/pkg/sqlutil/nullstring.go b/pkg/sqlutil/nullstring.go
new file mode 100644
index 0000000..ad7f62b
--- /dev/null
+++ b/pkg/sqlutil/nullstring.go
@@ -0,0 +1,19 @@
+package sqlutil
+
+import "database/sql"
+
+// StringToNullString 将 string 转换为 sql.NullString
+func StringToNullString(s string) sql.NullString {
+ return sql.NullString{
+ String: s,
+ Valid: s != "",
+ }
+}
+
+// NullStringToString 将 sql.NullString 转换为 string
+func NullStringToString(ns sql.NullString) string {
+ if ns.Valid {
+ return ns.String
+ }
+ return ""
+}
diff --git a/template/api/config.tpl b/template/api/config.tpl
new file mode 100644
index 0000000..55127ef
--- /dev/null
+++ b/template/api/config.tpl
@@ -0,0 +1,9 @@
+package config
+
+import {{.authImport}}
+
+type Config struct {
+ rest.RestConf
+ {{.auth}}
+ {{.jwtTrans}}
+}
diff --git a/template/api/context.tpl b/template/api/context.tpl
new file mode 100644
index 0000000..c15c1e4
--- /dev/null
+++ b/template/api/context.tpl
@@ -0,0 +1,17 @@
+package svc
+
+import (
+ {{.configImport}}
+)
+
+type ServiceContext struct {
+ Config {{.config}}
+ {{.middleware}}
+}
+
+func NewServiceContext(c {{.config}}) *ServiceContext {
+ return &ServiceContext{
+ Config: c,
+ {{.middlewareAssignment}}
+ }
+}
diff --git a/template/api/etc.tpl b/template/api/etc.tpl
new file mode 100644
index 0000000..ed55cf1
--- /dev/null
+++ b/template/api/etc.tpl
@@ -0,0 +1,3 @@
+Name: {{.serviceName}}
+Host: {{.host}}
+Port: {{.port}}
diff --git a/template/api/handler.tpl b/template/api/handler.tpl
new file mode 100644
index 0000000..eaefd84
--- /dev/null
+++ b/template/api/handler.tpl
@@ -0,0 +1,28 @@
+package {{.PkgName}}
+
+import (
+ "net/http"
+
+ {{if .HasRequest}}"github.com/zeromicro/go-zero/rest/httpx"{{end}}
+ {{.ImportPackages}}
+ xhttp "github.com/zeromicro/x/http"
+)
+
+{{if .HasDoc}}{{.Doc}}{{end}}
+func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ {{if .HasRequest}}var req types.{{.RequestType}}
+ if err := httpx.Parse(r, &req); err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ return
+ }
+
+ {{end}}l := {{.LogicName}}.New{{.LogicType}}(r.Context(), svcCtx)
+ {{if .HasResp}}resp, {{end}}err := l.{{.Call}}({{if .HasRequest}}&req{{end}})
+ if err != nil {
+ xhttp.JsonBaseResponseCtx(r.Context(), w, err)
+ } else {
+ {{if .HasResp}}xhttp.JsonBaseResponseCtx(r.Context(), w, resp){{else}}xhttp.JsonBaseResponseCtx(r.Context(), w, nil){{end}}
+ }
+ }
+}
diff --git a/template/api/logic.tpl b/template/api/logic.tpl
new file mode 100644
index 0000000..94611c5
--- /dev/null
+++ b/template/api/logic.tpl
@@ -0,0 +1,26 @@
+package {{.pkgName}}
+
+import (
+ {{.imports}}
+)
+
+type {{.logic}} struct {
+ logx.Logger
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+}
+
+{{if .hasDoc}}{{.doc}}{{end}}
+func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}} {
+ return &{{.logic}}{
+ Logger: logx.WithContext(ctx),
+ ctx: ctx,
+ svcCtx: svcCtx,
+ }
+}
+
+func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} {
+ // todo: add your logic here and delete this line
+
+ {{.returnString}}
+}
diff --git a/template/api/main.tpl b/template/api/main.tpl
new file mode 100644
index 0000000..ad1a46d
--- /dev/null
+++ b/template/api/main.tpl
@@ -0,0 +1,26 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+
+ {{.importPackages}}
+)
+
+var configFile = flag.String("f", "etc/{{.serviceName}}.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()
+}
diff --git a/template/api/middleware.tpl b/template/api/middleware.tpl
new file mode 100644
index 0000000..3a9f8e9
--- /dev/null
+++ b/template/api/middleware.tpl
@@ -0,0 +1,19 @@
+package middleware
+
+import "net/http"
+
+type {{.name}} struct {
+}
+
+func New{{.name}}() *{{.name}} {
+ return &{{.name}}{}
+}
+
+func (m *{{.name}})Handle(next http.HandlerFunc) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ // TODO generate middleware implement function, delete after code implementation
+
+ // Passthrough to next handler if need
+ next(w, r)
+ }
+}
diff --git a/template/api/route-addition.tpl b/template/api/route-addition.tpl
new file mode 100644
index 0000000..bb8a5df
--- /dev/null
+++ b/template/api/route-addition.tpl
@@ -0,0 +1,4 @@
+
+ server.AddRoutes(
+ {{.routes}} {{.jwt}}{{.signature}} {{.prefix}} {{.timeout}} {{.maxBytes}}
+ )
diff --git a/template/api/routes.tpl b/template/api/routes.tpl
new file mode 100644
index 0000000..f972853
--- /dev/null
+++ b/template/api/routes.tpl
@@ -0,0 +1,15 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl {{.version}}
+
+package handler
+
+import (
+ "net/http"{{if .hasTimeout}}
+ "time"{{end}}
+
+ {{.importPackages}}
+)
+
+func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
+ {{.routesAdditions}}
+}
diff --git a/template/api/template.tpl b/template/api/template.tpl
new file mode 100644
index 0000000..2176441
--- /dev/null
+++ b/template/api/template.tpl
@@ -0,0 +1,24 @@
+syntax = "v1"
+
+info (
+ title: // TODO: add title
+ desc: // TODO: add description
+ author: "{{.gitUser}}"
+ email: "{{.gitEmail}}"
+)
+
+type request {
+ // TODO: add members here and delete this comment
+}
+
+type response {
+ // TODO: add members here and delete this comment
+}
+
+service {{.serviceName}} {
+ @handler GetUser // TODO: set handler name and delete this comment
+ get /users/id/:userId(request) returns(response)
+
+ @handler CreateUser // TODO: set handler name and delete this comment
+ post /users/create(request)
+}
diff --git a/template/api/types.tpl b/template/api/types.tpl
new file mode 100644
index 0000000..8015c57
--- /dev/null
+++ b/template/api/types.tpl
@@ -0,0 +1,8 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl {{.version}}
+
+package types{{if .containsTime}}
+import (
+ "time"
+){{end}}
+{{.types}}
diff --git a/template/docker/docker.tpl b/template/docker/docker.tpl
new file mode 100644
index 0000000..d1b5ff4
--- /dev/null
+++ b/template/docker/docker.tpl
@@ -0,0 +1,33 @@
+FROM golang:{{.Version}}alpine AS builder
+
+LABEL stage=gobuilder
+
+ENV CGO_ENABLED 0
+{{if .Chinese}}ENV GOPROXY https://goproxy.cn,direct
+RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
+{{end}}{{if .HasTimezone}}
+RUN apk update --no-cache && apk add --no-cache tzdata
+{{end}}
+WORKDIR /build
+
+ADD go.mod .
+ADD go.sum .
+RUN go mod download
+COPY . .
+{{if .Argument}}COPY {{.GoRelPath}}/etc /app/etc
+{{end}}RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoMainFrom}}
+
+
+FROM {{.BaseImage}}
+
+COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
+{{if .HasTimezone}}COPY --from=builder /usr/share/zoneinfo/{{.Timezone}} /usr/share/zoneinfo/{{.Timezone}}
+ENV TZ {{.Timezone}}
+{{end}}
+WORKDIR /app
+COPY --from=builder /app/{{.ExeFile}} /app/{{.ExeFile}}{{if .Argument}}
+COPY --from=builder /app/etc /app/etc{{end}}
+{{if .HasPort}}
+EXPOSE {{.Port}}
+{{end}}
+CMD ["./{{.ExeFile}}"{{.Argument}}]
diff --git a/template/gateway/etc.tpl b/template/gateway/etc.tpl
new file mode 100644
index 0000000..0a70f1a
--- /dev/null
+++ b/template/gateway/etc.tpl
@@ -0,0 +1,18 @@
+Name: gateway-example # gateway name
+Host: localhost # gateway host
+Port: 8888 # gateway port
+Upstreams: # upstreams
+ - Grpc: # grpc upstream
+ Target: 0.0.0.0:8080 # grpc target,the direct grpc server address,for only one node
+# Endpoints: [0.0.0.0:8080,192.168.120.1:8080] # grpc endpoints, the grpc server address list, for multiple nodes
+# Etcd: # etcd config, if you want to use etcd to discover the grpc server address
+# Hosts: [127.0.0.1:2378,127.0.0.1:2379] # etcd hosts
+# Key: greet.grpc # the discovery key
+ # protoset mode
+ ProtoSets:
+ - hello.pb
+ # Mappings can also be written in proto options
+# Mappings: # routes mapping
+# - Method: get
+# Path: /ping
+# RpcPath: hello.Hello/Ping
diff --git a/template/gateway/main.tpl b/template/gateway/main.tpl
new file mode 100644
index 0000000..6273451
--- /dev/null
+++ b/template/gateway/main.tpl
@@ -0,0 +1,20 @@
+package main
+
+import (
+ "flag"
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/gateway"
+)
+
+var configFile = flag.String("f", "etc/gateway.yaml", "config file")
+
+func main() {
+ flag.Parse()
+
+ var c gateway.GatewayConf
+ conf.MustLoad(*configFile, &c)
+ gw := gateway.MustNewServer(c)
+ defer gw.Stop()
+ gw.Start()
+}
diff --git a/template/kube/deployment.tpl b/template/kube/deployment.tpl
new file mode 100644
index 0000000..14145df
--- /dev/null
+++ b/template/kube/deployment.tpl
@@ -0,0 +1,117 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{.Name}}
+ namespace: {{.Namespace}}
+ labels:
+ app: {{.Name}}
+spec:
+ replicas: {{.Replicas}}
+ revisionHistoryLimit: {{.Revisions}}
+ selector:
+ matchLabels:
+ app: {{.Name}}
+ template:
+ metadata:
+ labels:
+ app: {{.Name}}
+ spec:{{if .ServiceAccount}}
+ serviceAccountName: {{.ServiceAccount}}{{end}}
+ containers:
+ - name: {{.Name}}
+ image: {{.Image}}
+ {{if .ImagePullPolicy}}imagePullPolicy: {{.ImagePullPolicy}}
+ {{end}}ports:
+ - containerPort: {{.Port}}
+ readinessProbe:
+ tcpSocket:
+ port: {{.Port}}
+ initialDelaySeconds: 5
+ periodSeconds: 10
+ livenessProbe:
+ tcpSocket:
+ port: {{.Port}}
+ initialDelaySeconds: 15
+ periodSeconds: 20
+ resources:
+ requests:
+ cpu: {{.RequestCpu}}m
+ memory: {{.RequestMem}}Mi
+ limits:
+ cpu: {{.LimitCpu}}m
+ memory: {{.LimitMem}}Mi
+ volumeMounts:
+ - name: timezone
+ mountPath: /etc/localtime
+ {{if .Secret}}imagePullSecrets:
+ - name: {{.Secret}}
+ {{end}}volumes:
+ - name: timezone
+ hostPath:
+ path: /usr/share/zoneinfo/Asia/Shanghai
+
+---
+
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{.Name}}-svc
+ namespace: {{.Namespace}}
+spec:
+ ports:
+ {{if .UseNodePort}}- nodePort: {{.NodePort}}
+ port: {{.Port}}
+ protocol: TCP
+ targetPort: {{.TargetPort}}
+ type: NodePort{{else}}- port: {{.Port}}
+ targetPort: {{.TargetPort}}{{end}}
+ selector:
+ app: {{.Name}}
+
+---
+
+apiVersion: autoscaling/v2beta2
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{.Name}}-hpa-c
+ namespace: {{.Namespace}}
+ labels:
+ app: {{.Name}}-hpa-c
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{.Name}}
+ minReplicas: {{.MinReplicas}}
+ maxReplicas: {{.MaxReplicas}}
+ metrics:
+ - type: Resource
+ resource:
+ name: cpu
+ target:
+ type: Utilization
+ averageUtilization: 80
+
+---
+
+apiVersion: autoscaling/v2beta2
+kind: HorizontalPodAutoscaler
+metadata:
+ name: {{.Name}}-hpa-m
+ namespace: {{.Namespace}}
+ labels:
+ app: {{.Name}}-hpa-m
+spec:
+ scaleTargetRef:
+ apiVersion: apps/v1
+ kind: Deployment
+ name: {{.Name}}
+ minReplicas: {{.MinReplicas}}
+ maxReplicas: {{.MaxReplicas}}
+ metrics:
+ - type: Resource
+ resource:
+ name: memory
+ target:
+ type: Utilization
+ averageUtilization: 80
diff --git a/template/kube/job.tpl b/template/kube/job.tpl
new file mode 100644
index 0000000..0da72ed
--- /dev/null
+++ b/template/kube/job.tpl
@@ -0,0 +1,37 @@
+apiVersion: batch/v1
+kind: CronJob
+metadata:
+ name: {{.Name}}
+ namespace: {{.Namespace}}
+spec:
+ successfulJobsHistoryLimit: {{.SuccessfulJobsHistoryLimit}}
+ schedule: "{{.Schedule}}"
+ jobTemplate:
+ spec:
+ template:
+ spec:{{if .ServiceAccount}}
+ serviceAccountName: {{.ServiceAccount}}{{end}}
+ {{end}}containers:
+ - name: {{.Name}}
+ image: # todo image url
+ resources:
+ requests:
+ cpu: {{.RequestCpu}}m
+ memory: {{.RequestMem}}Mi
+ limits:
+ cpu: {{.LimitCpu}}m
+ memory: {{.LimitMem}}Mi
+ command:
+ - ./{{.ServiceName}}
+ - -f
+ - ./{{.Name}}.yaml
+ volumeMounts:
+ - name: timezone
+ mountPath: /etc/localtime
+ imagePullSecrets:
+ - name: # registry secret, if no, remove this
+ restartPolicy: OnFailure
+ volumes:
+ - name: timezone
+ hostPath:
+ path: /usr/share/zoneinfo/Asia/Shanghai
diff --git a/template/model/customized.tpl b/template/model/customized.tpl
new file mode 100644
index 0000000..e69de29
diff --git a/template/model/delete.tpl b/template/model/delete.tpl
new file mode 100644
index 0000000..fb995c2
--- /dev/null
+++ b/template/model/delete.tpl
@@ -0,0 +1,14 @@
+func (m *default{{.upperStartCamelObject}}Model) Delete(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) error {
+ {{if .withCache}}{{if .containsIndexCache}}data, err:=m.FindOne(ctx, {{.lowerStartCamelPrimaryKey}})
+ if err!=nil{
+ return err
+ }
+
+{{end}} {{.keys}}
+ _, err {{if .containsIndexCache}}={{else}}:={{end}} m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("delete from %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}}", m.table)
+ return conn.ExecCtx(ctx, query, {{.lowerStartCamelPrimaryKey}})
+ }, {{.keyValues}}){{else}}query := fmt.Sprintf("delete from %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}}", m.table)
+ _,err:=m.conn.ExecCtx(ctx, query, {{.lowerStartCamelPrimaryKey}}){{end}}
+ return err
+}
diff --git a/template/model/err.tpl b/template/model/err.tpl
new file mode 100644
index 0000000..dc5eac4
--- /dev/null
+++ b/template/model/err.tpl
@@ -0,0 +1,5 @@
+package {{.pkg}}
+
+import "github.com/zeromicro/go-zero/core/stores/sqlx"
+
+var ErrNotFound = sqlx.ErrNotFound
diff --git a/template/model/field.tpl b/template/model/field.tpl
new file mode 100644
index 0000000..6b4ed38
--- /dev/null
+++ b/template/model/field.tpl
@@ -0,0 +1 @@
+{{.name}} {{.type}} {{.tag}} {{if .hasComment}}// {{.comment}}{{end}}
\ No newline at end of file
diff --git a/template/model/find-one-by-field-extra-method.tpl b/template/model/find-one-by-field-extra-method.tpl
new file mode 100644
index 0000000..7e1df69
--- /dev/null
+++ b/template/model/find-one-by-field-extra-method.tpl
@@ -0,0 +1,8 @@
+func (m *default{{.upperStartCamelObject}}Model) formatPrimary(primary any) string {
+ return fmt.Sprintf("%s%v", {{.primaryKeyLeft}}, primary)
+}
+
+func (m *default{{.upperStartCamelObject}}Model) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error {
+ query := fmt.Sprintf("select %s from %s where {{.originalPrimaryField}} = {{if .postgreSql}}$1{{else}}?{{end}} limit 1", {{.lowerStartCamelObject}}Rows, m.table )
+ return conn.QueryRowCtx(ctx, v, query, primary)
+}
diff --git a/template/model/find-one-by-field.tpl b/template/model/find-one-by-field.tpl
new file mode 100644
index 0000000..dfcf923
--- /dev/null
+++ b/template/model/find-one-by-field.tpl
@@ -0,0 +1,30 @@
+func (m *default{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}(ctx context.Context, {{.in}}) (*{{.upperStartCamelObject}}, error) {
+ {{if .withCache}}{{.cacheKey}}
+ var resp {{.upperStartCamelObject}}
+ err := m.QueryRowIndexCtx(ctx, &resp, {{.cacheKeyVariable}}, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) {
+ query := fmt.Sprintf("select %s from %s where {{.originalField}} limit 1", {{.lowerStartCamelObject}}Rows, m.table)
+ if err := conn.QueryRowCtx(ctx, &resp, query, {{.lowerStartCamelField}}); err != nil {
+ return nil, err
+ }
+ return resp.{{.upperStartCamelPrimaryKey}}, nil
+ }, m.queryPrimary)
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}{{else}}var resp {{.upperStartCamelObject}}
+ query := fmt.Sprintf("select %s from %s where {{.originalField}} limit 1", {{.lowerStartCamelObject}}Rows, m.table )
+ err := m.conn.QueryRowCtx(ctx, &resp, query, {{.lowerStartCamelField}})
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlx.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}{{end}}
diff --git a/template/model/find-one.tpl b/template/model/find-one.tpl
new file mode 100644
index 0000000..4f9319d
--- /dev/null
+++ b/template/model/find-one.tpl
@@ -0,0 +1,26 @@
+func (m *default{{.upperStartCamelObject}}Model) FindOne(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error) {
+ {{if .withCache}}{{.cacheKey}}
+ var resp {{.upperStartCamelObject}}
+ err := m.QueryRowCtx(ctx, &resp, {{.cacheKeyVariable}}, func(ctx context.Context, conn sqlx.SqlConn, v any) error {
+ query := fmt.Sprintf("select %s from %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}} limit 1", {{.lowerStartCamelObject}}Rows, m.table)
+ return conn.QueryRowCtx(ctx, v, query, {{.lowerStartCamelPrimaryKey}})
+ })
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlc.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }{{else}}query := fmt.Sprintf("select %s from %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}} limit 1", {{.lowerStartCamelObject}}Rows, m.table)
+ var resp {{.upperStartCamelObject}}
+ err := m.conn.QueryRowCtx(ctx, &resp, query, {{.lowerStartCamelPrimaryKey}})
+ switch err {
+ case nil:
+ return &resp, nil
+ case sqlx.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }{{end}}
+}
diff --git a/template/model/import-no-cache.tpl b/template/model/import-no-cache.tpl
new file mode 100644
index 0000000..0ffbc24
--- /dev/null
+++ b/template/model/import-no-cache.tpl
@@ -0,0 +1,14 @@
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ {{if .time}}"time"{{end}}
+
+ {{if .containsPQ}}"github.com/lib/pq"{{end}}
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+
+ {{.third}}
+)
diff --git a/template/model/import.tpl b/template/model/import.tpl
new file mode 100644
index 0000000..96650fd
--- /dev/null
+++ b/template/model/import.tpl
@@ -0,0 +1,16 @@
+import (
+ "context"
+ "database/sql"
+ "fmt"
+ "strings"
+ {{if .time}}"time"{{end}}
+
+ {{if .containsPQ}}"github.com/lib/pq"{{end}}
+ "github.com/zeromicro/go-zero/core/stores/builder"
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlc"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+ "github.com/zeromicro/go-zero/core/stringx"
+
+ {{.third}}
+)
diff --git a/template/model/insert.tpl b/template/model/insert.tpl
new file mode 100644
index 0000000..08e02bc
--- /dev/null
+++ b/template/model/insert.tpl
@@ -0,0 +1,9 @@
+func (m *default{{.upperStartCamelObject}}Model) Insert(ctx context.Context, data *{{.upperStartCamelObject}}) (sql.Result,error) {
+ {{if .withCache}}{{.keys}}
+ ret, err := m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
+ return conn.ExecCtx(ctx, query, {{.expressionValues}})
+ }, {{.keyValues}}){{else}}query := fmt.Sprintf("insert into %s (%s) values ({{.expression}})", m.table, {{.lowerStartCamelObject}}RowsExpectAutoSet)
+ ret,err:=m.conn.ExecCtx(ctx, query, {{.expressionValues}}){{end}}
+ return ret,err
+}
diff --git a/template/model/interface-delete.tpl b/template/model/interface-delete.tpl
new file mode 100644
index 0000000..d10978b
--- /dev/null
+++ b/template/model/interface-delete.tpl
@@ -0,0 +1 @@
+Delete(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) error
\ No newline at end of file
diff --git a/template/model/interface-find-one-by-field.tpl b/template/model/interface-find-one-by-field.tpl
new file mode 100644
index 0000000..e18ded7
--- /dev/null
+++ b/template/model/interface-find-one-by-field.tpl
@@ -0,0 +1 @@
+FindOneBy{{.upperField}}(ctx context.Context, {{.in}}) (*{{.upperStartCamelObject}}, error)
\ No newline at end of file
diff --git a/template/model/interface-find-one.tpl b/template/model/interface-find-one.tpl
new file mode 100644
index 0000000..a7a5440
--- /dev/null
+++ b/template/model/interface-find-one.tpl
@@ -0,0 +1 @@
+FindOne(ctx context.Context, {{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error)
\ No newline at end of file
diff --git a/template/model/interface-insert.tpl b/template/model/interface-insert.tpl
new file mode 100644
index 0000000..2872403
--- /dev/null
+++ b/template/model/interface-insert.tpl
@@ -0,0 +1 @@
+Insert(ctx context.Context, data *{{.upperStartCamelObject}}) (sql.Result,error)
\ No newline at end of file
diff --git a/template/model/interface-update.tpl b/template/model/interface-update.tpl
new file mode 100644
index 0000000..1920425
--- /dev/null
+++ b/template/model/interface-update.tpl
@@ -0,0 +1 @@
+Update(ctx context.Context, {{if .containsIndexCache}}newData{{else}}data{{end}} *{{.upperStartCamelObject}}) error
\ No newline at end of file
diff --git a/template/model/model-gen.tpl b/template/model/model-gen.tpl
new file mode 100644
index 0000000..4afc9d3
--- /dev/null
+++ b/template/model/model-gen.tpl
@@ -0,0 +1,16 @@
+// Code generated by goctl. DO NOT EDIT.
+// versions:
+// goctl version: 1.7.2
+
+package {{.pkg}}
+{{.imports}}
+{{.vars}}
+{{.types}}
+{{.new}}
+{{.delete}}
+{{.find}}
+{{.insert}}
+{{.update}}
+{{.extraMethod}}
+{{.tableName}}
+{{.customized}}
diff --git a/template/model/model-new.tpl b/template/model/model-new.tpl
new file mode 100644
index 0000000..f6271cc
--- /dev/null
+++ b/template/model/model-new.tpl
@@ -0,0 +1,7 @@
+func new{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf, opts ...cache.Option{{end}}) *default{{.upperStartCamelObject}}Model {
+ return &default{{.upperStartCamelObject}}Model{
+ {{if .withCache}}CachedConn: sqlc.NewConn(conn, c, opts...){{else}}conn:conn{{end}},
+ table: {{.table}},
+ }
+}
+
diff --git a/template/model/model.tpl b/template/model/model.tpl
new file mode 100644
index 0000000..d861da7
--- /dev/null
+++ b/template/model/model.tpl
@@ -0,0 +1,38 @@
+package {{.pkg}}
+{{if .withCache}}
+import (
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/sqlx"
+)
+{{else}}
+
+import "github.com/zeromicro/go-zero/core/stores/sqlx"
+{{end}}
+var _ {{.upperStartCamelObject}}Model = (*custom{{.upperStartCamelObject}}Model)(nil)
+
+type (
+ // {{.upperStartCamelObject}}Model is an interface to be customized, add more methods here,
+ // and implement the added methods in custom{{.upperStartCamelObject}}Model.
+ {{.upperStartCamelObject}}Model interface {
+ {{.lowerStartCamelObject}}Model
+ {{if not .withCache}}withSession(session sqlx.Session) {{.upperStartCamelObject}}Model{{end}}
+ }
+
+ custom{{.upperStartCamelObject}}Model struct {
+ *default{{.upperStartCamelObject}}Model
+ }
+)
+
+// New{{.upperStartCamelObject}}Model returns a model for the database table.
+func New{{.upperStartCamelObject}}Model(conn sqlx.SqlConn{{if .withCache}}, c cache.CacheConf, opts ...cache.Option{{end}}) {{.upperStartCamelObject}}Model {
+ return &custom{{.upperStartCamelObject}}Model{
+ default{{.upperStartCamelObject}}Model: new{{.upperStartCamelObject}}Model(conn{{if .withCache}}, c, opts...{{end}}),
+ }
+}
+
+{{if not .withCache}}
+func (m *custom{{.upperStartCamelObject}}Model) withSession(session sqlx.Session) {{.upperStartCamelObject}}Model {
+ return New{{.upperStartCamelObject}}Model(sqlx.NewSqlConnFromSession(session))
+}
+{{end}}
+
diff --git a/template/model/table-name.tpl b/template/model/table-name.tpl
new file mode 100644
index 0000000..8b14e33
--- /dev/null
+++ b/template/model/table-name.tpl
@@ -0,0 +1,3 @@
+func (m *default{{.upperStartCamelObject}}Model) tableName() string {
+ return m.table
+}
diff --git a/template/model/tag.tpl b/template/model/tag.tpl
new file mode 100644
index 0000000..8e1ddf0
--- /dev/null
+++ b/template/model/tag.tpl
@@ -0,0 +1 @@
+`db:"{{.field}}"`
\ No newline at end of file
diff --git a/template/model/types.tpl b/template/model/types.tpl
new file mode 100644
index 0000000..960cf2b
--- /dev/null
+++ b/template/model/types.tpl
@@ -0,0 +1,14 @@
+type (
+ {{.lowerStartCamelObject}}Model interface{
+ {{.method}}
+ }
+
+ default{{.upperStartCamelObject}}Model struct {
+ {{if .withCache}}sqlc.CachedConn{{else}}conn sqlx.SqlConn{{end}}
+ table string
+ }
+
+ {{.upperStartCamelObject}} struct {
+ {{.fields}}
+ }
+)
diff --git a/template/model/update.tpl b/template/model/update.tpl
new file mode 100644
index 0000000..41b9331
--- /dev/null
+++ b/template/model/update.tpl
@@ -0,0 +1,14 @@
+func (m *default{{.upperStartCamelObject}}Model) Update(ctx context.Context, {{if .containsIndexCache}}newData{{else}}data{{end}} *{{.upperStartCamelObject}}) error {
+ {{if .withCache}}{{if .containsIndexCache}}data, err:=m.FindOne(ctx, newData.{{.upperStartCamelPrimaryKey}})
+ if err!=nil{
+ return err
+ }
+
+{{end}} {{.keys}}
+ _, {{if .containsIndexCache}}err{{else}}err:{{end}}= m.ExecCtx(ctx, func(ctx context.Context, conn sqlx.SqlConn) (result sql.Result, err error) {
+ query := fmt.Sprintf("update %s set %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}}", m.table, {{.lowerStartCamelObject}}RowsWithPlaceHolder)
+ return conn.ExecCtx(ctx, query, {{.expressionValues}})
+ }, {{.keyValues}}){{else}}query := fmt.Sprintf("update %s set %s where {{.originalPrimaryKey}} = {{if .postgreSql}}$1{{else}}?{{end}}", m.table, {{.lowerStartCamelObject}}RowsWithPlaceHolder)
+ _,err:=m.conn.ExecCtx(ctx, query, {{.expressionValues}}){{end}}
+ return err
+}
diff --git a/template/model/var.tpl b/template/model/var.tpl
new file mode 100644
index 0000000..c11fe53
--- /dev/null
+++ b/template/model/var.tpl
@@ -0,0 +1,8 @@
+var (
+{{.lowerStartCamelObject}}FieldNames = builder.RawFieldNames(&{{.upperStartCamelObject}}{}{{if .postgreSql}}, true{{end}})
+{{.lowerStartCamelObject}}Rows = strings.Join({{.lowerStartCamelObject}}FieldNames, ",")
+{{.lowerStartCamelObject}}RowsExpectAutoSet = {{if .postgreSql}}strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}", {{end}} {{.ignoreColumns}}), ","){{else}}strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}", {{end}} {{.ignoreColumns}}), ","){{end}}
+{{.lowerStartCamelObject}}RowsWithPlaceHolder = {{if .postgreSql}}builder.PostgreSqlJoin(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", {{.ignoreColumns}})){{else}}strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", {{.ignoreColumns}}), "=?,") + "=?"{{end}}
+
+{{if .withCache}}{{.cacheKeys}}{{end}}
+)
diff --git a/template/mongo/err.tpl b/template/mongo/err.tpl
new file mode 100644
index 0000000..27d9244
--- /dev/null
+++ b/template/mongo/err.tpl
@@ -0,0 +1,12 @@
+package model
+
+import (
+ "errors"
+
+ "github.com/zeromicro/go-zero/core/stores/mon"
+)
+
+var (
+ ErrNotFound = mon.ErrNotFound
+ ErrInvalidObjectId = errors.New("invalid objectId")
+)
diff --git a/template/mongo/model.tpl b/template/mongo/model.tpl
new file mode 100644
index 0000000..6f8fa83
--- /dev/null
+++ b/template/mongo/model.tpl
@@ -0,0 +1,80 @@
+// Code generated by goctl. DO NOT EDIT.
+// goctl {{.version}}
+
+package model
+
+import (
+ "context"
+ "time"
+
+ {{if .Cache}}"github.com/zeromicro/go-zero/core/stores/monc"{{else}}"github.com/zeromicro/go-zero/core/stores/mon"{{end}}
+ "go.mongodb.org/mongo-driver/bson"
+ "go.mongodb.org/mongo-driver/bson/primitive"
+ "go.mongodb.org/mongo-driver/mongo"
+)
+
+{{if .Cache}}var prefix{{.Type}}CacheKey = "cache:{{.lowerType}}:"{{end}}
+
+type {{.lowerType}}Model interface{
+ Insert(ctx context.Context,data *{{.Type}}) error
+ FindOne(ctx context.Context,id string) (*{{.Type}}, error)
+ Update(ctx context.Context,data *{{.Type}}) (*mongo.UpdateResult, error)
+ Delete(ctx context.Context,id string) (int64, error)
+}
+
+type default{{.Type}}Model struct {
+ conn {{if .Cache}}*monc.Model{{else}}*mon.Model{{end}}
+}
+
+func newDefault{{.Type}}Model(conn {{if .Cache}}*monc.Model{{else}}*mon.Model{{end}}) *default{{.Type}}Model {
+ return &default{{.Type}}Model{conn: conn}
+}
+
+
+func (m *default{{.Type}}Model) Insert(ctx context.Context, data *{{.Type}}) error {
+ if data.ID.IsZero() {
+ data.ID = primitive.NewObjectID()
+ data.CreateAt = time.Now()
+ data.UpdateAt = time.Now()
+ }
+
+ {{if .Cache}}key := prefix{{.Type}}CacheKey + data.ID.Hex(){{end}}
+ _, err := m.conn.InsertOne(ctx, {{if .Cache}}key, {{end}} data)
+ return err
+}
+
+func (m *default{{.Type}}Model) FindOne(ctx context.Context, id string) (*{{.Type}}, error) {
+ oid, err := primitive.ObjectIDFromHex(id)
+ if err != nil {
+ return nil, ErrInvalidObjectId
+ }
+
+ var data {{.Type}}
+ {{if .Cache}}key := prefix{{.Type}}CacheKey + id{{end}}
+ err = m.conn.FindOne(ctx, {{if .Cache}}key, {{end}}&data, bson.M{"_id": oid})
+ switch err {
+ case nil:
+ return &data, nil
+ case {{if .Cache}}monc{{else}}mon{{end}}.ErrNotFound:
+ return nil, ErrNotFound
+ default:
+ return nil, err
+ }
+}
+
+func (m *default{{.Type}}Model) Update(ctx context.Context, data *{{.Type}}) (*mongo.UpdateResult, error) {
+ data.UpdateAt = time.Now()
+ {{if .Cache}}key := prefix{{.Type}}CacheKey + data.ID.Hex(){{end}}
+ res, err := m.conn.UpdateOne(ctx, {{if .Cache}}key, {{end}}bson.M{"_id": data.ID}, bson.M{"$set": data})
+ return res, err
+}
+
+func (m *default{{.Type}}Model) Delete(ctx context.Context, id string) (int64, error) {
+ oid, err := primitive.ObjectIDFromHex(id)
+ if err != nil {
+ return 0, ErrInvalidObjectId
+ }
+ {{if .Cache}}key := prefix{{.Type}}CacheKey +id{{end}}
+ res, err := m.conn.DeleteOne(ctx, {{if .Cache}}key, {{end}}bson.M{"_id": oid})
+ return res, err
+}
diff --git a/template/mongo/model_custom.tpl b/template/mongo/model_custom.tpl
new file mode 100644
index 0000000..31fa865
--- /dev/null
+++ b/template/mongo/model_custom.tpl
@@ -0,0 +1,38 @@
+package model
+
+{{if .Cache}}import (
+ "github.com/zeromicro/go-zero/core/stores/cache"
+ "github.com/zeromicro/go-zero/core/stores/monc"
+){{else}}import "github.com/zeromicro/go-zero/core/stores/mon"{{end}}
+
+{{if .Easy}}
+const {{.Type}}CollectionName = "{{.snakeType}}"
+{{end}}
+
+var _ {{.Type}}Model = (*custom{{.Type}}Model)(nil)
+
+type (
+ // {{.Type}}Model is an interface to be customized, add more methods here,
+ // and implement the added methods in custom{{.Type}}Model.
+ {{.Type}}Model interface {
+ {{.lowerType}}Model
+ }
+
+ custom{{.Type}}Model struct {
+ *default{{.Type}}Model
+ }
+)
+
+
+// New{{.Type}}Model returns a model for the mongo.
+{{if .Easy}}func New{{.Type}}Model(url, db string{{if .Cache}}, c cache.CacheConf{{end}}) {{.Type}}Model {
+ conn := {{if .Cache}}monc{{else}}mon{{end}}.MustNewModel(url, db, {{.Type}}CollectionName{{if .Cache}}, c{{end}})
+ return &custom{{.Type}}Model{
+ default{{.Type}}Model: newDefault{{.Type}}Model(conn),
+ }
+}{{else}}func New{{.Type}}Model(url, db, collection string{{if .Cache}}, c cache.CacheConf{{end}}) {{.Type}}Model {
+ conn := {{if .Cache}}monc{{else}}mon{{end}}.MustNewModel(url, db, collection{{if .Cache}}, c{{end}})
+ return &custom{{.Type}}Model{
+ default{{.Type}}Model: newDefault{{.Type}}Model(conn),
+ }
+}{{end}}
diff --git a/template/mongo/model_types.tpl b/template/mongo/model_types.tpl
new file mode 100644
index 0000000..8da006f
--- /dev/null
+++ b/template/mongo/model_types.tpl
@@ -0,0 +1,14 @@
+package model
+
+import (
+ "time"
+
+ "go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+type {{.Type}} struct {
+ ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
+ // TODO: Fill your own fields
+ UpdateAt time.Time `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
+ CreateAt time.Time `bson:"createAt,omitempty" json:"createAt,omitempty"`
+}
diff --git a/template/newapi/newtemplate.tpl b/template/newapi/newtemplate.tpl
new file mode 100644
index 0000000..b677344
--- /dev/null
+++ b/template/newapi/newtemplate.tpl
@@ -0,0 +1,14 @@
+syntax = "v1"
+
+type Request {
+ Name string `path:"name,options=you|me"`
+}
+
+type Response {
+ Message string `json:"message"`
+}
+
+service {{.name}}-api {
+ @handler {{.handler}}Handler
+ get /from/:name(Request) returns (Response)
+}
diff --git a/template/rpc/call.tpl b/template/rpc/call.tpl
new file mode 100644
index 0000000..27b4879
--- /dev/null
+++ b/template/rpc/call.tpl
@@ -0,0 +1,33 @@
+{{.head}}
+
+package {{.filePackage}}
+
+import (
+ "context"
+
+ {{.pbPackage}}
+ {{if ne .pbPackage .protoGoPackage}}{{.protoGoPackage}}{{end}}
+
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+)
+
+type (
+ {{.alias}}
+
+ {{.serviceName}} interface {
+ {{.interface}}
+ }
+
+ default{{.serviceName}} struct {
+ cli zrpc.Client
+ }
+)
+
+func New{{.serviceName}}(cli zrpc.Client) {{.serviceName}} {
+ return &default{{.serviceName}}{
+ cli: cli,
+ }
+}
+
+{{.functions}}
diff --git a/template/rpc/config.tpl b/template/rpc/config.tpl
new file mode 100644
index 0000000..c1f85b9
--- /dev/null
+++ b/template/rpc/config.tpl
@@ -0,0 +1,7 @@
+package config
+
+import "github.com/zeromicro/go-zero/zrpc"
+
+type Config struct {
+ zrpc.RpcServerConf
+}
diff --git a/template/rpc/etc.tpl b/template/rpc/etc.tpl
new file mode 100644
index 0000000..6cd4bdd
--- /dev/null
+++ b/template/rpc/etc.tpl
@@ -0,0 +1,6 @@
+Name: {{.serviceName}}.rpc
+ListenOn: 0.0.0.0:8080
+Etcd:
+ Hosts:
+ - 127.0.0.1:2379
+ Key: {{.serviceName}}.rpc
diff --git a/template/rpc/logic-func.tpl b/template/rpc/logic-func.tpl
new file mode 100644
index 0000000..e9410d4
--- /dev/null
+++ b/template/rpc/logic-func.tpl
@@ -0,0 +1,6 @@
+{{if .hasComment}}{{.comment}}{{end}}
+func (l *{{.logicName}}) {{.method}} ({{if .hasReq}}in {{.request}}{{if .stream}},stream {{.streamBody}}{{end}}{{else}}stream {{.streamBody}}{{end}}) ({{if .hasReply}}{{.response}},{{end}} error) {
+ // todo: add your logic here and delete this line
+
+ return {{if .hasReply}}&{{.responseType}}{},{{end}} nil
+}
diff --git a/template/rpc/logic.tpl b/template/rpc/logic.tpl
new file mode 100644
index 0000000..b8d81f0
--- /dev/null
+++ b/template/rpc/logic.tpl
@@ -0,0 +1,24 @@
+package {{.packageName}}
+
+import (
+ "context"
+
+ {{.imports}}
+
+ "github.com/zeromicro/go-zero/core/logx"
+)
+
+type {{.logicName}} struct {
+ ctx context.Context
+ svcCtx *svc.ServiceContext
+ logx.Logger
+}
+
+func New{{.logicName}}(ctx context.Context,svcCtx *svc.ServiceContext) *{{.logicName}} {
+ return &{{.logicName}}{
+ ctx: ctx,
+ svcCtx: svcCtx,
+ Logger: logx.WithContext(ctx),
+ }
+}
+{{.functions}}
diff --git a/template/rpc/main.tpl b/template/rpc/main.tpl
new file mode 100644
index 0000000..566ad82
--- /dev/null
+++ b/template/rpc/main.tpl
@@ -0,0 +1,36 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+
+ {{.imports}}
+
+ "github.com/zeromicro/go-zero/core/conf"
+ "github.com/zeromicro/go-zero/core/service"
+ "github.com/zeromicro/go-zero/zrpc"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/reflection"
+)
+
+var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file")
+
+func main() {
+ flag.Parse()
+
+ var c config.Config
+ conf.MustLoad(*configFile, &c)
+ ctx := svc.NewServiceContext(c)
+
+ s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+{{range .serviceNames}} {{.Pkg}}.Register{{.GRPCService}}Server(grpcServer, {{.ServerPkg}}.New{{.Service}}Server(ctx))
+{{end}}
+ if c.Mode == service.DevMode || c.Mode == service.TestMode {
+ reflection.Register(grpcServer)
+ }
+ })
+ defer s.Stop()
+
+ fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+ s.Start()
+}
diff --git a/template/rpc/server-func.tpl b/template/rpc/server-func.tpl
new file mode 100644
index 0000000..d771b43
--- /dev/null
+++ b/template/rpc/server-func.tpl
@@ -0,0 +1,6 @@
+
+{{if .hasComment}}{{.comment}}{{end}}
+func (s *{{.server}}Server) {{.method}} ({{if .notStream}}ctx context.Context,{{if .hasReq}} in {{.request}}{{end}}{{else}}{{if .hasReq}} in {{.request}},{{end}}stream {{.streamBody}}{{end}}) ({{if .notStream}}{{.response}},{{end}}error) {
+ l := {{.logicPkg}}.New{{.logicName}}({{if .notStream}}ctx,{{else}}stream.Context(),{{end}}s.svcCtx)
+ return l.{{.method}}({{if .hasReq}}in{{if .stream}} ,stream{{end}}{{else}}{{if .stream}}stream{{end}}{{end}})
+}
diff --git a/template/rpc/server.tpl b/template/rpc/server.tpl
new file mode 100644
index 0000000..84a2f9c
--- /dev/null
+++ b/template/rpc/server.tpl
@@ -0,0 +1,22 @@
+{{.head}}
+
+package server
+
+import (
+ {{if .notStream}}"context"{{end}}
+
+ {{.imports}}
+)
+
+type {{.server}}Server struct {
+ svcCtx *svc.ServiceContext
+ {{.unimplementedServer}}
+}
+
+func New{{.server}}Server(svcCtx *svc.ServiceContext) *{{.server}}Server {
+ return &{{.server}}Server{
+ svcCtx: svcCtx,
+ }
+}
+
+{{.funcs}}
diff --git a/template/rpc/svc.tpl b/template/rpc/svc.tpl
new file mode 100644
index 0000000..cf2b47a
--- /dev/null
+++ b/template/rpc/svc.tpl
@@ -0,0 +1,13 @@
+package svc
+
+import {{.imports}}
+
+type ServiceContext struct {
+ Config config.Config
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+ return &ServiceContext{
+ Config:c,
+ }
+}
diff --git a/template/rpc/template.tpl b/template/rpc/template.tpl
new file mode 100644
index 0000000..76daa94
--- /dev/null
+++ b/template/rpc/template.tpl
@@ -0,0 +1,16 @@
+syntax = "proto3";
+
+package {{.package}};
+option go_package="./{{.package}}";
+
+message Request {
+ string ping = 1;
+}
+
+message Response {
+ string pong = 1;
+}
+
+service {{.serviceName}} {
+ rpc Ping(Request) returns(Response);
+}