优化申诉仲裁流程和证据展示
This commit is contained in:
@@ -75,6 +75,42 @@ func (h *Handler) Detail(c *gin.Context) {
|
||||
response.OK(c, item)
|
||||
}
|
||||
|
||||
func (h *Handler) Cancel(c *gin.Context) {
|
||||
userID, ok := currentUserID(c)
|
||||
if !ok {
|
||||
response.Unauthorized(c, "缺少用户上下文")
|
||||
return
|
||||
}
|
||||
id, ok := parseID(c)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
item, err := h.service.Cancel(c.Request.Context(), userID, id)
|
||||
if err != nil {
|
||||
writeDisputeError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, item)
|
||||
}
|
||||
|
||||
func (h *Handler) CancelByOrder(c *gin.Context) {
|
||||
userID, ok := currentUserID(c)
|
||||
if !ok {
|
||||
response.Unauthorized(c, "缺少用户上下文")
|
||||
return
|
||||
}
|
||||
orderID, ok := parseID(c)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
item, err := h.service.CancelByOrder(c.Request.Context(), userID, orderID)
|
||||
if err != nil {
|
||||
writeDisputeError(c, err)
|
||||
return
|
||||
}
|
||||
response.OK(c, item)
|
||||
}
|
||||
|
||||
func (h *Handler) AdminList(c *gin.Context) {
|
||||
page, pageSize := parsePagination(c)
|
||||
result, err := h.service.ListAdmin(c.Request.Context(), page, pageSize)
|
||||
@@ -168,6 +204,8 @@ func writeDisputeError(c *gin.Context, err error) {
|
||||
response.Error(c, http.StatusConflict, "dispute_exists", "该订单已有处理中申诉")
|
||||
case errors.Is(err, ErrDisputeCannotHandle):
|
||||
response.Error(c, http.StatusConflict, "dispute_cannot_handle", "当前申诉不能仲裁")
|
||||
case errors.Is(err, ErrDisputeCannotCancel):
|
||||
response.Error(c, http.StatusConflict, "dispute_cannot_cancel", "当前申诉不能取消")
|
||||
case errors.Is(err, ErrPermissionDenied):
|
||||
response.Error(c, http.StatusForbidden, "permission_denied", "无权操作该申诉")
|
||||
case IsNotFound(err):
|
||||
|
||||
Reference in New Issue
Block a user