contract 接口修改
This commit is contained in:
parent
ab1e64b6e4
commit
f898e79632
@ -29,14 +29,6 @@ func (c *ArtistInfoContractProvider) ContractListMgmt(ctx context.Context, req *
|
|||||||
return rep, nil
|
return rep, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ArtistInfoContractProvider) ContractHistoryByLockMgmt(ctx context.Context, req *contract.ContractHistoryByLockMgmtRequest) (rep *contract.ContractHistoryByLockMgmtRespond, err error) {
|
|
||||||
fmt.Println("第一处")
|
|
||||||
if rep, err = c.contractLogic.ContractHistoryByLockMgmt(req); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return rep, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ArtistInfoContractProvider) ContractList(ctx context.Context, req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
func (c *ArtistInfoContractProvider) ContractList(ctx context.Context, req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error) {
|
||||||
fmt.Println("第一处")
|
fmt.Println("第一处")
|
||||||
if rep, err = c.contractLogic.ContractList(req); err != nil {
|
if rep, err = c.contractLogic.ContractList(req); err != nil {
|
||||||
|
@ -105,38 +105,7 @@ func GetArtistNoByUid(artistUid string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetContractList(artistUid string, pageSize, offset int32) (contracts []*contract.Contracts, err error) {
|
func GetContractList(artistUid string, pageSize, offset, status int32) (contracts []*contract.Contracts, err error) {
|
||||||
|
|
||||||
var contractSlice []model.Contract
|
|
||||||
if err = db.DB.Where("artist_uid = ?", artistUid).Order("ID asc").Limit(int(pageSize)).Offset(int(offset)).Find(&contractSlice).Error; err != nil {
|
|
||||||
zap.L().Error("get contracts info err", zap.Error(err))
|
|
||||||
err = errors.New(m.CREATE_ERROR)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fmt.Println("第二处")
|
|
||||||
for _, v := range contractSlice {
|
|
||||||
contcontract := &contract.Contracts{
|
|
||||||
ContractUid: v.Uid,
|
|
||||||
ArtistUid: v.ArtistUid,
|
|
||||||
ArtworkUid: v.ArtworkUid,
|
|
||||||
ContractId: v.ContractId,
|
|
||||||
TransactionId: v.TransactionId,
|
|
||||||
Type: v.Type,
|
|
||||||
ViewUrl: v.ViewUrl,
|
|
||||||
DownloadUrl: v.DownloadUrl,
|
|
||||||
State: v.State,
|
|
||||||
Status: int32(v.Status),
|
|
||||||
LockTime: v.LockTime,
|
|
||||||
}
|
|
||||||
|
|
||||||
contracts = append(contracts, contcontract)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func ContractHistoryByLockMgmt(artistUid string, pageSize, offset, status int32) (contracts []*contract.Contracts, err error) {
|
|
||||||
|
|
||||||
var contractSlice []model.Contract
|
var contractSlice []model.Contract
|
||||||
if err = db.DB.Where("artist_uid = ? AND status = ?", artistUid, status).Order("ID asc").Limit(int(pageSize)).Offset(int(offset)).Find(&contractSlice).Error; err != nil {
|
if err = db.DB.Where("artist_uid = ? AND status = ?", artistUid, status).Order("ID asc").Limit(int(pageSize)).Offset(int(offset)).Find(&contractSlice).Error; err != nil {
|
||||||
@ -164,6 +133,7 @@ func ContractHistoryByLockMgmt(artistUid string, pageSize, offset, status int32)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetArtistInfoById(artistUid string) (user model.User, err error) {
|
func GetArtistInfoById(artistUid string) (user model.User, err error) {
|
||||||
|
@ -20,7 +20,6 @@ import (
|
|||||||
type IContract interface {
|
type IContract interface {
|
||||||
CreateContract(req *contract.CreateContractRequest) (rep *contract.CreateContractRespond, err error)
|
CreateContract(req *contract.CreateContractRequest) (rep *contract.CreateContractRespond, err error)
|
||||||
ContractListMgmt(req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error)
|
ContractListMgmt(req *contract.ContractListMgmtRequest) (rep *contract.ContractListMgmtRespond, err error)
|
||||||
ContractHistoryByLockMgmt(req *contract.ContractHistoryByLockMgmtRequest) (rep *contract.ContractHistoryByLockMgmtRespond, err error)
|
|
||||||
ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error)
|
ContractList(req *contract.ContractListRequest) (rep *contract.ContractListRespond, err error)
|
||||||
SignContract(req *contract.SignContractRequest) (rep *contract.SignContractRespond, err error)
|
SignContract(req *contract.SignContractRequest) (rep *contract.SignContractRespond, err error)
|
||||||
FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error)
|
FinishContract(req *contract.FinishContractRequest) (rep *contract.FinishContractRespond, err error)
|
||||||
@ -175,29 +174,7 @@ func (a *Contract) ContractListMgmt(req *contract.ContractListMgmtRequest) (rep
|
|||||||
offset := (req.Page - 1) * req.Num
|
offset := (req.Page - 1) * req.Num
|
||||||
|
|
||||||
//获取该用户的所有合同
|
//获取该用户的所有合同
|
||||||
contracts, err := dao.GetContractList(req.ArtistUid, req.Num, offset)
|
contracts, err := dao.GetContractList(req.ArtistUid, req.Num, offset, req.Status)
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rep.Data = contracts
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *Contract) ContractHistoryByLockMgmt(req *contract.ContractHistoryByLockMgmtRequest) (rep *contract.ContractHistoryByLockMgmtRespond, err error) {
|
|
||||||
rep = &contract.ContractHistoryByLockMgmtRespond{}
|
|
||||||
|
|
||||||
//合同分页查询操作
|
|
||||||
if req.Page < 1 {
|
|
||||||
req.Page = 1
|
|
||||||
}
|
|
||||||
if req.Num < 1 {
|
|
||||||
req.Num = 15
|
|
||||||
}
|
|
||||||
offset := (req.Page - 1) * req.Num
|
|
||||||
|
|
||||||
//获取该用户的所有合同
|
|
||||||
contracts, err := dao.ContractHistoryByLockMgmt(req.ArtistUid, req.Num, offset, req.Status)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ option go_package = "./;artistContract";
|
|||||||
service ArtistContract {
|
service ArtistContract {
|
||||||
rpc CreateContract (CreateContractRequest) returns (CreateContractRespond) {}
|
rpc CreateContract (CreateContractRequest) returns (CreateContractRespond) {}
|
||||||
rpc ContractListMgmt (ContractListMgmtRequest) returns (ContractListMgmtRespond) {}
|
rpc ContractListMgmt (ContractListMgmtRequest) returns (ContractListMgmtRespond) {}
|
||||||
rpc ContractHistoryByLockMgmt (ContractHistoryByLockMgmtRequest) returns (ContractHistoryByLockMgmtRespond) {}
|
|
||||||
rpc ContractList (ContractListRequest) returns (ContractListRespond) {}
|
rpc ContractList (ContractListRequest) returns (ContractListRespond) {}
|
||||||
rpc SignContract (SignContractRequest) returns (SignContractRespond) {}
|
rpc SignContract (SignContractRequest) returns (SignContractRespond) {}
|
||||||
rpc FinishContract (FinishContractRequest) returns (FinishContractRespond) {}
|
rpc FinishContract (FinishContractRequest) returns (FinishContractRespond) {}
|
||||||
@ -49,8 +48,9 @@ message CreateContractRespond{
|
|||||||
|
|
||||||
message ContractListMgmtRequest{
|
message ContractListMgmtRequest{
|
||||||
string ArtistUid = 1 [json_name = "artist_uid"];
|
string ArtistUid = 1 [json_name = "artist_uid"];
|
||||||
int32 Page = 2 [json_name = "page"];
|
int32 Status = 2 [json_name = "status"];
|
||||||
int32 Num = 3 [json_name = "num"];
|
int32 Page = 3 [json_name = "page"];
|
||||||
|
int32 Num = 4 [json_name = "num"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ContractListMgmtRespond{
|
message ContractListMgmtRespond{
|
||||||
@ -58,19 +58,6 @@ message ContractListMgmtRespond{
|
|||||||
string Msg = 2 [json_name = "msg"];
|
string Msg = 2 [json_name = "msg"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message ContractHistoryByLockMgmtRequest{
|
|
||||||
string ArtistUid = 1 [json_name = "artist_uid"];
|
|
||||||
int32 Status = 2 [json_name = "status"];
|
|
||||||
int32 Page = 3 [json_name = "page"];
|
|
||||||
int32 Num = 4 [json_name = "num"];
|
|
||||||
}
|
|
||||||
|
|
||||||
message ContractHistoryByLockMgmtRespond{
|
|
||||||
repeated Contracts Data = 1 [json_name = "data"];
|
|
||||||
string Msg = 2 [json_name = "msg"];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
message ContractListRequest {
|
message ContractListRequest {
|
||||||
string ArtistUid = 1 [json_name = "artist_uid"];
|
string ArtistUid = 1 [json_name = "artist_uid"];
|
||||||
int32 PageSize = 2 [json_name="pageSize"];
|
int32 PageSize = 2 [json_name="pageSize"];
|
||||||
|
@ -37,19 +37,6 @@ func (this *ContractListMgmtRespond) Validate() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (this *ContractHistoryByLockMgmtRequest) Validate() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractHistoryByLockMgmtRespond) Validate() error {
|
|
||||||
for _, item := range this.Data {
|
|
||||||
if item != nil {
|
|
||||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
|
||||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (this *ContractListRequest) Validate() error {
|
func (this *ContractListRequest) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ const _ = grpc_go.SupportPackageIsVersion7
|
|||||||
type ArtistContractClient interface {
|
type ArtistContractClient interface {
|
||||||
CreateContract(ctx context.Context, in *CreateContractRequest, opts ...grpc_go.CallOption) (*CreateContractRespond, common.ErrorWithAttachment)
|
CreateContract(ctx context.Context, in *CreateContractRequest, opts ...grpc_go.CallOption) (*CreateContractRespond, common.ErrorWithAttachment)
|
||||||
ContractListMgmt(ctx context.Context, in *ContractListMgmtRequest, opts ...grpc_go.CallOption) (*ContractListMgmtRespond, common.ErrorWithAttachment)
|
ContractListMgmt(ctx context.Context, in *ContractListMgmtRequest, opts ...grpc_go.CallOption) (*ContractListMgmtRespond, common.ErrorWithAttachment)
|
||||||
ContractHistoryByLockMgmt(ctx context.Context, in *ContractHistoryByLockMgmtRequest, opts ...grpc_go.CallOption) (*ContractHistoryByLockMgmtRespond, common.ErrorWithAttachment)
|
|
||||||
ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment)
|
ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment)
|
||||||
SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment)
|
SignContract(ctx context.Context, in *SignContractRequest, opts ...grpc_go.CallOption) (*SignContractRespond, common.ErrorWithAttachment)
|
||||||
FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment)
|
FinishContract(ctx context.Context, in *FinishContractRequest, opts ...grpc_go.CallOption) (*FinishContractRespond, common.ErrorWithAttachment)
|
||||||
@ -45,7 +44,6 @@ type artistContractClient struct {
|
|||||||
type ArtistContractClientImpl struct {
|
type ArtistContractClientImpl struct {
|
||||||
CreateContract func(ctx context.Context, in *CreateContractRequest) (*CreateContractRespond, error)
|
CreateContract func(ctx context.Context, in *CreateContractRequest) (*CreateContractRespond, error)
|
||||||
ContractListMgmt func(ctx context.Context, in *ContractListMgmtRequest) (*ContractListMgmtRespond, error)
|
ContractListMgmt func(ctx context.Context, in *ContractListMgmtRequest) (*ContractListMgmtRespond, error)
|
||||||
ContractHistoryByLockMgmt func(ctx context.Context, in *ContractHistoryByLockMgmtRequest) (*ContractHistoryByLockMgmtRespond, error)
|
|
||||||
ContractList func(ctx context.Context, in *ContractListRequest) (*ContractListRespond, error)
|
ContractList func(ctx context.Context, in *ContractListRequest) (*ContractListRespond, error)
|
||||||
SignContract func(ctx context.Context, in *SignContractRequest) (*SignContractRespond, error)
|
SignContract func(ctx context.Context, in *SignContractRequest) (*SignContractRespond, error)
|
||||||
FinishContract func(ctx context.Context, in *FinishContractRequest) (*FinishContractRespond, error)
|
FinishContract func(ctx context.Context, in *FinishContractRequest) (*FinishContractRespond, error)
|
||||||
@ -77,12 +75,6 @@ func (c *artistContractClient) ContractListMgmt(ctx context.Context, in *Contrac
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractListMgmt", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractListMgmt", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *artistContractClient) ContractHistoryByLockMgmt(ctx context.Context, in *ContractHistoryByLockMgmtRequest, opts ...grpc_go.CallOption) (*ContractHistoryByLockMgmtRespond, common.ErrorWithAttachment) {
|
|
||||||
out := new(ContractHistoryByLockMgmtRespond)
|
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
|
||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/ContractHistoryByLockMgmt", in, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *artistContractClient) ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment) {
|
func (c *artistContractClient) ContractList(ctx context.Context, in *ContractListRequest, opts ...grpc_go.CallOption) (*ContractListRespond, common.ErrorWithAttachment) {
|
||||||
out := new(ContractListRespond)
|
out := new(ContractListRespond)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
@ -119,7 +111,6 @@ func (c *artistContractClient) GetContractInfoByContractUid(ctx context.Context,
|
|||||||
type ArtistContractServer interface {
|
type ArtistContractServer interface {
|
||||||
CreateContract(context.Context, *CreateContractRequest) (*CreateContractRespond, error)
|
CreateContract(context.Context, *CreateContractRequest) (*CreateContractRespond, error)
|
||||||
ContractListMgmt(context.Context, *ContractListMgmtRequest) (*ContractListMgmtRespond, error)
|
ContractListMgmt(context.Context, *ContractListMgmtRequest) (*ContractListMgmtRespond, error)
|
||||||
ContractHistoryByLockMgmt(context.Context, *ContractHistoryByLockMgmtRequest) (*ContractHistoryByLockMgmtRespond, error)
|
|
||||||
ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error)
|
ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error)
|
||||||
SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error)
|
SignContract(context.Context, *SignContractRequest) (*SignContractRespond, error)
|
||||||
FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error)
|
FinishContract(context.Context, *FinishContractRequest) (*FinishContractRespond, error)
|
||||||
@ -139,9 +130,6 @@ func (UnimplementedArtistContractServer) CreateContract(context.Context, *Create
|
|||||||
func (UnimplementedArtistContractServer) ContractListMgmt(context.Context, *ContractListMgmtRequest) (*ContractListMgmtRespond, error) {
|
func (UnimplementedArtistContractServer) ContractListMgmt(context.Context, *ContractListMgmtRequest) (*ContractListMgmtRespond, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ContractListMgmt not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ContractListMgmt not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedArtistContractServer) ContractHistoryByLockMgmt(context.Context, *ContractHistoryByLockMgmtRequest) (*ContractHistoryByLockMgmtRespond, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ContractHistoryByLockMgmt not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedArtistContractServer) ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error) {
|
func (UnimplementedArtistContractServer) ContractList(context.Context, *ContractListRequest) (*ContractListRespond, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ContractList not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method ContractList not implemented")
|
||||||
}
|
}
|
||||||
@ -243,35 +231,6 @@ func _ArtistContract_ContractListMgmt_Handler(srv interface{}, ctx context.Conte
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _ArtistContract_ContractHistoryByLockMgmt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(ContractHistoryByLockMgmtRequest)
|
|
||||||
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("ContractHistoryByLockMgmt", 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 _ArtistContract_ContractList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
func _ArtistContract_ContractList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(ContractListRequest)
|
in := new(ContractListRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -432,10 +391,6 @@ var ArtistContract_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "ContractListMgmt",
|
MethodName: "ContractListMgmt",
|
||||||
Handler: _ArtistContract_ContractListMgmt_Handler,
|
Handler: _ArtistContract_ContractListMgmt_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "ContractHistoryByLockMgmt",
|
|
||||||
Handler: _ArtistContract_ContractHistoryByLockMgmt_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "ContractList",
|
MethodName: "ContractList",
|
||||||
Handler: _ArtistContract_ContractList_Handler,
|
Handler: _ArtistContract_ContractList_Handler,
|
||||||
|
Loading…
Reference in New Issue
Block a user