main
jhc 10 months ago
parent 86658d3a3f
commit 7f9822e81f

@ -0,0 +1,93 @@
kind: pipeline
type: docker
name: chain-dci【K8s-测试服】
volumes:
- name: pkgdeps
host:
path: /mnt/storage/data/drone/define_cache/chain-dci
- name: docker
host:
path: /var/run/docker.sock
- name: docker-daemon
host:
path: /etc/docker/daemon.json
steps:
- name: fetch submodules
image: testhub.szjixun.cn:9043/public/plugins/git
pull: if-not-exists
commands:
- git submodule update --init --force --recursive --remote
- name: build
image: testhub.szjixun.cn:9043/public/golang:1.20-alpine
pull: if-not-exists
environment:
GOPROXY: "https://goproxy.cn,direct"
GOPATH: /go
GOCACHE: /go/pkg/mod/cache
volumes:
- name: pkgdeps
path: /go/pkg
commands:
- cp DockerfileTest Dockerfile
- CGO_ENABLED=0 go build -ldflags "-s -w" -o oa-meeting-server ./cmd
- name: publish
image: testhub.szjixun.cn:9043/public/plugins/docker
pull: if-not-exists
volumes:
- name: docker
path: /var/run/docker.sock
- name: pkgdeps
path: /cache
settings:
purge: false
username:
from_secret: harbor22-name
password:
from_secret: harbor22-password
registry:
from_secret: harbor22-host
repo: testhub.szjixun.cn:9043/k8stest/chain-dci-server
tags:
- latest
- ${DRONE_BUILD_NUMBER}
- name: Deploy app
image: testhub.szjixun.cn:9043/public/drone-k8s:latest
settings:
debug: true
build_number: ${DRONE_BUILD_NUMBER}
kuboard_accessKey: i685rr3fr6dy.4zt5jbh6t4kxyxj8zt6dih6cdc4zbjwz
namespace: "chain-server"
deployment_name: "chain-dci-server"
dashboard: kuboard
build_repo:
from_secret: build_repo
- name: 钉钉通知
image: testhub.szjixun.cn:9043/public/drone-ding
settings:
token:
from_secret: ding-token
secret:
from_secret: ding-secret
type: markdown
message_color: true
message_pic: true
sha_link: true
db_log: true
db_type: mysql
db_name: notelog
db_host: "172.16.100.99"
db_port: 9007
db_username: artuser # 后期需要修改
db_password: "C250PflXIWv2SQm8" # 后期需要修改
when:
status: [ failure, success ]
branch: dev
network:
subnet: dnmp_default
trigger:
branch:
- dev
event:
- push
- custom

4
.gitmodules vendored

@ -0,0 +1,4 @@
[submodule "oa-proto"]
path = oa-proto
url = http://192.168.12.3:3000/fonchain/oa-proto.git
branch = main

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true">
<buildTags>
<option name="goVersion" value="go1.9" />
</buildTags>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SwUserDefinedSpecifications">
<option name="specTypeByUrl">
<map />
</option>
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/chain-dci.iml" filepath="$PROJECT_DIR$/.idea/chain-dci.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,22 @@
FROM testhub.szjixun.cn:9043/public/golang:1.20-alpine AS builder
LABEL stage=gobuilder
ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
WORKDIR /build
COPY chain-dci-server /app/chain-dci-server
#FROM 172.16.100.99:9006/alpine
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
#RUN apk update --no-cache
#RUN apk add --no-cache ca-certificates
#RUN apk add --no-cache tzdata
FROM testhub.szjixun.cn:9043/public/self-alpine
COPY ./conf /app/conf
ENV TZ Asia/Shanghai
ENV MODE_ENV k8stest
WORKDIR /app
COPY --from=builder /app/chain-dci-server .
EXPOSE 20117
CMD ["/app/chain-dci-server"]

@ -1,3 +1,17 @@
# chain-dci # chain-dci
数登 蚂蚁链版权保护接入指南:https://antdigital.com/docs/11/305591#900136f865aiw
账号:18051299227
测试环境调用入口:EndPointhttps://openapi-sit.antchain.antgroup.com/gateway.do
线上环境调用入口:EndPointhttps://openapi.antchain.antgroup.com/gateway.do
```text
#DCI申领流程
https://cdns.fontree.cn/fonchain-main/test/image/0/chain-dci/file/24bfa6de-cf39-4bb5-83bf-6a64d2b0d534.png
```
```text
#数字版权登记流程
https://cdns.fontree.cn/fonchain-main/test/image/0/chain-dci/file/b2b9ebf8-5e8a-4697-af11-c07f788a6f77.png
```

3
build/.gitignore vendored

@ -0,0 +1,3 @@
*
!.gitignore
!.gitkeep

@ -0,0 +1,2 @@
ls pb/dci/*.pb.go | xargs -n1 -IX bash -c 'sed s/,omitempty// X > X.tmp && mv X{.tmp,}';

@ -0,0 +1,45 @@
package main
import (
dciConfig "chain-dci/config"
"chain-dci/internal/controller"
_ "chain-dci/internal/handler"
"chain-dci/pkg/app"
common "chain-dci/pkg/init"
"chain-dci/pkg/tracing"
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/filter/tps/strategy"
_ "dubbo.apache.org/dubbo-go/v3/imports"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/bwmarrin/snowflake"
antCloud "github.com/huyi-cn/antcloud-golang-sdk"
"go.uber.org/zap"
)
func NewApp(Lg *zap.Logger, JaegerTracer *tracing.JaegerProvider, AntClient *antCloud.Client, BccrClient *bccrClient.Client, SfNode *snowflake.Node) *app.App {
return &app.App{
Lg: Lg,
//RedisClient: RedisClient,
JaegerTracer: JaegerTracer,
AntClient: AntClient,
BccrClient: BccrClient,
SfNode: SfNode,
//RtcClient: RtcClient,
}
}
func main() {
var err error
dciConfig.GetOptions()
app.ModuleClients, err = InitApp()
if err != nil {
panic(err)
}
//注册服务
config.SetProviderService(&controller.DciProvider{})
common.Init()
if err = config.Load(); err != nil {
panic(err)
}
select {}
}

@ -0,0 +1,20 @@
// go:build wireinject
//go:build wireinject
// +build wireinject
package main
import (
"chain-dci/pkg/ant"
"chain-dci/pkg/app"
"chain-dci/pkg/bccr"
"chain-dci/pkg/logger"
"chain-dci/pkg/snowf"
"chain-dci/pkg/tracing"
"github.com/google/wire"
)
func InitApp() (*app.App, error) {
wire.Build(logger.Provider, tracing.Provider, ant.Provider, bccr.Provider, snowf.Provider, NewApp)
return &app.App{}, nil
}

@ -0,0 +1,33 @@
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"chain-dci/pkg/ant"
"chain-dci/pkg/app"
"chain-dci/pkg/bccr"
"chain-dci/pkg/logger"
"chain-dci/pkg/snowf"
"chain-dci/pkg/tracing"
)
import (
_ "dubbo.apache.org/dubbo-go/v3/filter/tps/strategy"
_ "dubbo.apache.org/dubbo-go/v3/imports"
)
// Injectors from wire.go:
func InitApp() (*app.App, error) {
zapLogger := logger.ZapInit()
jaegerProvider := tracing.NewTracing()
client := ant.NewAntClient()
clientClient := bccr.NewBccrClient()
node := snowf.NewSf()
appApp := NewApp(zapLogger, jaegerProvider, client, clientClient, node)
return appApp, nil
}

@ -0,0 +1,42 @@
system:
mode: dev #正式 prod #测试 test #开发 dev
config_source: config
#oaMeeting:
# host: 127.0.0.1
# port: 3306
# user: dyb
# password: rootdyb
# db_name: "oa-meeting"
antCloud:
access_key: "ACsK4CQqzj5rGSKf"
access_key_secret: "SJmH5eATWY26tJrVg8QyHaBGbLNCbj7y"
end_point: "https://openapi-sit.antchain.antgroup.com/gateway.do"
Bccr:
access_key_id: "ACsK4CQqzj5rGSKf"
access_key_secret: "SJmH5eATWY26tJrVg8QyHaBGbLNCbj7y"
end_point: "https://openapi-sit.antchain.antgroup.com/gateway.do"
#aliYunRtc:
# appid: "aeztom27"
# app_key: "76c62466cbd77d7a3606660a15861d1e"
#redis:
# db: 1
# addr: 127.0.0.1:6379
# password: "7532T6R"
zapLog:
level: "info"
filename: "logs/chain-dci.log"
max_size: 5
max_age: 30
max_backups: 30
snowflake:
node_num: 4
start_time: "2023-05-31"
jaeger:
addr: "127.0.0.1:6831"
open: false
#rabbitmq:
# user: "myuser"
# password: "mypass"
# host: "localhost"
# port: 5672
# vhost: "oa"

@ -0,0 +1,68 @@
dubbo:
metrics:
enable: true # default is true
path: /metrics # default is /metrics
port: 9092 # default is 9090
namespace: dubboDci # default is dubbo 作为数据上报 metrics 的前缀
registries:
demoZK:
protocol: zookeeper
timeout: 10s
address: 127.0.0.1:2181
protocols:
triple: #triple
name: tri
port: 20201
provider:
filter: tracing
services:
MeetingProvider:
interface: com.fontree.microservices.chain.dci
retries: 0
filter: tps,tracing
tps.limiter: method-service
tps.limit.strategy: fixedWindow
tps.limit.rejected.handler: DefaultValueHandler
tps.limit.interval: 1000 # 间隔时间
tps.limit.rate: 30 # 间隔时间内次数
warmup: 100 #预热时间
logger:
zap-config:
level: info # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/logs/chain-dci.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 30
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 30
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

@ -0,0 +1,34 @@
system:
mode: dev #正式 prod #测试 test #开发 dev
config_source: configmap
#oaMeeting:
# host: ${mysql.host|localhost}
# port: ${mysql.port|3306}
# user: ${mysql.user}
# password: ${mysql.password}
# db_name: ${oa-meeting.mysql.db_name}
#aliYunRtc:
# appid: ${aliyun-rtc.appid}
# app_key: ${aliyun-rtc.app_key}
#redis:
# db: ${oa-meeting.redis.db}
# addr: ${redis.addr}
# password: ${redis.password}
zapLog:
level: "info"
filename: "logs/oa-meeting.log"
max_size: ${zap.max_size}
max_age: ${zap.max_age}
max_backups: ${zap.max_backups}
snowflake:
node_num: ${oa-meeting.snowflake.node_num}
start_time: "2023-05-31"
jaeger:
addr: ${jaeger.host}
open: ${oa-meeting.jaeger_open}
#rabbitmq:
# user: ${rabbitmq.user}
# password: ${rabbitmq.password}
# host: ${rabbitmq.host}
# port: ${rabbitmq.port}
# vhost: ${oa-meeting.rabbitmq.vhost}

@ -0,0 +1,68 @@
dubbo:
metrics:
enable: true # default is true
path: /metrics # default is /metrics
port: 9092 # default is 9090
namespace: dubboDci # default is dubbo 作为数据上报 metrics 的前缀
registries:
demoZK:
protocol: zookeeper
timeout: 10s
address: 172.16.100.93:2181
protocols:
triple: #triple
name: tri
port: 20117
provider:
filter: tracing
services:
MeetingProvider:
interface: com.fontree.microservices.chain.dci
retries: 0
filter: tps,tracing
tps.limiter: method-service
tps.limit.strategy: fixedWindow
tps.limit.rejected.handler: DefaultValueHandler
tps.limit.interval: 1000 # 间隔时间
tps.limit.rate: 30 # 间隔时间内次数
warmup: 100 #预热时间
logger:
zap-config:
level: info # 日志级别
development: false
disableCaller: false
disableStacktrace: false
encoding: "json"
# zap encoder 配置
encoderConfig:
messageKey: "message"
levelKey: "level"
timeKey: "time"
nameKey: "logger"
callerKey: "caller"
stacktraceKey: "stacktrace"
lineEnding: ""
levelEncoder: "capitalColor"
timeEncoder: "iso8601"
durationEncoder: "seconds"
callerEncoder: "short"
nameEncoder: ""
EncodeTime: zapcore.TimeEncoderOfLayout("2006-01-02 15:04:05.000"),
EncodeDuration: zapcore.SecondsDurationEncoder,
outputPaths:
- "stderr"
errorOutputPaths:
- "stderr"
lumberjack-config:
# 写日志的文件名称
filename: "runtime/logs/chain-dci.log"
# 每个日志文件长度的最大大小,单位是 MiB。默认 100MiB
maxSize: 5
# 日志保留的最大天数(只保留最近多少天的日志)
maxAge: 30
# 只保留最近多少个日志文件,用于控制程序总日志的大小
maxBackups: 30
# 是否使用本地时间,默认使用 UTC 时间
localTime: true
# 是否压缩日志文件,压缩方法 gzip
compress: false

@ -0,0 +1,162 @@
package config
import (
"chain-dci/pkg/msg"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"fmt"
"github.com/spf13/viper"
"os"
"reflect"
"strings"
)
var Data = new(AppConfig)
type AppConfig struct {
System struct {
Mode string
ConfigSource string `mapstructure:"config_source"`
}
ChainDci struct {
Host string
Port string
User string
Password string
DbName string `mapstructure:"db_name"`
}
AntCloud struct {
AccessKey string `mapstructure:"access_key"`
AccessKeySecret string `mapstructure:"access_key_secret"`
EndPoint string `mapstructure:"end_point"`
}
Bccr struct {
AccessKeyID string `mapstructure:"access_key_id"`
AccessKeySecret string `mapstructure:"access_key_secret"`
EndPoint string `mapstructure:"end_point"`
}
Redis struct {
DB string
Addr string
Password string
}
ZapLog struct {
Level string `mapstructure:"level"`
Filename string `mapstructure:"filename"`
MaxSize string `mapstructure:"max_size"`
MaxAge string `mapstructure:"max_age"`
MaxBackups string `mapstructure:"max_backups"`
}
SnowFlake struct {
NodeNum string `mapstructure:"node_num"`
StartTime string `mapstructure:"start_time"`
}
Jaeger struct {
Addr string `mapstructure:"host"`
Open string `mapstructure:"open"`
}
RabbitMq struct {
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
Vhost string `mapstructure:"vhost"`
}
}
func GetConf() (iniConf string, err error) {
if os.Getenv(msg.MODE_ENV) != "" {
if err = os.Setenv(constant.ConfigFileEnvKey, fmt.Sprintf("./conf/%s/%s", os.Getenv(msg.MODE_ENV), msg.SERVER_DUBBOGO_CONFIG)); err != nil {
return
}
}
if os.Getenv(msg.MODE_ENV) == "" {
iniConf = fmt.Sprintf("../conf/%s", msg.SERVER_CONFIG)
} else {
iniConf = fmt.Sprintf("./conf/%s/%s", os.Getenv(msg.MODE_ENV), msg.SERVER_CONFIG)
}
return
}
func GetOptions() {
iniConf, err := GetConf()
if err != nil {
panic("GetOptions err" + err.Error())
}
if err = Viper(iniConf); err != nil {
return
}
}
func Viper(iniConf string) (err error) {
viper.SetConfigFile(iniConf)
err = viper.ReadInConfig()
if err != nil {
panic("viper.ReadInConfig failed" + err.Error())
return
}
if err = viper.Unmarshal(Data); err != nil {
panic("viper.Unmarshal failed" + err.Error())
return
}
// 如果是configmap模式再修改
fmt.Println(Data.System)
if Data.System.ConfigSource == "configmap" {
traverseFields(reflect.ValueOf(*Data), "", Data)
}
return
}
func traverseFields(value reflect.Value, prefix string, configPtr interface{}) {
valueType := value.Type()
prefixEnv := "${"
suffixEnv := "}"
// 遍历结构体的字段
for i := 0; i < valueType.NumField(); i++ {
field := valueType.Field(i)
fieldValue := value.Field(i)
// 拼接字段名(带有前缀)
fieldName := prefix + field.Name
// 判断字段的类型
if fieldValue.Kind() == reflect.Struct {
// 递归遍历嵌套结构体字段
traverseFields(fieldValue, fieldName+".", configPtr)
} else {
// 获取字段的值
fieldValueStr := fmt.Sprintf("%v", fieldValue.Interface())
// 判断是不是需要通过环境变量获取
if len(fieldValueStr) > 3 && strings.HasPrefix(fieldValueStr, prefixEnv) && strings.HasSuffix(fieldValueStr, suffixEnv) {
end := len(fieldValueStr) - len(suffixEnv)
var hasDefault bool
if strings.Index(fieldValueStr, "|") > 0 {
hasDefault = true
end = strings.Index(fieldValueStr, "|")
}
envStr := fieldValueStr[len(prefixEnv):end]
getValue := os.Getenv(envStr)
if getValue == "" && hasDefault {
getValue = fieldValueStr[end+1 : len(fieldValueStr)-len(suffixEnv)]
}
setSubFieldValue(configPtr, fieldName, getValue)
}
}
}
}
func setSubFieldValue(configPtr interface{}, fieldPath string, newValue interface{}) {
value := reflect.ValueOf(configPtr).Elem()
fields := strings.Split(fieldPath, ".")
for _, field := range fields {
value = value.FieldByName(field)
if !value.IsValid() {
return // 字段不存在,直接返回
}
if value.Kind() == reflect.Ptr {
value = value.Elem() // 解引用指针类型的字段
}
}
// 检查字段是否可设置
if value.CanSet() {
// 根据字段类型,将新值转换为对应类型并设置字段的值
newValue := reflect.ValueOf(newValue).Convert(value.Type())
value.Set(newValue)
}
}

@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: oa-meeting-server
spec:
replicas: 1
selector:
matchLabels:
app: oa-meeting-server
template:
metadata:
labels:
app: oa-meeting-server
spec:
containers:
- name: oa-meeting-server
image: testhub.szjixun.cn:9043/k8stest/oa-meeting-server:latest
ports:
- containerPort: 20006
volumeMounts:
- name: logs
mountPath: /app/logs
- name: runtime
mountPath: /app/runtime
envFrom:
- configMapRef:
name: "erp-configmap"
- secretRef:
name: erp-secret
# nodeSelector:
# node: node1
imagePullSecrets:
- name: docker-login-secret
volumes:
- name: logs
nfs:
server: node0
path: /mnt/storage/erp/oa-meeting-server/logs
- name: runtime
nfs:
server: node0
path: /mnt/storage/erp/oa-meeting-server/runtime
---
apiVersion: v1
kind: Service
metadata:
name: oa-meeting-server
spec:
type: NodePort
selector:
app: oa-meeting-server
ports:
- name: http
protocol: TCP
nodePort: 20117
targetPort: 20117
port: 20117

169
go.mod

@ -0,0 +1,169 @@
module chain-dci
go 1.20
require (
dubbo.apache.org/dubbo-go/v3 v3.0.2
github.com/alibabacloud-go/tea v1.2.1
github.com/antchain-openapi-sdk-go/bccr v1.17.65
github.com/bwmarrin/snowflake v0.3.0
github.com/dubbogo/gost v1.13.2
github.com/dubbogo/grpc-go v1.42.10
github.com/dubbogo/triple v1.2.2-rc3
github.com/gin-gonic/gin v1.9.1
github.com/go-redis/redis v6.15.9+incompatible
github.com/golang/protobuf v1.5.3
github.com/google/wire v0.5.0
github.com/huyi-cn/antcloud-golang-sdk v1.0.2
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/opentracing/opentracing-go v1.2.0
github.com/spf13/viper v1.17.0
github.com/streadway/amqp v1.1.0
github.com/uber/jaeger-client-go v2.30.0+incompatible
go.uber.org/zap v1.26.0
google.golang.org/protobuf v1.31.0
gorm.io/driver/mysql v1.5.2
gorm.io/gorm v1.25.5
)
require (
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
github.com/RoaringBitmap/roaring v1.2.3 // indirect
github.com/Workiva/go-datastructures v1.0.52 // indirect
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
github.com/alibaba/sentinel-golang v1.0.4 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/tea-oss-utils v1.1.0 // indirect
github.com/alibabacloud-go/tea-rpc-utils v1.1.2 // indirect
github.com/alibabacloud-go/tea-utils v1.3.8 // indirect
github.com/alibabacloud-go/tea-utils/v2 v2.0.4 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect
github.com/antchain-openapi-sdk-go/antchain-util v0.0.7 // indirect
github.com/apache/dubbo-getty v1.4.9 // indirect
github.com/apache/dubbo-go-hessian2 v1.12.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect
github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/creasty/defaults v1.5.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/envoyproxy/go-control-plane v0.11.1 // indirect
github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-co-op/gocron v1.9.0 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/vault/sdk v0.7.0 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/k0kubun/pp v3.0.1+incompatible // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/nacos-group/nacos-sdk-go v1.1.4 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/polarismesh/polaris-go v1.3.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
github.com/zouyx/agollo/v3 v3.4.5 // indirect
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.11.0 // indirect
go.opentelemetry.io/otel/trace v1.11.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/grpc v1.58.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

1549
go.sum

File diff suppressed because it is too large Load Diff

@ -0,0 +1,100 @@
package controller
import (
"chain-dci/internal/logic"
"chain-dci/pb/dci"
errCommon "chain-dci/pkg/err"
"chain-dci/pkg/msg"
"context"
"errors"
)
type DciProvider struct {
dci.UnimplementedDciServer
file *logic.File
dciUser *logic.DciUser
dciWork *logic.DciWork
dciReg *logic.DciRegistration
}
func (d *DciProvider) GetUploadUrl(_ context.Context, req *dci.GetUploadUrlRequest) (res *dci.GetUploadUrlResponse, err error) {
res = new(dci.GetUploadUrlResponse)
if req.FileName == "" {
return res, errCommon.ReturnError(errors.New(msg.ErrrFileIsEmpty), msg.ErrrFileIsEmpty, "未获取到相关文件 :")
}
res, err = d.file.Upload(req)
return
}
func (d *DciProvider) AddDciUser(_ context.Context, req *dci.AddDciUserRequest) (res *dci.AddDciUserResponse, err error) {
res = new(dci.AddDciUserResponse)
res, err = d.dciUser.AddDciUser(req)
return
}
func (d *DciProvider) UpdateDciUser(_ context.Context, req *dci.UpdateDciUserRequest) (res *dci.UpdateDciUserResponse, err error) {
res = new(dci.UpdateDciUserResponse)
res, err = d.dciUser.UpdateDciUser(req)
return
}
func (d *DciProvider) QueryDciUser(_ context.Context, req *dci.QueryDciUserRequest) (res *dci.QueryDciUserResponse, err error) {
res = new(dci.QueryDciUserResponse)
res, err = d.dciUser.QueryDciUser(req)
return
}
func (d *DciProvider) CreateDciPreregistration(_ context.Context, req *dci.CreateDciPreregistrationRequest) (res *dci.CreateDciPreregistrationResponse, err error) {
res = new(dci.CreateDciPreregistrationResponse)
res, err = d.dciWork.CreateDciPreregistration(req)
return
}
func (d *DciProvider) QueryDciPreregistration(_ context.Context, req *dci.QueryDciPreregistrationRequest) (res *dci.QueryDciPreregistrationResponse, err error) {
res = new(dci.QueryDciPreregistrationResponse)
res, err = d.dciWork.QueryDciPreregistration(req)
return
}
func (d *DciProvider) CreateDciRegistration(_ context.Context, req *dci.CreateDciRegistrationRequest) (res *dci.CreateDciRegistrationResponse, err error) {
res = new(dci.CreateDciRegistrationResponse)
res, err = d.dciReg.CreateDciRegistration(req)
return
}
func (d *DciProvider) QueryDciRegistration(_ context.Context, req *dci.QueryDciRegistrationRequest) (res *dci.QueryDciRegistrationResponse, err error) {
res = new(dci.QueryDciRegistrationResponse)
res, err = d.dciReg.QueryDciRegistration(req)
return
}
func (d *DciProvider) GetDciPayUrl(_ context.Context, req *dci.GetDciPayUrlRequest) (res *dci.GetDciPayUrlResponse, err error) {
res = new(dci.GetDciPayUrlResponse)
res, err = d.dciReg.GetDciPayUrl(req)
return
}
func (d *DciProvider) QueryDciPay(_ context.Context, req *dci.QueryDciPayRequest) (res *dci.QueryDciPayResponse, err error) {
res = new(dci.QueryDciPayResponse)
res, err = d.dciReg.QueryDciPay(req)
return
}
func (d *DciProvider) GetDciRegistrationcert(_ context.Context, req *dci.GetDciRegistrationcertRequest) (res *dci.GetDciRegistrationcertResponse, err error) {
res = new(dci.GetDciRegistrationcertResponse)
res, err = d.dciReg.GetDciRegistrationcert(req)
return
}
func (d *DciProvider) RetryDciRegistration(_ context.Context, req *dci.RetryDciRegistrationRequest) (res *dci.RetryDciRegistrationResponse, err error) {
res = new(dci.RetryDciRegistrationResponse)
res, err = d.dciReg.RetryDciRegistration(req)
return
}
func (d *DciProvider) CloseDciRegistration(_ context.Context, req *dci.CloseDciRegistrationRequest) (res *dci.CloseDciRegistrationResponse, err error) {
res = new(dci.CloseDciRegistrationResponse)
res, err = d.dciReg.CloseDciRegistration(req)
return
}

@ -0,0 +1,57 @@
package handler
import (
"errors"
"sync"
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/common/extension"
"dubbo.apache.org/dubbo-go/v3/filter"
"dubbo.apache.org/dubbo-go/v3/protocol"
)
func init() {
extension.SetRejectedExecutionHandler("DefaultValueHandler", GetDefaultValueRejectedExecutionHandlerSingleton)
}
type DefaultValueRejectedExecutionHandler struct {
defaultResult sync.Map
}
func (mh *DefaultValueRejectedExecutionHandler) RejectedExecution(url *common.URL, invocation protocol.Invocation) protocol.Result {
key := url.ServiceKey() + "#" + invocation.MethodName()
result, loaded := mh.defaultResult.Load(key)
if !loaded {
// we didn't configure any default value for this invocation
return &protocol.RPCResult{
Err: errors.New("请求太频繁"),
}
}
return result.(*protocol.RPCResult)
}
func GetCustomRejectedExecutionHandler() filter.RejectedExecutionHandler {
return &DefaultValueRejectedExecutionHandler{}
}
var (
customHandlerOnce sync.Once
customHandlerInstance *DefaultValueRejectedExecutionHandler
)
/**
* the better way is designing the RejectedExecutionHandler as singleton.
*/
func GetDefaultValueRejectedExecutionHandlerSingleton() filter.RejectedExecutionHandler {
customHandlerOnce.Do(func() {
customHandlerInstance = &DefaultValueRejectedExecutionHandler{}
})
initDefaultValue()
return customHandlerInstance
}
func initDefaultValue() {
// setting your default value
}

