Merge branch 'cjy' into dev
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
06a23fb500
@ -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,36 @@ 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)
|
||||
|
||||
// 创建企业用户更新请求,使用AddDciUser的结构但设置为更新模式
|
||||
updateEnterpriseUserRequest := new(bccrClient.UpdateDciUserRequest)
|
||||
_ = copier.CopyWithOption(&updateEnterpriseUserRequest, req, copier.Option{DeepCopy: false})
|
||||
|
||||
// 创建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信息 参数信息: ")
|
||||
|
19
pb/dci.proto
19
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
|
||||
@ -356,3 +357,21 @@ message QueryDciFeedbackResponse {
|
||||
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 certificateNumber = 2 [json_name = "certificateNumber"];
|
||||
string certificateFrontFileId = 3 [json_name = "certificateFrontFileId",(validator.field) = {string_not_empty: true,human_error:"企业营业执照文件路径不能为空"}];
|
||||
string legalPersonCertName = 4 [json_name = "legalPersonCertName"];
|
||||
string legalPersonCertType = 5 [json_name = "legalPersonCertType"];
|
||||
string legalPersonCertNo = 6 [json_name = "legalPersonCertNo"];
|
||||
string phone = 7 [json_name = "phone"];
|
||||
string areaType = 8 [json_name = "areaType"];
|
||||
string clientToken = 9 [json_name = "clientToken"];
|
||||
}
|
||||
|
||||
message UpdateDciEnterpriseUserResponse {
|
||||
string resultCode = 1 [json_name = "resultCode"];
|
||||
string resultMsg = 2 [json_name = "resultMsg"];
|
||||
string reqMsgId = 3 [json_name = "reqMsgId"];
|
||||
}
|
865
pb/dci/dci.pb.go
865
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