Merge branch 'main' of https://gitea-inner.fontree.cn/chain/chain-dci
This commit is contained in:
commit
5835cb8de1
41
.drone.yml
41
.drone.yml
@ -4,27 +4,49 @@ name: chain-dci【K8s-测试服】
|
||||
volumes:
|
||||
- name: pkgdeps
|
||||
host:
|
||||
path: /mnt/storage/data/drone/define_cache/chain-dci
|
||||
path: /mnt/data/drone/define_cache/chain-dci
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
- name: docker-daemon
|
||||
host:
|
||||
path: /etc/docker/daemon.json
|
||||
clone:
|
||||
disable: true
|
||||
steps:
|
||||
- name: clone-and-configure
|
||||
image: testhub.szjixun.cn:9043/public/plugins/git
|
||||
environment:
|
||||
GITEA_USERNAME:
|
||||
from_secret: GITEA_USERNAME
|
||||
GITEA_TOKEN:
|
||||
from_secret: GITEA_TOKEN
|
||||
commands:
|
||||
# 手动克隆主仓库
|
||||
- git init
|
||||
- git remote add origin https://${GITEA_USERNAME}:${GITEA_TOKEN}@gitea-inner.fontree.cn/chain/chain-dci
|
||||
- git fetch --no-tags origin +refs/heads/dev
|
||||
- git reset --hard origin/dev
|
||||
# 配置子模块 URL 重定向
|
||||
- git config --global url."https://${GITEA_USERNAME}:${GITEA_TOKEN}@gitea-inner.fontree.cn/fonchain/oa-proto.git".insteadOf "https://gitea-net.fontree.cn/fonchain/oa-proto.git"
|
||||
# 配置 HTTPS 凭据
|
||||
# - git config --global credential.helper 'store --file=/tmp/git-credentials'
|
||||
# - echo "https://${GITEA_USERNAME}:${GITEA_TOKEN}@gitea-inner.fontree.cn" > /tmp/git-credentials
|
||||
# 更新子模块
|
||||
- git submodule update --init --recursive
|
||||
when:
|
||||
branch:
|
||||
- dev
|
||||
- name: fetch submodules
|
||||
image: testhub.szjixun.cn:9043/public/plugins/git
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- git config --file=.gitmodules submodule.oa-proto.url https://gitea-inner.fontree.cn/fonchain/oa-proto.git
|
||||
- git submodule sync
|
||||
- git submodule update --init --force --recursive --remote
|
||||
- name: build
|
||||
image: testhub.szjixun.cn:9043/public/golang:1.20-alpine
|
||||
pull: if-not-exists
|
||||
network:
|
||||
mode: bridge
|
||||
options:
|
||||
com.docker.network.bridge.host_binding_ipv4: "172.16.100.22"
|
||||
com.docker.network.bridge.name: "dnmp_default"
|
||||
environment:
|
||||
GOPROXY: "https://goproxy.cn,direct"
|
||||
GOPATH: /go
|
||||
@ -67,7 +89,6 @@ steps:
|
||||
dashboard: kuboard
|
||||
build_repo:
|
||||
from_secret: build_repo
|
||||
|
||||
- name: 钉钉通知
|
||||
image: testhub.szjixun.cn:9043/public/drone-ding
|
||||
settings:
|
||||
@ -82,15 +103,11 @@ steps:
|
||||
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: 172.18.0.0/16
|
||||
subnet: dnmp_default
|
||||
trigger:
|
||||
branch:
|
||||
- dev
|
||||
|
@ -39,6 +39,12 @@ func (d *DciProvider) UpdateDciUser(_ context.Context, req *dci.UpdateDciUserReq
|
||||
return
|
||||
}
|
||||
|
||||
func (d *DciProvider) UpdateDciEnterpriseUser(_ context.Context, req *dci.UpdateDciEnterpriseUserRequest) (res *dci.UpdateDciEnterpriseUserResponse, err error) {
|
||||
res = new(dci.UpdateDciEnterpriseUserResponse)
|
||||
res, err = d.dciUser.UpdateDciEnterpriseUser(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)
|
||||
|
@ -5,14 +5,16 @@ import (
|
||||
"chain-dci/pkg/app"
|
||||
errCommon "chain-dci/pkg/err"
|
||||
"chain-dci/pkg/msg"
|
||||
"time"
|
||||
|
||||
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
|
||||
"github.com/jinzhu/copier"
|
||||
"time"
|
||||
)
|
||||
|
||||
type IDciUser interface {
|
||||
AddDciUser(req *dci.AddDciUserRequest) (res *dci.AddDciUserResponse, err error)
|
||||
UpdateDciUser(req *dci.UpdateDciUserRequest) (res *dci.UpdateDciUserResponse, err error)
|
||||
UpdateDciEnterpriseUser(req *dci.UpdateDciEnterpriseUserRequest) (res *dci.UpdateDciEnterpriseUserResponse, err error)
|
||||
QueryDciUser(req *dci.QueryDciUserRequest) (res *dci.QueryDciUserResponse, err error)
|
||||
}
|
||||
|
||||
@ -73,6 +75,44 @@ func (u *DciUser) UpdateDciUser(req *dci.UpdateDciUserRequest) (res *dci.UpdateD
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateDciEnterpriseUser 企业著作权人 更新 DCI信息
|
||||
func (u *DciUser) UpdateDciEnterpriseUser(req *dci.UpdateDciEnterpriseUserRequest) (res *dci.UpdateDciEnterpriseUserResponse, err error) {
|
||||
errCommon.NoReturnInfo(req, "企业著作权人 更新 DCI信息 参数信息: ")
|
||||
|
||||
res = new(dci.UpdateDciEnterpriseUserResponse)
|
||||
|
||||
updateEnterpriseUserRequest := new(bccrClient.UpdateDciUserRequest)
|
||||
// 构建企业用户更新请求
|
||||
updateEnterpriseUserRequest.SetDciUserId(req.DciUserId)
|
||||
updateEnterpriseUserRequest.SetCertFrontFileId(req.CertificateFrontFileId)
|
||||
updateEnterpriseUserRequest.SetPhone(req.Phone)
|
||||
|
||||
updateEnterpriseUserRequest.SetLegalPersonInfo(&bccrClient.EnterpriseLegalPersonInfo{
|
||||
LegalPersonCertName: &req.LegalPersonCertName,
|
||||
LegalPersonCertType: &req.LegalPersonCertType,
|
||||
LegalPersonCertNo: &req.LegalPersonCertNo,
|
||||
})
|
||||
|
||||
// 创建clientToken,包含企业特有信息
|
||||
clientToken, err := createToken(time.Now().UnixMilli(), req.DciUserId, req.CertificateFrontFileId, req.Phone, app.ModuleClients.SfNode.Generate().Base64())
|
||||
if err != nil {
|
||||
return nil, errCommon.ReturnError(err, msg.ErrCreateClientToken, "创建企业用户clientToken 失败: ")
|
||||
}
|
||||
updateEnterpriseUserRequest.SetClientToken(clientToken)
|
||||
|
||||
// 调用底层API
|
||||
updateEnterpriseUserResponse, err := app.ModuleClients.BccrClient.UpdateDciUser(updateEnterpriseUserRequest)
|
||||
if err != nil {
|
||||
return nil, errCommon.ReturnError(err, msg.ErrUpdateDciUser, "企业著作权人 更新 DCI信息 失败: ")
|
||||
}
|
||||
|
||||
errCommon.NoReturnInfo(updateEnterpriseUserResponse, "企业著作权人 更新 DCI信息 成功: ")
|
||||
|
||||
_ = copier.CopyWithOption(&res, updateEnterpriseUserResponse, copier.Option{DeepCopy: false})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// QueryDciUser 著作权人 查询 DCI信息
|
||||
func (u *DciUser) QueryDciUser(req *dci.QueryDciUserRequest) (res *dci.QueryDciUserResponse, err error) {
|
||||
errCommon.NoReturnInfo(req, "著作权人 查询 DCI信息 参数信息: ")
|
||||
|
17
pb/dci.proto
17
pb/dci.proto
@ -13,6 +13,7 @@ service Dci {
|
||||
// dci user
|
||||
rpc AddDciUser(AddDciUserRequest) returns (AddDciUserResponse);
|
||||
rpc UpdateDciUser(UpdateDciUserRequest) returns (UpdateDciUserResponse);
|
||||
rpc UpdateDciEnterpriseUser(UpdateDciEnterpriseUserRequest) returns (UpdateDciEnterpriseUserResponse); // 更新企业用户
|
||||
rpc QueryDciUser(QueryDciUserRequest) returns (QueryDciUserResponse);
|
||||
|
||||
// dci work
|
||||
@ -355,4 +356,20 @@ message QueryDciFeedbackResponse {
|
||||
string feedbackStatus = 5 [json_name = "feedbackStatus"];
|
||||
string DciContentId = 6 [json_name = "DciContentId"];
|
||||
string msg = 7 [json_name = "msg"];
|
||||
}
|
||||
// Dci enterprise user 更新 - 专门用于企业用户
|
||||
message UpdateDciEnterpriseUserRequest {
|
||||
string dciUserId = 1 [json_name = "dciUserId",(validator.field) = {string_not_empty: true,human_error:"dci用户ID不能为空"}];
|
||||
string certificateFrontFileId = 2 [json_name = "certificateFrontFileId",(validator.field) = {string_not_empty: true,human_error:"企业营业执照文件路径不能为空"}];
|
||||
string legalPersonCertName = 3 [json_name = "legalPersonCertName"];
|
||||
string legalPersonCertType = 4 [json_name = "legalPersonCertType"];
|
||||
string legalPersonCertNo = 5 [json_name = "legalPersonCertNo"];
|
||||
string phone = 6 [json_name = "phone"];
|
||||
string clientToken = 7 [json_name = "clientToken"];
|
||||
}
|
||||
|
||||
message UpdateDciEnterpriseUserResponse {
|
||||
string resultCode = 1 [json_name = "resultCode"];
|
||||
string resultMsg = 2 [json_name = "resultMsg"];
|
||||
string reqMsgId = 3 [json_name = "reqMsgId"];
|
||||
}
|
850
pb/dci/dci.pb.go
850
pb/dci/dci.pb.go
File diff suppressed because it is too large
Load Diff
@ -335,3 +335,15 @@ func (this *QueryDciFeedbackRequest) Validate() error {
|
||||
func (this *QueryDciFeedbackResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateDciEnterpriseUserRequest) Validate() error {
|
||||
if this.DciUserId == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("DciUserId", fmt.Errorf(`dci用户ID不能为空`))
|
||||
}
|
||||
if this.CertificateFrontFileId == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("CertificateFrontFileId", fmt.Errorf(`企业营业执照文件路径不能为空`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateDciEnterpriseUserResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v5.29.0--rc3
|
||||
// - protoc-gen-go-triple v1.0.8
|
||||
// - protoc v3.21.1
|
||||
// source: pb/dci.proto
|
||||
|
||||
package dci
|
||||
@ -33,6 +33,7 @@ type DciClient interface {
|
||||
// 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)
|
||||
UpdateDciEnterpriseUser(ctx context.Context, in *UpdateDciEnterpriseUserRequest, opts ...grpc_go.CallOption) (*UpdateDciEnterpriseUserResponse, 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)
|
||||
@ -57,6 +58,7 @@ 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)
|
||||
UpdateDciEnterpriseUser func(ctx context.Context, in *UpdateDciEnterpriseUserRequest) (*UpdateDciEnterpriseUserResponse, 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)
|
||||
@ -101,6 +103,12 @@ func (c *dciClient) UpdateDciUser(ctx context.Context, in *UpdateDciUserRequest,
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateDciUser", in, out)
|
||||
}
|
||||
|
||||
func (c *dciClient) UpdateDciEnterpriseUser(ctx context.Context, in *UpdateDciEnterpriseUserRequest, opts ...grpc_go.CallOption) (*UpdateDciEnterpriseUserResponse, common.ErrorWithAttachment) {
|
||||
out := new(UpdateDciEnterpriseUserResponse)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateDciEnterpriseUser", 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)
|
||||
@ -182,6 +190,7 @@ type DciServer interface {
|
||||
// dci user
|
||||
AddDciUser(context.Context, *AddDciUserRequest) (*AddDciUserResponse, error)
|
||||
UpdateDciUser(context.Context, *UpdateDciUserRequest) (*UpdateDciUserResponse, error)
|
||||
UpdateDciEnterpriseUser(context.Context, *UpdateDciEnterpriseUserRequest) (*UpdateDciEnterpriseUserResponse, error)
|
||||
QueryDciUser(context.Context, *QueryDciUserRequest) (*QueryDciUserResponse, error)
|
||||
// dci work
|
||||
CreateDciPreregistration(context.Context, *CreateDciPreregistrationRequest) (*CreateDciPreregistrationResponse, error)
|
||||
@ -213,6 +222,9 @@ func (UnimplementedDciServer) AddDciUser(context.Context, *AddDciUserRequest) (*
|
||||
func (UnimplementedDciServer) UpdateDciUser(context.Context, *UpdateDciUserRequest) (*UpdateDciUserResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateDciUser not implemented")
|
||||
}
|
||||
func (UnimplementedDciServer) UpdateDciEnterpriseUser(context.Context, *UpdateDciEnterpriseUserRequest) (*UpdateDciEnterpriseUserResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateDciEnterpriseUser not implemented")
|
||||
}
|
||||
func (UnimplementedDciServer) QueryDciUser(context.Context, *QueryDciUserRequest) (*QueryDciUserResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QueryDciUser not implemented")
|
||||
}
|
||||
@ -364,6 +376,35 @@ func _Dci_UpdateDciUser_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Dci_UpdateDciEnterpriseUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateDciEnterpriseUserRequest)
|
||||
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("UpdateDciEnterpriseUser", 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 {
|
||||
@ -731,6 +772,10 @@ var Dci_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "UpdateDciUser",
|
||||
Handler: _Dci_UpdateDciUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateDciEnterpriseUser",
|
||||
Handler: _Dci_UpdateDciEnterpriseUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "QueryDciUser",
|
||||
Handler: _Dci_QueryDciUser_Handler,
|
||||
|
Loading…
Reference in New Issue
Block a user