@ -0,0 +1,52 @@
package logic
import (
"bytes"
"chain-dci/pkg/msg"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"go.uber.org/zap"
)
type IDci interface {
// DciAddUser 注册DCI账号 每位著作权人 都需要注册此账号
// DciUpdateUser 更新DCI用户信息 著作权人 证件信息更新
// DciQueryUser 查询DCI用户信息 著作权人 信息查询
// DciPreregistration DCI申领 申请版权的作品 需要 先进行 DCI申领 获取到 DCI作品ID
// DciQueryPreregistration 查询dci申领信息 通过 DCI作品ID 获取到 DCI申领的详细信息
// DciQueryPreregPublication 查询dci申领公示地址
// DciRegistration 发起数登申请 在发起数字版权登记简称数登申请前请先进行DCI申领只有申领完成的DCI才能发起数登申请
// DciQueryRegistration 查询数登申请 用户可通过主动查询的方式获取数登结果支持按数登id或发起数登的DCI申领id来查询
// DciGetPayUrl 获取数登支付链接 初审通过后用户通过主动查询的方式获取数登支付链接该接口在北京时间每日06:00-23:00可用支付链接有效期15分钟若支付链接过期可再次调用接口刷新支付链接
// DciQueryPay 数登支付查询 用户完成支付后,通过数登支付查询接口获取支付结果
// DciGetRegistrationCert 获取数登证书下载链接 对于申请成功的数登可通过该接口获取数登证书下载链接数登证书下载次数限制为10次/个/月下载链接有效期为15天
// RetryDigitalRegister 补正申请 对于初审不通过、待补证和待补证审核不通过的数登,请按照反馈原因调整数登申请信息,完成调整后通过补正申请接口对数登进行修改
// CloseDigitalRegister 数登停止申请 对于待补证和待补证审核不通过的数登,如不想进行补正,请调用数登申请停止接口,告知系统申请停止
}
type Dci struct {
}
func createToken(appID, appKey, channelId, userID, nonce string, timestamp int64) (token string, err error) {
var b bytes.Buffer
b.WriteString(appID)
b.WriteString(appKey)
b.WriteString(channelId)
b.WriteString(userID)
b.WriteString(nonce)
b.WriteString(fmt.Sprint(timestamp))
h := sha256.New()
if _, err = h.Write([]byte(b.String())); err != nil {
zap.L().Error("createToken sha256 err", zap.Error(err))
err = errors.New(msg.ErrorSha256Write)
return
}
s := h.Sum(nil)
token = hex.EncodeToString(s)
return
}

@ -0,0 +1,140 @@
package logic
import (
"chain-dci/pb/dci"
"chain-dci/pkg/app"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/jinzhu/copier"
)
type IDciRegistration interface {
CreateDciRegistration(req *dci.CreateDciRegistrationRequest) (res *dci.CreateDciRegistrationResponse, err error)
QueryDciRegistration(req *dci.QueryDciRegistrationRequest) (res *dci.QueryDciRegistrationResponse, err error)
GetDciPayUrl(req *dci.GetDciPayUrlRequest) (res *dci.GetDciPayUrlResponse, err error)
QueryDciPay(req *dci.QueryDciPayRequest) (res *dci.QueryDciPayResponse, err error)
GetDciRegistrationcert(req *dci.GetDciRegistrationcertRequest) (res *dci.GetDciRegistrationcertResponse, err error)
RetryDciRegistration(req *dci.RetryDciRegistrationRequest) (res *dci.RetryDciRegistrationResponse, err error)
CloseDciRegistration(req *dci.CloseDciRegistrationRequest) (res *dci.CloseDciRegistrationResponse, err error)
}
type DciRegistration struct {
}
// CreateDciRegistration 发起数登申请
func (r *DciRegistration) CreateDciRegistration(req *dci.CreateDciRegistrationRequest) (res *dci.CreateDciRegistrationResponse, err error) {
res = new(dci.CreateDciRegistrationResponse)
createDciRegistrationRequest := new(bccrClient.CreateDciRegistrationRequest)
_ = copier.CopyWithOption(&createDciRegistrationRequest, req, copier.Option{DeepCopy: true})
createDciPreregistrationResponse, err := app.ModuleClients.BccrClient.CreateDciRegistration(createDciRegistrationRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, createDciPreregistrationResponse, copier.Option{DeepCopy: true})
return
}
// QueryDciRegistration 查询数登申请
func (r *DciRegistration) QueryDciRegistration(req *dci.QueryDciRegistrationRequest) (res *dci.QueryDciRegistrationResponse, err error) {
res = new(dci.QueryDciRegistrationResponse)
queryDciRegistrationRequest := new(bccrClient.QueryDciRegistrationRequest)
_ = copier.CopyWithOption(&queryDciRegistrationRequest, req, copier.Option{DeepCopy: true})
queryDciRegistrationResponse, err := app.ModuleClients.BccrClient.QueryDciRegistration(queryDciRegistrationRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, queryDciRegistrationResponse, copier.Option{DeepCopy: true})
return
}
// GetDciPayUrl 数登支付链接获取
func (r *DciRegistration) GetDciPayUrl(req *dci.GetDciPayUrlRequest) (res *dci.GetDciPayUrlResponse, err error) {
res = new(dci.GetDciPayUrlResponse)
getDciPayUrlRequest := new(bccrClient.GetDciPayurlRequest)
_ = copier.CopyWithOption(&getDciPayUrlRequest, req, copier.Option{DeepCopy: true})
getDciPayUrlResponse, err := app.ModuleClients.BccrClient.GetDciPayurl(getDciPayUrlRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, getDciPayUrlResponse, copier.Option{DeepCopy: true})
return
}
// QueryDciPay 数登支付查询
func (r *DciRegistration) QueryDciPay(req *dci.QueryDciPayRequest) (res *dci.QueryDciPayResponse, err error) {
res = new(dci.QueryDciPayResponse)
queryDciPayRequest := new(bccrClient.QueryDciPayRequest)
_ = copier.CopyWithOption(&queryDciPayRequest, req, copier.Option{DeepCopy: true})
queryDciPayResponse, err := app.ModuleClients.BccrClient.QueryDciPay(queryDciPayRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, queryDciPayResponse, copier.Option{DeepCopy: true})
return
}
// GetDciRegistrationcert 获取数登证书下载
func (r *DciRegistration) GetDciRegistrationcert(req *dci.GetDciRegistrationcertRequest) (res *dci.GetDciRegistrationcertResponse, err error) {
res = new(dci.GetDciRegistrationcertResponse)
getDciRegistrationcertRequest := new(bccrClient.GetDciRegistrationcertRequest)
_ = copier.CopyWithOption(&getDciRegistrationcertRequest, req, copier.Option{DeepCopy: true})
getDciRegistrationcertResponse, err := app.ModuleClients.BccrClient.GetDciRegistrationcert(getDciRegistrationcertRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, getDciRegistrationcertResponse, copier.Option{DeepCopy: true})
return
}
// RetryDciRegistration 补正申请
func (r *DciRegistration) RetryDciRegistration(req *dci.RetryDciRegistrationRequest) (res *dci.RetryDciRegistrationResponse, err error) {
res = new(dci.RetryDciRegistrationResponse)
retryDciRegistrationRequest := new(bccrClient.RetryDciRegistrationRequest)
_ = copier.CopyWithOption(&retryDciRegistrationRequest, req, copier.Option{DeepCopy: true})
retryDciRegistrationResponse, err := app.ModuleClients.BccrClient.RetryDciRegistration(retryDciRegistrationRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, retryDciRegistrationResponse, copier.Option{DeepCopy: true})
return
}
// CloseDciRegistration 数登停止申请
func (r *DciRegistration) CloseDciRegistration(req *dci.CloseDciRegistrationRequest) (res *dci.CloseDciRegistrationResponse, err error) {
res = new(dci.CloseDciRegistrationResponse)
closeDciRegistrationRequest := new(bccrClient.CloseDciRegistrationRequest)
_ = copier.CopyWithOption(&closeDciRegistrationRequest, req, copier.Option{DeepCopy: true})
closeDciRegistrationResponse, err := app.ModuleClients.BccrClient.CloseDciRegistration(closeDciRegistrationRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, closeDciRegistrationResponse, copier.Option{DeepCopy: true})
return
}

