feat: 添加争议微服务,支持订单争议流程
This commit is contained in:
+65
-53
@@ -1,65 +1,77 @@
|
||||
syntax = "v1"
|
||||
|
||||
import "common.api"
|
||||
|
||||
type (
|
||||
PathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Dispute {
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
Reason string `json:"reason"`
|
||||
Status string `json:"status"`
|
||||
Evidence []string `json:"evidence"`
|
||||
Result string `json:"result,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
DisputeListResp {
|
||||
Items []Dispute `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
|
||||
CreateDisputeReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
|
||||
DisputeResponseReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
|
||||
AppealReq {
|
||||
PathId
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
DisputePathId {
|
||||
Id int64 `path:"id"`
|
||||
}
|
||||
Dispute {
|
||||
Id int64 `json:"id"`
|
||||
OrderId int64 `json:"orderId"`
|
||||
InitiatorId int64 `json:"initiatorId"`
|
||||
InitiatorName string `json:"initiatorName"`
|
||||
RespondentId int64 `json:"respondentId"`
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
Status string `json:"status"`
|
||||
Result string `json:"result,optional"`
|
||||
RespondentReason string `json:"respondentReason,optional"`
|
||||
RespondentEvidence []string `json:"respondentEvidence"`
|
||||
AppealReason string `json:"appealReason,optional"`
|
||||
AppealedAt string `json:"appealedAt,optional"`
|
||||
ResolvedBy int64 `json:"resolvedBy,optional"`
|
||||
ResolvedAt string `json:"resolvedAt,optional"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
DisputeListReq {
|
||||
PageReq
|
||||
Status string `form:"status,optional"`
|
||||
}
|
||||
DisputeListResp {
|
||||
Items []Dispute `json:"items"`
|
||||
Meta PageMeta `json:"meta"`
|
||||
}
|
||||
CreateDisputeReq {
|
||||
DisputePathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
DisputeResponseReq {
|
||||
DisputePathId
|
||||
Reason string `json:"reason"`
|
||||
Evidence []string `json:"evidence"`
|
||||
}
|
||||
AppealReq {
|
||||
DisputePathId
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
)
|
||||
|
||||
@server(
|
||||
prefix: api/v1
|
||||
group: dispute
|
||||
@server (
|
||||
prefix: api/v1
|
||||
group: dispute
|
||||
)
|
||||
service dispute-api {
|
||||
@doc "获取争议列表"
|
||||
@handler ListDisputes
|
||||
get /disputes (PageReq) returns (DisputeListResp)
|
||||
@doc "获取争议列表"
|
||||
@handler ListDisputes
|
||||
get /disputes (DisputeListReq) returns (DisputeListResp)
|
||||
|
||||
@doc "获取订单争议"
|
||||
@handler GetOrderDispute
|
||||
get /orders/:id/dispute (PathId) returns (Dispute)
|
||||
@doc "获取订单争议"
|
||||
@handler GetOrderDispute
|
||||
get /orders/:id/dispute (DisputePathId) returns (Dispute)
|
||||
|
||||
@doc "发起争议"
|
||||
@handler CreateDispute
|
||||
post /orders/:id/dispute (CreateDisputeReq) returns (EmptyResp)
|
||||
@doc "发起争议"
|
||||
@handler CreateDispute
|
||||
post /orders/:id/dispute (CreateDisputeReq) returns (EmptyResp)
|
||||
|
||||
@doc "回应争议"
|
||||
@handler RespondDispute
|
||||
post /disputes/:id/response (DisputeResponseReq) returns (EmptyResp)
|
||||
@doc "回应争议"
|
||||
@handler RespondDispute
|
||||
post /disputes/:id/response (DisputeResponseReq) returns (EmptyResp)
|
||||
|
||||
@doc "申诉"
|
||||
@handler AppealDispute
|
||||
post /disputes/:id/appeal (AppealReq) returns (EmptyResp)
|
||||
}
|
||||
|
||||
@doc "申诉"
|
||||
@handler AppealDispute
|
||||
post /disputes/:id/appeal (AppealReq) returns (EmptyResp)
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package ="./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// ------------------------------------
|
||||
// Messages
|
||||
// ------------------------------------
|
||||
|
||||
//--------------------------------disputes--------------------------------
|
||||
message Disputes {
|
||||
int64 id = 1;
|
||||
int64 orderId = 2;
|
||||
int64 initiatorId = 3;
|
||||
string initiatorName = 4;
|
||||
int64 respondentId = 5;
|
||||
string reason = 6;
|
||||
repeated string evidence = 7;
|
||||
string status = 8;
|
||||
string result = 9;
|
||||
string respondentReason = 10;
|
||||
repeated string respondentEvidence = 11;
|
||||
string appealReason = 12;
|
||||
int64 appealedAt = 13;
|
||||
int64 resolvedBy = 14;
|
||||
int64 resolvedAt = 15;
|
||||
int64 createdAt = 16;
|
||||
int64 updatedAt = 17;
|
||||
}
|
||||
|
||||
message AddDisputesReq {
|
||||
int64 orderId = 1;
|
||||
int64 initiatorId = 2;
|
||||
string initiatorName = 3;
|
||||
int64 respondentId = 4;
|
||||
string reason = 5;
|
||||
repeated string evidence = 6;
|
||||
string status = 7;
|
||||
}
|
||||
|
||||
message AddDisputesResp {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message UpdateDisputesReq {
|
||||
int64 id = 1;
|
||||
optional string status = 2;
|
||||
optional string result = 3;
|
||||
optional string respondentReason = 4;
|
||||
repeated string respondentEvidence = 5;
|
||||
optional string appealReason = 6;
|
||||
optional int64 appealedAt = 7;
|
||||
optional int64 resolvedBy = 8;
|
||||
optional int64 resolvedAt = 9;
|
||||
}
|
||||
|
||||
message UpdateDisputesResp {
|
||||
}
|
||||
|
||||
message DelDisputesReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message DelDisputesResp {
|
||||
}
|
||||
|
||||
message GetDisputesByIdReq {
|
||||
int64 id = 1;
|
||||
}
|
||||
|
||||
message GetDisputesByIdResp {
|
||||
Disputes disputes = 1;
|
||||
}
|
||||
|
||||
message SearchDisputesReq {
|
||||
int64 offset = 1;
|
||||
int64 limit = 2;
|
||||
optional int64 id = 3;
|
||||
optional int64 orderId = 4;
|
||||
optional int64 initiatorId = 5;
|
||||
optional int64 respondentId = 6;
|
||||
optional string status = 7;
|
||||
}
|
||||
|
||||
message SearchDisputesResp {
|
||||
repeated Disputes disputes = 1;
|
||||
}
|
||||
|
||||
//--------------------------------disputeTimeline--------------------------------
|
||||
message DisputeTimeline {
|
||||
int64 id = 1;
|
||||
int64 disputeId = 2;
|
||||
string eventType = 3;
|
||||
int64 actorId = 4;
|
||||
string actorName = 5;
|
||||
string details = 6;
|
||||
int64 createdAt = 7;
|
||||
}
|
||||
|
||||
message AddDisputeTimelineReq {
|
||||
int64 disputeId = 1;
|
||||
string eventType = 2;
|
||||
int64 actorId = 3;
|
||||
string actorName = 4;
|
||||
string details = 5;
|
||||
}
|
||||
|
||||
message AddDisputeTimelineResp {
|
||||
}
|
||||
|
||||
message SearchDisputeTimelineReq {
|
||||
int64 offset = 1;
|
||||
int64 limit = 2;
|
||||
optional int64 disputeId = 3;
|
||||
}
|
||||
|
||||
message SearchDisputeTimelineResp {
|
||||
repeated DisputeTimeline timeline = 1;
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Rpc Func
|
||||
// ------------------------------------
|
||||
|
||||
service disputeService {
|
||||
//-----------------------disputes-----------------------
|
||||
rpc AddDisputes(AddDisputesReq) returns (AddDisputesResp);
|
||||
rpc UpdateDisputes(UpdateDisputesReq) returns (UpdateDisputesResp);
|
||||
rpc DelDisputes(DelDisputesReq) returns (DelDisputesResp);
|
||||
rpc GetDisputesById(GetDisputesByIdReq) returns (GetDisputesByIdResp);
|
||||
rpc SearchDisputes(SearchDisputesReq) returns (SearchDisputesResp);
|
||||
|
||||
//-----------------------disputeTimeline-----------------------
|
||||
rpc AddDisputeTimeline(AddDisputeTimelineReq) returns (AddDisputeTimelineResp);
|
||||
rpc SearchDisputeTimeline(SearchDisputeTimelineReq) returns (SearchDisputeTimelineResp);
|
||||
}
|
||||
Reference in New Issue
Block a user