diff --git a/aes.go b/aes.go index 6eb7f78..990107c 100644 --- a/aes.go +++ b/aes.go @@ -48,13 +48,15 @@ type Data struct { func main() { // 定义 AES 密钥 - key, _ := hex.DecodeString("85af347e771bd631bf734068ad5798cc") + key, _ := hex.DecodeString("0ebf6481d213c846070c8f2964617d42") var data interface{} data = map[string]interface{}{ - "id_card": "45212220000827423X", - "name": "张荣宏", + "id_card": "45212220000827423X", + "name": "张荣宏", + "mobile_no": "18276151590", + "time_range": "5", } // 将结构体转为 JSON 字符串 diff --git a/api.json b/api.json index bb74b85..9d53812 100644 --- a/api.json +++ b/api.json @@ -33,7 +33,7 @@ }, { "serviceId": "FLXG75FE", - "sourceId": "G04-HZ01", + "sourceId": "G04-HZ0jmkolnjiuoiujhn1", "serviceName": "涉网风险", "dataDescription": "全国公安部门的网络犯罪调查服务", "group_cn": "法律相关", @@ -92,7 +92,7 @@ "sourceId": "G03-HZ01", "serviceName": "易诉人群识别", "dataDescription": "识别用户是否为易诉人群", - "group_cn": "法律相关", + "group_cn": "法律相关ddd", "group": "FLXG" }, { @@ -244,7 +244,7 @@ "sourceId": "G32-BJ05", "serviceName": "团伙欺诈排查(通用版)", "dataDescription": "团伙欺诈排查(通用版)", - "group_cn": "法律相关", + "group_cn": "法律相关ddd", "group": "FLXG" } ] diff --git a/apps/api/api.api b/apps/api/api.api index 4edcafe..d2c5923 100644 --- a/apps/api/api.api +++ b/apps/api/api.api @@ -18,7 +18,7 @@ type response { @server ( group: IVYZ prefix: /api/v1 - middleware: ApiAuthInterceptor + middleware: ApiAuthInterceptor,ApiMqsInterceptor ) service api-api { @handler IVYZ0B03 @@ -43,7 +43,7 @@ service api-api { @server ( group: FLXG prefix: /api/v1 - middleware: ApiAuthInterceptor + middleware: ApiAuthInterceptor,ApiMqsInterceptor ) service api-api { @handler FLXGCA3D @@ -80,7 +80,7 @@ service api-api { @server ( group: QYGL prefix: /api/v1 - middleware: ApiAuthInterceptor + middleware: ApiAuthInterceptor,ApiMqsInterceptor ) service api-api { @handler QYGLB4C0 @@ -102,7 +102,7 @@ service api-api { @server ( group: YYSY prefix: /api/v1 - middleware: ApiAuthInterceptor + middleware: ApiAuthInterceptor,ApiMqsInterceptor ) service api-api { @handler YYSY6F2E @@ -127,7 +127,7 @@ service api-api { @server ( group: JRZQ prefix: /api/v1 - middleware: ApiAuthInterceptor + middleware: ApiAuthInterceptor,ApiMqsInterceptor ) service api-api { @handler JRZQDCBE @@ -141,6 +141,5 @@ service api-api { @handler JRZQ4AA8 post /JRZQ4AA8 (request) returns (response) - } diff --git a/apps/api/etc/api-api.dev.yaml b/apps/api/etc/api-api.dev.yaml index 38f394f..bb27c63 100644 --- a/apps/api/etc/api-api.dev.yaml +++ b/apps/api/etc/api-api.dev.yaml @@ -18,4 +18,9 @@ KqPusherConf: WestConfig: Url: "http://proxy.tianyuanapi.com/api/invoke" Key: "121a1e41fc1690dd6b90afbcacd80cf4" - SecretId: "449159" \ No newline at end of file + SecretId: "449159" +UserRpc: + Etcd: + Hosts: + - 127.0.0.1:2379 + Key: user.rpc \ No newline at end of file diff --git a/apps/api/etc/api-api.yaml b/apps/api/etc/api-api.yaml index 5516c94..8a4746c 100644 --- a/apps/api/etc/api-api.yaml +++ b/apps/api/etc/api-api.yaml @@ -11,6 +11,11 @@ SentinelRpc: Hosts: - tyapi_etcd:2379 Key: sentinel.rpc +UserRpc: + Etcd: + Hosts: + - tyapi_etcd:2379 + Key: user.rpc KqPusherConf: Brokers: - tyapi_kafka:9092 diff --git a/apps/api/internal/common/crypt.go b/apps/api/internal/common/crypt.go new file mode 100644 index 0000000..2380714 --- /dev/null +++ b/apps/api/internal/common/crypt.go @@ -0,0 +1,44 @@ +package common + +import ( + "errors" + "fmt" + "reflect" + "tianyuan-api/pkg/crypto" +) + +// EncryptFields 加密字段的函数,处理不同类型,并跳过空值字段 +func EncryptStructFields(inputStruct interface{}, key string) (map[string]interface{}, error) { + encryptedFields := make(map[string]interface{}) + + // 使用反射获取结构体的类型和值 + v := reflect.ValueOf(inputStruct) + if v.Kind() != reflect.Struct { + return nil, errors.New("input is not a struct") + } + + // 遍历结构体字段 + for i := 0; i < v.NumField(); i++ { + field := v.Type().Field(i) + fieldValue := v.Field(i) + + // 如果字段为空值,跳过 + if fieldValue.IsZero() { + continue + } + + // 将字段的值转换为字符串进行加密 + strValue := fmt.Sprintf("%v", fieldValue.Interface()) + + // 执行加密操作 + encryptedValue, err := crypto.WestDexEncrypt(strValue, key) + if err != nil { + return nil, err + } + + // 将加密后的值存入结果映射 + encryptedFields[field.Name] = encryptedValue + } + + return encryptedFields, nil +} diff --git a/apps/api/internal/common/logic.go b/apps/api/internal/common/logic.go new file mode 100644 index 0000000..437fd68 --- /dev/null +++ b/apps/api/internal/common/logic.go @@ -0,0 +1,21 @@ +package common + +func MapStructToAPIRequest(encryptedFields map[string]interface{}, fieldMapping map[string]string, wrapField string) map[string]interface{} { + apiRequest := make(map[string]interface{}) + + // 遍历字段映射表 + for structField, apiField := range fieldMapping { + // 如果加密后的字段存在,才添加到请求 + if value, exists := encryptedFields[structField]; exists { + apiRequest[apiField] = value + } + } + + // 如果 wrapField 不为空,将 apiRequest 包裹到该字段下 + if wrapField != "" { + return map[string]interface{}{ + wrapField: apiRequest, + } + } + return apiRequest +} diff --git a/apps/api/internal/config/config.go b/apps/api/internal/config/config.go index 2e2c01c..ffa833b 100644 --- a/apps/api/internal/config/config.go +++ b/apps/api/internal/config/config.go @@ -11,6 +11,7 @@ type Config struct { DataSource string // 数据库连接的 DSN 字符串 CacheRedis cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体 SentinelRpc zrpc.RpcClientConf + UserRpc zrpc.RpcClientConf KqPusherConf KqPusherConf WestConfig WestConfig } diff --git a/apps/api/internal/handler/IVYZ/ivyz5733handler.go b/apps/api/internal/handler/IVYZ/ivyz5733handler.go index 5f11d5b..38a7cba 100644 --- a/apps/api/internal/handler/IVYZ/ivyz5733handler.go +++ b/apps/api/internal/handler/IVYZ/ivyz5733handler.go @@ -1,6 +1,7 @@ package IVYZ import ( + xhttp "github.com/zeromicro/x/http" "net/http" "tianyuan-api/pkg/response" @@ -14,10 +15,9 @@ 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 { - response.Fail(r.Context(), w, err) + xhttp.JsonBaseResponseCtx(r.Context(), w, err) return } - l := IVYZ.NewIVYZ5733Logic(r.Context(), svcCtx) resp, err := l.IVYZ5733(&req) if err != nil { diff --git a/apps/api/internal/handler/routes.go b/apps/api/internal/handler/routes.go index 11ab2ed..ddb6c87 100644 --- a/apps/api/internal/handler/routes.go +++ b/apps/api/internal/handler/routes.go @@ -19,7 +19,7 @@ import ( func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( rest.WithMiddlewares( - []rest.Middleware{serverCtx.ApiAuthInterceptor}, + []rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor}, []rest.Route{ { Method: http.MethodPost, @@ -78,7 +78,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( rest.WithMiddlewares( - []rest.Middleware{serverCtx.ApiAuthInterceptor}, + []rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor}, []rest.Route{ { Method: http.MethodPost, @@ -117,7 +117,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( rest.WithMiddlewares( - []rest.Middleware{serverCtx.ApiAuthInterceptor}, + []rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor}, []rest.Route{ { Method: http.MethodPost, @@ -134,21 +134,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { 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"), @@ -156,7 +146,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( rest.WithMiddlewares( - []rest.Middleware{serverCtx.ApiAuthInterceptor}, + []rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor}, []rest.Route{ { Method: http.MethodPost, @@ -168,11 +158,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { Path: "/QYGL45BD", Handler: QYGL.QYGL45BDHandler(serverCtx), }, - { - Method: http.MethodPost, - Path: "/QYGL51BC", - Handler: QYGL.QYGL51BCHandler(serverCtx), - }, { Method: http.MethodPost, Path: "/QYGL6F2D", @@ -195,7 +180,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( rest.WithMiddlewares( - []rest.Middleware{serverCtx.ApiAuthInterceptor}, + []rest.Middleware{serverCtx.ApiAuthInterceptor, serverCtx.ApiMqsInterceptor}, []rest.Route{ { Method: http.MethodPost, diff --git a/apps/api/internal/logic/FLXG/flxg162alogic.go b/apps/api/internal/logic/FLXG/flxg162alogic.go index e3ebca7..38922ed 100644 --- a/apps/api/internal/logic/FLXG/flxg162alogic.go +++ b/apps/api/internal/logic/FLXG/flxg162alogic.go @@ -2,6 +2,13 @@ package FLXG import ( "context" + "encoding/hex" + "encoding/json" + "tianyuan-api/apps/api/internal/common" + "tianyuan-api/apps/api/internal/validator" + "tianyuan-api/apps/api/internal/westmodel" + "tianyuan-api/pkg/crypto" + "tianyuan-api/pkg/errs" "tianyuan-api/apps/api/internal/svc" "tianyuan-api/apps/api/internal/types" @@ -24,7 +31,64 @@ func NewFLXG162ALogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG162A } func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err error) { - // todo: add your logic here and delete this line + secretKey, ok := l.ctx.Value("secretKey").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + transactionID, ok := l.ctx.Value("transactionID").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + // 1、解密 + key, decodeErr := hex.DecodeString(secretKey) + if decodeErr != nil { + return nil, errs.ErrSystem + } + decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key) + if aesDecryptErr != nil || len(decryptData) == 0 { + return nil, errs.ErrParamDecryption + } - return + // 2、校验 + var data validator.FLXG162ARequest + if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil { + return nil, errs.ErrParamValidation + } + + // 3、西部加密 + westConfig := l.svcCtx.Config.WestConfig + encryptedFields, err := common.EncryptStructFields(data, westConfig.Key) + if err != nil { + logx.Errorf("西部加密错误:%v", err) + return nil, errs.ErrSystem + } + + // 4、发送请求到西部 + logx.Infof("交易号:%s", transactionID) + apiRequest := common.MapStructToAPIRequest(encryptedFields, westmodel.FLXG162AFieldMapping, "data") + + westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G32BJ05", apiRequest) + if callAPIErr != nil { + return nil, errs.ErrSystem + } + + // 5、响应解析 + var respData westmodel.G32BJ05Response + unmarshalErr := json.Unmarshal(westResp, &respData) + if unmarshalErr != nil { + return nil, errs.ErrSystem + } + + if respData.Data.Code == "00" || respData.Data.Code == "100002" { + l.ctx = context.WithValue(l.ctx, "Charges", true) + } else { + return nil, errs.ErrSystem + } + encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key) + if aesEncrypt != nil { + return nil, errs.ErrSystem + } + return &types.Response{ + Data: encryptData, + }, nil } diff --git a/apps/api/internal/logic/FLXG/flxg3d56logic.go b/apps/api/internal/logic/FLXG/flxg3d56logic.go index c34e1e1..df1e7da 100644 --- a/apps/api/internal/logic/FLXG/flxg3d56logic.go +++ b/apps/api/internal/logic/FLXG/flxg3d56logic.go @@ -3,9 +3,12 @@ package FLXG import ( "context" "encoding/hex" - "errors" + "encoding/json" + "tianyuan-api/apps/api/internal/common" "tianyuan-api/apps/api/internal/validator" + "tianyuan-api/apps/api/internal/westmodel" "tianyuan-api/pkg/crypto" + "tianyuan-api/pkg/errs" "tianyuan-api/apps/api/internal/svc" "tianyuan-api/apps/api/internal/types" @@ -27,72 +30,66 @@ func NewFLXG3D56Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG3D56 } } +// FLXG3D56 特殊名单 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("系统错误,请联系管理员") + return &types.Response{}, errs.ErrSystem + } + transactionID, ok := l.ctx.Value("transactionID").(string) + if !ok { + return &types.Response{}, errs.ErrSystem } - // 1、解密 - key, err := hex.DecodeString(secretKey) - decryptData, err := crypto.AesDecrypt(req.Data, key) - if err != nil || len(decryptData) == 0 { - return nil, errors.New("参数解密失败") + key, decodeErr := hex.DecodeString(secretKey) + if decodeErr != nil { + return nil, errs.ErrSystem + } + decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key) + if aesDecryptErr != nil || len(decryptData) == 0 { + return nil, errs.ErrParamDecryption } // 2、校验 var data validator.FLXG3D56Request - if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil { - return nil, validatorErr + return nil, errs.ErrParamValidation } // 3、西部加密 westConfig := l.svcCtx.Config.WestConfig - mobileNo, err := crypto.WestDexEncrypt(data.MobileNo, westConfig.Key) + encryptedFields, err := common.EncryptStructFields(data, 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("业务异常") + return nil, errs.ErrSystem } + // 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 + logx.Infof("交易号:%s", transactionID) + apiRequest := common.MapStructToAPIRequest(encryptedFields, westmodel.FLXG3D56FieldMapping, "data") + + westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G26BJ05", apiRequest) + if callAPIErr != nil { + return nil, errs.ErrSystem } // 5、响应解析 - //var respData westmodel.G09GX01Response - //unmarshalErr := json.Unmarshal(westResp, &respData) - //if unmarshalErr != nil { - // return nil, unmarshalErr - //} - //crypto.AesEncrypt() + var respData westmodel.G26BJ05Response + unmarshalErr := json.Unmarshal(westResp, &respData) + if unmarshalErr != nil { + return nil, errs.ErrSystem + } + + if respData.Data.Code == "00" || respData.Data.Code == "100002" { + l.ctx = context.WithValue(l.ctx, "Charges", true) + } else { + return nil, errs.ErrSystem + } + encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key) + if aesEncrypt != nil { + return nil, errs.ErrSystem + } return &types.Response{ - Data: string(westResp), + Data: encryptData, }, nil } diff --git a/apps/api/internal/logic/FLXG/flxg54f5logic.go b/apps/api/internal/logic/FLXG/flxg54f5logic.go index bebfd55..eeef73e 100644 --- a/apps/api/internal/logic/FLXG/flxg54f5logic.go +++ b/apps/api/internal/logic/FLXG/flxg54f5logic.go @@ -2,6 +2,13 @@ package FLXG import ( "context" + "encoding/hex" + "encoding/json" + "tianyuan-api/apps/api/internal/common" + "tianyuan-api/apps/api/internal/validator" + "tianyuan-api/apps/api/internal/westmodel" + "tianyuan-api/pkg/crypto" + "tianyuan-api/pkg/errs" "tianyuan-api/apps/api/internal/svc" "tianyuan-api/apps/api/internal/types" @@ -24,7 +31,64 @@ func NewFLXG54F5Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG54F5 } func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err error) { - // todo: add your logic here and delete this line + secretKey, ok := l.ctx.Value("secretKey").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + transactionID, ok := l.ctx.Value("transactionID").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + // 1、解密 + key, decodeErr := hex.DecodeString(secretKey) + if decodeErr != nil { + return nil, errs.ErrSystem + } + decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key) + if aesDecryptErr != nil || len(decryptData) == 0 { + return nil, errs.ErrParamDecryption + } - return + // 2、校验 + var data validator.FLXG54F5Request + if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil { + return nil, errs.ErrParamValidation + } + + // 3、西部加密 + westConfig := l.svcCtx.Config.WestConfig + encryptedFields, err := common.EncryptStructFields(data, westConfig.Key) + if err != nil { + logx.Errorf("西部加密错误:%v", err) + return nil, errs.ErrSystem + } + + // 4、发送请求到西部 + logx.Infof("交易号:%s", transactionID) + apiRequest := common.MapStructToAPIRequest(encryptedFields, westmodel.FLXG54F5FieldMapping, "data") + + westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G03HZ01", apiRequest) + if callAPIErr != nil { + return nil, errs.ErrSystem + } + + // 5、响应解析 + var respData westmodel.G03HZ01Response + unmarshalErr := json.Unmarshal(westResp, &respData) + if unmarshalErr != nil { + return nil, errs.ErrSystem + } + + if respData.Code == "0000" { + l.ctx = context.WithValue(l.ctx, "Charges", true) + } else { + return nil, errs.ErrSystem + } + encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key) + if aesEncrypt != nil { + return nil, errs.ErrSystem + } + return &types.Response{ + Data: encryptData, + }, nil } diff --git a/apps/api/internal/logic/FLXG/flxg5876logic.go b/apps/api/internal/logic/FLXG/flxg5876logic.go index da9beb2..18ff925 100644 --- a/apps/api/internal/logic/FLXG/flxg5876logic.go +++ b/apps/api/internal/logic/FLXG/flxg5876logic.go @@ -2,6 +2,12 @@ package FLXG import ( "context" + "encoding/hex" + "tianyuan-api/apps/api/internal/common" + "tianyuan-api/apps/api/internal/validator" + "tianyuan-api/apps/api/internal/westmodel" + "tianyuan-api/pkg/crypto" + "tianyuan-api/pkg/errs" "tianyuan-api/apps/api/internal/svc" "tianyuan-api/apps/api/internal/types" @@ -24,7 +30,64 @@ func NewFLXG5876Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG5876 } func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err error) { - // todo: add your logic here and delete this line + secretKey, ok := l.ctx.Value("secretKey").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + transactionID, ok := l.ctx.Value("transactionID").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + // 1、解密 + key, decodeErr := hex.DecodeString(secretKey) + if decodeErr != nil { + return nil, errs.ErrSystem + } + decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key) + if aesDecryptErr != nil || len(decryptData) == 0 { + return nil, errs.ErrParamDecryption + } - return + // 2、校验 + var data validator.FLXG5876Request + if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil { + return nil, errs.ErrParamValidation + } + + // 3、西部加密 + westConfig := l.svcCtx.Config.WestConfig + encryptedFields, err := common.EncryptStructFields(data, westConfig.Key) + if err != nil { + logx.Errorf("西部加密错误:%v", err) + return nil, errs.ErrSystem + } + + // 4、发送请求到西部 + logx.Infof("交易号:%s", transactionID) + apiRequest := common.MapStructToAPIRequest(encryptedFields, westmodel.FLXG5876FieldMapping, "") + + westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G03XM02", apiRequest) + if callAPIErr != nil { + return nil, errs.ErrSystem + } + + // 5、响应解析 + //var respData westmodel.G26BJ05Response + //unmarshalErr := json.Unmarshal(westResp, &respData) + //if unmarshalErr != nil { + // return nil, errs.ErrSystem + //} + // + //if respData.Data.Code == "00" || respData.Data.Code == "100002" { + // l.ctx = context.WithValue(l.ctx, "Charges", true) + //} else { + // return nil, errs.ErrSystem + //} + //encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key) + //if aesEncrypt != nil { + // return nil, errs.ErrSystem + //} + return &types.Response{ + Data: string(westResp), + }, nil } diff --git a/apps/api/internal/logic/FLXG/flxg970flogic.go b/apps/api/internal/logic/FLXG/flxg970flogic.go index 131d48d..290b27a 100644 --- a/apps/api/internal/logic/FLXG/flxg970flogic.go +++ b/apps/api/internal/logic/FLXG/flxg970flogic.go @@ -2,6 +2,12 @@ package FLXG import ( "context" + "encoding/hex" + "tianyuan-api/apps/api/internal/common" + "tianyuan-api/apps/api/internal/validator" + "tianyuan-api/apps/api/internal/westmodel" + "tianyuan-api/pkg/crypto" + "tianyuan-api/pkg/errs" "tianyuan-api/apps/api/internal/svc" "tianyuan-api/apps/api/internal/types" @@ -24,7 +30,64 @@ func NewFLXG970FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG970F } func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err error) { - // todo: add your logic here and delete this line + secretKey, ok := l.ctx.Value("secretKey").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + transactionID, ok := l.ctx.Value("transactionID").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + // 1、解密 + key, decodeErr := hex.DecodeString(secretKey) + if decodeErr != nil { + return nil, errs.ErrSystem + } + decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key) + if aesDecryptErr != nil || len(decryptData) == 0 { + return nil, errs.ErrParamDecryption + } - return + // 2、校验 + var data validator.FLXG970FRequest + if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil { + return nil, errs.ErrParamValidation + } + + // 3、西部加密 + westConfig := l.svcCtx.Config.WestConfig + encryptedFields, err := common.EncryptStructFields(data, westConfig.Key) + if err != nil { + logx.Errorf("西部加密错误:%v", err) + return nil, errs.ErrSystem + } + + // 4、发送请求到西部 + logx.Infof("交易号:%s", transactionID) + apiRequest := common.MapStructToAPIRequest(encryptedFields, westmodel.FLXG970FFieldMapping, "") + + westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00028", apiRequest) + if callAPIErr != nil { + return nil, errs.ErrSystem + } + + // 5、响应解析 + //var respData westmodel.G32BJ05Response + //unmarshalErr := json.Unmarshal(westResp, &respData) + //if unmarshalErr != nil { + // return nil, errs.ErrSystem + //} + // + //if respData.Data.Code == "00" || respData.Data.Code == "100002" { + // l.ctx = context.WithValue(l.ctx, "Charges", true) + //} else { + // return nil, errs.ErrSystem + //} + //encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key) + //if aesEncrypt != nil { + // return nil, errs.ErrSystem + //} + return &types.Response{ + Data: string(westResp), + }, nil } diff --git a/apps/api/internal/logic/IVYZ/ivyz5733logic.go b/apps/api/internal/logic/IVYZ/ivyz5733logic.go index 445f190..42d3578 100644 --- a/apps/api/internal/logic/IVYZ/ivyz5733logic.go +++ b/apps/api/internal/logic/IVYZ/ivyz5733logic.go @@ -3,11 +3,14 @@ package IVYZ import ( "context" "encoding/hex" - "errors" + "encoding/json" + "tianyuan-api/apps/api/internal/common" "tianyuan-api/apps/api/internal/svc" "tianyuan-api/apps/api/internal/types" "tianyuan-api/apps/api/internal/validator" + "tianyuan-api/apps/api/internal/westmodel" "tianyuan-api/pkg/crypto" + "tianyuan-api/pkg/errs" "github.com/zeromicro/go-zero/core/logx" ) @@ -26,64 +29,66 @@ func NewIVYZ5733Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ5733 } } -type CustomResponse struct { - Code int `json:"code"` - Msg string `json:"msg"` - Data interface{} `json:"data,omitempty"` // `omitempty` 使得当 Data 为空时字段不返回 -} - -func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err error) { - //userId, ok := l.ctx.Value("userId").(int64) - //if !ok { - // return &types.Response{}, errors.New("系统错误,请联系管理员") - //} +func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err *errs.AppError) { secretKey, ok := l.ctx.Value("secretKey").(string) if !ok { - return &types.Response{}, errors.New("系统错误,请联系管理员") + return &types.Response{}, errs.ErrSystem } + + transactionID, ok := l.ctx.Value("transactionID").(string) + if !ok { + return &types.Response{}, errs.ErrSystem + } + // 1、解密 - key, err := hex.DecodeString(secretKey) - decryptData, err := crypto.AesDecrypt(req.Data, key) - if err != nil || len(decryptData) == 0 { - return nil, errors.New("参数解密失败") + key, decodeErr := hex.DecodeString(secretKey) + if decodeErr != nil { + return nil, errs.ErrSystem + } + decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key) + if aesDecryptErr != nil || len(decryptData) == 0 { + return nil, errs.ErrParamDecryption } // 2、校验 var data validator.IVYZ5733Request if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil { - return nil, validatorErr + return nil, errs.ErrParamValidation } // 3、西部加密 westConfig := l.svcCtx.Config.WestConfig - name, err := crypto.WestDexEncrypt(data.Name, westConfig.Key) - if err != nil { + encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key) + if encryptStructFieldsErr != 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("业务异常") - } - // 4、发送请求到西部 - westdexRequest := map[string]interface{}{ - "id": idCard, - "name": name, - } - westResp, err := l.svcCtx.WestDexService.CallAPI("G09GX01", westdexRequest) - if err != nil { - return nil, err + return nil, errs.ErrSystem } + logx.Infof("交易号:%s", transactionID) + apiRequest := common.MapStructToAPIRequest(encryptedFields, westmodel.IVYZ5733FieldMapping, "data") + westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G09GX01", apiRequest) + if callAPIErr != nil { + return nil, errs.ErrSystem + } // 5、响应解析 - //var respData westmodel.G09GX01Response - //unmarshalErr := json.Unmarshal(westResp, &respData) - //if unmarshalErr != nil { - // return nil, unmarshalErr - //} - //crypto.AesEncrypt() + var respData westmodel.G09GX01Response + unmarshalErr := json.Unmarshal(westResp, &respData) + if unmarshalErr != nil { + return nil, errs.ErrSystem + } + + if respData.Code == 400 || respData.Code == 500 || respData.Code == 999 { + logx.Errorf("西部响应错误%v", respData) + return nil, errs.ErrSystem + } + if respData.Code == 201 || respData.Code == 202 || respData.Code == 203 { + l.ctx = context.WithValue(l.ctx, "Charges", true) + } + encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key) + if aesEncrypt != nil { + return nil, errs.ErrSystem + } return &types.Response{ - Data: string(westResp), + Data: encryptData, }, nil } diff --git a/apps/api/internal/logic/QYGL/qygl2acdlogic.go b/apps/api/internal/logic/QYGL/qygl2acdlogic.go index 5e00262..bc86ec4 100644 --- a/apps/api/internal/logic/QYGL/qygl2acdlogic.go +++ b/apps/api/internal/logic/QYGL/qygl2acdlogic.go @@ -24,11 +24,6 @@ func NewQYGL2ACDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL2ACD } 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/middleware/apiauthinterceptormiddleware.go b/apps/api/internal/middleware/apiauthinterceptormiddleware.go index b4f75d6..cb5b8a0 100644 --- a/apps/api/internal/middleware/apiauthinterceptormiddleware.go +++ b/apps/api/internal/middleware/apiauthinterceptormiddleware.go @@ -14,12 +14,15 @@ import ( "tianyuan-api/apps/sentinel/client/userproduct" "tianyuan-api/apps/sentinel/client/whitelist" "tianyuan-api/apps/sentinel/sentinel" + "tianyuan-api/apps/user/user" + "tianyuan-api/pkg/crypto" ) type ApiAuthInterceptorMiddleware struct { WhitelistRpc sentinel.WhitelistClient SecretRpc sentinel.SecretClient UserProductRpc sentinel.UserProductClient + UserRpc user.UserClient Rds *redis.Redis } @@ -27,11 +30,13 @@ func NewApiAuthInterceptorMiddleware( whitelistRpc sentinel.WhitelistClient, secretRpc sentinel.SecretClient, userProductRpc sentinel.UserProductClient, + userRpc user.UserClient, rds *redis.Redis) *ApiAuthInterceptorMiddleware { return &ApiAuthInterceptorMiddleware{ WhitelistRpc: whitelistRpc, SecretRpc: secretRpc, UserProductRpc: userProductRpc, + UserRpc: userRpc, Rds: rds, } } @@ -83,8 +88,21 @@ func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.Handle return } - // 3、是否有开通该产品 userId := secrets.UserId + + // 3、额度是否冻结 + info, err := m.UserRpc.GetUserInfo(r.Context(), &user.UserInfoReq{UserId: userId}) + if err != nil { + xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("系统错误,请联系管理员")) + return + } + + if info.QuotaExceeded == 1 { + xhttp.JsonBaseResponseCtx(r.Context(), w, errors.New("账户余额不足,无法请求")) + return + } + + // 4、是否有开通该产品 pathParts := strings.Split(r.URL.Path, "/") productCode := pathParts[len(pathParts)-1] userProductRedisKey := fmt.Sprintf("user_products:%d", userId) @@ -106,7 +124,13 @@ func (m *ApiAuthInterceptorMiddleware) Handle(next http.HandlerFunc) http.Handle // 将 userId 存入 context,供后续逻辑使用 ctx := context.WithValue(r.Context(), "userId", userId) - ctx = context.WithValue(r.Context(), "secretKey", secrets.AesKey) + ctx = context.WithValue(ctx, "secretKey", secrets.AesKey) + ctx = context.WithValue(ctx, "productCode", productCode) + + // 生成流水号 + transactionID := crypto.GenerateTransactionID() + ctx = context.WithValue(ctx, "transactionID", transactionID) + next(w, r.WithContext(ctx)) } } diff --git a/apps/api/internal/middleware/apimqsinterceptormiddleware.go b/apps/api/internal/middleware/apimqsinterceptormiddleware.go new file mode 100644 index 0000000..457071d --- /dev/null +++ b/apps/api/internal/middleware/apimqsinterceptormiddleware.go @@ -0,0 +1,53 @@ +package middleware + +import ( + "github.com/zeromicro/go-zero/core/logx" + "net/http" + "tianyuan-api/apps/api/internal/service" +) + +type ApiMqsInterceptorMiddleware struct { + ApiRequestMqsService *service.ApiRequestMqsService +} + +func NewApiMqsInterceptorMiddleware(apiRequestMqsService *service.ApiRequestMqsService) *ApiMqsInterceptorMiddleware { + return &ApiMqsInterceptorMiddleware{ + ApiRequestMqsService: apiRequestMqsService, + } +} + +func (m *ApiMqsInterceptorMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + next(w, r) + //响应拦截 + ctx := r.Context() + transactionID, ok := ctx.Value("transactionID").(string) + if ok && transactionID != "" { + userId, userIdOk := ctx.Value("userId").(int64) + if !userIdOk { + logx.Error("userId 不存在或类型错误") + return + } + + productCode, productCodeOk := ctx.Value("productCode").(string) + if !productCodeOk || productCode == "" { + logx.Errorf("productCode 不存在或为空") + } + status, statusOk := ctx.Value("status").(string) + if !statusOk || status == "" { + status = "failed" + } + remark, remarkOk := ctx.Value("remark").(string) + if !remarkOk || remark == "" { + } + charges, chargesOk := ctx.Value("charges").(bool) + if !chargesOk || !charges { + charges = false + } + err := m.ApiRequestMqsService.SendApiRequestMessage(ctx, transactionID, userId, productCode, status, charges, remark) + if err != nil { + logx.Errorf("发送 API 请求消息失败: %v", err) + } + } + } +} diff --git a/apps/api/internal/service/apirequest_mqs_service.go b/apps/api/internal/service/apirequest_mqs_service.go new file mode 100644 index 0000000..8e550a4 --- /dev/null +++ b/apps/api/internal/service/apirequest_mqs_service.go @@ -0,0 +1,41 @@ +package service + +import ( + "context" + "encoding/json" + "github.com/zeromicro/go-queue/kq" + "tianyuan-api/pkg/models" + "time" +) + +type ApiRequestMqsService struct { + KqPusherClient *kq.Pusher +} + +// NewApiRequestMqsService +func NewApiRequestMqsService(KqPusherClient *kq.Pusher) *ApiRequestMqsService { + return &ApiRequestMqsService{ + KqPusherClient: KqPusherClient, + } +} +func (s *ApiRequestMqsService) SendApiRequestMessage(ctx context.Context, transactionID string, userId int64, productCode string, status string, charges bool, remark string) error { + message := models.ApiRequestMessage{ + TransactionID: transactionID, + UserId: userId, + ProductCode: productCode, + Status: status, + Charges: charges, + Remark: remark, + Timestamp: time.Now(), + } + + msgBytes, marshalErr := json.Marshal(message) + if marshalErr != nil { + return marshalErr + } + + if pushErr := s.KqPusherClient.Push(ctx, string(msgBytes)); pushErr != nil { + return pushErr + } + return nil +} diff --git a/apps/api/internal/service/west_dex_service.go b/apps/api/internal/service/west_dex_service.go index fce1c81..264bf64 100644 --- a/apps/api/internal/service/west_dex_service.go +++ b/apps/api/internal/service/west_dex_service.go @@ -44,11 +44,7 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r // 构造请求URL reqUrl := fmt.Sprintf("%s/%s/%s?timestamp=%s", w.config.Url, w.config.SecretId, code, timestamp) - // 将请求参数编码为JSON格式 - data := map[string]interface{}{ - "data": reqData, - } - jsonData, err := json.Marshal(data) + jsonData, err := json.Marshal(reqData) if err != nil { logx.Errorf("【西部数据请求】JSON编码错误: %v", err) return @@ -94,7 +90,7 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r logx.Errorf("【西部数据请求】JSON反序列化错误: %v", UnmarshalErr) return nil, UnmarshalErr } - + logx.Infof("西部流水号: %s", westDexResp.ID) // 到这层是西部系统 if westDexResp.Code != "00000" { logx.Errorf("【西部数据请求】响应数据业务异常: %s %s", westDexResp.Message, westDexResp.Reason) diff --git a/apps/api/internal/svc/servicecontext.go b/apps/api/internal/svc/servicecontext.go index f6f9e58..326a98c 100644 --- a/apps/api/internal/svc/servicecontext.go +++ b/apps/api/internal/svc/servicecontext.go @@ -9,18 +9,29 @@ import ( "tianyuan-api/apps/api/internal/middleware" "tianyuan-api/apps/api/internal/service" "tianyuan-api/apps/sentinel/sentinel" + "tianyuan-api/apps/user/user" + "time" ) 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 + Config config.Config + ApiAuthInterceptor rest.Middleware + ApiMqsInterceptor rest.Middleware + Redis *redis.Redis + WhitelistRpc sentinel.WhitelistClient + SecretRpc sentinel.SecretClient + ProductRpc sentinel.ProductClient + UserProductRpc sentinel.UserProductClient + WestDexService *service.WestDexService + ApiRequestMqsService *service.ApiRequestMqsService +} +type ApiRequestMessage struct { + TransactionID string `json:"transactionID"` + UserId string `json:"userId"` + ProductCode string `json:"productCode"` + Status string `json:"status"` // 1. success 2. error + Charges bool `json:"charges"` // 是否扣费 + Timestamp time.Time `json:"timestamp"` // 添加时间戳 } func NewServiceContext(c config.Config) *ServiceContext { @@ -36,15 +47,19 @@ func NewServiceContext(c config.Config) *ServiceContext { userProductRpc := sentinel.NewUserProductClient(zrpc.MustNewClient(c.SentinelRpc).Conn()) whitelistRpc := sentinel.NewWhitelistClient(zrpc.MustNewClient(c.SentinelRpc).Conn()) secretRpc := sentinel.NewSecretClient(zrpc.MustNewClient(c.SentinelRpc).Conn()) + userRpc := user.NewUserClient(zrpc.MustNewClient(c.UserRpc).Conn()) + KqPusherClient := kq.NewPusher(c.KqPusherConf.Brokers, c.KqPusherConf.Topic) + apiRequestMqsService := service.NewApiRequestMqsService(KqPusherClient) 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), // 假设你将密钥和 ID 配置在 config 中 + Config: c, + Redis: rds, + WhitelistRpc: whitelistRpc, + SecretRpc: secretRpc, + ProductRpc: productRpc, + UserProductRpc: userProductRpc, + ApiAuthInterceptor: middleware.NewApiAuthInterceptorMiddleware(whitelistRpc, secretRpc, userProductRpc, userRpc, rds).Handle, + ApiMqsInterceptor: middleware.NewApiMqsInterceptorMiddleware(apiRequestMqsService).Handle, + ApiRequestMqsService: apiRequestMqsService, + WestDexService: service.NewWestDexService(c.WestConfig), // 假设你将密钥和 ID 配置在 config 中 } } diff --git a/apps/api/internal/validator/structs.go b/apps/api/internal/validator/structs.go index 387d080..6036238 100644 --- a/apps/api/internal/validator/structs.go +++ b/apps/api/internal/validator/structs.go @@ -21,6 +21,22 @@ type FLXG3D56Request struct { Name string `json:"name" validate:"required,min=1,validName"` TimeRange string `json:"time_range" validate:"omitempty,validTimeRange"` // 非必填字段 } +type FLXG54F5Request struct { + MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"` +} +type FLXG162ARequest 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"` +} +type FLXG970FRequest struct { + IDCard string `json:"id_card" validate:"required,validIDCard"` + Name string `json:"name" validate:"required,min=1,validName"` +} +type FLXG5876Request struct { + MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"` +} + type IVYZ5733Request struct { Name string `json:"name" validate:"required,min=1,validName"` IDCard string `json:"id_card" validate:"required,validIDCard"` diff --git a/apps/api/internal/westmodel/fieldMapping.go b/apps/api/internal/westmodel/fieldMapping.go new file mode 100644 index 0000000..099ee0b --- /dev/null +++ b/apps/api/internal/westmodel/fieldMapping.go @@ -0,0 +1,28 @@ +package westmodel + +var IVYZ5733FieldMapping = map[string]string{ + "IDCard": "id", + "Name": "name", + "MobileNo": "cell", + "TimeRange": "time_range", +} +var FLXG3D56FieldMapping = map[string]string{ + "IDCard": "id", + "Name": "name", +} +var FLXG54F5FieldMapping = map[string]string{ + "MobileNo": "mobile", +} +var FLXG162AFieldMapping = map[string]string{ + "IDCard": "id", + "Name": "name", + "MobileNo": "cell", +} + +var FLXG970FFieldMapping = map[string]string{ + "IDCard": "id", + "Name": "name", +} +var FLXG5876FieldMapping = map[string]string{ + "MobileNo": "mobile", +} diff --git a/apps/api/internal/westmodel/response.go b/apps/api/internal/westmodel/response.go index d282ff2..fe4e485 100644 --- a/apps/api/internal/westmodel/response.go +++ b/apps/api/internal/westmodel/response.go @@ -6,6 +6,19 @@ type G09GX01Response struct { Data string `json:"data"` Success bool `json:"success"` } +type G26BJ05Response struct { + Data struct { + Code string `json:"code"` + } `json:"data"` +} +type G03HZ01Response struct { + Code string `json:"code"` +} +type G32BJ05Response struct { + Data struct { + Code string `json:"code"` + } `json:"data"` +} type G16BJ02Response struct { Code int `json:"code"` Msg string `json:"msg"` diff --git a/apps/mqs/etc/mqs.dev.yaml b/apps/mqs/etc/mqs.dev.yaml index 5905924..1594a95 100644 --- a/apps/mqs/etc/mqs.dev.yaml +++ b/apps/mqs/etc/mqs.dev.yaml @@ -22,4 +22,10 @@ KqConsumerCharge: Topic: apirequest Offset: first Consumers: 2 # 同样分配2个消费者 - Processors: 2 \ No newline at end of file + Processors: 2 + +UserRpc: + Etcd: + Hosts: + - 127.0.0.1:2379 + Key: user.rpc \ No newline at end of file diff --git a/apps/mqs/etc/mqs.yaml b/apps/mqs/etc/mqs.yaml index 69e13c6..64b3797 100644 --- a/apps/mqs/etc/mqs.yaml +++ b/apps/mqs/etc/mqs.yaml @@ -22,4 +22,10 @@ KqConsumerCharge: Topic: apirequest Offset: first Consumers: 2 # 同样分配2个消费者 - Processors: 2 \ No newline at end of file + Processors: 2 + +UserRpc: + Etcd: + Hosts: + - tyapi_etcd:2379 + Key: user.rpc \ No newline at end of file diff --git a/apps/mqs/internal/config/config.go b/apps/mqs/internal/config/config.go index f301ead..f050e7b 100644 --- a/apps/mqs/internal/config/config.go +++ b/apps/mqs/internal/config/config.go @@ -3,10 +3,12 @@ package config import ( "github.com/zeromicro/go-queue/kq" "github.com/zeromicro/go-zero/rest" + "github.com/zeromicro/go-zero/zrpc" ) type Config struct { rest.RestConf KqConsumerLog kq.KqConf KqConsumerCharge kq.KqConf + UserRpc zrpc.RpcClientConf } diff --git a/apps/mqs/internal/mqs/apirequest/charge.go b/apps/mqs/internal/mqs/apirequest/charge.go index 5cebeca..b855585 100644 --- a/apps/mqs/internal/mqs/apirequest/charge.go +++ b/apps/mqs/internal/mqs/apirequest/charge.go @@ -2,8 +2,11 @@ package apirequest import ( "context" + "encoding/json" "github.com/zeromicro/go-zero/core/logx" "tianyuan-api/apps/mqs/internal/svc" + "tianyuan-api/apps/user/user" + "tianyuan-api/pkg/models" ) type Charge struct { @@ -19,6 +22,18 @@ func NewCharge(ctx context.Context, svcCtx *svc.ServiceContext) *Charge { } func (l *Charge) Consume(ctx context.Context, key, val string) error { - logx.Infof("Charge key :%s , val :%s", key, val) + var apiRequestMessage models.ApiRequestMessage + err := json.Unmarshal([]byte(val), &apiRequestMessage) + if err != nil { + return err + } + logx.Infof("Charge val :%v", apiRequestMessage) + if !apiRequestMessage.Charges { + return nil + } + _, updateWalletErr := l.svcCtx.WalletRpc.UpdateWallet(ctx, &user.UpdateWalletRequest{UserId: apiRequestMessage.UserId, TransactionId: apiRequestMessage.TransactionID, ProductCode: apiRequestMessage.ProductCode, Remark: apiRequestMessage.Remark}) + if updateWalletErr != nil { + return err + } return nil } diff --git a/apps/mqs/internal/mqs/apirequest/log.go b/apps/mqs/internal/mqs/apirequest/log.go index e8349eb..0d15f07 100644 --- a/apps/mqs/internal/mqs/apirequest/log.go +++ b/apps/mqs/internal/mqs/apirequest/log.go @@ -2,8 +2,11 @@ package apirequest import ( "context" - "github.com/zeromicro/go-zero/core/logx" + "encoding/json" "tianyuan-api/apps/mqs/internal/svc" + "tianyuan-api/apps/user/user" + "tianyuan-api/pkg/models" + "time" ) type Log struct { @@ -19,6 +22,22 @@ func NewLog(ctx context.Context, svcCtx *svc.ServiceContext) *Log { } func (l *Log) Consume(ctx context.Context, key, val string) error { - logx.Infof("log key :%s , val :%s", key, val) + var apiRequestMessage models.ApiRequestMessage + err := json.Unmarshal([]byte(val), &apiRequestMessage) + if err != nil { + return err + } + _, err = l.svcCtx.ApiRequestRpc.AddApiRequest(ctx, &user.AddApiRequestRequest{ + TransactionId: apiRequestMessage.TransactionID, + UserId: apiRequestMessage.UserId, + ProductCode: apiRequestMessage.ProductCode, + Status: apiRequestMessage.Status, + Charges: apiRequestMessage.Charges, + Remark: apiRequestMessage.Remark, + Timestamp: apiRequestMessage.Timestamp.Format(time.RFC3339Nano), + }) + if err != nil { + return err + } return nil } diff --git a/apps/mqs/internal/svc/servicecontext.go b/apps/mqs/internal/svc/servicecontext.go index 41d74c5..ba76428 100644 --- a/apps/mqs/internal/svc/servicecontext.go +++ b/apps/mqs/internal/svc/servicecontext.go @@ -1,13 +1,24 @@ package svc -import "tianyuan-api/apps/mqs/internal/config" +import ( + "github.com/zeromicro/go-zero/zrpc" + "tianyuan-api/apps/mqs/internal/config" + "tianyuan-api/apps/user/user" +) type ServiceContext struct { - Config config.Config + Config config.Config + WalletRpc user.WalletServiceClient + ApiRequestRpc user.ApiRequestServiceClient } func NewServiceContext(c config.Config) *ServiceContext { + walletRpc := user.NewWalletServiceClient(zrpc.MustNewClient(c.UserRpc).Conn()) + apiRequestRpc := user.NewApiRequestServiceClient(zrpc.MustNewClient(c.UserRpc).Conn()) + return &ServiceContext{ - Config: c, + Config: c, + WalletRpc: walletRpc, + ApiRequestRpc: apiRequestRpc, } } diff --git a/apps/sentinel/client/product/product.go b/apps/sentinel/client/product/product.go index 29886e9..52603fe 100644 --- a/apps/sentinel/client/product/product.go +++ b/apps/sentinel/client/product/product.go @@ -22,6 +22,7 @@ type ( DeleteSecretRequest = sentinel.DeleteSecretRequest DeleteUserProductRequest = sentinel.DeleteUserProductRequest DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest + GetRecordByCodeRequest = sentinel.GetRecordByCodeRequest GetRecordByIdRequest = sentinel.GetRecordByIdRequest GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest MatchResponse = sentinel.MatchResponse @@ -51,6 +52,7 @@ type ( 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) + GetProductByCode(ctx context.Context, in *GetRecordByCodeRequest, opts ...grpc.CallOption) (*Product, error) } defaultProductZrpcClient struct { @@ -89,3 +91,8 @@ func (m *defaultProductZrpcClient) GetProductById(ctx context.Context, in *GetRe client := sentinel.NewProductClient(m.cli.Conn()) return client.GetProductById(ctx, in, opts...) } + +func (m *defaultProductZrpcClient) GetProductByCode(ctx context.Context, in *GetRecordByCodeRequest, opts ...grpc.CallOption) (*Product, error) { + client := sentinel.NewProductClient(m.cli.Conn()) + return client.GetProductByCode(ctx, in, opts...) +} diff --git a/apps/sentinel/client/secret/secret.go b/apps/sentinel/client/secret/secret.go index 4a7e943..7f45b88 100644 --- a/apps/sentinel/client/secret/secret.go +++ b/apps/sentinel/client/secret/secret.go @@ -22,6 +22,7 @@ type ( DeleteSecretRequest = sentinel.DeleteSecretRequest DeleteUserProductRequest = sentinel.DeleteUserProductRequest DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest + GetRecordByCodeRequest = sentinel.GetRecordByCodeRequest GetRecordByIdRequest = sentinel.GetRecordByIdRequest GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest MatchResponse = sentinel.MatchResponse diff --git a/apps/sentinel/client/userproduct/userproduct.go b/apps/sentinel/client/userproduct/userproduct.go index 25eec9d..f55152e 100644 --- a/apps/sentinel/client/userproduct/userproduct.go +++ b/apps/sentinel/client/userproduct/userproduct.go @@ -22,6 +22,7 @@ type ( DeleteSecretRequest = sentinel.DeleteSecretRequest DeleteUserProductRequest = sentinel.DeleteUserProductRequest DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest + GetRecordByCodeRequest = sentinel.GetRecordByCodeRequest GetRecordByIdRequest = sentinel.GetRecordByIdRequest GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest MatchResponse = sentinel.MatchResponse diff --git a/apps/sentinel/client/whitelist/whitelist.go b/apps/sentinel/client/whitelist/whitelist.go index 966b17f..8b58376 100644 --- a/apps/sentinel/client/whitelist/whitelist.go +++ b/apps/sentinel/client/whitelist/whitelist.go @@ -22,6 +22,7 @@ type ( DeleteSecretRequest = sentinel.DeleteSecretRequest DeleteUserProductRequest = sentinel.DeleteUserProductRequest DeleteWhitelistRequest = sentinel.DeleteWhitelistRequest + GetRecordByCodeRequest = sentinel.GetRecordByCodeRequest GetRecordByIdRequest = sentinel.GetRecordByIdRequest GetSecretBySecretIdRequest = sentinel.GetSecretBySecretIdRequest MatchResponse = sentinel.MatchResponse diff --git a/apps/sentinel/internal/logic/product/getproductbycodelogic.go b/apps/sentinel/internal/logic/product/getproductbycodelogic.go new file mode 100644 index 0000000..cd557db --- /dev/null +++ b/apps/sentinel/internal/logic/product/getproductbycodelogic.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 GetProductByCodeLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetProductByCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductByCodeLogic { + return &GetProductByCodeLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetProductByCodeLogic) GetProductByCode(in *sentinel.GetRecordByCodeRequest) (*sentinel.Product, error) { + product, err := l.svcCtx.ProductsModel.FindOneByProductCode(l.ctx, in.Code) + 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/server/product/productserver.go b/apps/sentinel/internal/server/product/productserver.go index c070655..91fdf5e 100644 --- a/apps/sentinel/internal/server/product/productserver.go +++ b/apps/sentinel/internal/server/product/productserver.go @@ -48,3 +48,8 @@ func (s *ProductServer) GetProductById(ctx context.Context, in *sentinel.GetReco l := productlogic.NewGetProductByIdLogic(ctx, s.svcCtx) return l.GetProductById(in) } + +func (s *ProductServer) GetProductByCode(ctx context.Context, in *sentinel.GetRecordByCodeRequest) (*sentinel.Product, error) { + l := productlogic.NewGetProductByCodeLogic(ctx, s.svcCtx) + return l.GetProductByCode(in) +} diff --git a/apps/sentinel/sentinel.proto b/apps/sentinel/sentinel.proto index 616f4c0..3121f5b 100644 --- a/apps/sentinel/sentinel.proto +++ b/apps/sentinel/sentinel.proto @@ -21,7 +21,9 @@ message WhitePageListRequest { message GetRecordByIdRequest { int64 id = 1; } - +message GetRecordByCodeRequest { + string code = 1; +} message Whitelist { int64 id = 1; @@ -186,6 +188,7 @@ service product { rpc DeleteProduct(DeleteProductRequest) returns (Product); rpc GetProductPageList(PageListRequest) returns (ProductResponse); rpc GetProductById(GetRecordByIdRequest) returns (Product); + rpc GetProductByCode(GetRecordByCodeRequest) returns (Product); } service userProduct { // UserProduct methods diff --git a/apps/sentinel/sentinel/sentinel.pb.go b/apps/sentinel/sentinel/sentinel.pb.go index 4366699..161d992 100644 --- a/apps/sentinel/sentinel/sentinel.pb.go +++ b/apps/sentinel/sentinel/sentinel.pb.go @@ -248,6 +248,53 @@ func (x *GetRecordByIdRequest) GetId() int64 { return 0 } +type GetRecordByCodeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` +} + +func (x *GetRecordByCodeRequest) Reset() { + *x = GetRecordByCodeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sentinel_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRecordByCodeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRecordByCodeRequest) ProtoMessage() {} + +func (x *GetRecordByCodeRequest) 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 GetRecordByCodeRequest.ProtoReflect.Descriptor instead. +func (*GetRecordByCodeRequest) Descriptor() ([]byte, []int) { + return file_sentinel_proto_rawDescGZIP(), []int{4} +} + +func (x *GetRecordByCodeRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + type Whitelist struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -263,7 +310,7 @@ type Whitelist struct { func (x *Whitelist) Reset() { *x = Whitelist{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[4] + mi := &file_sentinel_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -276,7 +323,7 @@ func (x *Whitelist) String() string { func (*Whitelist) ProtoMessage() {} func (x *Whitelist) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[4] + mi := &file_sentinel_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -289,7 +336,7 @@ func (x *Whitelist) ProtoReflect() protoreflect.Message { // Deprecated: Use Whitelist.ProtoReflect.Descriptor instead. func (*Whitelist) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{4} + return file_sentinel_proto_rawDescGZIP(), []int{5} } func (x *Whitelist) GetId() int64 { @@ -339,7 +386,7 @@ type CreateWhitelistRequest struct { func (x *CreateWhitelistRequest) Reset() { *x = CreateWhitelistRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[5] + mi := &file_sentinel_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -352,7 +399,7 @@ func (x *CreateWhitelistRequest) String() string { func (*CreateWhitelistRequest) ProtoMessage() {} func (x *CreateWhitelistRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[5] + mi := &file_sentinel_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -365,7 +412,7 @@ func (x *CreateWhitelistRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateWhitelistRequest.ProtoReflect.Descriptor instead. func (*CreateWhitelistRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{5} + return file_sentinel_proto_rawDescGZIP(), []int{6} } func (x *CreateWhitelistRequest) GetUserId() int64 { @@ -394,7 +441,7 @@ type UpdateWhitelistRequest struct { func (x *UpdateWhitelistRequest) Reset() { *x = UpdateWhitelistRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[6] + mi := &file_sentinel_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -407,7 +454,7 @@ func (x *UpdateWhitelistRequest) String() string { func (*UpdateWhitelistRequest) ProtoMessage() {} func (x *UpdateWhitelistRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[6] + mi := &file_sentinel_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -420,7 +467,7 @@ func (x *UpdateWhitelistRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateWhitelistRequest.ProtoReflect.Descriptor instead. func (*UpdateWhitelistRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{6} + return file_sentinel_proto_rawDescGZIP(), []int{7} } func (x *UpdateWhitelistRequest) GetId() int64 { @@ -448,7 +495,7 @@ type DeleteWhitelistRequest struct { func (x *DeleteWhitelistRequest) Reset() { *x = DeleteWhitelistRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[7] + mi := &file_sentinel_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -461,7 +508,7 @@ func (x *DeleteWhitelistRequest) String() string { func (*DeleteWhitelistRequest) ProtoMessage() {} func (x *DeleteWhitelistRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[7] + mi := &file_sentinel_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -474,7 +521,7 @@ func (x *DeleteWhitelistRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteWhitelistRequest.ProtoReflect.Descriptor instead. func (*DeleteWhitelistRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{7} + return file_sentinel_proto_rawDescGZIP(), []int{8} } func (x *DeleteWhitelistRequest) GetId() int64 { @@ -496,7 +543,7 @@ type WhitelistResponse struct { func (x *WhitelistResponse) Reset() { *x = WhitelistResponse{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[8] + mi := &file_sentinel_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -509,7 +556,7 @@ func (x *WhitelistResponse) String() string { func (*WhitelistResponse) ProtoMessage() {} func (x *WhitelistResponse) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[8] + mi := &file_sentinel_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -522,7 +569,7 @@ func (x *WhitelistResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use WhitelistResponse.ProtoReflect.Descriptor instead. func (*WhitelistResponse) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{8} + return file_sentinel_proto_rawDescGZIP(), []int{9} } func (x *WhitelistResponse) GetTotal() int64 { @@ -556,7 +603,7 @@ type Secret struct { func (x *Secret) Reset() { *x = Secret{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[9] + mi := &file_sentinel_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -569,7 +616,7 @@ func (x *Secret) String() string { func (*Secret) ProtoMessage() {} func (x *Secret) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[9] + mi := &file_sentinel_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -582,7 +629,7 @@ func (x *Secret) ProtoReflect() protoreflect.Message { // Deprecated: Use Secret.ProtoReflect.Descriptor instead. func (*Secret) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{9} + return file_sentinel_proto_rawDescGZIP(), []int{10} } func (x *Secret) GetId() int64 { @@ -638,7 +685,7 @@ type GetSecretBySecretIdRequest struct { func (x *GetSecretBySecretIdRequest) Reset() { *x = GetSecretBySecretIdRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[10] + mi := &file_sentinel_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -651,7 +698,7 @@ func (x *GetSecretBySecretIdRequest) String() string { func (*GetSecretBySecretIdRequest) ProtoMessage() {} func (x *GetSecretBySecretIdRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[10] + mi := &file_sentinel_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -664,7 +711,7 @@ func (x *GetSecretBySecretIdRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSecretBySecretIdRequest.ProtoReflect.Descriptor instead. func (*GetSecretBySecretIdRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{10} + return file_sentinel_proto_rawDescGZIP(), []int{11} } func (x *GetSecretBySecretIdRequest) GetSecretId() string { @@ -685,7 +732,7 @@ type CreateSecretRequest struct { func (x *CreateSecretRequest) Reset() { *x = CreateSecretRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[11] + mi := &file_sentinel_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -698,7 +745,7 @@ func (x *CreateSecretRequest) String() string { func (*CreateSecretRequest) ProtoMessage() {} func (x *CreateSecretRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[11] + mi := &file_sentinel_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -711,7 +758,7 @@ func (x *CreateSecretRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSecretRequest.ProtoReflect.Descriptor instead. func (*CreateSecretRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{11} + return file_sentinel_proto_rawDescGZIP(), []int{12} } func (x *CreateSecretRequest) GetUserId() int64 { @@ -734,7 +781,7 @@ type UpdateSecretRequest struct { func (x *UpdateSecretRequest) Reset() { *x = UpdateSecretRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[12] + mi := &file_sentinel_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -747,7 +794,7 @@ func (x *UpdateSecretRequest) String() string { func (*UpdateSecretRequest) ProtoMessage() {} func (x *UpdateSecretRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[12] + mi := &file_sentinel_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -760,7 +807,7 @@ func (x *UpdateSecretRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateSecretRequest.ProtoReflect.Descriptor instead. func (*UpdateSecretRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{12} + return file_sentinel_proto_rawDescGZIP(), []int{13} } func (x *UpdateSecretRequest) GetId() int64 { @@ -795,7 +842,7 @@ type DeleteSecretRequest struct { func (x *DeleteSecretRequest) Reset() { *x = DeleteSecretRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[13] + mi := &file_sentinel_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -808,7 +855,7 @@ func (x *DeleteSecretRequest) String() string { func (*DeleteSecretRequest) ProtoMessage() {} func (x *DeleteSecretRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[13] + mi := &file_sentinel_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -821,7 +868,7 @@ func (x *DeleteSecretRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteSecretRequest.ProtoReflect.Descriptor instead. func (*DeleteSecretRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{13} + return file_sentinel_proto_rawDescGZIP(), []int{14} } func (x *DeleteSecretRequest) GetId() int64 { @@ -843,7 +890,7 @@ type SecretResponse struct { func (x *SecretResponse) Reset() { *x = SecretResponse{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[14] + mi := &file_sentinel_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -856,7 +903,7 @@ func (x *SecretResponse) String() string { func (*SecretResponse) ProtoMessage() {} func (x *SecretResponse) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[14] + mi := &file_sentinel_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -869,7 +916,7 @@ func (x *SecretResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SecretResponse.ProtoReflect.Descriptor instead. func (*SecretResponse) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{14} + return file_sentinel_proto_rawDescGZIP(), []int{15} } func (x *SecretResponse) GetTotal() int64 { @@ -906,7 +953,7 @@ type Product struct { func (x *Product) Reset() { *x = Product{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[15] + mi := &file_sentinel_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -919,7 +966,7 @@ func (x *Product) String() string { func (*Product) ProtoMessage() {} func (x *Product) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[15] + mi := &file_sentinel_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -932,7 +979,7 @@ func (x *Product) ProtoReflect() protoreflect.Message { // Deprecated: Use Product.ProtoReflect.Descriptor instead. func (*Product) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{15} + return file_sentinel_proto_rawDescGZIP(), []int{16} } func (x *Product) GetId() int64 { @@ -1014,7 +1061,7 @@ type CreateProductRequest struct { func (x *CreateProductRequest) Reset() { *x = CreateProductRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[16] + mi := &file_sentinel_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1027,7 +1074,7 @@ func (x *CreateProductRequest) String() string { func (*CreateProductRequest) ProtoMessage() {} func (x *CreateProductRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[16] + mi := &file_sentinel_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1040,7 +1087,7 @@ func (x *CreateProductRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateProductRequest.ProtoReflect.Descriptor instead. func (*CreateProductRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{16} + return file_sentinel_proto_rawDescGZIP(), []int{17} } func (x *CreateProductRequest) GetProductName() string { @@ -1102,7 +1149,7 @@ type UpdateProductRequest struct { func (x *UpdateProductRequest) Reset() { *x = UpdateProductRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[17] + mi := &file_sentinel_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1115,7 +1162,7 @@ func (x *UpdateProductRequest) String() string { func (*UpdateProductRequest) ProtoMessage() {} func (x *UpdateProductRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[17] + mi := &file_sentinel_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1128,7 +1175,7 @@ func (x *UpdateProductRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateProductRequest.ProtoReflect.Descriptor instead. func (*UpdateProductRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{17} + return file_sentinel_proto_rawDescGZIP(), []int{18} } func (x *UpdateProductRequest) GetId() int64 { @@ -1191,7 +1238,7 @@ type DeleteProductRequest struct { func (x *DeleteProductRequest) Reset() { *x = DeleteProductRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[18] + mi := &file_sentinel_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1204,7 +1251,7 @@ func (x *DeleteProductRequest) String() string { func (*DeleteProductRequest) ProtoMessage() {} func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[18] + mi := &file_sentinel_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1217,7 +1264,7 @@ func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteProductRequest.ProtoReflect.Descriptor instead. func (*DeleteProductRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{18} + return file_sentinel_proto_rawDescGZIP(), []int{19} } func (x *DeleteProductRequest) GetId() int64 { @@ -1239,7 +1286,7 @@ type ProductResponse struct { func (x *ProductResponse) Reset() { *x = ProductResponse{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[19] + mi := &file_sentinel_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1252,7 +1299,7 @@ func (x *ProductResponse) String() string { func (*ProductResponse) ProtoMessage() {} func (x *ProductResponse) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[19] + mi := &file_sentinel_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1265,7 +1312,7 @@ func (x *ProductResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ProductResponse.ProtoReflect.Descriptor instead. func (*ProductResponse) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{19} + return file_sentinel_proto_rawDescGZIP(), []int{20} } func (x *ProductResponse) GetTotal() int64 { @@ -1292,7 +1339,7 @@ type UserProductEmptyResponse struct { func (x *UserProductEmptyResponse) Reset() { *x = UserProductEmptyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[20] + mi := &file_sentinel_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1305,7 +1352,7 @@ func (x *UserProductEmptyResponse) String() string { func (*UserProductEmptyResponse) ProtoMessage() {} func (x *UserProductEmptyResponse) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[20] + mi := &file_sentinel_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1318,7 +1365,7 @@ func (x *UserProductEmptyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UserProductEmptyResponse.ProtoReflect.Descriptor instead. func (*UserProductEmptyResponse) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{20} + return file_sentinel_proto_rawDescGZIP(), []int{21} } type UserProductItem struct { @@ -1340,7 +1387,7 @@ type UserProductItem struct { func (x *UserProductItem) Reset() { *x = UserProductItem{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[21] + mi := &file_sentinel_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1353,7 +1400,7 @@ func (x *UserProductItem) String() string { func (*UserProductItem) ProtoMessage() {} func (x *UserProductItem) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[21] + mi := &file_sentinel_proto_msgTypes[22] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1366,7 +1413,7 @@ func (x *UserProductItem) ProtoReflect() protoreflect.Message { // Deprecated: Use UserProductItem.ProtoReflect.Descriptor instead. func (*UserProductItem) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{21} + return file_sentinel_proto_rawDescGZIP(), []int{22} } func (x *UserProductItem) GetId() int64 { @@ -1444,7 +1491,7 @@ type CreateUserProductRequest struct { func (x *CreateUserProductRequest) Reset() { *x = CreateUserProductRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[22] + mi := &file_sentinel_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1457,7 +1504,7 @@ func (x *CreateUserProductRequest) String() string { func (*CreateUserProductRequest) ProtoMessage() {} func (x *CreateUserProductRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[22] + mi := &file_sentinel_proto_msgTypes[23] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1470,7 +1517,7 @@ func (x *CreateUserProductRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateUserProductRequest.ProtoReflect.Descriptor instead. func (*CreateUserProductRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{22} + return file_sentinel_proto_rawDescGZIP(), []int{23} } func (x *CreateUserProductRequest) GetUserId() int64 { @@ -1498,7 +1545,7 @@ type UpdateUserProductRequest struct { func (x *UpdateUserProductRequest) Reset() { *x = UpdateUserProductRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[23] + mi := &file_sentinel_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1511,7 +1558,7 @@ func (x *UpdateUserProductRequest) String() string { func (*UpdateUserProductRequest) ProtoMessage() {} func (x *UpdateUserProductRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[23] + mi := &file_sentinel_proto_msgTypes[24] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1524,7 +1571,7 @@ func (x *UpdateUserProductRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateUserProductRequest.ProtoReflect.Descriptor instead. func (*UpdateUserProductRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{23} + return file_sentinel_proto_rawDescGZIP(), []int{24} } func (x *UpdateUserProductRequest) GetId() int64 { @@ -1545,7 +1592,7 @@ type DeleteUserProductRequest struct { func (x *DeleteUserProductRequest) Reset() { *x = DeleteUserProductRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[24] + mi := &file_sentinel_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1558,7 +1605,7 @@ func (x *DeleteUserProductRequest) String() string { func (*DeleteUserProductRequest) ProtoMessage() {} func (x *DeleteUserProductRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[24] + mi := &file_sentinel_proto_msgTypes[25] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1571,7 +1618,7 @@ func (x *DeleteUserProductRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteUserProductRequest.ProtoReflect.Descriptor instead. func (*DeleteUserProductRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{24} + return file_sentinel_proto_rawDescGZIP(), []int{25} } func (x *DeleteUserProductRequest) GetId() int64 { @@ -1593,7 +1640,7 @@ type UserProductResponse struct { func (x *UserProductResponse) Reset() { *x = UserProductResponse{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[25] + mi := &file_sentinel_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1606,7 +1653,7 @@ func (x *UserProductResponse) String() string { func (*UserProductResponse) ProtoMessage() {} func (x *UserProductResponse) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[25] + mi := &file_sentinel_proto_msgTypes[26] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1619,7 +1666,7 @@ func (x *UserProductResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UserProductResponse.ProtoReflect.Descriptor instead. func (*UserProductResponse) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{25} + return file_sentinel_proto_rawDescGZIP(), []int{26} } func (x *UserProductResponse) GetTotal() int64 { @@ -1648,7 +1695,7 @@ type MatchingUserIdProductCodeRequest struct { func (x *MatchingUserIdProductCodeRequest) Reset() { *x = MatchingUserIdProductCodeRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[26] + mi := &file_sentinel_proto_msgTypes[27] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1661,7 +1708,7 @@ func (x *MatchingUserIdProductCodeRequest) String() string { func (*MatchingUserIdProductCodeRequest) ProtoMessage() {} func (x *MatchingUserIdProductCodeRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[26] + mi := &file_sentinel_proto_msgTypes[27] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1674,7 +1721,7 @@ func (x *MatchingUserIdProductCodeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchingUserIdProductCodeRequest.ProtoReflect.Descriptor instead. func (*MatchingUserIdProductCodeRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{26} + return file_sentinel_proto_rawDescGZIP(), []int{27} } func (x *MatchingUserIdProductCodeRequest) GetId() int64 { @@ -1702,7 +1749,7 @@ type MatchResponse struct { func (x *MatchResponse) Reset() { *x = MatchResponse{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[27] + mi := &file_sentinel_proto_msgTypes[28] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1715,7 +1762,7 @@ func (x *MatchResponse) String() string { func (*MatchResponse) ProtoMessage() {} func (x *MatchResponse) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[27] + mi := &file_sentinel_proto_msgTypes[28] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1728,7 +1775,7 @@ func (x *MatchResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchResponse.ProtoReflect.Descriptor instead. func (*MatchResponse) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{27} + return file_sentinel_proto_rawDescGZIP(), []int{28} } func (x *MatchResponse) GetMatch() bool { @@ -1749,7 +1796,7 @@ type MatchWhitelistByIpRequest struct { func (x *MatchWhitelistByIpRequest) Reset() { *x = MatchWhitelistByIpRequest{} if protoimpl.UnsafeEnabled { - mi := &file_sentinel_proto_msgTypes[28] + mi := &file_sentinel_proto_msgTypes[29] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1762,7 +1809,7 @@ func (x *MatchWhitelistByIpRequest) String() string { func (*MatchWhitelistByIpRequest) ProtoMessage() {} func (x *MatchWhitelistByIpRequest) ProtoReflect() protoreflect.Message { - mi := &file_sentinel_proto_msgTypes[28] + mi := &file_sentinel_proto_msgTypes[29] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1775,7 +1822,7 @@ func (x *MatchWhitelistByIpRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use MatchWhitelistByIpRequest.ProtoReflect.Descriptor instead. func (*MatchWhitelistByIpRequest) Descriptor() ([]byte, []int) { - return file_sentinel_proto_rawDescGZIP(), []int{28} + return file_sentinel_proto_rawDescGZIP(), []int{29} } func (x *MatchWhitelistByIpRequest) GetIp() string { @@ -1808,239 +1855,245 @@ var file_sentinel_proto_rawDesc = []byte{ 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, + 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2c, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x6f, + 0x72, 0x64, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, + 0x6f, 0x64, 0x65, 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, 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, + 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, 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, + 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, 0x67, + 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, 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, + 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, 0xc3, 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, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x15, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 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, 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, + 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, 0x12, 0x35, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 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 ( @@ -2055,77 +2108,80 @@ func file_sentinel_proto_rawDescGZIP() []byte { return file_sentinel_proto_rawDescData } -var file_sentinel_proto_msgTypes = make([]protoimpl.MessageInfo, 29) +var file_sentinel_proto_msgTypes = make([]protoimpl.MessageInfo, 30) 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 + (*GetRecordByCodeRequest)(nil), // 4: GetRecordByCodeRequest + (*Whitelist)(nil), // 5: Whitelist + (*CreateWhitelistRequest)(nil), // 6: CreateWhitelistRequest + (*UpdateWhitelistRequest)(nil), // 7: UpdateWhitelistRequest + (*DeleteWhitelistRequest)(nil), // 8: DeleteWhitelistRequest + (*WhitelistResponse)(nil), // 9: WhitelistResponse + (*Secret)(nil), // 10: Secret + (*GetSecretBySecretIdRequest)(nil), // 11: GetSecretBySecretIdRequest + (*CreateSecretRequest)(nil), // 12: CreateSecretRequest + (*UpdateSecretRequest)(nil), // 13: UpdateSecretRequest + (*DeleteSecretRequest)(nil), // 14: DeleteSecretRequest + (*SecretResponse)(nil), // 15: SecretResponse + (*Product)(nil), // 16: Product + (*CreateProductRequest)(nil), // 17: CreateProductRequest + (*UpdateProductRequest)(nil), // 18: UpdateProductRequest + (*DeleteProductRequest)(nil), // 19: DeleteProductRequest + (*ProductResponse)(nil), // 20: ProductResponse + (*UserProductEmptyResponse)(nil), // 21: UserProductEmptyResponse + (*UserProductItem)(nil), // 22: UserProductItem + (*CreateUserProductRequest)(nil), // 23: CreateUserProductRequest + (*UpdateUserProductRequest)(nil), // 24: UpdateUserProductRequest + (*DeleteUserProductRequest)(nil), // 25: DeleteUserProductRequest + (*UserProductResponse)(nil), // 26: UserProductResponse + (*MatchingUserIdProductCodeRequest)(nil), // 27: matchingUserIdProductCodeRequest + (*MatchResponse)(nil), // 28: matchResponse + (*MatchWhitelistByIpRequest)(nil), // 29: 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 + 5, // 0: WhitelistResponse.whitelists:type_name -> Whitelist + 10, // 1: SecretResponse.secrets:type_name -> Secret + 16, // 2: ProductResponse.products:type_name -> Product + 22, // 3: UserProductResponse.user_products:type_name -> UserProductItem + 6, // 4: whitelist.CreateWhitelist:input_type -> CreateWhitelistRequest + 7, // 5: whitelist.UpdateWhitelist:input_type -> UpdateWhitelistRequest + 8, // 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 + 29, // 8: whitelist.MatchWhitelistByIp:input_type -> MatchWhitelistByIpRequest + 12, // 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 + 11, // 11: secret.GetSecretBySecretId:input_type -> GetSecretBySecretIdRequest + 17, // 12: product.CreateProduct:input_type -> CreateProductRequest + 18, // 13: product.UpdateProduct:input_type -> UpdateProductRequest + 19, // 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, // 17: product.GetProductByCode:input_type -> GetRecordByCodeRequest + 23, // 18: userProduct.CreateUserProduct:input_type -> CreateUserProductRequest + 1, // 19: userProduct.GetUserProductPageList:input_type -> UserProuctPageListRequest + 27, // 20: userProduct.MatchingUserIdProductCode:input_type -> matchingUserIdProductCodeRequest + 5, // 21: whitelist.CreateWhitelist:output_type -> Whitelist + 5, // 22: whitelist.UpdateWhitelist:output_type -> Whitelist + 5, // 23: whitelist.DeleteWhitelist:output_type -> Whitelist + 9, // 24: whitelist.GetWhitePageList:output_type -> WhitelistResponse + 28, // 25: whitelist.MatchWhitelistByIp:output_type -> matchResponse + 10, // 26: secret.CreateSecret:output_type -> Secret + 10, // 27: secret.GetSecretByUserId:output_type -> Secret + 10, // 28: secret.GetSecretBySecretId:output_type -> Secret + 16, // 29: product.CreateProduct:output_type -> Product + 16, // 30: product.UpdateProduct:output_type -> Product + 16, // 31: product.DeleteProduct:output_type -> Product + 20, // 32: product.GetProductPageList:output_type -> ProductResponse + 16, // 33: product.GetProductById:output_type -> Product + 16, // 34: product.GetProductByCode:output_type -> Product + 21, // 35: userProduct.CreateUserProduct:output_type -> UserProductEmptyResponse + 26, // 36: userProduct.GetUserProductPageList:output_type -> UserProductResponse + 28, // 37: userProduct.MatchingUserIdProductCode:output_type -> matchResponse + 21, // [21:38] is the sub-list for method output_type + 4, // [4:21] 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 @@ -2186,7 +2242,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*Whitelist); i { + switch v := v.(*GetRecordByCodeRequest); i { case 0: return &v.state case 1: @@ -2198,7 +2254,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*CreateWhitelistRequest); i { + switch v := v.(*Whitelist); i { case 0: return &v.state case 1: @@ -2210,7 +2266,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*UpdateWhitelistRequest); i { + switch v := v.(*CreateWhitelistRequest); i { case 0: return &v.state case 1: @@ -2222,7 +2278,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*DeleteWhitelistRequest); i { + switch v := v.(*UpdateWhitelistRequest); i { case 0: return &v.state case 1: @@ -2234,7 +2290,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*WhitelistResponse); i { + switch v := v.(*DeleteWhitelistRequest); i { case 0: return &v.state case 1: @@ -2246,7 +2302,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*Secret); i { + switch v := v.(*WhitelistResponse); i { case 0: return &v.state case 1: @@ -2258,7 +2314,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*GetSecretBySecretIdRequest); i { + switch v := v.(*Secret); i { case 0: return &v.state case 1: @@ -2270,7 +2326,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*CreateSecretRequest); i { + switch v := v.(*GetSecretBySecretIdRequest); i { case 0: return &v.state case 1: @@ -2282,7 +2338,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*UpdateSecretRequest); i { + switch v := v.(*CreateSecretRequest); i { case 0: return &v.state case 1: @@ -2294,7 +2350,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*DeleteSecretRequest); i { + switch v := v.(*UpdateSecretRequest); i { case 0: return &v.state case 1: @@ -2306,7 +2362,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*SecretResponse); i { + switch v := v.(*DeleteSecretRequest); i { case 0: return &v.state case 1: @@ -2318,7 +2374,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*Product); i { + switch v := v.(*SecretResponse); i { case 0: return &v.state case 1: @@ -2330,7 +2386,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[16].Exporter = func(v any, i int) any { - switch v := v.(*CreateProductRequest); i { + switch v := v.(*Product); i { case 0: return &v.state case 1: @@ -2342,7 +2398,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*UpdateProductRequest); i { + switch v := v.(*CreateProductRequest); i { case 0: return &v.state case 1: @@ -2354,7 +2410,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[18].Exporter = func(v any, i int) any { - switch v := v.(*DeleteProductRequest); i { + switch v := v.(*UpdateProductRequest); i { case 0: return &v.state case 1: @@ -2366,7 +2422,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[19].Exporter = func(v any, i int) any { - switch v := v.(*ProductResponse); i { + switch v := v.(*DeleteProductRequest); i { case 0: return &v.state case 1: @@ -2378,7 +2434,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[20].Exporter = func(v any, i int) any { - switch v := v.(*UserProductEmptyResponse); i { + switch v := v.(*ProductResponse); i { case 0: return &v.state case 1: @@ -2390,7 +2446,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[21].Exporter = func(v any, i int) any { - switch v := v.(*UserProductItem); i { + switch v := v.(*UserProductEmptyResponse); i { case 0: return &v.state case 1: @@ -2402,7 +2458,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[22].Exporter = func(v any, i int) any { - switch v := v.(*CreateUserProductRequest); i { + switch v := v.(*UserProductItem); i { case 0: return &v.state case 1: @@ -2414,7 +2470,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[23].Exporter = func(v any, i int) any { - switch v := v.(*UpdateUserProductRequest); i { + switch v := v.(*CreateUserProductRequest); i { case 0: return &v.state case 1: @@ -2426,7 +2482,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[24].Exporter = func(v any, i int) any { - switch v := v.(*DeleteUserProductRequest); i { + switch v := v.(*UpdateUserProductRequest); i { case 0: return &v.state case 1: @@ -2438,7 +2494,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[25].Exporter = func(v any, i int) any { - switch v := v.(*UserProductResponse); i { + switch v := v.(*DeleteUserProductRequest); i { case 0: return &v.state case 1: @@ -2450,7 +2506,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[26].Exporter = func(v any, i int) any { - switch v := v.(*MatchingUserIdProductCodeRequest); i { + switch v := v.(*UserProductResponse); i { case 0: return &v.state case 1: @@ -2462,7 +2518,7 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[27].Exporter = func(v any, i int) any { - switch v := v.(*MatchResponse); i { + switch v := v.(*MatchingUserIdProductCodeRequest); i { case 0: return &v.state case 1: @@ -2474,6 +2530,18 @@ func file_sentinel_proto_init() { } } file_sentinel_proto_msgTypes[28].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[29].Exporter = func(v any, i int) any { switch v := v.(*MatchWhitelistByIpRequest); i { case 0: return &v.state @@ -2492,7 +2560,7 @@ func file_sentinel_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_sentinel_proto_rawDesc, NumEnums: 0, - NumMessages: 29, + NumMessages: 30, NumExtensions: 0, NumServices: 4, }, diff --git a/apps/sentinel/sentinel/sentinel_grpc.pb.go b/apps/sentinel/sentinel/sentinel_grpc.pb.go index 7941857..a1dbd99 100644 --- a/apps/sentinel/sentinel/sentinel_grpc.pb.go +++ b/apps/sentinel/sentinel/sentinel_grpc.pb.go @@ -442,6 +442,7 @@ const ( Product_DeleteProduct_FullMethodName = "/product/DeleteProduct" Product_GetProductPageList_FullMethodName = "/product/GetProductPageList" Product_GetProductById_FullMethodName = "/product/GetProductById" + Product_GetProductByCode_FullMethodName = "/product/GetProductByCode" ) // ProductClient is the client API for Product service. @@ -454,6 +455,7 @@ type ProductClient interface { 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) + GetProductByCode(ctx context.Context, in *GetRecordByCodeRequest, opts ...grpc.CallOption) (*Product, error) } type productClient struct { @@ -514,6 +516,16 @@ func (c *productClient) GetProductById(ctx context.Context, in *GetRecordByIdReq return out, nil } +func (c *productClient) GetProductByCode(ctx context.Context, in *GetRecordByCodeRequest, opts ...grpc.CallOption) (*Product, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Product) + err := c.cc.Invoke(ctx, Product_GetProductByCode_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 @@ -524,6 +536,7 @@ type ProductServer interface { DeleteProduct(context.Context, *DeleteProductRequest) (*Product, error) GetProductPageList(context.Context, *PageListRequest) (*ProductResponse, error) GetProductById(context.Context, *GetRecordByIdRequest) (*Product, error) + GetProductByCode(context.Context, *GetRecordByCodeRequest) (*Product, error) mustEmbedUnimplementedProductServer() } @@ -546,6 +559,9 @@ func (UnimplementedProductServer) GetProductPageList(context.Context, *PageListR func (UnimplementedProductServer) GetProductById(context.Context, *GetRecordByIdRequest) (*Product, error) { return nil, status.Errorf(codes.Unimplemented, "method GetProductById not implemented") } +func (UnimplementedProductServer) GetProductByCode(context.Context, *GetRecordByCodeRequest) (*Product, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProductByCode not implemented") +} func (UnimplementedProductServer) mustEmbedUnimplementedProductServer() {} // UnsafeProductServer may be embedded to opt out of forward compatibility for this service. @@ -649,6 +665,24 @@ func _Product_GetProductById_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } +func _Product_GetProductByCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetRecordByCodeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProductServer).GetProductByCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Product_GetProductByCode_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProductServer).GetProductByCode(ctx, req.(*GetRecordByCodeRequest)) + } + 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) @@ -676,6 +710,10 @@ var Product_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetProductById", Handler: _Product_GetProductById_Handler, }, + { + MethodName: "GetProductByCode", + Handler: _Product_GetProductByCode_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "sentinel.proto", diff --git a/apps/user/client/apirequestservice/apirequestservice.go b/apps/user/client/apirequestservice/apirequestservice.go new file mode 100644 index 0000000..c129921 --- /dev/null +++ b/apps/user/client/apirequestservice/apirequestservice.go @@ -0,0 +1,85 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.2 +// Source: user.proto + +package apirequestservice + +import ( + "context" + + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + AddApiRequestRequest = user.AddApiRequestRequest + AddApiRequestResponse = user.AddApiRequestResponse + ApiRequest = user.ApiRequest + Deduction = user.Deduction + EmptyResponse = user.EmptyResponse + EnterpriseAuthReq = user.EnterpriseAuthReq + EnterpriseItem = user.EnterpriseItem + GetApiRequestByTransactionIdRequest = user.GetApiRequestByTransactionIdRequest + GetApiRequestByTransactionIdResponse = user.GetApiRequestByTransactionIdResponse + GetApiRequestsRequest = user.GetApiRequestsRequest + GetApiRequestsResponse = user.GetApiRequestsResponse + GetDeductionByTransactionIdRequest = user.GetDeductionByTransactionIdRequest + GetDeductionByTransactionIdResponse = user.GetDeductionByTransactionIdResponse + GetDeductionsRequest = user.GetDeductionsRequest + GetDeductionsResponse = user.GetDeductionsResponse + GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq + GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp + GetPendingEnterpriseReq = user.GetPendingEnterpriseReq + GetPendingEnterpriseResp = user.GetPendingEnterpriseResp + GetUserInfoResp = user.GetUserInfoResp + GetWalletRequest = user.GetWalletRequest + GetWalletResponse = user.GetWalletResponse + LoginReq = user.LoginReq + LoginResp = user.LoginResp + PhoneLoginReq = user.PhoneLoginReq + RegisterReq = user.RegisterReq + ReviewEnterpriseReq = user.ReviewEnterpriseReq + UpdateWalletRequest = user.UpdateWalletRequest + UpdateWalletResponse = user.UpdateWalletResponse + UserInfoReq = user.UserInfoReq + UserInfoResp = user.UserInfoResp + + ApiRequestService interface { + // 添加API请求记录 + AddApiRequest(ctx context.Context, in *AddApiRequestRequest, opts ...grpc.CallOption) (*AddApiRequestResponse, error) + // 查询API请求记录 + GetApiRequests(ctx context.Context, in *GetApiRequestsRequest, opts ...grpc.CallOption) (*GetApiRequestsResponse, error) + // 查询API请求记录ByTransactionId + GetApiRequestByTransactionId(ctx context.Context, in *GetApiRequestByTransactionIdRequest, opts ...grpc.CallOption) (*GetApiRequestByTransactionIdResponse, error) + } + + defaultApiRequestService struct { + cli zrpc.Client + } +) + +func NewApiRequestService(cli zrpc.Client) ApiRequestService { + return &defaultApiRequestService{ + cli: cli, + } +} + +// 添加API请求记录 +func (m *defaultApiRequestService) AddApiRequest(ctx context.Context, in *AddApiRequestRequest, opts ...grpc.CallOption) (*AddApiRequestResponse, error) { + client := user.NewApiRequestServiceClient(m.cli.Conn()) + return client.AddApiRequest(ctx, in, opts...) +} + +// 查询API请求记录 +func (m *defaultApiRequestService) GetApiRequests(ctx context.Context, in *GetApiRequestsRequest, opts ...grpc.CallOption) (*GetApiRequestsResponse, error) { + client := user.NewApiRequestServiceClient(m.cli.Conn()) + return client.GetApiRequests(ctx, in, opts...) +} + +// 查询API请求记录ByTransactionId +func (m *defaultApiRequestService) GetApiRequestByTransactionId(ctx context.Context, in *GetApiRequestByTransactionIdRequest, opts ...grpc.CallOption) (*GetApiRequestByTransactionIdResponse, error) { + client := user.NewApiRequestServiceClient(m.cli.Conn()) + return client.GetApiRequestByTransactionId(ctx, in, opts...) +} diff --git a/apps/user/client/auth/auth.go b/apps/user/client/auth/auth.go index d859268..62e238c 100644 --- a/apps/user/client/auth/auth.go +++ b/apps/user/client/auth/auth.go @@ -14,20 +14,37 @@ import ( ) 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 + AddApiRequestRequest = user.AddApiRequestRequest + AddApiRequestResponse = user.AddApiRequestResponse + ApiRequest = user.ApiRequest + Deduction = user.Deduction + EmptyResponse = user.EmptyResponse + EnterpriseAuthReq = user.EnterpriseAuthReq + EnterpriseItem = user.EnterpriseItem + GetApiRequestByTransactionIdRequest = user.GetApiRequestByTransactionIdRequest + GetApiRequestByTransactionIdResponse = user.GetApiRequestByTransactionIdResponse + GetApiRequestsRequest = user.GetApiRequestsRequest + GetApiRequestsResponse = user.GetApiRequestsResponse + GetDeductionByTransactionIdRequest = user.GetDeductionByTransactionIdRequest + GetDeductionByTransactionIdResponse = user.GetDeductionByTransactionIdResponse + GetDeductionsRequest = user.GetDeductionsRequest + GetDeductionsResponse = user.GetDeductionsResponse + GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq + GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp + GetPendingEnterpriseReq = user.GetPendingEnterpriseReq + GetPendingEnterpriseResp = user.GetPendingEnterpriseResp + GetUserInfoResp = user.GetUserInfoResp + GetWalletRequest = user.GetWalletRequest + GetWalletResponse = user.GetWalletResponse + LoginReq = user.LoginReq + LoginResp = user.LoginResp + PhoneLoginReq = user.PhoneLoginReq + RegisterReq = user.RegisterReq + ReviewEnterpriseReq = user.ReviewEnterpriseReq + UpdateWalletRequest = user.UpdateWalletRequest + UpdateWalletResponse = user.UpdateWalletResponse + UserInfoReq = user.UserInfoReq + UserInfoResp = user.UserInfoResp Auth interface { // 注册接口 diff --git a/apps/user/client/enterprise/enterprise.go b/apps/user/client/enterprise/enterprise.go index b38ac6f..1497e93 100644 --- a/apps/user/client/enterprise/enterprise.go +++ b/apps/user/client/enterprise/enterprise.go @@ -14,20 +14,37 @@ import ( ) 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 + AddApiRequestRequest = user.AddApiRequestRequest + AddApiRequestResponse = user.AddApiRequestResponse + ApiRequest = user.ApiRequest + Deduction = user.Deduction + EmptyResponse = user.EmptyResponse + EnterpriseAuthReq = user.EnterpriseAuthReq + EnterpriseItem = user.EnterpriseItem + GetApiRequestByTransactionIdRequest = user.GetApiRequestByTransactionIdRequest + GetApiRequestByTransactionIdResponse = user.GetApiRequestByTransactionIdResponse + GetApiRequestsRequest = user.GetApiRequestsRequest + GetApiRequestsResponse = user.GetApiRequestsResponse + GetDeductionByTransactionIdRequest = user.GetDeductionByTransactionIdRequest + GetDeductionByTransactionIdResponse = user.GetDeductionByTransactionIdResponse + GetDeductionsRequest = user.GetDeductionsRequest + GetDeductionsResponse = user.GetDeductionsResponse + GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq + GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp + GetPendingEnterpriseReq = user.GetPendingEnterpriseReq + GetPendingEnterpriseResp = user.GetPendingEnterpriseResp + GetUserInfoResp = user.GetUserInfoResp + GetWalletRequest = user.GetWalletRequest + GetWalletResponse = user.GetWalletResponse + LoginReq = user.LoginReq + LoginResp = user.LoginResp + PhoneLoginReq = user.PhoneLoginReq + RegisterReq = user.RegisterReq + ReviewEnterpriseReq = user.ReviewEnterpriseReq + UpdateWalletRequest = user.UpdateWalletRequest + UpdateWalletResponse = user.UpdateWalletResponse + UserInfoReq = user.UserInfoReq + UserInfoResp = user.UserInfoResp Enterprise interface { // 获取待审核企业列表 diff --git a/apps/user/client/user/user.go b/apps/user/client/user/user.go index d6449fb..04506d1 100644 --- a/apps/user/client/user/user.go +++ b/apps/user/client/user/user.go @@ -14,24 +14,42 @@ import ( ) 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 + AddApiRequestRequest = user.AddApiRequestRequest + AddApiRequestResponse = user.AddApiRequestResponse + ApiRequest = user.ApiRequest + Deduction = user.Deduction + EmptyResponse = user.EmptyResponse + EnterpriseAuthReq = user.EnterpriseAuthReq + EnterpriseItem = user.EnterpriseItem + GetApiRequestByTransactionIdRequest = user.GetApiRequestByTransactionIdRequest + GetApiRequestByTransactionIdResponse = user.GetApiRequestByTransactionIdResponse + GetApiRequestsRequest = user.GetApiRequestsRequest + GetApiRequestsResponse = user.GetApiRequestsResponse + GetDeductionByTransactionIdRequest = user.GetDeductionByTransactionIdRequest + GetDeductionByTransactionIdResponse = user.GetDeductionByTransactionIdResponse + GetDeductionsRequest = user.GetDeductionsRequest + GetDeductionsResponse = user.GetDeductionsResponse + GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq + GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp + GetPendingEnterpriseReq = user.GetPendingEnterpriseReq + GetPendingEnterpriseResp = user.GetPendingEnterpriseResp + GetUserInfoResp = user.GetUserInfoResp + GetWalletRequest = user.GetWalletRequest + GetWalletResponse = user.GetWalletResponse + LoginReq = user.LoginReq + LoginResp = user.LoginResp + PhoneLoginReq = user.PhoneLoginReq + RegisterReq = user.RegisterReq + ReviewEnterpriseReq = user.ReviewEnterpriseReq + UpdateWalletRequest = user.UpdateWalletRequest + UpdateWalletResponse = user.UpdateWalletResponse + UserInfoReq = user.UserInfoReq + UserInfoResp = user.UserInfoResp User interface { // 获取用户信息 UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*UserInfoResp, error) + GetUserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpriseAuthStatusReq, opts ...grpc.CallOption) (*GetEnterpriseAuthStatusResp, error) } @@ -52,6 +70,11 @@ func (m *defaultUser) UserInfo(ctx context.Context, in *UserInfoReq, opts ...grp return client.UserInfo(ctx, in, opts...) } +func (m *defaultUser) GetUserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) { + client := user.NewUserClient(m.cli.Conn()) + return client.GetUserInfo(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/client/walletservice/walletservice.go b/apps/user/client/walletservice/walletservice.go new file mode 100644 index 0000000..77b3e27 --- /dev/null +++ b/apps/user/client/walletservice/walletservice.go @@ -0,0 +1,91 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.2 +// Source: user.proto + +package walletservice + +import ( + "context" + + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/zrpc" + "google.golang.org/grpc" +) + +type ( + AddApiRequestRequest = user.AddApiRequestRequest + AddApiRequestResponse = user.AddApiRequestResponse + ApiRequest = user.ApiRequest + Deduction = user.Deduction + EmptyResponse = user.EmptyResponse + EnterpriseAuthReq = user.EnterpriseAuthReq + EnterpriseItem = user.EnterpriseItem + GetApiRequestByTransactionIdRequest = user.GetApiRequestByTransactionIdRequest + GetApiRequestByTransactionIdResponse = user.GetApiRequestByTransactionIdResponse + GetApiRequestsRequest = user.GetApiRequestsRequest + GetApiRequestsResponse = user.GetApiRequestsResponse + GetDeductionByTransactionIdRequest = user.GetDeductionByTransactionIdRequest + GetDeductionByTransactionIdResponse = user.GetDeductionByTransactionIdResponse + GetDeductionsRequest = user.GetDeductionsRequest + GetDeductionsResponse = user.GetDeductionsResponse + GetEnterpriseAuthStatusReq = user.GetEnterpriseAuthStatusReq + GetEnterpriseAuthStatusResp = user.GetEnterpriseAuthStatusResp + GetPendingEnterpriseReq = user.GetPendingEnterpriseReq + GetPendingEnterpriseResp = user.GetPendingEnterpriseResp + GetUserInfoResp = user.GetUserInfoResp + GetWalletRequest = user.GetWalletRequest + GetWalletResponse = user.GetWalletResponse + LoginReq = user.LoginReq + LoginResp = user.LoginResp + PhoneLoginReq = user.PhoneLoginReq + RegisterReq = user.RegisterReq + ReviewEnterpriseReq = user.ReviewEnterpriseReq + UpdateWalletRequest = user.UpdateWalletRequest + UpdateWalletResponse = user.UpdateWalletResponse + UserInfoReq = user.UserInfoReq + UserInfoResp = user.UserInfoResp + + WalletService interface { + // 修改钱包余额 + UpdateWallet(ctx context.Context, in *UpdateWalletRequest, opts ...grpc.CallOption) (*UpdateWalletResponse, error) + // 查询钱包信息 + GetWallet(ctx context.Context, in *GetWalletRequest, opts ...grpc.CallOption) (*GetWalletResponse, error) + // 查询扣款记录 + GetDeductions(ctx context.Context, in *GetDeductionsRequest, opts ...grpc.CallOption) (*GetDeductionsResponse, error) + GetDeductionByTransactionId(ctx context.Context, in *GetDeductionByTransactionIdRequest, opts ...grpc.CallOption) (*GetDeductionByTransactionIdResponse, error) + } + + defaultWalletService struct { + cli zrpc.Client + } +) + +func NewWalletService(cli zrpc.Client) WalletService { + return &defaultWalletService{ + cli: cli, + } +} + +// 修改钱包余额 +func (m *defaultWalletService) UpdateWallet(ctx context.Context, in *UpdateWalletRequest, opts ...grpc.CallOption) (*UpdateWalletResponse, error) { + client := user.NewWalletServiceClient(m.cli.Conn()) + return client.UpdateWallet(ctx, in, opts...) +} + +// 查询钱包信息 +func (m *defaultWalletService) GetWallet(ctx context.Context, in *GetWalletRequest, opts ...grpc.CallOption) (*GetWalletResponse, error) { + client := user.NewWalletServiceClient(m.cli.Conn()) + return client.GetWallet(ctx, in, opts...) +} + +// 查询扣款记录 +func (m *defaultWalletService) GetDeductions(ctx context.Context, in *GetDeductionsRequest, opts ...grpc.CallOption) (*GetDeductionsResponse, error) { + client := user.NewWalletServiceClient(m.cli.Conn()) + return client.GetDeductions(ctx, in, opts...) +} + +func (m *defaultWalletService) GetDeductionByTransactionId(ctx context.Context, in *GetDeductionByTransactionIdRequest, opts ...grpc.CallOption) (*GetDeductionByTransactionIdResponse, error) { + client := user.NewWalletServiceClient(m.cli.Conn()) + return client.GetDeductionByTransactionId(ctx, in, opts...) +} diff --git a/apps/user/internal/logic/apirequestservice/addapirequestlogic.go b/apps/user/internal/logic/apirequestservice/addapirequestlogic.go new file mode 100644 index 0000000..da445dc --- /dev/null +++ b/apps/user/internal/logic/apirequestservice/addapirequestlogic.go @@ -0,0 +1,52 @@ +package apirequestservicelogic + +import ( + "context" + "tianyuan-api/apps/user/internal/model" + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + "tianyuan-api/pkg/sqlutil" + "time" + + "github.com/zeromicro/go-zero/core/logx" +) + +type AddApiRequestLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewAddApiRequestLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddApiRequestLogic { + return &AddApiRequestLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 添加API请求记录 +func (l *AddApiRequestLogic) AddApiRequest(in *user.AddApiRequestRequest) (*user.AddApiRequestResponse, error) { + chargesValue := int64(0) + if in.Charges { + chargesValue = 1 + } + parsedTime, err := time.Parse(time.RFC3339Nano, in.Timestamp) + if err != nil { + // 错误处理,比如日志输出或返回错误 + parsedTime = time.Now() + } + _, err = l.svcCtx.ApiRequestsModel.Insert(l.ctx, &model.ApiRequests{ + TransactionId: in.TransactionId, + UserId: in.UserId, + ProductCode: in.ProductCode, + Status: in.Status, + Charges: chargesValue, + Remark: sqlutil.StringToNullString(in.Remark), + Timestamp: parsedTime, + }) + if err != nil { + return nil, err + } + return &user.AddApiRequestResponse{}, nil +} diff --git a/apps/user/internal/logic/apirequestservice/getapirequestbytransactionidlogic.go b/apps/user/internal/logic/apirequestservice/getapirequestbytransactionidlogic.go new file mode 100644 index 0000000..10eb195 --- /dev/null +++ b/apps/user/internal/logic/apirequestservice/getapirequestbytransactionidlogic.go @@ -0,0 +1,38 @@ +package apirequestservicelogic + +import ( + "context" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetApiRequestByTransactionIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetApiRequestByTransactionIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetApiRequestByTransactionIdLogic { + return &GetApiRequestByTransactionIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 查询API请求记录ByTransactionId +func (l *GetApiRequestByTransactionIdLogic) GetApiRequestByTransactionId(in *user.GetApiRequestByTransactionIdRequest) (*user.GetApiRequestByTransactionIdResponse, error) { + apiRequest, err := l.svcCtx.ApiRequestsModel.FindOneByTransactionId(l.ctx, in.TransactionId) + if err != nil { + return nil, err + } + + return &user.GetApiRequestByTransactionIdResponse{ + Id: apiRequest.Id, + TransactionId: apiRequest.TransactionId, + UserId: apiRequest.UserId, + }, nil +} diff --git a/apps/user/internal/logic/apirequestservice/getapirequestslogic.go b/apps/user/internal/logic/apirequestservice/getapirequestslogic.go new file mode 100644 index 0000000..3911001 --- /dev/null +++ b/apps/user/internal/logic/apirequestservice/getapirequestslogic.go @@ -0,0 +1,31 @@ +package apirequestservicelogic + +import ( + "context" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetApiRequestsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetApiRequestsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetApiRequestsLogic { + return &GetApiRequestsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 查询API请求记录 +func (l *GetApiRequestsLogic) GetApiRequests(in *user.GetApiRequestsRequest) (*user.GetApiRequestsResponse, error) { + // todo: add your logic here and delete this line + + return &user.GetApiRequestsResponse{}, nil +} diff --git a/apps/user/internal/logic/enterprise/reviewenterpriselogic.go b/apps/user/internal/logic/enterprise/reviewenterpriselogic.go index e120386..816f06d 100644 --- a/apps/user/internal/logic/enterprise/reviewenterpriselogic.go +++ b/apps/user/internal/logic/enterprise/reviewenterpriselogic.go @@ -72,7 +72,10 @@ func (l *ReviewEnterpriseLogic) ReviewEnterprise(in *user.ReviewEnterpriseReq) ( if insertEnterpriseErr != nil { return insertEnterpriseErr } - + _, InsertWalletsTransErr := l.svcCtx.WalletsModel.InsertWalletsTrans(l.ctx, &model.Wallets{UserId: enterpriseAuth.UserId}, session) + if InsertWalletsTransErr != nil { + return InsertWalletsTransErr + } _, createSecretErr := l.svcCtx.SecretRpc.CreateSecret(l.ctx, &secret.CreateSecretRequest{ UserId: enterpriseAuth.UserId, }) diff --git a/apps/user/internal/logic/user/getuserinfologic.go b/apps/user/internal/logic/user/getuserinfologic.go new file mode 100644 index 0000000..a252532 --- /dev/null +++ b/apps/user/internal/logic/user/getuserinfologic.go @@ -0,0 +1,41 @@ +package userlogic + +import ( + "context" + "errors" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetUserInfoLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic { + return &GetUserInfoLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetUserInfoLogic) GetUserInfo(in *user.UserInfoReq) (*user.GetUserInfoResp, error) { + // 查询用户信息 + users, err := l.svcCtx.UserModel.FindOne(l.ctx, in.UserId) + if err != nil { + return nil, errors.New("用户不存在") + } + + // 正常返回用户和企业信息 + return &user.GetUserInfoResp{ + Username: users.Username, + Phone: users.Phone, + Disable: users.Disable, + QuotaExceeded: users.QuotaExceeded, + }, nil +} diff --git a/apps/user/internal/logic/walletservice/getdeductionbytransactionidlogic.go b/apps/user/internal/logic/walletservice/getdeductionbytransactionidlogic.go new file mode 100644 index 0000000..f3ee0e8 --- /dev/null +++ b/apps/user/internal/logic/walletservice/getdeductionbytransactionidlogic.go @@ -0,0 +1,38 @@ +package walletservicelogic + +import ( + "context" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetDeductionByTransactionIdLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetDeductionByTransactionIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeductionByTransactionIdLogic { + return &GetDeductionByTransactionIdLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +func (l *GetDeductionByTransactionIdLogic) GetDeductionByTransactionId(in *user.GetDeductionByTransactionIdRequest) (*user.GetDeductionByTransactionIdResponse, error) { + deduction, err := l.svcCtx.DeductionsModel.FindOneByTransactionId(l.ctx, in.TransactionId) + if err != nil { + return nil, err + } + return &user.GetDeductionByTransactionIdResponse{ + Id: deduction.Id, + UserId: deduction.UserId, + Amount: deduction.Amount, + TransactionId: deduction.TransactionId, + CreatedAt: deduction.CreatedAt.Format("2006-01-02 15:04:05"), + }, nil +} diff --git a/apps/user/internal/logic/walletservice/getdeductionslogic.go b/apps/user/internal/logic/walletservice/getdeductionslogic.go new file mode 100644 index 0000000..4d204d0 --- /dev/null +++ b/apps/user/internal/logic/walletservice/getdeductionslogic.go @@ -0,0 +1,31 @@ +package walletservicelogic + +import ( + "context" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetDeductionsLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetDeductionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDeductionsLogic { + return &GetDeductionsLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 查询扣款记录 +func (l *GetDeductionsLogic) GetDeductions(in *user.GetDeductionsRequest) (*user.GetDeductionsResponse, error) { + // todo: add your logic here and delete this line + + return &user.GetDeductionsResponse{}, nil +} diff --git a/apps/user/internal/logic/walletservice/getwalletlogic.go b/apps/user/internal/logic/walletservice/getwalletlogic.go new file mode 100644 index 0000000..640531b --- /dev/null +++ b/apps/user/internal/logic/walletservice/getwalletlogic.go @@ -0,0 +1,31 @@ +package walletservicelogic + +import ( + "context" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type GetWalletLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewGetWalletLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetWalletLogic { + return &GetWalletLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +// 查询钱包信息 +func (l *GetWalletLogic) GetWallet(in *user.GetWalletRequest) (*user.GetWalletResponse, error) { + // todo: add your logic here and delete this line + + return &user.GetWalletResponse{}, nil +} diff --git a/apps/user/internal/logic/walletservice/updatewalletlogic.go b/apps/user/internal/logic/walletservice/updatewalletlogic.go new file mode 100644 index 0000000..1a6b3ea --- /dev/null +++ b/apps/user/internal/logic/walletservice/updatewalletlogic.go @@ -0,0 +1,114 @@ +package walletservicelogic + +import ( + "context" + "database/sql" + "errors" + "github.com/zeromicro/go-zero/core/stores/sqlx" + "tianyuan-api/apps/sentinel/client/product" + "tianyuan-api/apps/user/internal/model" + "time" + + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" + + "github.com/zeromicro/go-zero/core/logx" +) + +type UpdateWalletLogic struct { + ctx context.Context + svcCtx *svc.ServiceContext + logx.Logger +} + +func NewUpdateWalletLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateWalletLogic { + return &UpdateWalletLogic{ + ctx: ctx, + svcCtx: svcCtx, + Logger: logx.WithContext(ctx), + } +} + +const maxRetries = 5 // 最大重试次数 +// 修改钱包余额 +func (l *UpdateWalletLogic) UpdateWallet(in *user.UpdateWalletRequest) (*user.UpdateWalletResponse, error) { + if !in.Charge { + return nil, errors.New("不需要扣款") + } + // 获取产品信息 + consumeProduct, getProductByCodeErr := l.svcCtx.ProductRpc.GetProductByCode(l.ctx, &product.GetRecordByCodeRequest{Code: in.ProductCode}) + if getProductByCodeErr != nil { + return nil, getProductByCodeErr + } + + // 检查是否已经扣款 + deduction, FindOneByTransactionIdErr := l.svcCtx.DeductionsModel.FindOneByTransactionId(l.ctx, in.TransactionId) + if FindOneByTransactionIdErr != nil { + if FindOneByTransactionIdErr == sql.ErrNoRows { + } else { + // 其他错误,直接返回 + return nil, FindOneByTransactionIdErr + } + } else if deduction != nil { + // 找到扣款记录,不能重复扣款 + return nil, errors.New("该订单已扣款") + } + + // 启动事务 + err := l.svcCtx.WalletsModel.TransCtx(l.ctx, func(ctx context.Context, session sqlx.Session) error { + var err error + // 尝试多次更新余额(用于乐观锁) + for i := 0; i < maxRetries; i++ { + err = l.svcCtx.WalletsModel.UpdateBalance(session, l.ctx, in.UserId, -consumeProduct.ProductPrice) + if err == nil { + // 成功,退出循环 + break + } + if errors.Is(err, model.ErrVersionMismatch) { + // 版本号不匹配,重试 + time.Sleep(100 * time.Millisecond) // 重试前的延迟 + continue + } else { + // 其他错误,直接返回 + return err + } + } + + if err != nil { + return err + } + + // 更新余额成功后,插入扣款记录 + _, err = l.svcCtx.DeductionsModel.InsertDeductionsTrans(ctx, &model.Deductions{ + TransactionId: in.TransactionId, + UserId: in.UserId, + Amount: consumeProduct.ProductPrice, + }, session) + if err != nil { + return err + } + return nil + }) + if err != nil { + return nil, err + } + // 获取最新的用户余额 + wallet, err := l.svcCtx.WalletsModel.FindOneByUserId(l.ctx, in.UserId) + if err != nil { + return nil, err + } + + // 如果余额小于 0,更新 QuotaExceeded 字段为 1 + if wallet.Balance < 0 { + users, findOneErr := l.svcCtx.UserModel.FindOne(l.ctx, in.UserId) + if findOneErr != nil { + return nil, findOneErr + } + users.QuotaExceeded = 1 + updateErr := l.svcCtx.UserModel.Update(l.ctx, users) + if updateErr != nil { + return nil, updateErr + } + } + return &user.UpdateWalletResponse{}, nil +} diff --git a/apps/user/internal/model/apirequestsmodel.go b/apps/user/internal/model/apirequestsmodel.go new file mode 100644 index 0000000..ecbcb12 --- /dev/null +++ b/apps/user/internal/model/apirequestsmodel.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 _ ApiRequestsModel = (*customApiRequestsModel)(nil) + +type ( + // ApiRequestsModel is an interface to be customized, add more methods here, + // and implement the added methods in customApiRequestsModel. + ApiRequestsModel interface { + apiRequestsModel + } + + customApiRequestsModel struct { + *defaultApiRequestsModel + } +) + +// NewApiRequestsModel returns a model for the database table. +func NewApiRequestsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) ApiRequestsModel { + return &customApiRequestsModel{ + defaultApiRequestsModel: newApiRequestsModel(conn, c, opts...), + } +} diff --git a/apps/user/internal/model/apirequestsmodel_gen.go b/apps/user/internal/model/apirequestsmodel_gen.go new file mode 100644 index 0000000..5af2fb6 --- /dev/null +++ b/apps/user/internal/model/apirequestsmodel_gen.go @@ -0,0 +1,152 @@ +// 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 ( + apiRequestsFieldNames = builder.RawFieldNames(&ApiRequests{}) + apiRequestsRows = strings.Join(apiRequestsFieldNames, ",") + apiRequestsRowsExpectAutoSet = strings.Join(stringx.Remove(apiRequestsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + apiRequestsRowsWithPlaceHolder = strings.Join(stringx.Remove(apiRequestsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheApiRequestsIdPrefix = "cache:apiRequests:id:" + cacheApiRequestsTransactionIdPrefix = "cache:apiRequests:transactionId:" +) + +type ( + apiRequestsModel interface { + Insert(ctx context.Context, data *ApiRequests) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*ApiRequests, error) + FindOneByTransactionId(ctx context.Context, transactionId string) (*ApiRequests, error) + Update(ctx context.Context, data *ApiRequests) error + Delete(ctx context.Context, id int64) error + } + + defaultApiRequestsModel struct { + sqlc.CachedConn + table string + } + + ApiRequests struct { + Id int64 `db:"id"` // 请求记录ID + TransactionId string `db:"transaction_id"` // 交易ID + UserId int64 `db:"user_id"` // 用户ID + ProductCode string `db:"product_code"` // 产品编码 + Status string `db:"status"` // 请求状态:success=成功,failed=失败 + Charges int64 `db:"charges"` // 是否需要付费 + Remark sql.NullString `db:"remark"` // 备注 + Timestamp time.Time `db:"timestamp"` // 请求时间 + } +) + +func newApiRequestsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultApiRequestsModel { + return &defaultApiRequestsModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`api_requests`", + } +} + +func (m *defaultApiRequestsModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + apiRequestsIdKey := fmt.Sprintf("%s%v", cacheApiRequestsIdPrefix, id) + apiRequestsTransactionIdKey := fmt.Sprintf("%s%v", cacheApiRequestsTransactionIdPrefix, data.TransactionId) + _, 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) + }, apiRequestsIdKey, apiRequestsTransactionIdKey) + return err +} + +func (m *defaultApiRequestsModel) FindOne(ctx context.Context, id int64) (*ApiRequests, error) { + apiRequestsIdKey := fmt.Sprintf("%s%v", cacheApiRequestsIdPrefix, id) + var resp ApiRequests + err := m.QueryRowCtx(ctx, &resp, apiRequestsIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", apiRequestsRows, 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 *defaultApiRequestsModel) FindOneByTransactionId(ctx context.Context, transactionId string) (*ApiRequests, error) { + apiRequestsTransactionIdKey := fmt.Sprintf("%s%v", cacheApiRequestsTransactionIdPrefix, transactionId) + var resp ApiRequests + err := m.QueryRowIndexCtx(ctx, &resp, apiRequestsTransactionIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `transaction_id` = ? limit 1", apiRequestsRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, transactionId); 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 *defaultApiRequestsModel) Insert(ctx context.Context, data *ApiRequests) (sql.Result, error) { + apiRequestsIdKey := fmt.Sprintf("%s%v", cacheApiRequestsIdPrefix, data.Id) + apiRequestsTransactionIdKey := fmt.Sprintf("%s%v", cacheApiRequestsTransactionIdPrefix, data.TransactionId) + 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, apiRequestsRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.TransactionId, data.UserId, data.ProductCode, data.Status, data.Charges, data.Remark, data.Timestamp) + }, apiRequestsIdKey, apiRequestsTransactionIdKey) + return ret, err +} + +func (m *defaultApiRequestsModel) Update(ctx context.Context, newData *ApiRequests) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + apiRequestsIdKey := fmt.Sprintf("%s%v", cacheApiRequestsIdPrefix, data.Id) + apiRequestsTransactionIdKey := fmt.Sprintf("%s%v", cacheApiRequestsTransactionIdPrefix, data.TransactionId) + _, 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, apiRequestsRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.TransactionId, newData.UserId, newData.ProductCode, newData.Status, newData.Charges, newData.Remark, newData.Timestamp, newData.Id) + }, apiRequestsIdKey, apiRequestsTransactionIdKey) + return err +} + +func (m *defaultApiRequestsModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheApiRequestsIdPrefix, primary) +} + +func (m *defaultApiRequestsModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", apiRequestsRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultApiRequestsModel) tableName() string { + return m.table +} diff --git a/apps/user/internal/model/deductionsmodel.go b/apps/user/internal/model/deductionsmodel.go new file mode 100644 index 0000000..3848e16 --- /dev/null +++ b/apps/user/internal/model/deductionsmodel.go @@ -0,0 +1,52 @@ +package model + +import ( + "context" + "database/sql" + "fmt" + "github.com/zeromicro/go-zero/core/stores/cache" + "github.com/zeromicro/go-zero/core/stores/sqlx" +) + +var _ DeductionsModel = (*customDeductionsModel)(nil) + +type ( + // DeductionsModel is an interface to be customized, add more methods here, + // and implement the added methods in customDeductionsModel. + DeductionsModel interface { + deductionsModel + InsertDeductionsTrans(ctx context.Context, deductions *Deductions, session sqlx.Session) (sql.Result, error) + } + + customDeductionsModel struct { + *defaultDeductionsModel + } +) + +// NewDeductionsModel returns a model for the database table. +func NewDeductionsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) DeductionsModel { + return &customDeductionsModel{ + defaultDeductionsModel: newDeductionsModel(conn, c, opts...), + } +} +func (m *customDeductionsModel) InsertDeductionsTrans(ctx context.Context, deductions *Deductions, session sqlx.Session) (sql.Result, error) { + + query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (?, ?, ?)", m.table, deductionsRowsExpectAutoSet) + ret, err := session.ExecCtx(ctx, query, deductions.UserId, deductions.Amount, deductions.TransactionId) + if err != nil { + return nil, err + } + deductionsTransactionIdKey := fmt.Sprintf("%s%v", cacheDeductionsTransactionIdPrefix, deductions.TransactionId) + // 2. 更新缓存,保证所有缓存操作成功 + cacheKeys := []string{deductionsTransactionIdKey} + cacheErrors := make([]error, len(cacheKeys)) + + cacheErrors[0] = m.DelCacheCtx(ctx, deductionsTransactionIdKey) + // 3. 检查缓存操作是否全部成功 + for _, cacheErr := range cacheErrors { + if cacheErr != nil { + return nil, cacheErr // 返回第一个缓存更新失败的错误 + } + } + return ret, err +} diff --git a/apps/user/internal/model/deductionsmodel_gen.go b/apps/user/internal/model/deductionsmodel_gen.go new file mode 100644 index 0000000..e8754db --- /dev/null +++ b/apps/user/internal/model/deductionsmodel_gen.go @@ -0,0 +1,149 @@ +// 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 ( + deductionsFieldNames = builder.RawFieldNames(&Deductions{}) + deductionsRows = strings.Join(deductionsFieldNames, ",") + deductionsRowsExpectAutoSet = strings.Join(stringx.Remove(deductionsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + deductionsRowsWithPlaceHolder = strings.Join(stringx.Remove(deductionsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheDeductionsIdPrefix = "cache:deductions:id:" + cacheDeductionsTransactionIdPrefix = "cache:deductions:transactionId:" +) + +type ( + deductionsModel interface { + Insert(ctx context.Context, data *Deductions) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*Deductions, error) + FindOneByTransactionId(ctx context.Context, transactionId string) (*Deductions, error) + Update(ctx context.Context, data *Deductions) error + Delete(ctx context.Context, id int64) error + } + + defaultDeductionsModel struct { + sqlc.CachedConn + table string + } + + Deductions struct { + Id int64 `db:"id"` // 扣款记录ID + UserId int64 `db:"user_id"` // 用户ID + Amount float64 `db:"amount"` // 扣款金额 + TransactionId string `db:"transaction_id"` // 交易流水号 + CreatedAt time.Time `db:"created_at"` // 扣款时间 + } +) + +func newDeductionsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultDeductionsModel { + return &defaultDeductionsModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`deductions`", + } +} + +func (m *defaultDeductionsModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + deductionsIdKey := fmt.Sprintf("%s%v", cacheDeductionsIdPrefix, id) + deductionsTransactionIdKey := fmt.Sprintf("%s%v", cacheDeductionsTransactionIdPrefix, data.TransactionId) + _, 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) + }, deductionsIdKey, deductionsTransactionIdKey) + return err +} + +func (m *defaultDeductionsModel) FindOne(ctx context.Context, id int64) (*Deductions, error) { + deductionsIdKey := fmt.Sprintf("%s%v", cacheDeductionsIdPrefix, id) + var resp Deductions + err := m.QueryRowCtx(ctx, &resp, deductionsIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", deductionsRows, 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 *defaultDeductionsModel) FindOneByTransactionId(ctx context.Context, transactionId string) (*Deductions, error) { + deductionsTransactionIdKey := fmt.Sprintf("%s%v", cacheDeductionsTransactionIdPrefix, transactionId) + var resp Deductions + err := m.QueryRowIndexCtx(ctx, &resp, deductionsTransactionIdKey, m.formatPrimary, func(ctx context.Context, conn sqlx.SqlConn, v any) (i any, e error) { + query := fmt.Sprintf("select %s from %s where `transaction_id` = ? limit 1", deductionsRows, m.table) + if err := conn.QueryRowCtx(ctx, &resp, query, transactionId); 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 *defaultDeductionsModel) Insert(ctx context.Context, data *Deductions) (sql.Result, error) { + deductionsIdKey := fmt.Sprintf("%s%v", cacheDeductionsIdPrefix, data.Id) + deductionsTransactionIdKey := fmt.Sprintf("%s%v", cacheDeductionsTransactionIdPrefix, data.TransactionId) + 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, deductionsRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.UserId, data.Amount, data.TransactionId) + }, deductionsIdKey, deductionsTransactionIdKey) + return ret, err +} + +func (m *defaultDeductionsModel) Update(ctx context.Context, newData *Deductions) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + deductionsIdKey := fmt.Sprintf("%s%v", cacheDeductionsIdPrefix, data.Id) + deductionsTransactionIdKey := fmt.Sprintf("%s%v", cacheDeductionsTransactionIdPrefix, data.TransactionId) + _, 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, deductionsRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.UserId, newData.Amount, newData.TransactionId, newData.Id) + }, deductionsIdKey, deductionsTransactionIdKey) + return err +} + +func (m *defaultDeductionsModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheDeductionsIdPrefix, primary) +} + +func (m *defaultDeductionsModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", deductionsRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultDeductionsModel) tableName() string { + return m.table +} diff --git a/apps/user/internal/model/usersmodel_gen.go b/apps/user/internal/model/usersmodel_gen.go index c088fa7..0757093 100644 --- a/apps/user/internal/model/usersmodel_gen.go +++ b/apps/user/internal/model/usersmodel_gen.go @@ -45,13 +45,16 @@ type ( } 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"` // 用户更新时间 + 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=审核拒绝 + Disable int64 `db:"disable"` // 是否禁用,0=未禁用,1=禁用 + Internal int64 `db:"internal"` // 是否内部人员,0=否,1=是 + QuotaExceeded int64 `db:"quota_exceeded"` // 是否额度用完,0=否,1=是 + CreatedAt time.Time `db:"created_at"` // 用户创建时间 + UpdatedAt time.Time `db:"updated_at"` // 用户更新时间 } ) @@ -140,8 +143,8 @@ func (m *defaultUsersModel) Insert(ctx context.Context, data *Users) (sql.Result 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) + query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?)", m.table, usersRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.Username, data.Password, data.Phone, data.AuthStatus, data.Disable, data.Internal, data.QuotaExceeded) }, usersIdKey, usersPhoneKey, usersUsernameKey) return ret, err } @@ -157,7 +160,7 @@ func (m *defaultUsersModel) Update(ctx context.Context, newData *Users) error { 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) + return conn.ExecCtx(ctx, query, newData.Username, newData.Password, newData.Phone, newData.AuthStatus, newData.Disable, newData.Internal, newData.QuotaExceeded, newData.Id) }, usersIdKey, usersPhoneKey, usersUsernameKey) return err } diff --git a/apps/user/internal/model/walletsmodel.go b/apps/user/internal/model/walletsmodel.go new file mode 100644 index 0000000..5ee2fb6 --- /dev/null +++ b/apps/user/internal/model/walletsmodel.go @@ -0,0 +1,89 @@ +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 _ WalletsModel = (*customWalletsModel)(nil) + +type ( + // WalletsModel is an interface to be customized, add more methods here, + // and implement the added methods in customWalletsModel. + WalletsModel interface { + walletsModel + InsertWalletsTrans(ctx context.Context, wallets *Wallets, session sqlx.Session) (sql.Result, error) + UpdateBalance(session sqlx.Session, ctx context.Context, userId int64, amount float64) error + TransCtx(ctx context.Context, fn func(ctx context.Context, session sqlx.Session) error) error + } + + customWalletsModel struct { + *defaultWalletsModel + } +) + +var ErrBalanceNotEnough = errors.New("余额不足") +var ErrVersionMismatch = errors.New("版本号不匹配,请重试") + +// NewWalletsModel returns a model for the database table. +func NewWalletsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) WalletsModel { + return &customWalletsModel{ + defaultWalletsModel: newWalletsModel(conn, c, opts...), + } +} +func (m *customWalletsModel) 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 *customWalletsModel) UpdateBalance(session sqlx.Session, ctx context.Context, userId int64, amount float64) error { + + wallet, err := m.FindOneByUserId(ctx, userId) + if err != nil { + return err + } + + // 检查余额是否足够 + if wallet.Balance+amount < 0 { + return ErrBalanceNotEnough + } + + // 使用乐观锁更新余额 + result, err := session.Exec("UPDATE wallets SET balance = balance + ?, version = version + 1 WHERE user_id = ? AND version = ?", amount, userId, wallet.Version) + if err != nil { + return err + } + + // 检查影响的行数,确保更新成功 + rowsAffected, err := result.RowsAffected() + if err != nil { + return err + } + if rowsAffected == 0 { + return ErrVersionMismatch + } + + walletsUserIdKey := fmt.Sprintf("%s%v", cacheWalletsUserIdPrefix, userId) + cacheErrors := m.DelCacheCtx(ctx, walletsUserIdKey) + if cacheErrors != nil { + return cacheErrors + } + return nil +} +func (m *customWalletsModel) InsertWalletsTrans(ctx context.Context, wallets *Wallets, session sqlx.Session) (sql.Result, error) { + query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (?, ?, ?)", m.table, walletsRowsExpectAutoSet) + ret, err := session.ExecCtx(ctx, query, wallets.UserId, wallets.Balance, wallets.Version) + if err != nil { + return nil, err + } + + return ret, err +} diff --git a/apps/user/internal/model/walletsmodel_gen.go b/apps/user/internal/model/walletsmodel_gen.go new file mode 100644 index 0000000..f517121 --- /dev/null +++ b/apps/user/internal/model/walletsmodel_gen.go @@ -0,0 +1,150 @@ +// 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 ( + walletsFieldNames = builder.RawFieldNames(&Wallets{}) + walletsRows = strings.Join(walletsFieldNames, ",") + walletsRowsExpectAutoSet = strings.Join(stringx.Remove(walletsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), ",") + walletsRowsWithPlaceHolder = strings.Join(stringx.Remove(walletsFieldNames, "`id`", "`create_at`", "`create_time`", "`created_at`", "`update_at`", "`update_time`", "`updated_at`"), "=?,") + "=?" + + cacheWalletsIdPrefix = "cache:wallets:id:" + cacheWalletsUserIdPrefix = "cache:wallets:userId:" +) + +type ( + walletsModel interface { + Insert(ctx context.Context, data *Wallets) (sql.Result, error) + FindOne(ctx context.Context, id int64) (*Wallets, error) + FindOneByUserId(ctx context.Context, userId int64) (*Wallets, error) + Update(ctx context.Context, data *Wallets) error + Delete(ctx context.Context, id int64) error + } + + defaultWalletsModel struct { + sqlc.CachedConn + table string + } + + Wallets struct { + Id int64 `db:"id"` // 钱包ID + UserId int64 `db:"user_id"` // 用户ID + Balance float64 `db:"balance"` // 钱包余额 + Version int64 `db:"version"` // 乐观锁版本号 + CreatedAt time.Time `db:"created_at"` // 创建时间 + UpdatedAt time.Time `db:"updated_at"` // 更新时间 + } +) + +func newWalletsModel(conn sqlx.SqlConn, c cache.CacheConf, opts ...cache.Option) *defaultWalletsModel { + return &defaultWalletsModel{ + CachedConn: sqlc.NewConn(conn, c, opts...), + table: "`wallets`", + } +} + +func (m *defaultWalletsModel) Delete(ctx context.Context, id int64) error { + data, err := m.FindOne(ctx, id) + if err != nil { + return err + } + + walletsIdKey := fmt.Sprintf("%s%v", cacheWalletsIdPrefix, id) + walletsUserIdKey := fmt.Sprintf("%s%v", cacheWalletsUserIdPrefix, 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) + }, walletsIdKey, walletsUserIdKey) + return err +} + +func (m *defaultWalletsModel) FindOne(ctx context.Context, id int64) (*Wallets, error) { + walletsIdKey := fmt.Sprintf("%s%v", cacheWalletsIdPrefix, id) + var resp Wallets + err := m.QueryRowCtx(ctx, &resp, walletsIdKey, func(ctx context.Context, conn sqlx.SqlConn, v any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", walletsRows, 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 *defaultWalletsModel) FindOneByUserId(ctx context.Context, userId int64) (*Wallets, error) { + walletsUserIdKey := fmt.Sprintf("%s%v", cacheWalletsUserIdPrefix, userId) + var resp Wallets + err := m.QueryRowIndexCtx(ctx, &resp, walletsUserIdKey, 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", walletsRows, 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 *defaultWalletsModel) Insert(ctx context.Context, data *Wallets) (sql.Result, error) { + walletsIdKey := fmt.Sprintf("%s%v", cacheWalletsIdPrefix, data.Id) + walletsUserIdKey := fmt.Sprintf("%s%v", cacheWalletsUserIdPrefix, 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, walletsRowsExpectAutoSet) + return conn.ExecCtx(ctx, query, data.UserId, data.Balance, data.Version) + }, walletsIdKey, walletsUserIdKey) + return ret, err +} + +func (m *defaultWalletsModel) Update(ctx context.Context, newData *Wallets) error { + data, err := m.FindOne(ctx, newData.Id) + if err != nil { + return err + } + + walletsIdKey := fmt.Sprintf("%s%v", cacheWalletsIdPrefix, data.Id) + walletsUserIdKey := fmt.Sprintf("%s%v", cacheWalletsUserIdPrefix, 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, walletsRowsWithPlaceHolder) + return conn.ExecCtx(ctx, query, newData.UserId, newData.Balance, newData.Version, newData.Id) + }, walletsIdKey, walletsUserIdKey) + return err +} + +func (m *defaultWalletsModel) formatPrimary(primary any) string { + return fmt.Sprintf("%s%v", cacheWalletsIdPrefix, primary) +} + +func (m *defaultWalletsModel) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary any) error { + query := fmt.Sprintf("select %s from %s where `id` = ? limit 1", walletsRows, m.table) + return conn.QueryRowCtx(ctx, v, query, primary) +} + +func (m *defaultWalletsModel) tableName() string { + return m.table +} diff --git a/apps/user/internal/server/apirequestservice/apirequestserviceserver.go b/apps/user/internal/server/apirequestservice/apirequestserviceserver.go new file mode 100644 index 0000000..0cd21bc --- /dev/null +++ b/apps/user/internal/server/apirequestservice/apirequestserviceserver.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/apirequestservice" + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" +) + +type ApiRequestServiceServer struct { + svcCtx *svc.ServiceContext + user.UnimplementedApiRequestServiceServer +} + +func NewApiRequestServiceServer(svcCtx *svc.ServiceContext) *ApiRequestServiceServer { + return &ApiRequestServiceServer{ + svcCtx: svcCtx, + } +} + +// 添加API请求记录 +func (s *ApiRequestServiceServer) AddApiRequest(ctx context.Context, in *user.AddApiRequestRequest) (*user.AddApiRequestResponse, error) { + l := apirequestservicelogic.NewAddApiRequestLogic(ctx, s.svcCtx) + return l.AddApiRequest(in) +} + +// 查询API请求记录 +func (s *ApiRequestServiceServer) GetApiRequests(ctx context.Context, in *user.GetApiRequestsRequest) (*user.GetApiRequestsResponse, error) { + l := apirequestservicelogic.NewGetApiRequestsLogic(ctx, s.svcCtx) + return l.GetApiRequests(in) +} + +// 查询API请求记录ByTransactionId +func (s *ApiRequestServiceServer) GetApiRequestByTransactionId(ctx context.Context, in *user.GetApiRequestByTransactionIdRequest) (*user.GetApiRequestByTransactionIdResponse, error) { + l := apirequestservicelogic.NewGetApiRequestByTransactionIdLogic(ctx, s.svcCtx) + return l.GetApiRequestByTransactionId(in) +} diff --git a/apps/user/internal/server/user/userserver.go b/apps/user/internal/server/user/userserver.go index 902ae30..e6c7669 100644 --- a/apps/user/internal/server/user/userserver.go +++ b/apps/user/internal/server/user/userserver.go @@ -29,6 +29,11 @@ func (s *UserServer) UserInfo(ctx context.Context, in *user.UserInfoReq) (*user. return l.UserInfo(in) } +func (s *UserServer) GetUserInfo(ctx context.Context, in *user.UserInfoReq) (*user.GetUserInfoResp, error) { + l := userlogic.NewGetUserInfoLogic(ctx, s.svcCtx) + return l.GetUserInfo(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/server/walletservice/walletserviceserver.go b/apps/user/internal/server/walletservice/walletserviceserver.go new file mode 100644 index 0000000..a46ffdd --- /dev/null +++ b/apps/user/internal/server/walletservice/walletserviceserver.go @@ -0,0 +1,47 @@ +// Code generated by goctl. DO NOT EDIT. +// goctl 1.7.2 +// Source: user.proto + +package server + +import ( + "context" + + "tianyuan-api/apps/user/internal/logic/walletservice" + "tianyuan-api/apps/user/internal/svc" + "tianyuan-api/apps/user/user" +) + +type WalletServiceServer struct { + svcCtx *svc.ServiceContext + user.UnimplementedWalletServiceServer +} + +func NewWalletServiceServer(svcCtx *svc.ServiceContext) *WalletServiceServer { + return &WalletServiceServer{ + svcCtx: svcCtx, + } +} + +// 修改钱包余额 +func (s *WalletServiceServer) UpdateWallet(ctx context.Context, in *user.UpdateWalletRequest) (*user.UpdateWalletResponse, error) { + l := walletservicelogic.NewUpdateWalletLogic(ctx, s.svcCtx) + return l.UpdateWallet(in) +} + +// 查询钱包信息 +func (s *WalletServiceServer) GetWallet(ctx context.Context, in *user.GetWalletRequest) (*user.GetWalletResponse, error) { + l := walletservicelogic.NewGetWalletLogic(ctx, s.svcCtx) + return l.GetWallet(in) +} + +// 查询扣款记录 +func (s *WalletServiceServer) GetDeductions(ctx context.Context, in *user.GetDeductionsRequest) (*user.GetDeductionsResponse, error) { + l := walletservicelogic.NewGetDeductionsLogic(ctx, s.svcCtx) + return l.GetDeductions(in) +} + +func (s *WalletServiceServer) GetDeductionByTransactionId(ctx context.Context, in *user.GetDeductionByTransactionIdRequest) (*user.GetDeductionByTransactionIdResponse, error) { + l := walletservicelogic.NewGetDeductionByTransactionIdLogic(ctx, s.svcCtx) + return l.GetDeductionByTransactionId(in) +} diff --git a/apps/user/internal/svc/servicecontext.go b/apps/user/internal/svc/servicecontext.go index 49c246d..b1f55dc 100644 --- a/apps/user/internal/svc/servicecontext.go +++ b/apps/user/internal/svc/servicecontext.go @@ -15,7 +15,11 @@ type ServiceContext struct { UserModel model.UsersModel // 用户表的模型 EnterpriseModel model.EnterpriseInfoModel EnterpriseAuthModel model.EnterpriseAuthModel + WalletsModel model.WalletsModel + DeductionsModel model.DeductionsModel + ApiRequestsModel model.ApiRequestsModel SecretRpc sentinel.SecretClient + ProductRpc sentinel.ProductClient } func NewServiceContext(c config.Config) *ServiceContext { @@ -34,6 +38,10 @@ func NewServiceContext(c config.Config) *ServiceContext { UserModel: model.NewUsersModel(db, c.CacheRedis), // 注入UserModel EnterpriseModel: model.NewEnterpriseInfoModel(db, c.CacheRedis), EnterpriseAuthModel: model.NewEnterpriseAuthModel(db, c.CacheRedis), + WalletsModel: model.NewWalletsModel(db, c.CacheRedis), + DeductionsModel: model.NewDeductionsModel(db, c.CacheRedis), + ApiRequestsModel: model.NewApiRequestsModel(db, c.CacheRedis), SecretRpc: sentinel.NewSecretClient(zrpc.MustNewClient(c.SentinelRpc).Conn()), + ProductRpc: sentinel.NewProductClient(zrpc.MustNewClient(c.SentinelRpc).Conn()), } } diff --git a/apps/user/user.go b/apps/user/user.go index d749771..6eade6f 100644 --- a/apps/user/user.go +++ b/apps/user/user.go @@ -6,9 +6,11 @@ import ( "os" "tianyuan-api/apps/user/internal/config" + apirequestserviceServer "tianyuan-api/apps/user/internal/server/apirequestservice" authServer "tianyuan-api/apps/user/internal/server/auth" enterpriseServer "tianyuan-api/apps/user/internal/server/enterprise" userServer "tianyuan-api/apps/user/internal/server/user" + walletserviceServer "tianyuan-api/apps/user/internal/server/walletservice" "tianyuan-api/apps/user/internal/svc" "tianyuan-api/apps/user/user" @@ -46,6 +48,8 @@ func main() { user.RegisterEnterpriseServer(grpcServer, enterpriseServer.NewEnterpriseServer(ctx)) user.RegisterAuthServer(grpcServer, authServer.NewAuthServer(ctx)) user.RegisterUserServer(grpcServer, userServer.NewUserServer(ctx)) + user.RegisterWalletServiceServer(grpcServer, walletserviceServer.NewWalletServiceServer(ctx)) + user.RegisterApiRequestServiceServer(grpcServer, apirequestserviceServer.NewApiRequestServiceServer(ctx)) if c.Mode == service.DevMode || c.Mode == service.TestMode { reflection.Register(grpcServer) diff --git a/apps/user/user.proto b/apps/user/user.proto index b793c1e..41d21ec 100644 --- a/apps/user/user.proto +++ b/apps/user/user.proto @@ -107,10 +107,18 @@ message UserInfoReq { message UserInfoResp{ string username = 1; string phone = 2; - string enterpriseAuthStatus = 3; - string enterpriseName = 4; - string creditCode = 5; - string legalPerson = 6; + int64 disable = 3; + int64 quotaExceeded = 4; + string enterpriseAuthStatus = 5; + string enterpriseName = 6; + string creditCode = 7; + string legalPerson = 8; +} +message GetUserInfoResp{ + string username = 1; + string phone = 2; + int64 disable = 3; + int64 quotaExceeded = 4; } message GetEnterpriseAuthStatusReq { @@ -122,5 +130,142 @@ message GetEnterpriseAuthStatusResp { service User { // 获取用户信息 rpc UserInfo(UserInfoReq) returns (UserInfoResp); + + rpc GetUserInfo(UserInfoReq) returns (GetUserInfoResp); + rpc GetEnterpriseAuthStatus(GetEnterpriseAuthStatusReq) returns (GetEnterpriseAuthStatusResp); +} + + +// 定义钱包服务 +service WalletService { + + + // 修改钱包余额 + rpc UpdateWallet (UpdateWalletRequest) returns (UpdateWalletResponse); + + // 查询钱包信息 + rpc GetWallet (GetWalletRequest) returns (GetWalletResponse); + + // 查询扣款记录 + rpc GetDeductions (GetDeductionsRequest) returns (GetDeductionsResponse); + + rpc GetDeductionByTransactionId (GetDeductionByTransactionIdRequest) returns (GetDeductionByTransactionIdResponse); +} + +// 更新钱包余额 +message UpdateWalletRequest { + int64 user_id = 1; + string transaction_id = 2; + string product_code = 3; + string remark = 4; + bool charge = 5; +} + +message UpdateWalletResponse { + +} + +// 查询钱包信息 +message GetWalletRequest { + int64 id = 1; +} + +message GetWalletResponse { + int64 id = 1; + int64 user_id = 2; + double balance = 3; + int64 version = 4; +} + +// 查询扣款记录 +message GetDeductionsRequest { + int64 user_id = 1; + int64 page = 2; + int64 size = 3; +} + +message GetDeductionsResponse { + repeated Deduction deductions = 1; +} +message GetDeductionByTransactionIdRequest { + string transaction_id = 1; +} +message GetDeductionByTransactionIdResponse { + int64 id = 1; + int64 user_id = 2; + double amount = 3; + string transaction_id = 4; + string created_at = 5; +} +message Deduction { + int64 id = 1; + int64 user_id = 2; + double amount = 3; + string transaction_id = 4; + string created_at = 5; +} + + +service ApiRequestService { + // 添加API请求记录 + rpc AddApiRequest (AddApiRequestRequest) returns (AddApiRequestResponse); + + // 查询API请求记录 + rpc GetApiRequests (GetApiRequestsRequest) returns (GetApiRequestsResponse); + + // 查询API请求记录ByTransactionId + rpc GetApiRequestByTransactionId (GetApiRequestByTransactionIdRequest) returns (GetApiRequestByTransactionIdResponse); +} +// 添加API请求记录 +message AddApiRequestRequest { + string transaction_id = 1; + int64 user_id = 2; + string product_code = 3; + string status = 4; + bool charges = 5; + string remark = 6; + string timestamp = 7; +} + +message AddApiRequestResponse { + bool success = 1; +} + +// 查询API请求记录 +message GetApiRequestsRequest { + int64 user_id = 1; + int64 page = 2; + int64 size = 3; +} + +message GetApiRequestsResponse { + repeated ApiRequest api_requests = 1; +} + +message ApiRequest { + int64 id = 1; + string transaction_id = 2; + int64 user_id = 3; + string product_code = 4; + string status = 5; + double charges = 6; + string remark = 7; + string timestamp = 8; +} + +// 查询API请求记录 +message GetApiRequestByTransactionIdRequest { + string transaction_id = 1; +} + +message GetApiRequestByTransactionIdResponse { + int64 id = 1; + string transaction_id = 2; + int64 user_id = 3; + string product_code = 4; + string status = 5; + double charges = 6; + string remark = 7; + string timestamp = 8; } \ No newline at end of file diff --git a/apps/user/user.sql b/apps/user/user.sql index 7afa790..8860e52 100644 --- a/apps/user/user.sql +++ b/apps/user/user.sql @@ -4,6 +4,9 @@ CREATE TABLE users ( 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=审核拒绝', + disable TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否禁用,0=未禁用,1=禁用', + internal TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否内部人员,0=否,1=是', + quota_exceeded TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否额度用完,0=否,1=是', created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '用户创建时间', updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '用户更新时间', PRIMARY KEY (id) @@ -35,3 +38,35 @@ CREATE TABLE enterprise_auth ( updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '认证更新时间', PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企业认证表,存储企业认证的相关信息'; + + +CREATE TABLE wallets ( + id INT(11) NOT NULL AUTO_INCREMENT COMMENT '钱包ID', + user_id INT(11) NOT NULL UNIQUE COMMENT '用户ID', + balance DECIMAL(10, 2) DEFAULT 0.00 COMMENT '钱包余额', + version INT(11) DEFAULT 0 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 deductions ( + id INT(11) NOT NULL AUTO_INCREMENT COMMENT '扣款记录ID', + user_id INT(11) NOT NULL COMMENT '用户ID', + amount DECIMAL(10, 2) NOT NULL COMMENT '扣款金额', + transaction_id VARCHAR(50) NOT NULL UNIQUE COMMENT '交易流水号', + created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '扣款时间', + PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='扣款记录表,存储用户的扣款历史记录'; + +CREATE TABLE api_requests ( + id INT(11) NOT NULL AUTO_INCREMENT COMMENT '请求记录ID', + transaction_id VARCHAR(50) NOT NULL UNIQUE COMMENT '交易ID', + user_id INT(11) NOT NULL COMMENT '用户ID', + product_code VARCHAR(100) NOT NULL COMMENT '产品编码', + status ENUM('success', 'failed') DEFAULT 'success' COMMENT '请求状态:success=成功,failed=失败', + charges TINYINT(1) NOT NULL COMMENT '是否需要付费', + remark VARCHAR(255) COMMENT '备注', + timestamp DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '请求时间', + PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='API请求记录表,存储API请求的相关信息'; diff --git a/apps/user/user/user.pb.go b/apps/user/user/user.pb.go index 79b5820..d9b7d84 100644 --- a/apps/user/user/user.pb.go +++ b/apps/user/user/user.pb.go @@ -728,10 +728,12 @@ type UserInfoResp struct { 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"` + Disable int64 `protobuf:"varint,3,opt,name=disable,proto3" json:"disable,omitempty"` + QuotaExceeded int64 `protobuf:"varint,4,opt,name=quotaExceeded,proto3" json:"quotaExceeded,omitempty"` + EnterpriseAuthStatus string `protobuf:"bytes,5,opt,name=enterpriseAuthStatus,proto3" json:"enterpriseAuthStatus,omitempty"` + EnterpriseName string `protobuf:"bytes,6,opt,name=enterpriseName,proto3" json:"enterpriseName,omitempty"` + CreditCode string `protobuf:"bytes,7,opt,name=creditCode,proto3" json:"creditCode,omitempty"` + LegalPerson string `protobuf:"bytes,8,opt,name=legalPerson,proto3" json:"legalPerson,omitempty"` } func (x *UserInfoResp) Reset() { @@ -780,6 +782,20 @@ func (x *UserInfoResp) GetPhone() string { return "" } +func (x *UserInfoResp) GetDisable() int64 { + if x != nil { + return x.Disable + } + return 0 +} + +func (x *UserInfoResp) GetQuotaExceeded() int64 { + if x != nil { + return x.QuotaExceeded + } + return 0 +} + func (x *UserInfoResp) GetEnterpriseAuthStatus() string { if x != nil { return x.EnterpriseAuthStatus @@ -808,6 +824,77 @@ func (x *UserInfoResp) GetLegalPerson() string { return "" } +type GetUserInfoResp 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"` + Disable int64 `protobuf:"varint,3,opt,name=disable,proto3" json:"disable,omitempty"` + QuotaExceeded int64 `protobuf:"varint,4,opt,name=quotaExceeded,proto3" json:"quotaExceeded,omitempty"` +} + +func (x *GetUserInfoResp) Reset() { + *x = GetUserInfoResp{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetUserInfoResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserInfoResp) ProtoMessage() {} + +func (x *GetUserInfoResp) 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 GetUserInfoResp.ProtoReflect.Descriptor instead. +func (*GetUserInfoResp) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{12} +} + +func (x *GetUserInfoResp) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *GetUserInfoResp) GetPhone() string { + if x != nil { + return x.Phone + } + return "" +} + +func (x *GetUserInfoResp) GetDisable() int64 { + if x != nil { + return x.Disable + } + return 0 +} + +func (x *GetUserInfoResp) GetQuotaExceeded() int64 { + if x != nil { + return x.QuotaExceeded + } + return 0 +} + type GetEnterpriseAuthStatusReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -819,7 +906,7 @@ type GetEnterpriseAuthStatusReq struct { func (x *GetEnterpriseAuthStatusReq) Reset() { *x = GetEnterpriseAuthStatusReq{} if protoimpl.UnsafeEnabled { - mi := &file_user_proto_msgTypes[12] + mi := &file_user_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -832,7 +919,7 @@ func (x *GetEnterpriseAuthStatusReq) String() string { func (*GetEnterpriseAuthStatusReq) ProtoMessage() {} func (x *GetEnterpriseAuthStatusReq) ProtoReflect() protoreflect.Message { - mi := &file_user_proto_msgTypes[12] + mi := &file_user_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -845,7 +932,7 @@ func (x *GetEnterpriseAuthStatusReq) ProtoReflect() protoreflect.Message { // Deprecated: Use GetEnterpriseAuthStatusReq.ProtoReflect.Descriptor instead. func (*GetEnterpriseAuthStatusReq) Descriptor() ([]byte, []int) { - return file_user_proto_rawDescGZIP(), []int{12} + return file_user_proto_rawDescGZIP(), []int{13} } func (x *GetEnterpriseAuthStatusReq) GetUserId() int64 { @@ -866,7 +953,7 @@ type GetEnterpriseAuthStatusResp struct { func (x *GetEnterpriseAuthStatusResp) Reset() { *x = GetEnterpriseAuthStatusResp{} if protoimpl.UnsafeEnabled { - mi := &file_user_proto_msgTypes[13] + mi := &file_user_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -879,7 +966,7 @@ func (x *GetEnterpriseAuthStatusResp) String() string { func (*GetEnterpriseAuthStatusResp) ProtoMessage() {} func (x *GetEnterpriseAuthStatusResp) ProtoReflect() protoreflect.Message { - mi := &file_user_proto_msgTypes[13] + mi := &file_user_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -892,7 +979,7 @@ func (x *GetEnterpriseAuthStatusResp) ProtoReflect() protoreflect.Message { // Deprecated: Use GetEnterpriseAuthStatusResp.ProtoReflect.Descriptor instead. func (*GetEnterpriseAuthStatusResp) Descriptor() ([]byte, []int) { - return file_user_proto_rawDescGZIP(), []int{13} + return file_user_proto_rawDescGZIP(), []int{14} } func (x *GetEnterpriseAuthStatusResp) GetIsAuth() bool { @@ -902,6 +989,1067 @@ func (x *GetEnterpriseAuthStatusResp) GetIsAuth() bool { return false } +// 更新钱包余额 +type UpdateWalletRequest 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"` + TransactionId string `protobuf:"bytes,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + ProductCode string `protobuf:"bytes,3,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"` + Remark string `protobuf:"bytes,4,opt,name=remark,proto3" json:"remark,omitempty"` + Charge bool `protobuf:"varint,5,opt,name=charge,proto3" json:"charge,omitempty"` +} + +func (x *UpdateWalletRequest) Reset() { + *x = UpdateWalletRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateWalletRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateWalletRequest) ProtoMessage() {} + +func (x *UpdateWalletRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 UpdateWalletRequest.ProtoReflect.Descriptor instead. +func (*UpdateWalletRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{15} +} + +func (x *UpdateWalletRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *UpdateWalletRequest) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *UpdateWalletRequest) GetProductCode() string { + if x != nil { + return x.ProductCode + } + return "" +} + +func (x *UpdateWalletRequest) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *UpdateWalletRequest) GetCharge() bool { + if x != nil { + return x.Charge + } + return false +} + +type UpdateWalletResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateWalletResponse) Reset() { + *x = UpdateWalletResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateWalletResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateWalletResponse) ProtoMessage() {} + +func (x *UpdateWalletResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 UpdateWalletResponse.ProtoReflect.Descriptor instead. +func (*UpdateWalletResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{16} +} + +// 查询钱包信息 +type GetWalletRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetWalletRequest) Reset() { + *x = GetWalletRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetWalletRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWalletRequest) ProtoMessage() {} + +func (x *GetWalletRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetWalletRequest.ProtoReflect.Descriptor instead. +func (*GetWalletRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{17} +} + +func (x *GetWalletRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type GetWalletResponse 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"` + Balance float64 `protobuf:"fixed64,3,opt,name=balance,proto3" json:"balance,omitempty"` + Version int64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *GetWalletResponse) Reset() { + *x = GetWalletResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetWalletResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetWalletResponse) ProtoMessage() {} + +func (x *GetWalletResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetWalletResponse.ProtoReflect.Descriptor instead. +func (*GetWalletResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{18} +} + +func (x *GetWalletResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *GetWalletResponse) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetWalletResponse) GetBalance() float64 { + if x != nil { + return x.Balance + } + return 0 +} + +func (x *GetWalletResponse) GetVersion() int64 { + if x != nil { + return x.Version + } + return 0 +} + +// 查询扣款记录 +type GetDeductionsRequest 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"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *GetDeductionsRequest) Reset() { + *x = GetDeductionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeductionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeductionsRequest) ProtoMessage() {} + +func (x *GetDeductionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetDeductionsRequest.ProtoReflect.Descriptor instead. +func (*GetDeductionsRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{19} +} + +func (x *GetDeductionsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetDeductionsRequest) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetDeductionsRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type GetDeductionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Deductions []*Deduction `protobuf:"bytes,1,rep,name=deductions,proto3" json:"deductions,omitempty"` +} + +func (x *GetDeductionsResponse) Reset() { + *x = GetDeductionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeductionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeductionsResponse) ProtoMessage() {} + +func (x *GetDeductionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetDeductionsResponse.ProtoReflect.Descriptor instead. +func (*GetDeductionsResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{20} +} + +func (x *GetDeductionsResponse) GetDeductions() []*Deduction { + if x != nil { + return x.Deductions + } + return nil +} + +type GetDeductionByTransactionIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` +} + +func (x *GetDeductionByTransactionIdRequest) Reset() { + *x = GetDeductionByTransactionIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeductionByTransactionIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeductionByTransactionIdRequest) ProtoMessage() {} + +func (x *GetDeductionByTransactionIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetDeductionByTransactionIdRequest.ProtoReflect.Descriptor instead. +func (*GetDeductionByTransactionIdRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{21} +} + +func (x *GetDeductionByTransactionIdRequest) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +type GetDeductionByTransactionIdResponse 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"` + Amount float64 `protobuf:"fixed64,3,opt,name=amount,proto3" json:"amount,omitempty"` + TransactionId string `protobuf:"bytes,4,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *GetDeductionByTransactionIdResponse) Reset() { + *x = GetDeductionByTransactionIdResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetDeductionByTransactionIdResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDeductionByTransactionIdResponse) ProtoMessage() {} + +func (x *GetDeductionByTransactionIdResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetDeductionByTransactionIdResponse.ProtoReflect.Descriptor instead. +func (*GetDeductionByTransactionIdResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{22} +} + +func (x *GetDeductionByTransactionIdResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *GetDeductionByTransactionIdResponse) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetDeductionByTransactionIdResponse) GetAmount() float64 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *GetDeductionByTransactionIdResponse) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *GetDeductionByTransactionIdResponse) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +type Deduction 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"` + Amount float64 `protobuf:"fixed64,3,opt,name=amount,proto3" json:"amount,omitempty"` + TransactionId string `protobuf:"bytes,4,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (x *Deduction) Reset() { + *x = Deduction{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Deduction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Deduction) ProtoMessage() {} + +func (x *Deduction) ProtoReflect() protoreflect.Message { + mi := &file_user_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 Deduction.ProtoReflect.Descriptor instead. +func (*Deduction) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{23} +} + +func (x *Deduction) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Deduction) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *Deduction) GetAmount() float64 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *Deduction) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *Deduction) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +// 添加API请求记录 +type AddApiRequestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ProductCode string `protobuf:"bytes,3,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + Charges bool `protobuf:"varint,5,opt,name=charges,proto3" json:"charges,omitempty"` + Remark string `protobuf:"bytes,6,opt,name=remark,proto3" json:"remark,omitempty"` + Timestamp string `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *AddApiRequestRequest) Reset() { + *x = AddApiRequestRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddApiRequestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddApiRequestRequest) ProtoMessage() {} + +func (x *AddApiRequestRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 AddApiRequestRequest.ProtoReflect.Descriptor instead. +func (*AddApiRequestRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{24} +} + +func (x *AddApiRequestRequest) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *AddApiRequestRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *AddApiRequestRequest) GetProductCode() string { + if x != nil { + return x.ProductCode + } + return "" +} + +func (x *AddApiRequestRequest) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *AddApiRequestRequest) GetCharges() bool { + if x != nil { + return x.Charges + } + return false +} + +func (x *AddApiRequestRequest) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *AddApiRequestRequest) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + +type AddApiRequestResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` +} + +func (x *AddApiRequestResponse) Reset() { + *x = AddApiRequestResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddApiRequestResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddApiRequestResponse) ProtoMessage() {} + +func (x *AddApiRequestResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 AddApiRequestResponse.ProtoReflect.Descriptor instead. +func (*AddApiRequestResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{25} +} + +func (x *AddApiRequestResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +// 查询API请求记录 +type GetApiRequestsRequest 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"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *GetApiRequestsRequest) Reset() { + *x = GetApiRequestsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetApiRequestsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetApiRequestsRequest) ProtoMessage() {} + +func (x *GetApiRequestsRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetApiRequestsRequest.ProtoReflect.Descriptor instead. +func (*GetApiRequestsRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{26} +} + +func (x *GetApiRequestsRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetApiRequestsRequest) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetApiRequestsRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type GetApiRequestsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ApiRequests []*ApiRequest `protobuf:"bytes,1,rep,name=api_requests,json=apiRequests,proto3" json:"api_requests,omitempty"` +} + +func (x *GetApiRequestsResponse) Reset() { + *x = GetApiRequestsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetApiRequestsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetApiRequestsResponse) ProtoMessage() {} + +func (x *GetApiRequestsResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_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 GetApiRequestsResponse.ProtoReflect.Descriptor instead. +func (*GetApiRequestsResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{27} +} + +func (x *GetApiRequestsResponse) GetApiRequests() []*ApiRequest { + if x != nil { + return x.ApiRequests + } + return nil +} + +type ApiRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + TransactionId string `protobuf:"bytes,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + UserId int64 `protobuf:"varint,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ProductCode string `protobuf:"bytes,4,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"` + Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` + Charges float64 `protobuf:"fixed64,6,opt,name=charges,proto3" json:"charges,omitempty"` + Remark string `protobuf:"bytes,7,opt,name=remark,proto3" json:"remark,omitempty"` + Timestamp string `protobuf:"bytes,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *ApiRequest) Reset() { + *x = ApiRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ApiRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ApiRequest) ProtoMessage() {} + +func (x *ApiRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_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 ApiRequest.ProtoReflect.Descriptor instead. +func (*ApiRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{28} +} + +func (x *ApiRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *ApiRequest) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *ApiRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *ApiRequest) GetProductCode() string { + if x != nil { + return x.ProductCode + } + return "" +} + +func (x *ApiRequest) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *ApiRequest) GetCharges() float64 { + if x != nil { + return x.Charges + } + return 0 +} + +func (x *ApiRequest) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *ApiRequest) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + +// 查询API请求记录 +type GetApiRequestByTransactionIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TransactionId string `protobuf:"bytes,1,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` +} + +func (x *GetApiRequestByTransactionIdRequest) Reset() { + *x = GetApiRequestByTransactionIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetApiRequestByTransactionIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetApiRequestByTransactionIdRequest) ProtoMessage() {} + +func (x *GetApiRequestByTransactionIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[29] + 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 GetApiRequestByTransactionIdRequest.ProtoReflect.Descriptor instead. +func (*GetApiRequestByTransactionIdRequest) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{29} +} + +func (x *GetApiRequestByTransactionIdRequest) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +type GetApiRequestByTransactionIdResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + TransactionId string `protobuf:"bytes,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` + UserId int64 `protobuf:"varint,3,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ProductCode string `protobuf:"bytes,4,opt,name=product_code,json=productCode,proto3" json:"product_code,omitempty"` + Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` + Charges float64 `protobuf:"fixed64,6,opt,name=charges,proto3" json:"charges,omitempty"` + Remark string `protobuf:"bytes,7,opt,name=remark,proto3" json:"remark,omitempty"` + Timestamp string `protobuf:"bytes,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *GetApiRequestByTransactionIdResponse) Reset() { + *x = GetApiRequestByTransactionIdResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_user_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetApiRequestByTransactionIdResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetApiRequestByTransactionIdResponse) ProtoMessage() {} + +func (x *GetApiRequestByTransactionIdResponse) ProtoReflect() protoreflect.Message { + mi := &file_user_proto_msgTypes[30] + 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 GetApiRequestByTransactionIdResponse.ProtoReflect.Descriptor instead. +func (*GetApiRequestByTransactionIdResponse) Descriptor() ([]byte, []int) { + return file_user_proto_rawDescGZIP(), []int{30} +} + +func (x *GetApiRequestByTransactionIdResponse) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *GetApiRequestByTransactionIdResponse) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *GetApiRequestByTransactionIdResponse) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *GetApiRequestByTransactionIdResponse) GetProductCode() string { + if x != nil { + return x.ProductCode + } + return "" +} + +func (x *GetApiRequestByTransactionIdResponse) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +func (x *GetApiRequestByTransactionIdResponse) GetCharges() float64 { + if x != nil { + return x.Charges + } + return 0 +} + +func (x *GetApiRequestByTransactionIdResponse) GetRemark() string { + if x != nil { + return x.Remark + } + return "" +} + +func (x *GetApiRequestByTransactionIdResponse) GetTimestamp() string { + if x != nil { + return x.Timestamp + } + return "" +} + var File_user_proto protoreflect.FileDescriptor var file_user_proto_rawDesc = []byte{ @@ -982,59 +2130,229 @@ var file_user_proto_rawDesc = []byte{ 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, + 0x64, 0x22, 0x9e, 0x02, 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, + 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, + 0x0a, 0x0d, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x45, 0x78, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x45, 0x78, 0x63, 0x65, + 0x65, 0x64, 0x65, 0x64, 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, 0x05, 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, + 0x72, 0x70, 0x72, 0x69, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 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, + 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x07, 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, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x65, 0x67, 0x61, 0x6c, 0x50, 0x65, 0x72, 0x73, + 0x6f, 0x6e, 0x22, 0x83, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 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, 0x18, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x61, + 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x64, 0x69, 0x73, 0x61, 0x62, + 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x71, 0x75, 0x6f, 0x74, 0x61, 0x45, 0x78, 0x63, 0x65, 0x65, + 0x64, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x71, 0x75, 0x6f, 0x74, 0x61, + 0x45, 0x78, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 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, 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, + 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, 0x22, 0xa8, 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x57, 0x61, 0x6c, 0x6c, 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, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 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, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x72, + 0x67, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, + 0x22, 0x16, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x57, + 0x61, 0x6c, 0x6c, 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, 0x70, 0x0a, 0x11, + 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 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, 0x18, 0x0a, 0x07, 0x62, 0x61, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x62, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x57, + 0x0a, 0x14, 0x47, 0x65, 0x74, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 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, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x43, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x44, 0x65, + 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x2a, 0x0a, 0x0a, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x0a, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x4b, 0x0a, 0x22, + 0x47, 0x65, 0x74, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xac, 0x01, 0x0a, 0x23, 0x47, 0x65, + 0x74, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 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, 0x16, 0x0a, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 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, 0x22, 0x92, 0x01, 0x0a, 0x09, 0x44, 0x65, 0x64, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 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, + 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 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, 0x22, 0xe1, 0x01, + 0x0a, 0x14, 0x41, 0x64, 0x64, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 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, 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, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x6d, + 0x61, 0x72, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x22, 0x31, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x22, 0x58, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 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, 0x12, 0x0a, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x48, + 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x0c, 0x61, 0x70, 0x69, 0x5f, + 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, + 0x2e, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0b, 0x61, 0x70, 0x69, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x22, 0xe7, 0x01, 0x0a, 0x0a, 0x41, 0x70, 0x69, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x17, + 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x73, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, + 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, + 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x22, 0x4c, 0x0a, 0x23, 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x42, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x22, 0x81, 0x02, 0x0a, 0x24, 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x42, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, + 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x73, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x67, 0x65, 0x73, 0x12, 0x16, + 0x0a, 0x06, 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x72, 0x65, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 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, + 0xb4, 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, 0x2d, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x0c, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x10, + 0x2e, 0x47, 0x65, 0x74, 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, 0x32, 0xaa, 0x02, 0x0a, 0x0d, 0x57, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x14, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, + 0x65, 0x74, 0x12, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x15, 0x2e, 0x47, 0x65, 0x74, + 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x1b, 0x47, 0x65, 0x74, + 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x23, 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, + 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, + 0x47, 0x65, 0x74, 0x44, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x32, 0x83, 0x02, 0x0a, 0x11, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x41, 0x64, 0x64, + 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x2e, 0x41, 0x64, 0x64, + 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, + 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x16, 0x2e, 0x47, 0x65, + 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6b, 0x0a, 0x1c, + 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x79, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x24, 0x2e, 0x47, + 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x79, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x42, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x75, + 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1049,46 +2367,81 @@ func file_user_proto_rawDescGZIP() []byte { return file_user_proto_rawDescData } -var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 31) 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 + (*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 + (*GetUserInfoResp)(nil), // 12: GetUserInfoResp + (*GetEnterpriseAuthStatusReq)(nil), // 13: GetEnterpriseAuthStatusReq + (*GetEnterpriseAuthStatusResp)(nil), // 14: GetEnterpriseAuthStatusResp + (*UpdateWalletRequest)(nil), // 15: UpdateWalletRequest + (*UpdateWalletResponse)(nil), // 16: UpdateWalletResponse + (*GetWalletRequest)(nil), // 17: GetWalletRequest + (*GetWalletResponse)(nil), // 18: GetWalletResponse + (*GetDeductionsRequest)(nil), // 19: GetDeductionsRequest + (*GetDeductionsResponse)(nil), // 20: GetDeductionsResponse + (*GetDeductionByTransactionIdRequest)(nil), // 21: GetDeductionByTransactionIdRequest + (*GetDeductionByTransactionIdResponse)(nil), // 22: GetDeductionByTransactionIdResponse + (*Deduction)(nil), // 23: Deduction + (*AddApiRequestRequest)(nil), // 24: AddApiRequestRequest + (*AddApiRequestResponse)(nil), // 25: AddApiRequestResponse + (*GetApiRequestsRequest)(nil), // 26: GetApiRequestsRequest + (*GetApiRequestsResponse)(nil), // 27: GetApiRequestsResponse + (*ApiRequest)(nil), // 28: ApiRequest + (*GetApiRequestByTransactionIdRequest)(nil), // 29: GetApiRequestByTransactionIdRequest + (*GetApiRequestByTransactionIdResponse)(nil), // 30: GetApiRequestByTransactionIdResponse } 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 + 23, // 1: GetDeductionsResponse.deductions:type_name -> Deduction + 28, // 2: GetApiRequestsResponse.api_requests:type_name -> ApiRequest + 1, // 3: Enterprise.GetPendingEnterprise:input_type -> GetPendingEnterpriseReq + 4, // 4: Enterprise.ReviewEnterprise:input_type -> ReviewEnterpriseReq + 5, // 5: Enterprise.CreateEnterpriseAuth:input_type -> EnterpriseAuthReq + 6, // 6: Auth.RegisterUser:input_type -> RegisterReq + 7, // 7: Auth.LoginUser:input_type -> LoginReq + 8, // 8: Auth.PhoneLoginUser:input_type -> PhoneLoginReq + 10, // 9: User.UserInfo:input_type -> UserInfoReq + 10, // 10: User.GetUserInfo:input_type -> UserInfoReq + 13, // 11: User.GetEnterpriseAuthStatus:input_type -> GetEnterpriseAuthStatusReq + 15, // 12: WalletService.UpdateWallet:input_type -> UpdateWalletRequest + 17, // 13: WalletService.GetWallet:input_type -> GetWalletRequest + 19, // 14: WalletService.GetDeductions:input_type -> GetDeductionsRequest + 21, // 15: WalletService.GetDeductionByTransactionId:input_type -> GetDeductionByTransactionIdRequest + 24, // 16: ApiRequestService.AddApiRequest:input_type -> AddApiRequestRequest + 26, // 17: ApiRequestService.GetApiRequests:input_type -> GetApiRequestsRequest + 29, // 18: ApiRequestService.GetApiRequestByTransactionId:input_type -> GetApiRequestByTransactionIdRequest + 3, // 19: Enterprise.GetPendingEnterprise:output_type -> GetPendingEnterpriseResp + 0, // 20: Enterprise.ReviewEnterprise:output_type -> EmptyResponse + 0, // 21: Enterprise.CreateEnterpriseAuth:output_type -> EmptyResponse + 0, // 22: Auth.RegisterUser:output_type -> EmptyResponse + 9, // 23: Auth.LoginUser:output_type -> LoginResp + 9, // 24: Auth.PhoneLoginUser:output_type -> LoginResp + 11, // 25: User.UserInfo:output_type -> UserInfoResp + 12, // 26: User.GetUserInfo:output_type -> GetUserInfoResp + 14, // 27: User.GetEnterpriseAuthStatus:output_type -> GetEnterpriseAuthStatusResp + 16, // 28: WalletService.UpdateWallet:output_type -> UpdateWalletResponse + 18, // 29: WalletService.GetWallet:output_type -> GetWalletResponse + 20, // 30: WalletService.GetDeductions:output_type -> GetDeductionsResponse + 22, // 31: WalletService.GetDeductionByTransactionId:output_type -> GetDeductionByTransactionIdResponse + 25, // 32: ApiRequestService.AddApiRequest:output_type -> AddApiRequestResponse + 27, // 33: ApiRequestService.GetApiRequests:output_type -> GetApiRequestsResponse + 30, // 34: ApiRequestService.GetApiRequestByTransactionId:output_type -> GetApiRequestByTransactionIdResponse + 19, // [19:35] is the sub-list for method output_type + 3, // [3:19] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_user_proto_init() } @@ -1242,7 +2595,7 @@ func file_user_proto_init() { } } file_user_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*GetEnterpriseAuthStatusReq); i { + switch v := v.(*GetUserInfoResp); i { case 0: return &v.state case 1: @@ -1254,6 +2607,18 @@ func file_user_proto_init() { } } file_user_proto_msgTypes[13].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[14].Exporter = func(v any, i int) any { switch v := v.(*GetEnterpriseAuthStatusResp); i { case 0: return &v.state @@ -1265,6 +2630,198 @@ func file_user_proto_init() { return nil } } + file_user_proto_msgTypes[15].Exporter = func(v any, i int) any { + switch v := v.(*UpdateWalletRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[16].Exporter = func(v any, i int) any { + switch v := v.(*UpdateWalletResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[17].Exporter = func(v any, i int) any { + switch v := v.(*GetWalletRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[18].Exporter = func(v any, i int) any { + switch v := v.(*GetWalletResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[19].Exporter = func(v any, i int) any { + switch v := v.(*GetDeductionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[20].Exporter = func(v any, i int) any { + switch v := v.(*GetDeductionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[21].Exporter = func(v any, i int) any { + switch v := v.(*GetDeductionByTransactionIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[22].Exporter = func(v any, i int) any { + switch v := v.(*GetDeductionByTransactionIdResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[23].Exporter = func(v any, i int) any { + switch v := v.(*Deduction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[24].Exporter = func(v any, i int) any { + switch v := v.(*AddApiRequestRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[25].Exporter = func(v any, i int) any { + switch v := v.(*AddApiRequestResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[26].Exporter = func(v any, i int) any { + switch v := v.(*GetApiRequestsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[27].Exporter = func(v any, i int) any { + switch v := v.(*GetApiRequestsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[28].Exporter = func(v any, i int) any { + switch v := v.(*ApiRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[29].Exporter = func(v any, i int) any { + switch v := v.(*GetApiRequestByTransactionIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_user_proto_msgTypes[30].Exporter = func(v any, i int) any { + switch v := v.(*GetApiRequestByTransactionIdResponse); 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{ @@ -1272,9 +2829,9 @@ func file_user_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_user_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 31, NumExtensions: 0, - NumServices: 3, + NumServices: 5, }, GoTypes: file_user_proto_goTypes, DependencyIndexes: file_user_proto_depIdxs, diff --git a/apps/user/user/user_grpc.pb.go b/apps/user/user/user_grpc.pb.go index 90a82c8..2b6d2f0 100644 --- a/apps/user/user/user_grpc.pb.go +++ b/apps/user/user/user_grpc.pb.go @@ -374,6 +374,7 @@ var Auth_ServiceDesc = grpc.ServiceDesc{ const ( User_UserInfo_FullMethodName = "/User/UserInfo" + User_GetUserInfo_FullMethodName = "/User/GetUserInfo" User_GetEnterpriseAuthStatus_FullMethodName = "/User/GetEnterpriseAuthStatus" ) @@ -383,6 +384,7 @@ const ( type UserClient interface { // 获取用户信息 UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*UserInfoResp, error) + GetUserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpriseAuthStatusReq, opts ...grpc.CallOption) (*GetEnterpriseAuthStatusResp, error) } @@ -404,6 +406,16 @@ func (c *userClient) UserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc return out, nil } +func (c *userClient) GetUserInfo(ctx context.Context, in *UserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserInfoResp) + err := c.cc.Invoke(ctx, User_GetUserInfo_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) @@ -420,6 +432,7 @@ func (c *userClient) GetEnterpriseAuthStatus(ctx context.Context, in *GetEnterpr type UserServer interface { // 获取用户信息 UserInfo(context.Context, *UserInfoReq) (*UserInfoResp, error) + GetUserInfo(context.Context, *UserInfoReq) (*GetUserInfoResp, error) GetEnterpriseAuthStatus(context.Context, *GetEnterpriseAuthStatusReq) (*GetEnterpriseAuthStatusResp, error) mustEmbedUnimplementedUserServer() } @@ -431,6 +444,9 @@ type UnimplementedUserServer struct { func (UnimplementedUserServer) UserInfo(context.Context, *UserInfoReq) (*UserInfoResp, error) { return nil, status.Errorf(codes.Unimplemented, "method UserInfo not implemented") } +func (UnimplementedUserServer) GetUserInfo(context.Context, *UserInfoReq) (*GetUserInfoResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented") +} func (UnimplementedUserServer) GetEnterpriseAuthStatus(context.Context, *GetEnterpriseAuthStatusReq) (*GetEnterpriseAuthStatusResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetEnterpriseAuthStatus not implemented") } @@ -465,6 +481,24 @@ func _User_UserInfo_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _User_GetUserInfo_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).GetUserInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: User_GetUserInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).GetUserInfo(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 { @@ -494,6 +528,10 @@ var User_ServiceDesc = grpc.ServiceDesc{ MethodName: "UserInfo", Handler: _User_UserInfo_Handler, }, + { + MethodName: "GetUserInfo", + Handler: _User_GetUserInfo_Handler, + }, { MethodName: "GetEnterpriseAuthStatus", Handler: _User_GetEnterpriseAuthStatus_Handler, @@ -502,3 +540,391 @@ var User_ServiceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "user.proto", } + +const ( + WalletService_UpdateWallet_FullMethodName = "/WalletService/UpdateWallet" + WalletService_GetWallet_FullMethodName = "/WalletService/GetWallet" + WalletService_GetDeductions_FullMethodName = "/WalletService/GetDeductions" + WalletService_GetDeductionByTransactionId_FullMethodName = "/WalletService/GetDeductionByTransactionId" +) + +// WalletServiceClient is the client API for WalletService 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 WalletServiceClient interface { + // 修改钱包余额 + UpdateWallet(ctx context.Context, in *UpdateWalletRequest, opts ...grpc.CallOption) (*UpdateWalletResponse, error) + // 查询钱包信息 + GetWallet(ctx context.Context, in *GetWalletRequest, opts ...grpc.CallOption) (*GetWalletResponse, error) + // 查询扣款记录 + GetDeductions(ctx context.Context, in *GetDeductionsRequest, opts ...grpc.CallOption) (*GetDeductionsResponse, error) + GetDeductionByTransactionId(ctx context.Context, in *GetDeductionByTransactionIdRequest, opts ...grpc.CallOption) (*GetDeductionByTransactionIdResponse, error) +} + +type walletServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWalletServiceClient(cc grpc.ClientConnInterface) WalletServiceClient { + return &walletServiceClient{cc} +} + +func (c *walletServiceClient) UpdateWallet(ctx context.Context, in *UpdateWalletRequest, opts ...grpc.CallOption) (*UpdateWalletResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateWalletResponse) + err := c.cc.Invoke(ctx, WalletService_UpdateWallet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) GetWallet(ctx context.Context, in *GetWalletRequest, opts ...grpc.CallOption) (*GetWalletResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetWalletResponse) + err := c.cc.Invoke(ctx, WalletService_GetWallet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) GetDeductions(ctx context.Context, in *GetDeductionsRequest, opts ...grpc.CallOption) (*GetDeductionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetDeductionsResponse) + err := c.cc.Invoke(ctx, WalletService_GetDeductions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *walletServiceClient) GetDeductionByTransactionId(ctx context.Context, in *GetDeductionByTransactionIdRequest, opts ...grpc.CallOption) (*GetDeductionByTransactionIdResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetDeductionByTransactionIdResponse) + err := c.cc.Invoke(ctx, WalletService_GetDeductionByTransactionId_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WalletServiceServer is the server API for WalletService service. +// All implementations must embed UnimplementedWalletServiceServer +// for forward compatibility +// +// 定义钱包服务 +type WalletServiceServer interface { + // 修改钱包余额 + UpdateWallet(context.Context, *UpdateWalletRequest) (*UpdateWalletResponse, error) + // 查询钱包信息 + GetWallet(context.Context, *GetWalletRequest) (*GetWalletResponse, error) + // 查询扣款记录 + GetDeductions(context.Context, *GetDeductionsRequest) (*GetDeductionsResponse, error) + GetDeductionByTransactionId(context.Context, *GetDeductionByTransactionIdRequest) (*GetDeductionByTransactionIdResponse, error) + mustEmbedUnimplementedWalletServiceServer() +} + +// UnimplementedWalletServiceServer must be embedded to have forward compatible implementations. +type UnimplementedWalletServiceServer struct { +} + +func (UnimplementedWalletServiceServer) UpdateWallet(context.Context, *UpdateWalletRequest) (*UpdateWalletResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateWallet not implemented") +} +func (UnimplementedWalletServiceServer) GetWallet(context.Context, *GetWalletRequest) (*GetWalletResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetWallet not implemented") +} +func (UnimplementedWalletServiceServer) GetDeductions(context.Context, *GetDeductionsRequest) (*GetDeductionsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDeductions not implemented") +} +func (UnimplementedWalletServiceServer) GetDeductionByTransactionId(context.Context, *GetDeductionByTransactionIdRequest) (*GetDeductionByTransactionIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDeductionByTransactionId not implemented") +} +func (UnimplementedWalletServiceServer) mustEmbedUnimplementedWalletServiceServer() {} + +// UnsafeWalletServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WalletServiceServer will +// result in compilation errors. +type UnsafeWalletServiceServer interface { + mustEmbedUnimplementedWalletServiceServer() +} + +func RegisterWalletServiceServer(s grpc.ServiceRegistrar, srv WalletServiceServer) { + s.RegisterService(&WalletService_ServiceDesc, srv) +} + +func _WalletService_UpdateWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateWalletRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).UpdateWallet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WalletService_UpdateWallet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).UpdateWallet(ctx, req.(*UpdateWalletRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_GetWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetWalletRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).GetWallet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WalletService_GetWallet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).GetWallet(ctx, req.(*GetWalletRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_GetDeductions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDeductionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).GetDeductions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WalletService_GetDeductions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).GetDeductions(ctx, req.(*GetDeductionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WalletService_GetDeductionByTransactionId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDeductionByTransactionIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WalletServiceServer).GetDeductionByTransactionId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WalletService_GetDeductionByTransactionId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WalletServiceServer).GetDeductionByTransactionId(ctx, req.(*GetDeductionByTransactionIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WalletService_ServiceDesc is the grpc.ServiceDesc for WalletService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WalletService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "WalletService", + HandlerType: (*WalletServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateWallet", + Handler: _WalletService_UpdateWallet_Handler, + }, + { + MethodName: "GetWallet", + Handler: _WalletService_GetWallet_Handler, + }, + { + MethodName: "GetDeductions", + Handler: _WalletService_GetDeductions_Handler, + }, + { + MethodName: "GetDeductionByTransactionId", + Handler: _WalletService_GetDeductionByTransactionId_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "user.proto", +} + +const ( + ApiRequestService_AddApiRequest_FullMethodName = "/ApiRequestService/AddApiRequest" + ApiRequestService_GetApiRequests_FullMethodName = "/ApiRequestService/GetApiRequests" + ApiRequestService_GetApiRequestByTransactionId_FullMethodName = "/ApiRequestService/GetApiRequestByTransactionId" +) + +// ApiRequestServiceClient is the client API for ApiRequestService 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 ApiRequestServiceClient interface { + // 添加API请求记录 + AddApiRequest(ctx context.Context, in *AddApiRequestRequest, opts ...grpc.CallOption) (*AddApiRequestResponse, error) + // 查询API请求记录 + GetApiRequests(ctx context.Context, in *GetApiRequestsRequest, opts ...grpc.CallOption) (*GetApiRequestsResponse, error) + // 查询API请求记录ByTransactionId + GetApiRequestByTransactionId(ctx context.Context, in *GetApiRequestByTransactionIdRequest, opts ...grpc.CallOption) (*GetApiRequestByTransactionIdResponse, error) +} + +type apiRequestServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewApiRequestServiceClient(cc grpc.ClientConnInterface) ApiRequestServiceClient { + return &apiRequestServiceClient{cc} +} + +func (c *apiRequestServiceClient) AddApiRequest(ctx context.Context, in *AddApiRequestRequest, opts ...grpc.CallOption) (*AddApiRequestResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddApiRequestResponse) + err := c.cc.Invoke(ctx, ApiRequestService_AddApiRequest_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiRequestServiceClient) GetApiRequests(ctx context.Context, in *GetApiRequestsRequest, opts ...grpc.CallOption) (*GetApiRequestsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetApiRequestsResponse) + err := c.cc.Invoke(ctx, ApiRequestService_GetApiRequests_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiRequestServiceClient) GetApiRequestByTransactionId(ctx context.Context, in *GetApiRequestByTransactionIdRequest, opts ...grpc.CallOption) (*GetApiRequestByTransactionIdResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetApiRequestByTransactionIdResponse) + err := c.cc.Invoke(ctx, ApiRequestService_GetApiRequestByTransactionId_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ApiRequestServiceServer is the server API for ApiRequestService service. +// All implementations must embed UnimplementedApiRequestServiceServer +// for forward compatibility +type ApiRequestServiceServer interface { + // 添加API请求记录 + AddApiRequest(context.Context, *AddApiRequestRequest) (*AddApiRequestResponse, error) + // 查询API请求记录 + GetApiRequests(context.Context, *GetApiRequestsRequest) (*GetApiRequestsResponse, error) + // 查询API请求记录ByTransactionId + GetApiRequestByTransactionId(context.Context, *GetApiRequestByTransactionIdRequest) (*GetApiRequestByTransactionIdResponse, error) + mustEmbedUnimplementedApiRequestServiceServer() +} + +// UnimplementedApiRequestServiceServer must be embedded to have forward compatible implementations. +type UnimplementedApiRequestServiceServer struct { +} + +func (UnimplementedApiRequestServiceServer) AddApiRequest(context.Context, *AddApiRequestRequest) (*AddApiRequestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddApiRequest not implemented") +} +func (UnimplementedApiRequestServiceServer) GetApiRequests(context.Context, *GetApiRequestsRequest) (*GetApiRequestsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetApiRequests not implemented") +} +func (UnimplementedApiRequestServiceServer) GetApiRequestByTransactionId(context.Context, *GetApiRequestByTransactionIdRequest) (*GetApiRequestByTransactionIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetApiRequestByTransactionId not implemented") +} +func (UnimplementedApiRequestServiceServer) mustEmbedUnimplementedApiRequestServiceServer() {} + +// UnsafeApiRequestServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ApiRequestServiceServer will +// result in compilation errors. +type UnsafeApiRequestServiceServer interface { + mustEmbedUnimplementedApiRequestServiceServer() +} + +func RegisterApiRequestServiceServer(s grpc.ServiceRegistrar, srv ApiRequestServiceServer) { + s.RegisterService(&ApiRequestService_ServiceDesc, srv) +} + +func _ApiRequestService_AddApiRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddApiRequestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiRequestServiceServer).AddApiRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ApiRequestService_AddApiRequest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiRequestServiceServer).AddApiRequest(ctx, req.(*AddApiRequestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiRequestService_GetApiRequests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetApiRequestsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiRequestServiceServer).GetApiRequests(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ApiRequestService_GetApiRequests_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiRequestServiceServer).GetApiRequests(ctx, req.(*GetApiRequestsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ApiRequestService_GetApiRequestByTransactionId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetApiRequestByTransactionIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiRequestServiceServer).GetApiRequestByTransactionId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ApiRequestService_GetApiRequestByTransactionId_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiRequestServiceServer).GetApiRequestByTransactionId(ctx, req.(*GetApiRequestByTransactionIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ApiRequestService_ServiceDesc is the grpc.ServiceDesc for ApiRequestService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ApiRequestService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "ApiRequestService", + HandlerType: (*ApiRequestServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddApiRequest", + Handler: _ApiRequestService_AddApiRequest_Handler, + }, + { + MethodName: "GetApiRequests", + Handler: _ApiRequestService_GetApiRequests_Handler, + }, + { + MethodName: "GetApiRequestByTransactionId", + Handler: _ApiRequestService_GetApiRequestByTransactionId_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "user.proto", +} diff --git a/pkg/errs/api.go b/pkg/errs/api.go new file mode 100644 index 0000000..408f02e --- /dev/null +++ b/pkg/errs/api.go @@ -0,0 +1,9 @@ +package errs + +// 常见错误 +var ( + ErrSystem = NewAppError(1001, "业务失败") + ErrParamDecryption = NewAppError(1002, "参数解密失败") + ErrParamValidation = NewAppError(1003, "校验参数不正确") + ErrDataSource = NewAppError(1004, "数据源异常") +) diff --git a/pkg/errs/err.go b/pkg/errs/err.go new file mode 100644 index 0000000..38d4630 --- /dev/null +++ b/pkg/errs/err.go @@ -0,0 +1,20 @@ +package errs + +// 定义自定义错误类型 +type AppError struct { + Code int // 错误码 + Message string // 错误信息 +} + +// 实现 error 接口的 Error 方法 +func (e *AppError) Error() string { + return e.Message +} + +// 创建带有错误码和错误信息的 AppError +func NewAppError(code int, message string) *AppError { + return &AppError{ + Code: code, + Message: message, + } +} diff --git a/pkg/models/mqs.go b/pkg/models/mqs.go new file mode 100644 index 0000000..db433d8 --- /dev/null +++ b/pkg/models/mqs.go @@ -0,0 +1,13 @@ +package models + +import "time" + +type ApiRequestMessage struct { + TransactionID string `json:"transactionID"` + UserId int64 `json:"userId"` + ProductCode string `json:"productCode"` + Status string `json:"status"` // 1. success 2. error + Charges bool `json:"charges"` // 是否扣费 + Remark string `json:"remark"` + Timestamp time.Time `json:"timestamp"` // 添加时间戳 +} diff --git a/pkg/response/response.go b/pkg/response/response.go index e642816..4ca9abf 100644 --- a/pkg/response/response.go +++ b/pkg/response/response.go @@ -4,6 +4,7 @@ import ( "context" "github.com/zeromicro/go-zero/rest/httpx" "net/http" + "tianyuan-api/pkg/errs" ) // 定义通用的响应结构 @@ -13,41 +14,43 @@ type Response struct { Message string `json:"message"` } type ResponseWithTransactionID struct { - Response - TransactionID string `json:"transaction_id"` + Code int `json:"code"` + Data interface{} `json:"data,omitempty"` + Message string `json:"message"` + TransactionID string `json:"transaction_id"` +} + +// 发送响应(公用函数) +func sendResponse(ctx context.Context, w http.ResponseWriter, code int, message string, data interface{}) { + // 从上下文中获取 TransactionID + transactionID, _ := ctx.Value("transactionID").(string) + if transactionID != "" { + result := ResponseWithTransactionID{ + Code: code, + Data: data, + Message: message, + TransactionID: transactionID, + } + httpx.OkJsonCtx(ctx, w, result) + } else { + result := Response{ + Code: code, + Data: data, + Message: message, + } + httpx.OkJsonCtx(ctx, w, result) + } } // 响应成功 func Success(ctx context.Context, w http.ResponseWriter, data interface{}) { - // 从上下文中获取 TransactionID - transactionID := ctx.Value("TransactionID") - - // 判断是否存在 TransactionID - if transactionID != nil { - result := ResponseWithTransactionID{ - Response: Response{ - Code: http.StatusOK, - Data: data, - Message: "success", - }, - TransactionID: transactionID.(string), // 将 TransactionID 添加到响应 - } - httpx.OkJsonCtx(ctx, w, result) // 返回带有 TransactionID 的响应 - } else { - result := Response{ - Code: http.StatusOK, - Data: data, - Message: "success", - } - httpx.OkJsonCtx(ctx, w, result) // 返回没有 TransactionID 的响应 - } + ctx = context.WithValue(ctx, "status", "success") + sendResponse(ctx, w, 0, "success", data) } // 响应失败 -func Fail(ctx context.Context, w http.ResponseWriter, err error) { - result := Response{ - Code: -1, - Message: err.Error(), - } - httpx.OkJsonCtx(ctx, w, result) +func Fail(ctx context.Context, w http.ResponseWriter, err *errs.AppError) { + ctx = context.WithValue(ctx, "status", "failed") + ctx = context.WithValue(ctx, "remark", err.Message) + sendResponse(ctx, w, err.Code, err.Message, nil) } diff --git a/pkg/schema/schemaVerify.go b/pkg/schema/schemaVerify.go deleted file mode 100644 index 919c599..0000000 --- a/pkg/schema/schemaVerify.go +++ /dev/null @@ -1,86 +0,0 @@ -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, ", ") // 用换行符连接每个错误信息 -}