@ -0,0 +1,68 @@
package logic
import (
"chain-dci/pb/dci"
"chain-dci/pkg/app"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/jinzhu/copier"
)
type IDciUser interface {
AddDciUser(req *dci.AddDciUserRequest) (res *dci.AddDciUserResponse, err error)
UpdateDciUser(req *dci.UpdateDciUserRequest) (res *dci.UpdateDciUserResponse, err error)
QueryDciUser(req *dci.QueryDciUserRequest) (res *dci.QueryDciUserResponse, err error)
}
type DciUser struct {
}
// AddDciUser 著作权人 申领 DCI信息
func (u *DciUser) AddDciUser(req *dci.AddDciUserRequest) (res *dci.AddDciUserResponse, err error) {
res = new(dci.AddDciUserResponse)
addDciUserRequest := new(bccrClient.AddDciUserRequest)
_ = copier.CopyWithOption(&addDciUserRequest, req, copier.Option{DeepCopy: true})
addDciUserResponse, err := app.ModuleClients.BccrClient.AddDciUser(addDciUserRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, addDciUserResponse, copier.Option{DeepCopy: true})
return
}
// UpdateDciUser 著作权人 更新 DCI信息
func (u *DciUser) UpdateDciUser(req *dci.UpdateDciUserRequest) (res *dci.UpdateDciUserResponse, err error) {
res = new(dci.UpdateDciUserResponse)
updateDciUserRequest := new(bccrClient.UpdateDciUserRequest)
_ = copier.CopyWithOption(&updateDciUserRequest, req, copier.Option{DeepCopy: true})
updateDciUserResponse, err := app.ModuleClients.BccrClient.UpdateDciUser(updateDciUserRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, updateDciUserResponse, copier.Option{DeepCopy: true})
return
}
// QueryDciUser 著作权人 查询 DCI信息
func (u *DciUser) QueryDciUser(req *dci.QueryDciUserRequest) (res *dci.QueryDciUserResponse, err error) {
res = new(dci.QueryDciUserResponse)
queryDciUserRequest := new(bccrClient.QueryDciUserRequest)
_ = copier.CopyWithOption(&queryDciUserRequest, req, copier.Option{DeepCopy: true})
queryDciUserResponse, err := app.ModuleClients.BccrClient.QueryDciUser(queryDciUserRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, queryDciUserResponse, copier.Option{DeepCopy: true})
return
}

@ -0,0 +1,50 @@
package logic
import (
"chain-dci/pb/dci"
"chain-dci/pkg/app"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/jinzhu/copier"
)
type IDciWork interface {
CreateDciPreregistration(req *dci.CreateDciPreregistrationRequest) (res *dci.CreateDciPreregistrationResponse, err error)
QueryDciPreregistration(req *dci.QueryDciPreregistrationRequest) (res *dci.QueryDciPreregistrationResponse, err error)
}
type DciWork struct {
}
// CreateDciPreregistration 作品 申领 DCI
func (w *DciWork) CreateDciPreregistration(req *dci.CreateDciPreregistrationRequest) (res *dci.CreateDciPreregistrationResponse, err error) {
res = new(dci.CreateDciPreregistrationResponse)
createDciPreregistrationRequest := new(bccrClient.CreateDciPreregistrationRequest)
_ = copier.CopyWithOption(&createDciPreregistrationRequest, req, copier.Option{DeepCopy: true})
createDciPreregistrationResponse, err := app.ModuleClients.BccrClient.CreateDciPreregistration(createDciPreregistrationRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, createDciPreregistrationResponse, copier.Option{DeepCopy: true})
return
}
// QueryDciPreregistration 作品 查询 DCI
func (w *DciWork) QueryDciPreregistration(req *dci.QueryDciPreregistrationRequest) (res *dci.QueryDciPreregistrationResponse, err error) {
res = new(dci.QueryDciPreregistrationResponse)
queryDciPreregistrationRequest := new(bccrClient.QueryDciPreregistrationRequest)
_ = copier.CopyWithOption(&queryDciPreregistrationRequest, req, copier.Option{DeepCopy: true})
queryDciPreregistrationResponse, err := app.ModuleClients.BccrClient.QueryDciPreregistration(queryDciPreregistrationRequest)
if err != nil {
return nil, err
}
_ = copier.CopyWithOption(&res, queryDciPreregistrationResponse, copier.Option{DeepCopy: true})
return
}

@ -0,0 +1,85 @@
package logic
import (
"chain-dci/pb/dci"
"chain-dci/pkg/app"
errCommon "chain-dci/pkg/err"
"chain-dci/pkg/utils"
"encoding/base64"
"github.com/alibabacloud-go/tea/tea"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/jinzhu/copier"
"strings"
"unicode"
)
type IFile interface {
Upload(request *dci.GetUploadUrlRequest) error
}
type File struct {
}
/*
API
GetUploadUrl
访 oss, 使 utf-8 URL
*/
func GetUploadUrl(req *bccrClient.GetUploadurlRequest) (result *bccrClient.GetUploadurlResponse) {
result, err := app.ModuleClients.BccrClient.GetUploadurl(req)
if err != nil {
errCommon.NoReturnError(err, "调用 蚂蚁链获取 oss url 错误:")
return
}
return
}
/*
API
Upload
*/
func (f *File) Upload(req *dci.GetUploadUrlRequest) (res *dci.GetUploadUrlResponse, err error) {
isChinese := false
getUploadUrlRequest := new(bccrClient.GetUploadurlRequest)
var fileName string
// 拆分 文件名 和 文件链接
fileArr := strings.Split(req.FileName, "/")
fileNameWithSuffix := strings.Split(fileArr[len(fileArr)-1], ".")
fileName = fileNameWithSuffix[0]
// 如果文件名包含 中文 则需要对 fileName 进行 utf-8 字符集进行 URL编码
for _, c := range fileName {
if unicode.Is(unicode.Scripts["Han"], c) {
isChinese = true
}
}
if isChinese {
getUploadUrlRequest.SetFileName(base64.URLEncoding.EncodeToString([]byte(fileName)))
} else {
getUploadUrlRequest.SetFileName(fileName)
}
getUploadUrlResponse := GetUploadUrl(getUploadUrlRequest)
//res = serializer.UploadUrlResponseToRpc(getUploadUrlResponse)
res = new(dci.GetUploadUrlResponse)
_ = copier.CopyWithOption(&res, getUploadUrlResponse, copier.Option{DeepCopy: true})
if tea.ToString(getUploadUrlResponse.ResultCode) != "OK" {
return res, errCommon.ReturnError(err, err.Error(), "获取授权访问OSS链接 错误:")
}
if tea.ToString(getUploadUrlResponse.Url) == "" || tea.ToString(getUploadUrlResponse.FileId) == "" {
return res, errCommon.ReturnError(err, err.Error(), "获取授权访问OSS链接 错误:")
}
code, result := utils.PutFromFileUrlWithStream(tea.ToString(res.Url), fileName, req.FileName)
if code != 200 {
return res, errCommon.ReturnError(err, result, "上传文件 错误:")
}
return
}

@ -0,0 +1 @@
package model

@ -0,0 +1 @@
package serializer

@ -0,0 +1,17 @@
package serializer
import (
"chain-dci/pb/dci"
"github.com/alibabacloud-go/tea/tea"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
)
func UploadUrlResponseToRpc(in *bccrClient.GetUploadurlResponse) (out *dci.GetUploadUrlResponse) {
out = new(dci.GetUploadUrlResponse)
out.ReqMsgId = tea.ToString(in.ReqMsgId)
out.ResultMsg = tea.ToString(in.ResultMsg)
out.ResultCode = tea.ToString(in.ResultCode)
out.Url = tea.ToString(in.Url)
out.FileId = tea.ToString(in.FileId)
return
}

@ -0,0 +1,321 @@
syntax = "proto3";
package dci;
option go_package = "./dci";
import "pb/descriptor.proto";
import "pb/validator.proto";
service Dci {
//
rpc GetUploadUrl(GetUploadUrlRequest) returns (GetUploadUrlResponse);
// dci user
rpc AddDciUser(AddDciUserRequest) returns (AddDciUserResponse);
rpc UpdateDciUser(UpdateDciUserRequest) returns (UpdateDciUserResponse);
rpc QueryDciUser(QueryDciUserRequest) returns (QueryDciUserResponse);
// dci work
rpc CreateDciPreregistration(CreateDciPreregistrationRequest) returns (CreateDciPreregistrationResponse);
rpc QueryDciPreregistration(QueryDciPreregistrationRequest) returns (QueryDciPreregistrationResponse);
// rpc RetryDciPreregistration(RetryDciPreregistrationRequest) returns ();
//
rpc CreateDciRegistration(CreateDciRegistrationRequest) returns (CreateDciRegistrationResponse); //
rpc QueryDciRegistration(QueryDciRegistrationRequest) returns (QueryDciRegistrationResponse); //
rpc GetDciPayUrl(GetDciPayUrlRequest) returns (GetDciPayUrlResponse); //
rpc QueryDciPay(QueryDciPayRequest) returns (QueryDciPayResponse); //
rpc GetDciRegistrationcert(GetDciRegistrationcertRequest) returns (GetDciRegistrationcertResponse); //
rpc RetryDciRegistration(RetryDciRegistrationRequest) returns (RetryDciRegistrationResponse); //
rpc CloseDciRegistration(CloseDciRegistrationRequest) returns (CloseDciRegistrationResponse); //
}
// oss
message GetUploadUrlRequest {
string authToken = 1 [json_name = "authToken"];
string productInstanceId = 2 [json_name = "productInstanceId"];
string fileName = 3 [json_name = "fileName",(validator.field) = {string_not_empty: true,human_error:"文件不能为空"}]; // ,
string clientToken = 4 [json_name = "clientToken"];
}
message GetUploadUrlResponse {
string reqMsgId = 1 [json_name = "reqMsgId"];
string resultCode = 2 [json_name = "resultCode"];
string resultMsg = 3 [json_name = "resultMsg"];
string url = 4 [json_name = "url"];
string fileId = 5 [json_name = "fileId"];
}
// Dci user
message AddDciUserRequest {
string certName = 1 [json_name = "certName",(validator.field) = {string_not_empty: true,human_error:"证件名称不能为空"}];
string certificateNumber = 2 [json_name = "certificateNumber",(validator.field) = {string_not_empty: true,human_error:"证件号码不能为空"}];
string certificateType = 3 [json_name = "certificateType",(validator.field) = {string_not_empty: true,human_error:"证件类型不能为空"}];
string certificateFrontFileId = 4 [json_name = "certificateFrontFileId",(validator.field) = {string_not_empty: true,human_error:"证件正面文件路径不能为空"}];
string certificateBackFileId = 5 [json_name = "certificateBackFileId"];
string legalPersonCertName = 6 [json_name = "legalPersonCertName"];
string legalPersonCertType = 7 [json_name = "legalPersonCertType"];
string legalPersonCertNo = 8 [json_name = "legalPersonCertNo"];
string phone = 9 [json_name = "phone",(validator.field) = {string_not_empty: true,human_error:"手机号不能为空"}];
string areaType = 10 [json_name = "areaType",(validator.field) = {string_not_empty: true,human_error:"所属地区不能为空"}];
string clientToken = 11 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message AddDciUserResponse {
string dciUserId = 1 [json_name = "dciUserId"];
string dciUserStatus = 2 [json_name = "dciUserStatus"];
string resultCode = 3 [json_name = "resultCode"];
string resultMsg = 4 [json_name = "resultMsg"];
string reqMsgId = 5 [json_name = "reqMsgId"];
}
// Dci user
message UpdateDciUserRequest {
string dciUserId = 1 [json_name = "dciUserId",(validator.field) = {string_not_empty: true,human_error:"dci用户ID不能为空"}];
string certFrontFileId = 2 [json_name = "certFrontFileId",(validator.field) = {string_not_empty: true,human_error:"证件正面文件路径不能为空"}];
string certBackFileId = 3 [json_name = "certBackFileId"];
string phone = 4 [json_name = "phone"];
string clientToken = 5 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message UpdateDciUserResponse {
string resultCode = 1 [json_name = "resultCode"];
string resultMsg = 2 [json_name = "resultMsg"];
string reqMsgId = 3 [json_name = "reqMsgId"];
}
// Dci user
message QueryDciUserRequest {
string certificateType = 1 [json_name = "certificateType",(validator.field) = {string_not_empty: true,human_error:"证件类型不能为空"}];
string certificateNumber = 2 [json_name = "certificateNumber",(validator.field) = {string_not_empty: true,human_error:"证件号码不能为空"}];
string phone = 3 [json_name = "phone",(validator.field) = {string_not_empty: true,human_error:"手机号不能为空"}];
}
message QueryDciUserResponse {
string dciUserId = 1 [json_name = "dciUserId"];
string dciUserStatus = 2 [json_name = "dciUserStatus"];
string name = 3 [json_name = "name"];
string certificateType = 4 [json_name = "certificateType"];
string certificateNumber = 5 [json_name = "certificateNumber"];
string address = 6 [json_name = "address"];
string certStartTime = 7 [json_name = "certStartTime"];
string certEndTime = 8 [json_name = "certEndTime"];
string legalPerson = 9 [json_name = "legalPerson"];
string resultCode = 10 [json_name = "resultCode"];
string resultMsg = 11 [json_name = "resultMsg"];
string reqMsgId = 12 [json_name = "reqMsgId"];
}
// Dci work
message CreateDciPreregistrationRequest {
string workName = 1 [json_name = "workName",(validator.field) = {string_not_empty: true,length_lt: 51,human_error:"作品名称不能为空"}];
string dciUserId = 2 [json_name = "dciUserId",(validator.field) = {string_not_empty: true,human_error:"DCI用户ID不能为空"}];
string workCategory = 3 [json_name = "workCategory",(validator.field) = {string_not_empty: true,human_error:"作品类型不能为空"}];
string workFileId = 4 [json_name = "workFileId",(validator.field) = {string_not_empty: true,human_error:"作品文件路径不能为空"}];
string fileType = 5 [json_name = "fileType",(validator.field) = {string_not_empty: true,human_error:"文件类型不能为空"}];
DciCreationInfo creationInfo = 6 [json_name = "creationInfo",(validator.field) = {string_not_empty: true,human_error:"创作信息不能为空"}];
DciPublicationInfo publicationInfo = 7 [json_name = "publicationInfo",(validator.field) = {string_not_empty: true,human_error:"发表信息不能为空"}];
string authorName = 8 [json_name = "authorName",(validator.field) = {string_not_empty: true,human_error:"作者姓名不能为空"}];
string authorSignature = 9 [json_name = "authorSignature",(validator.field) = {string_not_empty: true,human_error:"作者署名不能为空"}];
string originalStatement = 10 [json_name = "originalStatement"];
DciRightInfo rightInfo = 11 [json_name = "rightInfo",(validator.field) = {string_not_empty: true,human_error:"权利信息不能为空"}];
string preRegistrationTrueWill = 12 [json_name = "preRegistrationTrueWill",(validator.field) = {string_not_empty: true,human_error:"真实意愿表达信息不能为空"}];
repeated string copyrightOwnerIds = 13 [json_name = "copyrightOwnerIds",(validator.field) = {string_not_empty: true,human_error:"著作权人用户id列表不能为空"}];
string clientToken = 14 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message DciCreationInfo {
string creationNature = 1 [json_name = "creationNature",(validator.field) = {string_not_empty: true,human_error:"作品创作性质不能为空"}];
string creationCompletionDate = 2 [json_name = "creationCompletionDate",(validator.field) = {string_not_empty: true,human_error:"创作完成日期不能为空"}];
string creationCompletionCode = 3 [json_name = "creationCompletionCode",(validator.field) = {string_not_empty: true,human_error:"作品创作地点地区编码不能为空"}];
}
message DciPublicationInfo {
string creationNature = 1 [json_name = "creationNature",(validator.field) = {string_not_empty: true,human_error:"作品发表状态不能为空"}];
string creationCompletionDate = 2 [json_name = "creationCompletionDate",(validator.field) = {string_not_empty: true,human_error:"首次发表日期不能为空"}];
string creationCompletionCode = 3 [json_name = "creationCompletionCode",(validator.field) = {string_not_empty: true,human_error:"首次发表地点地区编码不能为空"}];
}
message DciRightInfo {
string rightScope = 1 [json_name = "rightScope",(validator.field) = {string_not_empty: true,human_error:"作品权利范围不能为空"}];
string rightObtainWay = 2 [json_name = "rightObtainWay",(validator.field) = {string_not_empty: true,human_error:"权利取得方式不能为空"}];
string ownershipWay = 3 [json_name = "ownershipWay",(validator.field) = {string_not_empty: true,human_error:"权利归属方式不能为空"}];
}
message CreateDciPreregistrationResponse {
string dciContentId = 1 [json_name = "dciContentId"];
string resultCode = 2 [json_name = "resultCode"];
string resultMsg = 3 [json_name = "resultMsg"];
string reqMsgId = 4 [json_name = "reqMsgId"];
}
// Dci work
message QueryDciPreregistrationRequest {
string dciContentId = 1 [json_name = "dciContentId",(validator.field) = {string_not_empty: true,human_error:"DCI内容ID不能为空"}];
}
message QueryDciPreregistrationResponse {
string status = 1 [json_name = "status"];
string fileHash = 2 [json_name = "fileHash"];
string fileHashTxHash = 3 [json_name = "fileHashTxHash"];
string fileHashBlockHeight = 4 [json_name = "fileHashBlockHeight"];
string dciCode = 5 [json_name = "dciCode"];
string dciCodeTxHash = 6 [json_name = "dciCodeTxHash"];
string dciCodeBlockHeight = 7 [json_name = "dciCodeBlockHeight"];
string dciCodeFileTxHash = 8 [json_name = "dciCodeFileTxHash"];
string dciCodeFileBlockHeight = 9 [json_name = "dciCodeFileBlockHeight"];
string preRegCertTxHash = 10 [json_name = "preRegCertTxHash"];
string preRegCertBlockHeight = 11 [json_name = "preRegCertBlockHeight"];
string dciCodeTsr = 12 [json_name = "dciCodeTsr"];
string dciCodeFileTsr = 13 [json_name = "dciCodeFileTsr"];
string preRegCertTsr = 14 [json_name = "preRegCertTsr"];
string preRegCertFileHash = 15 [json_name = "preRegCertFileHash"];
string preRegCertUrl = 16 [json_name = "preRegCertUrl"];
string applyObtainDate = 17 [json_name = "applyObtainDate"];
string dciCodeObtainDate = 18 [json_name = "dciCodeObtainDate"];
string errorReason = 19 [json_name = "errorReason"];
string errorReasonCn = 20 [json_name = "errorReasonCn"];
string resultCode = 21 [json_name = "resultCode"];
string resultMsg = 22 [json_name = "resultMsg"];
string reqMsgId = 23 [json_name = "reqMsgId"];
}
// Dci work
//
message CreateDciRegistrationRequest {
string dciContentId = 1 [json_name = "dciContentId",(validator.field) = {string_not_empty: true,human_error:"DCI申领ID不能为空"}];
DciExplanationInfo explanationInfo = 2 [json_name = "explanationInfo",(validator.field) = {string_not_empty: true,human_error:"作品创作说明不能为空"}];
InvoiceInfo invoiceInfo = 3 [json_name = "invoiceInfo",(validator.field) = {string_not_empty: true,human_error:"发票信息不能为空"}];
AdditionalFileInfo additionalFileInfo = 4 [json_name = "additionalFileInfo"];
string clientToken = 5 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message DciExplanationInfo {
string creationPurpose = 1 [json_name = "creationPurpose",(validator.field) = {string_not_empty: true,length_lt: 51,human_error:"创作目的不能为空"}];
string creationProcess = 2 [json_name = "creationProcess",(validator.field) = {string_not_empty: true,length_lt: 86,human_error:"创作过程不能为空"}];
string originality = 3 [json_name = "originality",(validator.field) = {string_not_empty: true,length_lt: 141,human_error:"独创性说明不能为空"}];
string fontCopyright = 4 [json_name = "fontCopyright",(validator.field) = {string_not_empty: true,human_error:"字体声明不能为空"}];
}
message InvoiceInfo {
string invoiceType = 1 [json_name = "invoiceType",(validator.field) = {string_not_empty: true,human_error:"发票类型不能为空"}];
string invoiceHeader = 2 [json_name = "invoiceHeader",(validator.field) = {string_not_empty: true,human_error:"发票抬头不能为空"}];
string taxpayerNumber = 3 [json_name = "taxpayerNumber"];
string registeredAddress = 4 [json_name = "registeredAddress"];
string registeredTel = 5 [json_name = "registeredTel"];
string openAccountTel = 6 [json_name = "openAccountTel"];
string openAccountBank = 7 [json_name = "openAccountBank"];
string bankAccount = 8 [json_name = "bankAccount"];
}
message AdditionalFileInfo {
string contentSummaryFileId = 1 [json_name = "contentSummaryFileId"];
repeated string ownershipFileIds = 2 [json_name = "ownershipFileIds"];
string portraitAuthFileId = 3 [json_name = "portraitAuthFileId"];
string othersWorkAuthFileId = 4 [json_name = "othersWorkAuthFileId"];
repeated string otherFileIdList = 5 [json_name = "otherFileIdList"];
}
message CreateDciRegistrationResponse {
string digitalRegisterId = 1 [json_name = "digitalRegisterId"];
string resultCode = 2 [json_name = "resultCode"];
string resultMsg = 3 [json_name = "resultMsg"];
string reqMsgId = 4 [json_name = "reqMsgId"];
}
//
message QueryDciRegistrationRequest {
string digitalRegisterId = 1 [json_name = "digitalRegisterId"];
string dciContentId = 2 [json_name = "dciContentId"];
}
message QueryDciRegistrationResponse {
string regNumber = 1 [json_name = "regNumber"];
string digitalRegisterId = 2 [json_name = "digitalRegisterId"];
string dciContentId = 3 [json_name = "dciContentId"];
string digitalRegisterStatus = 4 [json_name = "digitalRegisterStatus"];
string digitalRegisterApplyTime = 5 [json_name = "digitalRegisterApplyTime"];
string digitalRegisterCompletionTime = 6 [json_name = "digitalRegisterCompletionTime"];
int64 downloadTimesLeft = 7 [json_name = "downloadTimesLeft"];
repeated string invoiceUrlList = 8 [json_name = "invoiceUrlList"];
string failDetail = 9 [json_name = "failDetail"];
string amendType = 10 [json_name = "amendType"];
string applyFormUrl = 11 [json_name = "applyFormUrl"];
string flowNumber = 12 [json_name = "flowNumber"];
string resultCode = 13 [json_name = "resultCode"];
string resultMsg = 14 [json_name = "resultMsg"];
string reqMsgId = 15 [json_name = "reqMsgId"];
}
//
message GetDciPayUrlRequest {
string digitalRegisterId = 1 [json_name = "digitalRegisterId",(validator.field) = {string_not_empty: true,human_error:"数登申请ID不能为空"}];
string clientToken = 2 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message GetDciPayUrlResponse {
string payUrl = 12 [json_name = "payUrl"];
string resultCode = 13 [json_name = "resultCode"];
string resultMsg = 14 [json_name = "resultMsg"];
string reqMsgId = 15 [json_name = "reqMsgId"];
}
//
message QueryDciPayRequest {
string digitalRegisterId = 1 [json_name = "digitalRegisterId",(validator.field) = {string_not_empty: true,human_error:"数登申请ID不能为空"}];
}
message QueryDciPayResponse {
string payStatus = 12 [json_name = "payStatus"];
string resultCode = 13 [json_name = "resultCode"];
string resultMsg = 14 [json_name = "resultMsg"];
string reqMsgId = 15 [json_name = "reqMsgId"];
}
//
message GetDciRegistrationcertRequest {
string digitalRegisterId = 1 [json_name = "digitalRegisterId",(validator.field) = {string_not_empty: true,human_error:"数登申请ID不能为空"}];
string clientToken = 2 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message GetDciRegistrationcertResponse {
string digitalRegisterStatus = 1 [json_name = "digitalRegisterStatus"];
string downloadUrl = 2 [json_name = "downloadUrl"];
int64 downloadTimesLeft = 3 [json_name = "downloadTimesLeft"];
string failDetail = 4 [json_name = "failDetail"];
string resultCode = 5 [json_name = "resultCode"];
string resultMsg = 6 [json_name = "resultMsg"];
string reqMsgId = 7 [json_name = "reqMsgId"];
}
//
message RetryDciRegistrationRequest {
string digitalRegisterId = 1 [json_name = "digitalRegisterId",(validator.field) = {string_not_empty: true,human_error:"数登申请ID不能为空"}];
string dciContentId = 2 [json_name = "dciContentId"];
DciExplanationInfo explanationInfo = 3 [json_name = "explanationInfo"];
AdditionalFileInfo additionalFileInfo = 4 [json_name = "additionalFileInfo"];
string clientToken = 5 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message RetryDciRegistrationResponse {
string resultCode = 1 [json_name = "resultCode"];
string resultMsg = 2 [json_name = "resultMsg"];
string reqMsgId = 3 [json_name = "reqMsgId"];
}
//
message CloseDciRegistrationRequest {
string digitalRegisterId = 1 [json_name = "digitalRegisterId",(validator.field) = {string_not_empty: true,human_error:"数登申请ID不能为空"}];
string name = 2 [json_name = "name",(validator.field) = {string_not_empty: true,length_lt: 41,human_error:"退费人名称不能为空"}];
string mobileNo = 3 [json_name = "mobileNo",(validator.field) = {string_not_empty: true,human_error:"联系手机号不能为空"}];
string clientToken = 5 [json_name = "clientToken",(validator.field) = {string_not_empty: true,human_error:"客户端token不能为空"}];
}
message CloseDciRegistrationResponse {
string resultCode = 1 [json_name = "resultCode"];
string resultMsg = 2 [json_name = "resultMsg"];
string reqMsgId = 3 [json_name = "reqMsgId"];
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,331 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: pb/dci.proto
package dci
import (
fmt "fmt"
math "math"
proto "github.com/golang/protobuf/proto"
_ "google.golang.org/protobuf/types/descriptorpb"
_ "github.com/mwitkow/go-proto-validators"
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func (this *GetUploadUrlRequest) Validate() error {
if this.FileName == "" {
return github_com_mwitkow_go_proto_validators.FieldError("FileName", fmt.Errorf(`文件不能为空`))
}
return nil
}
func (this *GetUploadUrlResponse) Validate() error {
return nil
}
func (this *AddDciUserRequest) Validate() error {
if this.CertName == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertName", fmt.Errorf(`证件名称不能为空`))
}
if this.CertificateNumber == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertificateNumber", fmt.Errorf(`证件号码不能为空`))
}
if this.CertificateType == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertificateType", fmt.Errorf(`证件类型不能为空`))
}
if this.CertificateFrontFileId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertificateFrontFileId", fmt.Errorf(`证件正面文件路径不能为空`))
}
if this.Phone == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Phone", fmt.Errorf(`手机号不能为空`))
}
if this.AreaType == "" {
return github_com_mwitkow_go_proto_validators.FieldError("AreaType", fmt.Errorf(`所属地区不能为空`))
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *AddDciUserResponse) Validate() error {
return nil
}
func (this *UpdateDciUserRequest) Validate() error {
if this.DciUserId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DciUserId", fmt.Errorf(`dci用户ID不能为空`))
}
if this.CertFrontFileId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertFrontFileId", fmt.Errorf(`证件正面文件路径不能为空`))
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *UpdateDciUserResponse) Validate() error {
return nil
}
func (this *QueryDciUserRequest) Validate() error {
if this.CertificateType == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertificateType", fmt.Errorf(`证件类型不能为空`))
}
if this.CertificateNumber == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CertificateNumber", fmt.Errorf(`证件号码不能为空`))
}
if this.Phone == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Phone", fmt.Errorf(`手机号不能为空`))
}
return nil
}
func (this *QueryDciUserResponse) Validate() error {
return nil
}
func (this *CreateDciPreregistrationRequest) Validate() error {
if this.WorkName == "" {
return github_com_mwitkow_go_proto_validators.FieldError("WorkName", fmt.Errorf(`作品名称不能为空`))
}
if !(len(this.WorkName) < 51) {
return github_com_mwitkow_go_proto_validators.FieldError("WorkName", fmt.Errorf(`作品名称不能为空`))
}
if this.DciUserId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DciUserId", fmt.Errorf(`DCI用户ID不能为空`))
}
if this.WorkCategory == "" {
return github_com_mwitkow_go_proto_validators.FieldError("WorkCategory", fmt.Errorf(`作品类型不能为空`))
}
if this.WorkFileId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("WorkFileId", fmt.Errorf(`作品文件路径不能为空`))
}
if this.FileType == "" {
return github_com_mwitkow_go_proto_validators.FieldError("FileType", fmt.Errorf(`文件类型不能为空`))
}
if this.CreationInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.CreationInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("CreationInfo", err)
}
}
if this.PublicationInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PublicationInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("PublicationInfo", err)
}
}
if this.AuthorName == "" {
return github_com_mwitkow_go_proto_validators.FieldError("AuthorName", fmt.Errorf(`作者姓名不能为空`))
}
if this.AuthorSignature == "" {
return github_com_mwitkow_go_proto_validators.FieldError("AuthorSignature", fmt.Errorf(`作者署名不能为空`))
}
if this.RightInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.RightInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("RightInfo", err)
}
}
if this.PreRegistrationTrueWill == "" {
return github_com_mwitkow_go_proto_validators.FieldError("PreRegistrationTrueWill", fmt.Errorf(`真实意愿表达信息不能为空`))
}
for _, item := range this.CopyrightOwnerIds {
if item == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CopyrightOwnerIds", fmt.Errorf(`著作权人用户id列表不能为空`))
}
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *DciCreationInfo) Validate() error {
if this.CreationNature == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationNature", fmt.Errorf(`作品创作性质不能为空`))
}
if this.CreationCompletionDate == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationCompletionDate", fmt.Errorf(`创作完成日期不能为空`))
}
if this.CreationCompletionCode == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationCompletionCode", fmt.Errorf(`作品创作地点地区编码不能为空`))
}
return nil
}
func (this *DciPublicationInfo) Validate() error {
if this.CreationNature == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationNature", fmt.Errorf(`作品发表状态不能为空`))
}
if this.CreationCompletionDate == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationCompletionDate", fmt.Errorf(`首次发表日期不能为空`))
}
if this.CreationCompletionCode == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationCompletionCode", fmt.Errorf(`首次发表地点地区编码不能为空`))
}
return nil
}
func (this *DciRightInfo) Validate() error {
if this.RightScope == "" {
return github_com_mwitkow_go_proto_validators.FieldError("RightScope", fmt.Errorf(`作品权利范围不能为空`))
}
if this.RightObtainWay == "" {
return github_com_mwitkow_go_proto_validators.FieldError("RightObtainWay", fmt.Errorf(`权利取得方式不能为空`))
}
if this.OwnershipWay == "" {
return github_com_mwitkow_go_proto_validators.FieldError("OwnershipWay", fmt.Errorf(`权利归属方式不能为空`))
}
return nil
}
func (this *CreateDciPreregistrationResponse) Validate() error {
return nil
}
func (this *QueryDciPreregistrationRequest) Validate() error {
if this.DciContentId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DciContentId", fmt.Errorf(`DCI内容ID不能为空`))
}
return nil
}
func (this *QueryDciPreregistrationResponse) Validate() error {
return nil
}
func (this *CreateDciRegistrationRequest) Validate() error {
if this.DciContentId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DciContentId", fmt.Errorf(`DCI申领ID不能为空`))
}
if this.ExplanationInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ExplanationInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ExplanationInfo", err)
}
}
if this.InvoiceInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.InvoiceInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("InvoiceInfo", err)
}
}
if this.AdditionalFileInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AdditionalFileInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("AdditionalFileInfo", err)
}
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *DciExplanationInfo) Validate() error {
if this.CreationPurpose == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationPurpose", fmt.Errorf(`创作目的不能为空`))
}
if !(len(this.CreationPurpose) < 51) {
return github_com_mwitkow_go_proto_validators.FieldError("CreationPurpose", fmt.Errorf(`创作目的不能为空`))
}
if this.CreationProcess == "" {
return github_com_mwitkow_go_proto_validators.FieldError("CreationProcess", fmt.Errorf(`创作过程不能为空`))
}
if !(len(this.CreationProcess) < 86) {
return github_com_mwitkow_go_proto_validators.FieldError("CreationProcess", fmt.Errorf(`创作过程不能为空`))
}
if this.Originality == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Originality", fmt.Errorf(`独创性说明不能为空`))
}
if !(len(this.Originality) < 141) {
return github_com_mwitkow_go_proto_validators.FieldError("Originality", fmt.Errorf(`独创性说明不能为空`))
}
if this.FontCopyright == "" {
return github_com_mwitkow_go_proto_validators.FieldError("FontCopyright", fmt.Errorf(`字体声明不能为空`))
}
return nil
}
func (this *InvoiceInfo) Validate() error {
if this.InvoiceType == "" {
return github_com_mwitkow_go_proto_validators.FieldError("InvoiceType", fmt.Errorf(`发票类型不能为空`))
}
if this.InvoiceHeader == "" {
return github_com_mwitkow_go_proto_validators.FieldError("InvoiceHeader", fmt.Errorf(`发票抬头不能为空`))
}
return nil
}
func (this *AdditionalFileInfo) Validate() error {
return nil
}
func (this *CreateDciRegistrationResponse) Validate() error {
return nil
}
func (this *QueryDciRegistrationRequest) Validate() error {
return nil
}
func (this *QueryDciRegistrationResponse) Validate() error {
return nil
}
func (this *GetDciPayUrlRequest) Validate() error {
if this.DigitalRegisterId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DigitalRegisterId", fmt.Errorf(`数登申请ID不能为空`))
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *GetDciPayUrlResponse) Validate() error {
return nil
}
func (this *QueryDciPayRequest) Validate() error {
if this.DigitalRegisterId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DigitalRegisterId", fmt.Errorf(`数登申请ID不能为空`))
}
return nil
}
func (this *QueryDciPayResponse) Validate() error {
return nil
}
func (this *GetDciRegistrationcertRequest) Validate() error {
if this.DigitalRegisterId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DigitalRegisterId", fmt.Errorf(`数登申请ID不能为空`))
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *GetDciRegistrationcertResponse) Validate() error {
return nil
}
func (this *RetryDciRegistrationRequest) Validate() error {
if this.DigitalRegisterId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DigitalRegisterId", fmt.Errorf(`数登申请ID不能为空`))
}
if this.ExplanationInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.ExplanationInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("ExplanationInfo", err)
}
}
if this.AdditionalFileInfo != nil {
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AdditionalFileInfo); err != nil {
return github_com_mwitkow_go_proto_validators.FieldError("AdditionalFileInfo", err)
}
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *RetryDciRegistrationResponse) Validate() error {
return nil
}
func (this *CloseDciRegistrationRequest) Validate() error {
if this.DigitalRegisterId == "" {
return github_com_mwitkow_go_proto_validators.FieldError("DigitalRegisterId", fmt.Errorf(`数登申请ID不能为空`))
}
if this.Name == "" {
return github_com_mwitkow_go_proto_validators.FieldError("Name", fmt.Errorf(`退费人名称不能为空`))
}
if !(len(this.Name) < 41) {
return github_com_mwitkow_go_proto_validators.FieldError("Name", fmt.Errorf(`退费人名称不能为空`))
}
if this.MobileNo == "" {
return github_com_mwitkow_go_proto_validators.FieldError("MobileNo", fmt.Errorf(`联系手机号不能为空`))
}
if this.ClientToken == "" {
return github_com_mwitkow_go_proto_validators.FieldError("ClientToken", fmt.Errorf(`客户端token不能为空`))
}
return nil
}
func (this *CloseDciRegistrationResponse) Validate() error {
return nil
}

@ -0,0 +1,695 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v3.21.4
// source: pb/dci.proto
package dci
import (
context "context"
protocol "dubbo.apache.org/dubbo-go/v3/protocol"
dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
grpc_go "github.com/dubbogo/grpc-go"
codes "github.com/dubbogo/grpc-go/codes"
metadata "github.com/dubbogo/grpc-go/metadata"
status "github.com/dubbogo/grpc-go/status"
common "github.com/dubbogo/triple/pkg/common"
constant "github.com/dubbogo/triple/pkg/common/constant"
triple "github.com/dubbogo/triple/pkg/triple"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc_go.SupportPackageIsVersion7
// DciClient is the client API for Dci 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 DciClient interface {
// 通用接口 用于文件上传
GetUploadUrl(ctx context.Context, in *GetUploadUrlRequest, opts ...grpc_go.CallOption) (*GetUploadUrlResponse, common.ErrorWithAttachment)
// dci user
AddDciUser(ctx context.Context, in *AddDciUserRequest, opts ...grpc_go.CallOption) (*AddDciUserResponse, common.ErrorWithAttachment)
UpdateDciUser(ctx context.Context, in *UpdateDciUserRequest, opts ...grpc_go.CallOption) (*UpdateDciUserResponse, common.ErrorWithAttachment)
QueryDciUser(ctx context.Context, in *QueryDciUserRequest, opts ...grpc_go.CallOption) (*QueryDciUserResponse, common.ErrorWithAttachment)
// dci work
CreateDciPreregistration(ctx context.Context, in *CreateDciPreregistrationRequest, opts ...grpc_go.CallOption) (*CreateDciPreregistrationResponse, common.ErrorWithAttachment)
QueryDciPreregistration(ctx context.Context, in *QueryDciPreregistrationRequest, opts ...grpc_go.CallOption) (*QueryDciPreregistrationResponse, common.ErrorWithAttachment)
// 数登
CreateDciRegistration(ctx context.Context, in *CreateDciRegistrationRequest, opts ...grpc_go.CallOption) (*CreateDciRegistrationResponse, common.ErrorWithAttachment)
QueryDciRegistration(ctx context.Context, in *QueryDciRegistrationRequest, opts ...grpc_go.CallOption) (*QueryDciRegistrationResponse, common.ErrorWithAttachment)
GetDciPayUrl(ctx context.Context, in *GetDciPayUrlRequest, opts ...grpc_go.CallOption) (*GetDciPayUrlResponse, common.ErrorWithAttachment)
QueryDciPay(ctx context.Context, in *QueryDciPayRequest, opts ...grpc_go.CallOption) (*QueryDciPayResponse, common.ErrorWithAttachment)
GetDciRegistrationcert(ctx context.Context, in *GetDciRegistrationcertRequest, opts ...grpc_go.CallOption) (*GetDciRegistrationcertResponse, common.ErrorWithAttachment)
RetryDciRegistration(ctx context.Context, in *RetryDciRegistrationRequest, opts ...grpc_go.CallOption) (*RetryDciRegistrationResponse, common.ErrorWithAttachment)
CloseDciRegistration(ctx context.Context, in *CloseDciRegistrationRequest, opts ...grpc_go.CallOption) (*CloseDciRegistrationResponse, common.ErrorWithAttachment)
}
type dciClient struct {
cc *triple.TripleConn
}
type DciClientImpl struct {
GetUploadUrl func(ctx context.Context, in *GetUploadUrlRequest) (*GetUploadUrlResponse, error)
AddDciUser func(ctx context.Context, in *AddDciUserRequest) (*AddDciUserResponse, error)
UpdateDciUser func(ctx context.Context, in *UpdateDciUserRequest) (*UpdateDciUserResponse, error)
QueryDciUser func(ctx context.Context, in *QueryDciUserRequest) (*QueryDciUserResponse, error)
CreateDciPreregistration func(ctx context.Context, in *CreateDciPreregistrationRequest) (*CreateDciPreregistrationResponse, error)
QueryDciPreregistration func(ctx context.Context, in *QueryDciPreregistrationRequest) (*QueryDciPreregistrationResponse, error)
CreateDciRegistration func(ctx context.Context, in *CreateDciRegistrationRequest) (*CreateDciRegistrationResponse, error)
QueryDciRegistration func(ctx context.Context, in *QueryDciRegistrationRequest) (*QueryDciRegistrationResponse, error)
GetDciPayUrl func(ctx context.Context, in *GetDciPayUrlRequest) (*GetDciPayUrlResponse, error)
QueryDciPay func(ctx context.Context, in *QueryDciPayRequest) (*QueryDciPayResponse, error)
GetDciRegistrationcert func(ctx context.Context, in *GetDciRegistrationcertRequest) (*GetDciRegistrationcertResponse, error)
RetryDciRegistration func(ctx context.Context, in *RetryDciRegistrationRequest) (*RetryDciRegistrationResponse, error)
CloseDciRegistration func(ctx context.Context, in *CloseDciRegistrationRequest) (*CloseDciRegistrationResponse, error)
}
func (c *DciClientImpl) GetDubboStub(cc *triple.TripleConn) DciClient {
return NewDciClient(cc)
}
func (c *DciClientImpl) XXX_InterfaceName() string {
return "dci.Dci"
}
func NewDciClient(cc *triple.TripleConn) DciClient {
return &dciClient{cc}
}
func (c *dciClient) GetUploadUrl(ctx context.Context, in *GetUploadUrlRequest, opts ...grpc_go.CallOption) (*GetUploadUrlResponse, common.ErrorWithAttachment) {
out := new(GetUploadUrlResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetUploadUrl", in, out)
}
func (c *dciClient) AddDciUser(ctx context.Context, in *AddDciUserRequest, opts ...grpc_go.CallOption) (*AddDciUserResponse, common.ErrorWithAttachment) {
out := new(AddDciUserResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/AddDciUser", in, out)
}
func (c *dciClient) UpdateDciUser(ctx context.Context, in *UpdateDciUserRequest, opts ...grpc_go.CallOption) (*UpdateDciUserResponse, common.ErrorWithAttachment) {
out := new(UpdateDciUserResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateDciUser", in, out)
}
func (c *dciClient) QueryDciUser(ctx context.Context, in *QueryDciUserRequest, opts ...grpc_go.CallOption) (*QueryDciUserResponse, common.ErrorWithAttachment) {
out := new(QueryDciUserResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/QueryDciUser", in, out)
}
func (c *dciClient) CreateDciPreregistration(ctx context.Context, in *CreateDciPreregistrationRequest, opts ...grpc_go.CallOption) (*CreateDciPreregistrationResponse, common.ErrorWithAttachment) {
out := new(CreateDciPreregistrationResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateDciPreregistration", in, out)
}
func (c *dciClient) QueryDciPreregistration(ctx context.Context, in *QueryDciPreregistrationRequest, opts ...grpc_go.CallOption) (*QueryDciPreregistrationResponse, common.ErrorWithAttachment) {
out := new(QueryDciPreregistrationResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/QueryDciPreregistration", in, out)
}
func (c *dciClient) CreateDciRegistration(ctx context.Context, in *CreateDciRegistrationRequest, opts ...grpc_go.CallOption) (*CreateDciRegistrationResponse, common.ErrorWithAttachment) {
out := new(CreateDciRegistrationResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateDciRegistration", in, out)
}
func (c *dciClient) QueryDciRegistration(ctx context.Context, in *QueryDciRegistrationRequest, opts ...grpc_go.CallOption) (*QueryDciRegistrationResponse, common.ErrorWithAttachment) {
out := new(QueryDciRegistrationResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/QueryDciRegistration", in, out)
}
func (c *dciClient) GetDciPayUrl(ctx context.Context, in *GetDciPayUrlRequest, opts ...grpc_go.CallOption) (*GetDciPayUrlResponse, common.ErrorWithAttachment) {
out := new(GetDciPayUrlResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetDciPayUrl", in, out)
}
func (c *dciClient) QueryDciPay(ctx context.Context, in *QueryDciPayRequest, opts ...grpc_go.CallOption) (*QueryDciPayResponse, common.ErrorWithAttachment) {
out := new(QueryDciPayResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/QueryDciPay", in, out)
}
func (c *dciClient) GetDciRegistrationcert(ctx context.Context, in *GetDciRegistrationcertRequest, opts ...grpc_go.CallOption) (*GetDciRegistrationcertResponse, common.ErrorWithAttachment) {
out := new(GetDciRegistrationcertResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetDciRegistrationcert", in, out)
}
func (c *dciClient) RetryDciRegistration(ctx context.Context, in *RetryDciRegistrationRequest, opts ...grpc_go.CallOption) (*RetryDciRegistrationResponse, common.ErrorWithAttachment) {
out := new(RetryDciRegistrationResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/RetryDciRegistration", in, out)
}
func (c *dciClient) CloseDciRegistration(ctx context.Context, in *CloseDciRegistrationRequest, opts ...grpc_go.CallOption) (*CloseDciRegistrationResponse, common.ErrorWithAttachment) {
out := new(CloseDciRegistrationResponse)
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CloseDciRegistration", in, out)
}
// DciServer is the server API for Dci service.
// All implementations must embed UnimplementedDciServer
// for forward compatibility
type DciServer interface {
// 通用接口 用于文件上传
GetUploadUrl(context.Context, *GetUploadUrlRequest) (*GetUploadUrlResponse, error)
// dci user
AddDciUser(context.Context, *AddDciUserRequest) (*AddDciUserResponse, error)
UpdateDciUser(context.Context, *UpdateDciUserRequest) (*UpdateDciUserResponse, error)
QueryDciUser(context.Context, *QueryDciUserRequest) (*QueryDciUserResponse, error)
// dci work
CreateDciPreregistration(context.Context, *CreateDciPreregistrationRequest) (*CreateDciPreregistrationResponse, error)
QueryDciPreregistration(context.Context, *QueryDciPreregistrationRequest) (*QueryDciPreregistrationResponse, error)
// 数登
CreateDciRegistration(context.Context, *CreateDciRegistrationRequest) (*CreateDciRegistrationResponse, error)
QueryDciRegistration(context.Context, *QueryDciRegistrationRequest) (*QueryDciRegistrationResponse, error)
GetDciPayUrl(context.Context, *GetDciPayUrlRequest) (*GetDciPayUrlResponse, error)
QueryDciPay(context.Context, *QueryDciPayRequest) (*QueryDciPayResponse, error)
GetDciRegistrationcert(context.Context, *GetDciRegistrationcertRequest) (*GetDciRegistrationcertResponse, error)
RetryDciRegistration(context.Context, *RetryDciRegistrationRequest) (*RetryDciRegistrationResponse, error)
CloseDciRegistration(context.Context, *CloseDciRegistrationRequest) (*CloseDciRegistrationResponse, error)
mustEmbedUnimplementedDciServer()
}
// UnimplementedDciServer must be embedded to have forward compatible implementations.
type UnimplementedDciServer struct {
proxyImpl protocol.Invoker
}
func (UnimplementedDciServer) GetUploadUrl(context.Context, *GetUploadUrlRequest) (*GetUploadUrlResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUploadUrl not implemented")
}
func (UnimplementedDciServer) AddDciUser(context.Context, *AddDciUserRequest) (*AddDciUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddDciUser not implemented")
}
func (UnimplementedDciServer) UpdateDciUser(context.Context, *UpdateDciUserRequest) (*UpdateDciUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateDciUser not implemented")
}
func (UnimplementedDciServer) QueryDciUser(context.Context, *QueryDciUserRequest) (*QueryDciUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryDciUser not implemented")
}
func (UnimplementedDciServer) CreateDciPreregistration(context.Context, *CreateDciPreregistrationRequest) (*CreateDciPreregistrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateDciPreregistration not implemented")
}
func (UnimplementedDciServer) QueryDciPreregistration(context.Context, *QueryDciPreregistrationRequest) (*QueryDciPreregistrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryDciPreregistration not implemented")
}
func (UnimplementedDciServer) CreateDciRegistration(context.Context, *CreateDciRegistrationRequest) (*CreateDciRegistrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateDciRegistration not implemented")
}
func (UnimplementedDciServer) QueryDciRegistration(context.Context, *QueryDciRegistrationRequest) (*QueryDciRegistrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryDciRegistration not implemented")
}
func (UnimplementedDciServer) GetDciPayUrl(context.Context, *GetDciPayUrlRequest) (*GetDciPayUrlResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDciPayUrl not implemented")
}
func (UnimplementedDciServer) QueryDciPay(context.Context, *QueryDciPayRequest) (*QueryDciPayResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method QueryDciPay not implemented")
}
func (UnimplementedDciServer) GetDciRegistrationcert(context.Context, *GetDciRegistrationcertRequest) (*GetDciRegistrationcertResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDciRegistrationcert not implemented")
}
func (UnimplementedDciServer) RetryDciRegistration(context.Context, *RetryDciRegistrationRequest) (*RetryDciRegistrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RetryDciRegistration not implemented")
}
func (UnimplementedDciServer) CloseDciRegistration(context.Context, *CloseDciRegistrationRequest) (*CloseDciRegistrationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CloseDciRegistration not implemented")
}
func (s *UnimplementedDciServer) XXX_SetProxyImpl(impl protocol.Invoker) {
s.proxyImpl = impl
}
func (s *UnimplementedDciServer) XXX_GetProxyImpl() protocol.Invoker {
return s.proxyImpl
}
func (s *UnimplementedDciServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
return &Dci_ServiceDesc
}
func (s *UnimplementedDciServer) XXX_InterfaceName() string {
return "dci.Dci"
}
func (UnimplementedDciServer) mustEmbedUnimplementedDciServer() {}
// UnsafeDciServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DciServer will
// result in compilation errors.
type UnsafeDciServer interface {
mustEmbedUnimplementedDciServer()
}
func RegisterDciServer(s grpc_go.ServiceRegistrar, srv DciServer) {
s.RegisterService(&Dci_ServiceDesc, srv)
}
func _Dci_GetUploadUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUploadUrlRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("GetUploadUrl", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_AddDciUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(AddDciUserRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("AddDciUser", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_UpdateDciUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateDciUserRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("UpdateDciUser", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_QueryDciUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDciUserRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("QueryDciUser", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_CreateDciPreregistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateDciPreregistrationRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("CreateDciPreregistration", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_QueryDciPreregistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDciPreregistrationRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("QueryDciPreregistration", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_CreateDciRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateDciRegistrationRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("CreateDciRegistration", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_QueryDciRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDciRegistrationRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("QueryDciRegistration", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_GetDciPayUrl_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDciPayUrlRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("GetDciPayUrl", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_QueryDciPay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDciPayRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("QueryDciPay", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_GetDciRegistrationcert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDciRegistrationcertRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("GetDciRegistrationcert", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_RetryDciRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(RetryDciRegistrationRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("RetryDciRegistration", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
func _Dci_CloseDciRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
in := new(CloseDciRegistrationRequest)
if err := dec(in); err != nil {
return nil, err
}
base := srv.(dubbo3.Dubbo3GrpcService)
args := []interface{}{}
args = append(args, in)
md, _ := metadata.FromIncomingContext(ctx)
invAttachment := make(map[string]interface{}, len(md))
for k, v := range md {
invAttachment[k] = v
}
invo := invocation.NewRPCInvocation("CloseDciRegistration", args, invAttachment)
if interceptor == nil {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
info := &grpc_go.UnaryServerInfo{
Server: srv,
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
return result, result.Error()
}
return interceptor(ctx, in, info, handler)
}
// Dci_ServiceDesc is the grpc_go.ServiceDesc for Dci service.
// It's only intended for direct use with grpc_go.RegisterService,
// and not to be introspected or modified (even as a copy)
var Dci_ServiceDesc = grpc_go.ServiceDesc{
ServiceName: "dci.Dci",
HandlerType: (*DciServer)(nil),
Methods: []grpc_go.MethodDesc{
{
MethodName: "GetUploadUrl",
Handler: _Dci_GetUploadUrl_Handler,
},
{
MethodName: "AddDciUser",
Handler: _Dci_AddDciUser_Handler,
},
{
MethodName: "UpdateDciUser",
Handler: _Dci_UpdateDciUser_Handler,
},
{
MethodName: "QueryDciUser",
Handler: _Dci_QueryDciUser_Handler,
},
{
MethodName: "CreateDciPreregistration",
Handler: _Dci_CreateDciPreregistration_Handler,
},
{
MethodName: "QueryDciPreregistration",
Handler: _Dci_QueryDciPreregistration_Handler,
},
{
MethodName: "CreateDciRegistration",
Handler: _Dci_CreateDciRegistration_Handler,
},
{
MethodName: "QueryDciRegistration",
Handler: _Dci_QueryDciRegistration_Handler,
},
{
MethodName: "GetDciPayUrl",
Handler: _Dci_GetDciPayUrl_Handler,
},
{
MethodName: "QueryDciPay",
Handler: _Dci_QueryDciPay_Handler,
},
{
MethodName: "GetDciRegistrationcert",
Handler: _Dci_GetDciRegistrationcert_Handler,
},
{
MethodName: "RetryDciRegistration",
Handler: _Dci_RetryDciRegistration_Handler,
},
{
MethodName: "CloseDciRegistration",
Handler: _Dci_CloseDciRegistration_Handler,
},
},
Streams: []grpc_go.StreamDesc{},
Metadata: "pb/dci.proto",
}

@ -0,0 +1,923 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Author: kenton@google.com (Kenton Varda)
// Based on original Protocol Buffers design by
// Sanjay Ghemawat, Jeff Dean, and others.
//
// The messages in this file describe the definitions found in .proto files.
// A valid .proto file can be translated directly to a FileDescriptorProto
// without any other information (e.g. without reading its imports).
syntax = "proto2";
package google.protobuf;
option go_package = "google.golang.org/protobuf/types/descriptorpb";
option java_package = "com.google.protobuf";
option java_outer_classname = "DescriptorProtos";
option csharp_namespace = "Google.Protobuf.Reflection";
option objc_class_prefix = "GPB";
option cc_enable_arenas = true;
// descriptor.proto must be optimized for speed because reflection-based
// algorithms don't work during bootstrapping.
option optimize_for = SPEED;
// The protocol compiler can output a FileDescriptorSet containing the .proto
// files it parses.
message FileDescriptorSet {
repeated FileDescriptorProto file = 1;
}
// Describes a complete .proto file.
message FileDescriptorProto {
optional string name = 1; // file name, relative to root of source tree
optional string package = 2; // e.g. "foo", "foo.bar", etc.
// Names of files imported by this file.
repeated string dependency = 3;
// Indexes of the public imported files in the dependency list above.
repeated int32 public_dependency = 10;
// Indexes of the weak imported files in the dependency list.
// For Google-internal migration only. Do not use.
repeated int32 weak_dependency = 11;
// All top-level definitions in this file.
repeated DescriptorProto message_type = 4;
repeated EnumDescriptorProto enum_type = 5;
repeated ServiceDescriptorProto service = 6;
repeated FieldDescriptorProto extension = 7;
optional FileOptions options = 8;
// This field contains optional information about the original source code.
// You may safely remove this entire field without harming runtime
// functionality of the descriptors -- the information is needed only by
// development tools.
optional SourceCodeInfo source_code_info = 9;
// The syntax of the proto file.
// The supported values are "proto2", "proto3", and "editions".
//
// If `edition` is present, this value must be "editions".
optional string syntax = 12;
// The edition of the proto file, which is an opaque string.
optional string edition = 13;
}
// Describes a message type.
message DescriptorProto {
optional string name = 1;
repeated FieldDescriptorProto field = 2;
repeated FieldDescriptorProto extension = 6;
repeated DescriptorProto nested_type = 3;
repeated EnumDescriptorProto enum_type = 4;
message ExtensionRange {
optional int32 start = 1; // Inclusive.
optional int32 end = 2; // Exclusive.
optional ExtensionRangeOptions options = 3;
}
repeated ExtensionRange extension_range = 5;
repeated OneofDescriptorProto oneof_decl = 8;
optional MessageOptions options = 7;
// Range of reserved tag numbers. Reserved tag numbers may not be used by
// fields or extension ranges in the same message. Reserved ranges may
// not overlap.
message ReservedRange {
optional int32 start = 1; // Inclusive.
optional int32 end = 2; // Exclusive.
}
repeated ReservedRange reserved_range = 9;
// Reserved field names, which may not be used by fields in the same message.
// A given name may only be reserved once.
repeated string reserved_name = 10;
}
message ExtensionRangeOptions {
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
// Describes a field within a message.
message FieldDescriptorProto {
enum Type {
// 0 is reserved for errors.
// Order is weird for historical reasons.
TYPE_DOUBLE = 1;
TYPE_FLOAT = 2;
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
// negative values are likely.
TYPE_INT64 = 3;
TYPE_UINT64 = 4;
// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
// negative values are likely.
TYPE_INT32 = 5;
TYPE_FIXED64 = 6;
TYPE_FIXED32 = 7;
TYPE_BOOL = 8;
TYPE_STRING = 9;
// Tag-delimited aggregate.
// Group type is deprecated and not supported in proto3. However, Proto3
// implementations should still be able to parse the group wire format and
// treat group fields as unknown fields.
TYPE_GROUP = 10;
TYPE_MESSAGE = 11; // Length-delimited aggregate.
// New in version 2.
TYPE_BYTES = 12;
TYPE_UINT32 = 13;
TYPE_ENUM = 14;
TYPE_SFIXED32 = 15;
TYPE_SFIXED64 = 16;
TYPE_SINT32 = 17; // Uses ZigZag encoding.
TYPE_SINT64 = 18; // Uses ZigZag encoding.
}
enum Label {
// 0 is reserved for errors
LABEL_OPTIONAL = 1;
LABEL_REQUIRED = 2;
LABEL_REPEATED = 3;
}
optional string name = 1;
optional int32 number = 3;
optional Label label = 4;
// If type_name is set, this need not be set. If both this and type_name
// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.
optional Type type = 5;
// For message and enum types, this is the name of the type. If the name
// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping
// rules are used to find the type (i.e. first the nested types within this
// message are searched, then within the parent, on up to the root
// namespace).
optional string type_name = 6;
// For extensions, this is the name of the type being extended. It is
// resolved in the same manner as type_name.
optional string extendee = 2;
// For numeric types, contains the original text representation of the value.
// For booleans, "true" or "false".
// For strings, contains the default text contents (not escaped in any way).
// For bytes, contains the C escaped value. All bytes >= 128 are escaped.
optional string default_value = 7;
// If set, gives the index of a oneof in the containing type's oneof_decl
// list. This field is a member of that oneof.
optional int32 oneof_index = 9;
// JSON name of this field. The value is set by protocol compiler. If the
// user has set a "json_name" option on this field, that option's value
// will be used. Otherwise, it's deduced from the field's name by converting
// it to camelCase.
optional string json_name = 10;
optional FieldOptions options = 8;
// If true, this is a proto3 "optional". When a proto3 field is optional, it
// tracks presence regardless of field type.
//
// When proto3_optional is true, this field must be belong to a oneof to
// signal to old proto3 clients that presence is tracked for this field. This
// oneof is known as a "synthetic" oneof, and this field must be its sole
// member (each proto3 optional field gets its own synthetic oneof). Synthetic
// oneofs exist in the descriptor only, and do not generate any API. Synthetic
// oneofs must be ordered after all "real" oneofs.
//
// For message fields, proto3_optional doesn't create any semantic change,
// since non-repeated message fields always track presence. However it still
// indicates the semantic detail of whether the user wrote "optional" or not.
// This can be useful for round-tripping the .proto file. For consistency we
// give message fields a synthetic oneof also, even though it is not required
// to track presence. This is especially important because the parser can't
// tell if a field is a message or an enum, so it must always create a
// synthetic oneof.
//
// Proto2 optional fields do not set this flag, because they already indicate
// optional with `LABEL_OPTIONAL`.
optional bool proto3_optional = 17;
}
// Describes a oneof.
message OneofDescriptorProto {
optional string name = 1;
optional OneofOptions options = 2;
}
// Describes an enum type.
message EnumDescriptorProto {
optional string name = 1;
repeated EnumValueDescriptorProto value = 2;
optional EnumOptions options = 3;
// Range of reserved numeric values. Reserved values may not be used by
// entries in the same enum. Reserved ranges may not overlap.
//
// Note that this is distinct from DescriptorProto.ReservedRange in that it
// is inclusive such that it can appropriately represent the entire int32
// domain.
message EnumReservedRange {
optional int32 start = 1; // Inclusive.
optional int32 end = 2; // Inclusive.
}
// Range of reserved numeric values. Reserved numeric values may not be used
// by enum values in the same enum declaration. Reserved ranges may not
// overlap.
repeated EnumReservedRange reserved_range = 4;
// Reserved enum value names, which may not be reused. A given name may only
// be reserved once.
repeated string reserved_name = 5;
}
// Describes a value within an enum.
message EnumValueDescriptorProto {
optional string name = 1;
optional int32 number = 2;
optional EnumValueOptions options = 3;
}
// Describes a service.
message ServiceDescriptorProto {
optional string name = 1;
repeated MethodDescriptorProto method = 2;
optional ServiceOptions options = 3;
}
// Describes a method of a service.
message MethodDescriptorProto {
optional string name = 1;
// Input and output type names. These are resolved in the same way as
// FieldDescriptorProto.type_name, but must refer to a message type.
optional string input_type = 2;
optional string output_type = 3;
optional MethodOptions options = 4;
// Identifies if client streams multiple client messages
optional bool client_streaming = 5 [default = false];
// Identifies if server streams multiple server messages
optional bool server_streaming = 6 [default = false];
}
// ===================================================================
// Options
// Each of the definitions above may have "options" attached. These are
// just annotations which may cause code to be generated slightly differently
// or may contain hints for code that manipulates protocol messages.
//
// Clients may define custom options as extensions of the *Options messages.
// These extensions may not yet be known at parsing time, so the parser cannot
// store the values in them. Instead it stores them in a field in the *Options
// message called uninterpreted_option. This field must have the same name
// across all *Options messages. We then use this field to populate the
// extensions when we build a descriptor, at which point all protos have been
// parsed and so all extensions are known.
//
// Extension numbers for custom options may be chosen as follows:
// * For options which will only be used within a single application or
// organization, or for experimental options, use field numbers 50000
// through 99999. It is up to you to ensure that you do not use the
// same number for multiple options.
// * For options which will be published and used publicly by multiple
// independent entities, e-mail protobuf-global-extension-registry@google.com
// to reserve extension numbers. Simply provide your project name (e.g.
// Objective-C plugin) and your project website (if available) -- there's no
// need to explain how you intend to use them. Usually you only need one
// extension number. You can declare multiple options with only one extension
// number by putting them in a sub-message. See the Custom Options section of
// the docs for examples:
// https://developers.google.com/protocol-buffers/docs/proto#options
// If this turns out to be popular, a web service will be set up
// to automatically assign option numbers.
message FileOptions {
// Sets the Java package where classes generated from this .proto will be
// placed. By default, the proto package is used, but this is often
// inappropriate because proto packages do not normally start with backwards
// domain names.
optional string java_package = 1;
// Controls the name of the wrapper Java class generated for the .proto file.
// That class will always contain the .proto file's getDescriptor() method as
// well as any top-level extensions defined in the .proto file.
// If java_multiple_files is disabled, then all the other classes from the
// .proto file will be nested inside the single wrapper outer class.
optional string java_outer_classname = 8;
// If enabled, then the Java code generator will generate a separate .java
// file for each top-level message, enum, and service defined in the .proto
// file. Thus, these types will *not* be nested inside the wrapper class
// named by java_outer_classname. However, the wrapper class will still be
// generated to contain the file's getDescriptor() method as well as any
// top-level extensions defined in the file.
optional bool java_multiple_files = 10 [default = false];
// This option does nothing.
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
// If set true, then the Java2 code generator will generate code that
// throws an exception whenever an attempt is made to assign a non-UTF-8
// byte sequence to a string field.
// Message reflection will do the same.
// However, an extension field still accepts non-UTF-8 byte sequences.
// This option has no effect on when used with the lite runtime.
optional bool java_string_check_utf8 = 27 [default = false];
// Generated classes can be optimized for speed or code size.
enum OptimizeMode {
SPEED = 1; // Generate complete code for parsing, serialization,
// etc.
CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
}
optional OptimizeMode optimize_for = 9 [default = SPEED];
// Sets the Go package where structs generated from this .proto will be
// placed. If omitted, the Go package will be derived from the following:
// - The basename of the package import path, if provided.
// - Otherwise, the package statement in the .proto file, if present.
// - Otherwise, the basename of the .proto file, without extension.
optional string go_package = 11;
// Should generic services be generated in each language? "Generic" services
// are not specific to any particular RPC system. They are generated by the
// main code generators in each language (without additional plugins).
// Generic services were the only kind of service generation supported by
// early versions of google.protobuf.
//
// Generic services are now considered deprecated in favor of using plugins
// that generate code specific to your particular RPC system. Therefore,
// these default to false. Old code which depends on generic services should
// explicitly set them to true.
optional bool cc_generic_services = 16 [default = false];
optional bool java_generic_services = 17 [default = false];
optional bool py_generic_services = 18 [default = false];
optional bool php_generic_services = 42 [default = false];
// Is this file deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for everything in the file, or it will be completely ignored; in the very
// least, this is a formalization for deprecating files.
optional bool deprecated = 23 [default = false];
// Enables the use of arenas for the proto messages in this file. This applies
// only to generated classes for C++.
optional bool cc_enable_arenas = 31 [default = true];
// Sets the objective c class prefix which is prepended to all objective c
// generated classes from this .proto. There is no default.
optional string objc_class_prefix = 36;
// Namespace for generated classes; defaults to the package.
optional string csharp_namespace = 37;
// By default Swift generators will take the proto package and CamelCase it
// replacing '.' with underscore and use that to prefix the types/symbols
// defined. When this options is provided, they will use this value instead
// to prefix the types/symbols defined.
optional string swift_prefix = 39;
// Sets the php class prefix which is prepended to all php generated classes
// from this .proto. Default is empty.
optional string php_class_prefix = 40;
// Use this option to change the namespace of php generated classes. Default
// is empty. When this option is empty, the package name will be used for
// determining the namespace.
optional string php_namespace = 41;
// Use this option to change the namespace of php generated metadata classes.
// Default is empty. When this option is empty, the proto file name will be
// used for determining the namespace.
optional string php_metadata_namespace = 44;
// Use this option to change the package of ruby generated classes. Default
// is empty. When this option is not set, the package name will be used for
// determining the ruby package.
optional string ruby_package = 45;
// The parser stores options it doesn't recognize here.
// See the documentation for the "Options" section above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message.
// See the documentation for the "Options" section above.
extensions 1000 to max;
reserved 38;
}
message MessageOptions {
// Set true to use the old proto1 MessageSet wire format for extensions.
// This is provided for backwards-compatibility with the MessageSet wire
// format. You should not use this for any other reason: It's less
// efficient, has fewer features, and is more complicated.
//
// The message must be defined exactly as follows:
// message Foo {
// option message_set_wire_format = true;
// extensions 4 to max;
// }
// Note that the message cannot have any defined fields; MessageSets only
// have extensions.
//
// All extensions of your type must be singular messages; e.g. they cannot
// be int32s, enums, or repeated messages.
//
// Because this is an option, the above two restrictions are not enforced by
// the protocol compiler.
optional bool message_set_wire_format = 1 [default = false];
// Disables the generation of the standard "descriptor()" accessor, which can
// conflict with a field of the same name. This is meant to make migration
// from proto1 easier; new code should avoid fields named "descriptor".
optional bool no_standard_descriptor_accessor = 2 [default = false];
// Is this message deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for the message, or it will be completely ignored; in the very least,
// this is a formalization for deprecating messages.
optional bool deprecated = 3 [default = false];
reserved 4, 5, 6;
// Whether the message is an automatically generated map entry type for the
// maps field.
//
// For maps fields:
// map<KeyType, ValueType> map_field = 1;
// The parsed descriptor looks like:
// message MapFieldEntry {
// option map_entry = true;
// optional KeyType key = 1;
// optional ValueType value = 2;
// }
// repeated MapFieldEntry map_field = 1;
//
// Implementations may choose not to generate the map_entry=true message, but
// use a native map in the target language to hold the keys and values.
// The reflection APIs in such implementations still need to work as
// if the field is a repeated message field.
//
// NOTE: Do not set the option in .proto files. Always use the maps syntax
// instead. The option should only be implicitly set by the proto compiler
// parser.
optional bool map_entry = 7;
reserved 8; // javalite_serializable
reserved 9; // javanano_as_lite
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
message FieldOptions {
// The ctype option instructs the C++ code generator to use a different
// representation of the field than it normally would. See the specific
// options below. This option is not yet implemented in the open source
// release -- sorry, we'll try to include it in a future version!
optional CType ctype = 1 [default = STRING];
enum CType {
// Default mode.
STRING = 0;
CORD = 1;
STRING_PIECE = 2;
}
// The packed option can be enabled for repeated primitive fields to enable
// a more efficient representation on the wire. Rather than repeatedly
// writing the tag and type for each element, the entire array is encoded as
// a single length-delimited blob. In proto3, only explicit setting it to
// false will avoid using packed encoding.
optional bool packed = 2;
// The jstype option determines the JavaScript type used for values of the
// field. The option is permitted only for 64 bit integral and fixed types
// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
// is represented as JavaScript string, which avoids loss of precision that
// can happen when a large value is converted to a floating point JavaScript.
// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
// use the JavaScript "number" type. The behavior of the default option
// JS_NORMAL is implementation dependent.
//
// This option is an enum to permit additional types to be added, e.g.
// goog.math.Integer.
optional JSType jstype = 6 [default = JS_NORMAL];
enum JSType {
// Use the default type.
JS_NORMAL = 0;
// Use JavaScript strings.
JS_STRING = 1;
// Use JavaScript numbers.
JS_NUMBER = 2;
}
// Should this field be parsed lazily? Lazy applies only to message-type
// fields. It means that when the outer message is initially parsed, the
// inner message's contents will not be parsed but instead stored in encoded
// form. The inner message will actually be parsed when it is first accessed.
//
// This is only a hint. Implementations are free to choose whether to use
// eager or lazy parsing regardless of the value of this option. However,
// setting this option true suggests that the protocol author believes that
// using lazy parsing on this field is worth the additional bookkeeping
// overhead typically needed to implement it.
//
// This option does not affect the public interface of any generated code;
// all method signatures remain the same. Furthermore, thread-safety of the
// interface is not affected by this option; const methods remain safe to
// call from multiple threads concurrently, while non-const methods continue
// to require exclusive access.
//
//
// Note that implementations may choose not to check required fields within
// a lazy sub-message. That is, calling IsInitialized() on the outer message
// may return true even if the inner message has missing required fields.
// This is necessary because otherwise the inner message would have to be
// parsed in order to perform the check, defeating the purpose of lazy
// parsing. An implementation which chooses not to check required fields
// must be consistent about it. That is, for any particular sub-message, the
// implementation must either *always* check its required fields, or *never*
// check its required fields, regardless of whether or not the message has
// been parsed.
//
// As of May 2022, lazy verifies the contents of the byte stream during
// parsing. An invalid byte stream will cause the overall parsing to fail.
optional bool lazy = 5 [default = false];
// unverified_lazy does no correctness checks on the byte stream. This should
// only be used where lazy with verification is prohibitive for performance
// reasons.
optional bool unverified_lazy = 15 [default = false];
// Is this field deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for accessors, or it will be completely ignored; in the very least, this
// is a formalization for deprecating fields.
optional bool deprecated = 3 [default = false];
// For Google-internal migration only. Do not use.
optional bool weak = 10 [default = false];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
reserved 4; // removed jtype
}
message OneofOptions {
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
message EnumOptions {
// Set this option to true to allow mapping different tag names to the same
// value.
optional bool allow_alias = 2;
// Is this enum deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for the enum, or it will be completely ignored; in the very least, this
// is a formalization for deprecating enums.
optional bool deprecated = 3 [default = false];
reserved 5; // javanano_as_lite
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
message EnumValueOptions {
// Is this enum value deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for the enum value, or it will be completely ignored; in the very least,
// this is a formalization for deprecating enum values.
optional bool deprecated = 1 [default = false];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
message ServiceOptions {
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
// framework. We apologize for hoarding these numbers to ourselves, but
// we were already using them long before we decided to release Protocol
// Buffers.
// Is this service deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for the service, or it will be completely ignored; in the very least,
// this is a formalization for deprecating services.
optional bool deprecated = 33 [default = false];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
message MethodOptions {
// Note: Field numbers 1 through 32 are reserved for Google's internal RPC
// framework. We apologize for hoarding these numbers to ourselves, but
// we were already using them long before we decided to release Protocol
// Buffers.
// Is this method deprecated?
// Depending on the target platform, this can emit Deprecated annotations
// for the method, or it will be completely ignored; in the very least,
// this is a formalization for deprecating methods.
optional bool deprecated = 33 [default = false];
// Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
// or neither? HTTP based RPC implementation may choose GET verb for safe
// methods, and PUT verb for idempotent methods instead of the default POST.
enum IdempotencyLevel {
IDEMPOTENCY_UNKNOWN = 0;
NO_SIDE_EFFECTS = 1; // implies idempotent
IDEMPOTENT = 2; // idempotent, but may have side effects
}
optional IdempotencyLevel idempotency_level = 34
[default = IDEMPOTENCY_UNKNOWN];
// The parser stores options it doesn't recognize here. See above.
repeated UninterpretedOption uninterpreted_option = 999;
// Clients can define custom options in extensions of this message. See above.
extensions 1000 to max;
}
// A message representing a option the parser does not recognize. This only
// appears in options protos created by the compiler::Parser class.
// DescriptorPool resolves these when building Descriptor objects. Therefore,
// options protos in descriptor objects (e.g. returned by Descriptor::options(),
// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions
// in them.
message UninterpretedOption {
// The name of the uninterpreted option. Each string represents a segment in
// a dot-separated name. is_extension is true iff a segment represents an
// extension (denoted with parentheses in options specs in .proto files).
// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents
// "foo.(bar.baz).moo".
message NamePart {
required string name_part = 1;
required bool is_extension = 2;
}
repeated NamePart name = 2;
// The value of the uninterpreted option, in whatever type the tokenizer
// identified it as during parsing. Exactly one of these should be set.
optional string identifier_value = 3;
optional uint64 positive_int_value = 4;
optional int64 negative_int_value = 5;
optional double double_value = 6;
optional bytes string_value = 7;
optional string aggregate_value = 8;
}
// ===================================================================
// Optional source code info
// Encapsulates information about the original source file from which a
// FileDescriptorProto was generated.
message SourceCodeInfo {
// A Location identifies a piece of source code in a .proto file which
// corresponds to a particular definition. This information is intended
// to be useful to IDEs, code indexers, documentation generators, and similar
// tools.
//
// For example, say we have a file like:
// message Foo {
// optional string foo = 1;
// }
// Let's look at just the field definition:
// optional string foo = 1;
// ^ ^^ ^^ ^ ^^^
// a bc de f ghi
// We have the following locations:
// span path represents
// [a,i) [ 4, 0, 2, 0 ] The whole field definition.
// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).
// [c,d) [ 4, 0, 2, 0, 5 ] The type (string).
// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).
// [g,h) [ 4, 0, 2, 0, 3 ] The number (1).
//
// Notes:
// - A location may refer to a repeated field itself (i.e. not to any
// particular index within it). This is used whenever a set of elements are
// logically enclosed in a single code segment. For example, an entire
// extend block (possibly containing multiple extension definitions) will
// have an outer location whose path refers to the "extensions" repeated
// field without an index.
// - Multiple locations may have the same path. This happens when a single
// logical declaration is spread out across multiple places. The most
// obvious example is the "extend" block again -- there may be multiple
// extend blocks in the same scope, each of which will have the same path.
// - A location's span is not always a subset of its parent's span. For
// example, the "extendee" of an extension declaration appears at the
// beginning of the "extend" block and is shared by all extensions within
// the block.
// - Just because a location's span is a subset of some other location's span
// does not mean that it is a descendant. For example, a "group" defines
// both a type and a field in a single declaration. Thus, the locations
// corresponding to the type and field and their components will overlap.
// - Code which tries to interpret locations should probably be designed to
// ignore those that it doesn't understand, as more types of locations could
// be recorded in the future.
repeated Location location = 1;
message Location {
// Identifies which part of the FileDescriptorProto was defined at this
// location.
//
// Each element is a field number or an index. They form a path from
// the root FileDescriptorProto to the place where the definition occurs.
// For example, this path:
// [ 4, 3, 2, 7, 1 ]
// refers to:
// file.message_type(3) // 4, 3
// .field(7) // 2, 7
// .name() // 1
// This is because FileDescriptorProto.message_type has field number 4:
// repeated DescriptorProto message_type = 4;
// and DescriptorProto.field has field number 2:
// repeated FieldDescriptorProto field = 2;
// and FieldDescriptorProto.name has field number 1:
// optional string name = 1;
//
// Thus, the above path gives the location of a field name. If we removed
// the last element:
// [ 4, 3, 2, 7 ]
// this path refers to the whole field declaration (from the beginning
// of the label to the terminating semicolon).
repeated int32 path = 1 [packed = true];
// Always has exactly three or four elements: start line, start column,
// end line (optional, otherwise assumed same as start line), end column.
// These are packed into a single field for efficiency. Note that line
// and column numbers are zero-based -- typically you will want to add
// 1 to each before displaying to a user.
repeated int32 span = 2 [packed = true];
// If this SourceCodeInfo represents a complete declaration, these are any
// comments appearing before and after the declaration which appear to be
// attached to the declaration.
//
// A series of line comments appearing on consecutive lines, with no other
// tokens appearing on those lines, will be treated as a single comment.
//
// leading_detached_comments will keep paragraphs of comments that appear
// before (but not connected to) the current element. Each paragraph,
// separated by empty lines, will be one comment element in the repeated
// field.
//
// Only the comment content is provided; comment markers (e.g. //) are
// stripped out. For block comments, leading whitespace and an asterisk
// will be stripped from the beginning of each line other than the first.
// Newlines are included in the output.
//
// Examples:
//
// optional int32 foo = 1; // Comment attached to foo.
// // Comment attached to bar.
// optional int32 bar = 2;
//
// optional string baz = 3;
// // Comment attached to baz.
// // Another line attached to baz.
//
// // Comment attached to moo.
// //
// // Another line attached to moo.
// optional double moo = 4;
//
// // Detached comment for corge. This is not leading or trailing comments
// // to moo or corge because there are blank lines separating it from
// // both.
//
// // Detached comment for corge paragraph 2.
//
// optional string corge = 5;
// /* Block comment attached
// * to corge. Leading asterisks
// * will be removed. */
// /* Block comment attached to
// * grault. */
// optional int32 grault = 6;
//
// // ignored detached comments.
optional string leading_comments = 3;
optional string trailing_comments = 4;
repeated string leading_detached_comments = 6;
}
}
// Describes the relationship between generated code and its original source
// file. A GeneratedCodeInfo message is associated with only one generated
// source file, but may contain references to different source .proto files.
message GeneratedCodeInfo {
// An Annotation connects some span of text in generated code to an element
// of its generating .proto file.
repeated Annotation annotation = 1;
message Annotation {
// Identifies the element in the original source .proto file. This field
// is formatted the same as SourceCodeInfo.Location.path.
repeated int32 path = 1 [packed = true];
// Identifies the filesystem path to the original source .proto.
optional string source_file = 2;
// Identifies the starting offset in bytes in the generated code
// that relates to the identified object.
optional int32 begin = 3;
// Identifies the ending offset in bytes in the generated code that
// relates to the identified offset. The end offset should be one past
// the last relevant byte (so the length of the text = end - begin).
optional int32 end = 4;
}
}

@ -0,0 +1,80 @@
// Copyright 2016 Michal Witkowski. All Rights Reserved.
// See LICENSE for licensing terms.
// Protocol Buffers extensions for defining auto-generateable validators for messages.
// TODO(mwitkow): Add example.
syntax = "proto2";
package validator;
import "pb/descriptor.proto";
option go_package = "github.com/mwitkow/go-proto-validators;validator";
// TODO(mwitkow): Email protobuf-global-extension-registry@google.com to get an extension ID.
extend google.protobuf.FieldOptions {
optional FieldValidator field = 65020;
}
extend google.protobuf.OneofOptions {
optional OneofValidator oneof = 65021;
}
message FieldValidator {
// Uses a Golang RE2-syntax regex to match the field contents.
optional string regex = 1;
// Field value of integer strictly greater than this value.
optional int64 int_gt = 2;
// Field value of integer strictly smaller than this value.
optional int64 int_lt = 3;
// Used for nested message types, requires that the message type exists.
optional bool msg_exists = 4;
// Human error specifies a user-customizable error that is visible to the user.
optional string human_error = 5;
// Field value of double strictly greater than this value.
// Note that this value can only take on a valid floating point
// value. Use together with float_epsilon if you need something more specific.
optional double float_gt = 6;
// Field value of double strictly smaller than this value.
// Note that this value can only take on a valid floating point
// value. Use together with float_epsilon if you need something more specific.
optional double float_lt = 7;
// Field value of double describing the epsilon within which
// any comparison should be considered to be true. For example,
// when using float_gt = 0.35, using a float_epsilon of 0.05
// would mean that any value above 0.30 is acceptable. It can be
// thought of as a {float_value_condition} +- {float_epsilon}.
// If unset, no correction for floating point inaccuracies in
// comparisons will be attempted.
optional double float_epsilon = 8;
// Floating-point value compared to which the field content should be greater or equal.
optional double float_gte = 9;
// Floating-point value compared to which the field content should be smaller or equal.
optional double float_lte = 10;
// Used for string fields, requires the string to be not empty (i.e different from "").
optional bool string_not_empty = 11;
// Repeated field with at least this number of elements.
optional int64 repeated_count_min = 12;
// Repeated field with at most this number of elements.
optional int64 repeated_count_max = 13;
// Field value of length greater than this value.
optional int64 length_gt = 14;
// Field value of length smaller than this value.
optional int64 length_lt = 15;
// Field value of length strictly equal to this value.
optional int64 length_eq = 16;
// Requires that the value is in the enum.
optional bool is_in_enum = 17;
// Ensures that a string value is in UUID format.
// uuid_ver specifies the valid UUID versions. Valid values are: 0-5.
// If uuid_ver is 0 all UUID versions are accepted.
optional int32 uuid_ver = 18;
}
message OneofValidator {
// Require that one of the oneof fields is set.
optional bool required = 1;
}

@ -0,0 +1,20 @@
package amqp
import (
"github.com/google/wire"
"github.com/streadway/amqp"
)
var RabbitMqConn *amqp.Connection
var Provider = wire.NewSet(NewRabbitMq)
func NewRabbitMq() *amqp.Connection {
//var err error
// 创建连接
/*RabbitMqConn, err = amqp.Dial(fmt.Sprintf("amqp://%s:%s@%s:%d/%s", appConfig.Data.RabbitMq.User, appConfig.Data.RabbitMq.Password, appConfig.Data.RabbitMq.Host, appConfig.Data.RabbitMq.Port, appConfig.Data.RabbitMq.Vhost))
if err != nil {
log.Fatalf("failed to connect RabbitMQ: %v", err)
}*/
return RabbitMqConn
}

@ -0,0 +1,20 @@
package ant
import (
dciConfig "chain-dci/config"
"github.com/google/wire"
antCloud "github.com/huyi-cn/antcloud-golang-sdk"
)
var Provider = wire.NewSet(NewAntClient)
func NewAntClient() *antCloud.Client {
// Endpoint 请参考 https://api.aliyun.com/product/rtc
//bccrConfig := new(bccrClient.Config)
//bccrConfig.SetEndpoint(dciConfig.Data.Dci.EndPoint)
//bccrConfig.SetAccessKeyId(dciConfig.Data.Dci.AccessKey)
//bccrConfig.SetAccessKeySecret(dciConfig.Data.Dci.AccessKeySecret)
client := antCloud.NewClient(dciConfig.Data.AntCloud.EndPoint, dciConfig.Data.AntCloud.AccessKey, dciConfig.Data.AntCloud.AccessKeySecret, nil)
return client
}

@ -0,0 +1,21 @@
package app
import (
"chain-dci/pkg/tracing"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/bwmarrin/snowflake"
antCloud "github.com/huyi-cn/antcloud-golang-sdk"
"go.uber.org/zap"
)
var ModuleClients *App
type App struct {
Lg *zap.Logger
//RedisClient *redis.Client
JaegerTracer *tracing.JaegerProvider
//DbMeeting *gorm.DB
SfNode *snowflake.Node
AntClient *antCloud.Client
BccrClient *bccrClient.Client
}

@ -0,0 +1,25 @@
package bccr
import (
dciConfig "chain-dci/config"
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
"github.com/google/wire"
)
var Provider = wire.NewSet(NewBccrClient)
func NewBccrClient() *bccrClient.Client {
// Endpoint 请参考 https://api.aliyun.com/product/rtc
bccrConfig := new(bccrClient.Config)
bccrConfig.SetEndpoint(dciConfig.Data.Bccr.EndPoint)
bccrConfig.SetAccessKeyId(dciConfig.Data.Bccr.AccessKeyID)
bccrConfig.SetAccessKeySecret(dciConfig.Data.Bccr.AccessKeySecret)
client, err := bccrClient.NewClient(bccrConfig)
if err != nil {
panic(err)
}
return client
}

27
pkg/cache/redis.go vendored

@ -0,0 +1,27 @@
package cache
import (
dciConfig "chain-dci/config"
"github.com/dubbogo/gost/log/logger"
"github.com/go-redis/redis"
"github.com/google/wire"
"strconv"
)
var RedisProvider = wire.NewSet(NewRedis)
// TODO 添加连接池
func NewRedis() *redis.Client {
redisDb, _ := strconv.Atoi(dciConfig.Data.Redis.DB)
RedisClient := redis.NewClient(&redis.Options{
Addr: dciConfig.Data.Redis.Addr,
Password: dciConfig.Data.Redis.Password,
DB: redisDb,
})
_, err := RedisClient.Ping().Result()
if err != nil {
logger.Errorf("connRedis err", err)
panic(err)
}
return RedisClient
}

@ -0,0 +1,18 @@
package db
import (
dciConfig "chain-dci/config"
"github.com/google/wire"
"gorm.io/gorm"
"strings"
)
var MeetingProvider = wire.NewSet(NewDci)
func NewDci() *gorm.DB {
connOaMeeting := strings.Join([]string{dciConfig.Data.ChainDci.User, ":", dciConfig.Data.ChainDci.Password,
"@tcp(", dciConfig.Data.ChainDci.Host, ":", dciConfig.Data.ChainDci.Port, ")/",
dciConfig.Data.ChainDci.DbName, "?charset=utf8mb4&parseTime=true"}, "")
DbOaMeeting := loadMysqlConn(connOaMeeting)
return DbOaMeeting
}

@ -0,0 +1,51 @@
package db
import (
"github.com/gin-gonic/gin"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/logger"
"gorm.io/gorm/schema"
"time"
)
func loadMysqlConn(conn string) *gorm.DB {
var ormLogger logger.Interface
if gin.Mode() == "debug" {
ormLogger = logger.Default.LogMode(logger.Info)
} else {
ormLogger = logger.Default
}
db, err := gorm.Open(mysql.New(mysql.Config{
DSN: conn, // DSN data source name
DefaultStringSize: 256, // string 类型字段的默认长度
DisableDatetimePrecision: true, // 禁用 datetime 精度MySQL 5.6 之前的数据库不支持
DontSupportRenameIndex: true, // 重命名索引时采用删除并新建的方式MySQL 5.7 之前的数据库和 MariaDB 不支持重命名索引
DontSupportRenameColumn: true, // 用 `change` 重命名列MySQL 8 之前的数据库和 MariaDB 不支持重命名列
SkipInitializeWithVersion: false, // 根据版本自动配置
}), &gorm.Config{
Logger: ormLogger,
NamingStrategy: schema.NamingStrategy{
SingularTable: true,
},
DisableForeignKeyConstraintWhenMigrating: true,
})
if err != nil {
panic(err)
}
sqlDB, _ := db.DB()
sqlDB.SetMaxIdleConns(20) //设置连接池,空闲
sqlDB.SetMaxOpenConns(100) //打开
sqlDB.SetConnMaxLifetime(time.Second * 30)
return db
}
func DBMigration() {
//addColumn(&model_account.Users{}, "action_code")
}
func addColumn(dst interface{}, column string) {
return
}

@ -0,0 +1,28 @@
package err
import (
"chain-dci/pkg/app"
"errors"
"fmt"
"go.uber.org/zap"
)
func ReturnError(err error, msg, print string) error {
if err != nil {
field := zap.Field{}
field.String = err.Error()
app.ModuleClients.Lg.Error(print, field)
fmt.Printf(print+"%+v\n", err)
return errors.New(msg)
}
return nil
}
func NoReturnError(err error, print string) {
if err != nil {
field := zap.Field{}
field.String = err.Error()
app.ModuleClients.Lg.Error(print, field)
fmt.Printf(print+"%+v\n", err)
}
}

@ -0,0 +1,7 @@
package common
import "chain-dci/pkg/db"
func Init() {
db.DBMigration()
}

@ -0,0 +1,63 @@
package logger
import (
dciConfig "chain-dci/config"
"github.com/google/wire"
"os"
"strconv"
"github.com/natefinch/lumberjack"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var Provider = wire.NewSet(ZapInit)
// ZapInit 初始化lg
func ZapInit() *zap.Logger {
var err error
maxSize, _ := strconv.Atoi(dciConfig.Data.ZapLog.MaxSize)
maxAge, _ := strconv.Atoi(dciConfig.Data.ZapLog.MaxAge)
maxBackups, _ := strconv.Atoi(dciConfig.Data.ZapLog.MaxAge)
writeSyncer := getLogWriter(dciConfig.Data.ZapLog.Filename, maxSize, maxBackups, maxAge)
encoder := getEncoder()
var l = new(zapcore.Level)
err = l.UnmarshalText([]byte(dciConfig.Data.ZapLog.Level))
if err != nil {
return nil
}
var core zapcore.Core
if dciConfig.Data.System.Mode == "dev" {
// 进入开发模式,日志输出到终端
consoleEncoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig())
core = zapcore.NewTee(
zapcore.NewCore(encoder, writeSyncer, l),
zapcore.NewCore(consoleEncoder, zapcore.Lock(os.Stdout), zapcore.DebugLevel),
)
} else {
core = zapcore.NewCore(encoder, writeSyncer, l)
}
lg := zap.New(core, zap.AddCaller())
zap.ReplaceGlobals(lg)
return lg
}
func getEncoder() zapcore.Encoder {
encoderConfig := zap.NewProductionEncoderConfig()
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
encoderConfig.TimeKey = "time"
encoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
encoderConfig.EncodeDuration = zapcore.SecondsDurationEncoder
encoderConfig.EncodeCaller = zapcore.ShortCallerEncoder
return zapcore.NewJSONEncoder(encoderConfig)
}
func getLogWriter(filename string, maxSize, maxBackup, maxAge int) zapcore.WriteSyncer {
lumberJackLogger := &lumberjack.Logger{
Filename: filename,
MaxSize: maxSize,
MaxBackups: maxBackup,
MaxAge: maxAge,
}
return zapcore.AddSync(lumberJackLogger)
}

@ -0,0 +1,5 @@
package msg
const (
ErrrFileIsEmpty = "未获取到相关文件"
)

@ -0,0 +1,35 @@
package msg
const (
SERVER_CONFIG = "config.yaml"
SERVER_DUBBOGO_CONFIG = "dubbogo.yaml"
MODE_ENV = "MODE_ENV"
)
const (
Success = "操作成功"
Failed = "操作失败"
)
const (
Http = 200
)
const (
ErrorLogin = "账号或密码错误"
ErrorJSONParse = "json解析失败"
ErrorJSONMarshal = "json序列化失败"
ErrorForUpdate = "锁定错误"
ErrorInsert = "插入异常"
ErrorDelete = "删除异常"
ErrorUpdate = "更新异常"
ErrorSelect = "查询异常"
ErrorEmptyParam = "值为空"
ErrorCopierStruct = "拷贝结构体错误"
ErrorNoAction = "无需操作"
ErrorInvalidParam = "参数不合法"
ErrorNoData = "没有数据"
ErrorDatetime = "时间格式错误"
ErrorSha256Write = "sha256加密错误"
)

@ -0,0 +1,4 @@
package service
func init() {
}

@ -0,0 +1,31 @@
package snowf
import (
dciConfig "chain-dci/config"
"chain-dci/pkg/app"
"github.com/bwmarrin/snowflake"
"github.com/google/wire"
"strconv"
"time"
)
var Provider = wire.NewSet(NewSf)
func NewSf() *snowflake.Node {
var err error
var st time.Time
nodeNum, _ := strconv.Atoi(dciConfig.Data.SnowFlake.NodeNum)
st, err = time.Parse("2006-01-02", dciConfig.Data.SnowFlake.StartTime)
if err != nil {
panic(err)
}
snowflake.Epoch = st.UnixNano() / 1000000
node, errS := snowflake.NewNode(int64(nodeNum))
if errS != nil {
panic(errS)
}
return node
}
func GenID() int64 {
return app.ModuleClients.SfNode.Generate().Int64()
}

@ -0,0 +1,51 @@
package tracing
import (
dciConfig "chain-dci/config"
"io"
"time"
"github.com/google/wire"
"github.com/opentracing/opentracing-go"
"github.com/uber/jaeger-client-go"
jaegerConfig "github.com/uber/jaeger-client-go/config"
"go.uber.org/zap"
)
var Provider = wire.NewSet(NewTracing)
type JaegerProvider struct {
Tracer opentracing.Tracer
Closer io.Closer
}
//var JaegerPoint *JaegerProvider
func NewTracing() (jaegerProvider *JaegerProvider) {
if dciConfig.Data.Jaeger.Open != "true" {
return
}
jaegerProvider = &JaegerProvider{}
cfg := jaegerConfig.Configuration{
ServiceName: "oa-meeting",
Sampler: &jaegerConfig.SamplerConfig{
Type: jaeger.SamplerTypeRemote,
Param: 1,
},
Reporter: &jaegerConfig.ReporterConfig{
LocalAgentHostPort: dciConfig.Data.Jaeger.Addr,
LogSpans: true,
BufferFlushInterval: 5 * time.Second,
},
}
nativeTracerIo, closerIo, err := cfg.NewTracer(jaegerConfig.Logger(jaeger.StdLogger))
if err != nil {
zap.L().Error("nativeTracer err", zap.Error(err))
return
}
opentracing.SetGlobalTracer(nativeTracerIo)
jaegerProvider.Tracer = nativeTracerIo
jaegerProvider.Closer = closerIo
//JaegerPoint = jaegerProvider
return
}

@ -0,0 +1,73 @@
package utils
import (
"bytes"
"encoding/base64"
"fmt"
"go.uber.org/zap"
"io/ioutil"
"net/http"
)
func Post(url string, jsonStr []byte) (statusCode int, result string) {
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
statusCode = resp.StatusCode
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println("post url:", url)
fmt.Println("response Headers:", resp.Header)
fmt.Println("response Body:", string(body))
result = string(body)
zap.L().Info("post", zap.Any("url", url), zap.Any("jsonStr", jsonStr), zap.Any("result", result))
return
}
func Get(url string) (statusCode int, result string) {
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
statusCode = resp.StatusCode
fmt.Println("response StatusCode:", resp.StatusCode)
fmt.Println("response Status:", resp.Status)
fmt.Println("response Headers:", resp.Header)
body, _ := ioutil.ReadAll(resp.Body)
result = string(body)
fmt.Println("response Body:", string(body))
zap.L().Info("Get", zap.Any("url", url), zap.Any("result", result))
return
}
func PutFromFileUrlWithStream(url, fileName, fileUrl string) (statusCode int, result string) {
file, err := http.Get(fileUrl)
if err != nil {
panic(err)
}
defer file.Body.Close()
fileBody, _ := ioutil.ReadAll(file.Body)
req, err := http.NewRequest("PUT", url, bytes.NewBuffer(fileBody))
req.Header.Set("Content-Type", "application/octet-stream")
req.Header.Set("x-oss-meta-rawfilename", base64.URLEncoding.EncodeToString([]byte(fileName)))
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
statusCode = resp.StatusCode
body, _ := ioutil.ReadAll(resp.Body)
result = string(body)
fmt.Println("put url:", url)
fmt.Println("response Headers:", resp.Header)
fmt.Println("response Body:", string(body))
zap.L().Info("post", zap.Any("url", url), zap.Any("jsonStr", bytes.NewBuffer(fileBody).String()), zap.Any("result", result))
return
}

@ -0,0 +1,11 @@
package utils
import "strings"
import "errors"
func SubstrError(err error) (sErr error) {
start := strings.Index(err.Error(), ":")
msg := err.Error()[start+2:]
sErr = errors.New(msg)
return
}

@ -0,0 +1,50 @@
package utils
import (
"chain-dci/pkg/msg"
"errors"
"go.uber.org/zap"
"time"
)
const (
DateTimeFormat = "2006-01-02 15:04:05"
DateFormat = "2006-01-02"
DateFormatYmdHisDot = "2006.01.02 15:04"
DateFormatMonth = "2006年01月02日 15:04"
)
func DatetimeToTimes(datetime string, dateFormat string) (times int32, err error) {
if datetime == "" {
times = 0
return
}
loc, _ := time.LoadLocation("Asia/Shanghai")
t, err := time.ParseInLocation(dateFormat, datetime, loc)
if err != nil {
zap.L().Error("DatetimeToTimes err:"+datetime+":", zap.Error(err))
err = errors.New(msg.ErrorDatetime)
return
}
times = int32(t.Unix())
return
}
func TimesToDatetime(times int32, format string) string {
if times == 0 {
return ""
}
t := time.Unix(int64(times), 0)
if format == "" {
format = DateTimeFormat
}
return t.Format(format)
}
func MonthInfo() (startTime int64, endTime int64) {
timeNow := time.Now()
timeToday := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 0, 0, 0, timeNow.Location()) // 获取当天0点时间 time类型
startTime = timeToday.AddDate(0, 0, -timeToday.Day()+1).Unix() // 获取本月第一天0点 时间戳类型
endTime = timeToday.AddDate(0, 1, -timeToday.Day()+1).Unix()
return
}

@ -0,0 +1,24 @@
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T13:55:30.971+0800","caller":"config/root_config.go:131","message":"[Config Center] Config center doesn't start"}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T13:57:24.898+0800","caller":"config/root_config.go:131","message":"[Config Center] Config center doesn't start"}
{"level":"\u001b[33mWARN\u001b[0m","time":"2023-11-17T13:57:24.900+0800","caller":"common/rpc_service.go:373","message":"method Resume of mtype func(*health.DubbogoHealthServer) has wrong number of in out parameters 0; needs exactly 1/2"}
{"level":"\u001b[33mWARN\u001b[0m","time":"2023-11-17T13:57:24.900+0800","caller":"common/rpc_service.go:373","message":"method SetServingStatus of mtype func(*health.DubbogoHealthServer, string, triple_health_v1.HealthCheckResponse_ServingStatus) has wrong number of in out parameters 0; needs exactly 1/2"}
{"level":"\u001b[33mWARN\u001b[0m","time":"2023-11-17T13:57:24.900+0800","caller":"common/rpc_service.go:373","message":"method Shutdown of mtype func(*health.DubbogoHealthServer) has wrong number of in out parameters 0; needs exactly 1/2"}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T13:57:24.900+0800","caller":"dubbo3/dubbo3_protocol.go:82","message":"[Triple Protocol] Export service: tri://:20201/grpc.health.v1.Health?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=DubbogoHealthServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.health.v1.Health&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&param.sign=&pid=8424&registry.role=3&release=dubbo-golang-3.0.4&retries=&serialization=&service.filter=tracing&side=provider&timestamp=1700200644&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T13:57:24.901+0800","caller":"dubbo3/dubbo3_protocol.go:82","message":"[Triple Protocol] Export service: tri://:20201/grpc.reflection.v1alpha.ServerReflection?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=DubbogoServerReflectionServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.reflection.v1alpha.ServerReflection&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&param.sign=&pid=8424&registry.role=3&release=dubbo-golang-3.0.4&retries=&serialization=&service.filter=tracing&side=provider&timestamp=1700200644&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
{"level":"\u001b[33mWARN\u001b[0m","time":"2023-11-17T13:57:24.901+0800","caller":"config/provider_config.go:167","message":"Dubbogo can not find service with registeredTypeName DciProvider in configuration. Use the default configuration instead."}
{"level":"\u001b[31mERROR\u001b[0m","time":"2023-11-17T13:57:24.901+0800","caller":"config/provider_config.go:171","message":"Dubbogo do not read service interface name with registeredTypeName = DciProvider.Please run go install github.com/dubbogo/dubbogo-cli/cmd/protoc-gen-go-triple@latest to update your protoc-gen-go-triple and re-generate your pb file again.If you are not using pb serialization, please set 'interface' field in service config."}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T13:57:24.902+0800","caller":"dubbo/dubbo_protocol.go:84","message":"[DUBBO Protocol] Export service: dubbo://:51211/org.apache.dubbo.metadata.MetadataService?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=MetadataService&cluster=&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&group=dubbo.io&interface=org.apache.dubbo.metadata.MetadataService&loadbalance=&message_size=0&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&param.sign=&pid=8424&registry.role=3&release=dubbo-golang-3.0.4&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=1700200644&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=1.0.0&warmup="}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T13:57:24.902+0800","caller":"configurable/exporter.go:80","message":"[Metadata Service] The MetadataService exports urls : [dubbo://:51211/org.apache.dubbo.metadata.MetadataService?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=MetadataService&cluster=&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&group=dubbo.io&interface=org.apache.dubbo.metadata.MetadataService&loadbalance=&message_size=0&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&param.sign=&pid=8424&registry.role=3&release=dubbo-golang-3.0.4&retries=&serialization=&service.filter=echo%2Cmetrics%2Ctoken%2Caccesslog%2Ctps%2Cgeneric_service%2Cexecute%2Cpshutdown&side=provider&timestamp=1700200644&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=1.0.0&warmup=] "}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:54.252+0800","caller":"config/graceful_shutdown.go:81","message":"get signal terminated, applicationConfig will shutdown."}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:54.252+0800","caller":"config/graceful_shutdown.go:121","message":"Graceful shutdown --- Destroy all registriesConfig. "}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:54.252+0800","caller":"config/graceful_shutdown.go:162","message":"Graceful shutdown --- Keep waiting and accept new requests for a short time. "}
{"level":"\u001b[31mERROR\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"config/graceful_shutdown_config.go:110","message":"The OfflineRequestWindowTimeout configuration is invalid: , and we will use the default value: 3s, err: time: invalid duration \"\""}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"config/graceful_shutdown.go:196","message":"Graceful shutdown --- Keep waiting until sending/accepting requests finish or timeout. "}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"config/graceful_shutdown.go:129","message":"Graceful shutdown --- Destroy protocols. "}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"config/graceful_shutdown.go:144","message":"Graceful shutdown --- First destroy provider's protocols. "}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"protocol/protocol.go:142","message":"Exporter unexport."}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"protocol/invoker.go:92","message":"Destroy invoker: tri://:20201/grpc.health.v1.Health?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=DubbogoHealthServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.health.v1.Health&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&param.sign=&pid=8424&registry.role=3&release=dubbo-golang-3.0.4&retries=&serialization=&service.filter=tracing&side=provider&timestamp=1700200644&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"protocol/protocol.go:142","message":"Exporter unexport."}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"protocol/invoker.go:92","message":"Destroy invoker: tri://:20201/grpc.reflection.v1alpha.ServerReflection?accesslog=&app.version=&application=dubbo.io&auth=&bean.name=DubbogoServerReflectionServer&cluster=failover&config.tracing=&environment=&execute.limit=&execute.limit.rejected.handler=&export=true&interface=grpc.reflection.v1alpha.ServerReflection&loadbalance=random&message_size=4&metadata-type=local&module=sample&name=dubbo.io&organization=dubbo-go&owner=dubbo-go&param.sign=&pid=8424&registry.role=3&release=dubbo-golang-3.0.4&retries=&serialization=&service.filter=tracing&side=provider&timestamp=1700200644&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&warmup="}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.256+0800","caller":"config/graceful_shutdown.go:155","message":"Graceful shutdown --- Second Destroy consumer's protocols. "}
{"level":"\u001b[34mINFO\u001b[0m","time":"2023-11-17T14:44:57.257+0800","caller":"config/graceful_shutdown.go:113","message":"Graceful shutdown --- Execute the custom callbacks."}
Loading…
Cancel
Save