39 lines
793 B
Go
39 lines
793 B
Go
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"psi/models/request"
|
|
"psi/service"
|
|
"psi/utils"
|
|
)
|
|
|
|
type CancelLogisticsApi struct{}
|
|
|
|
var cancelLogisticsService = service.CancelLogisticsService{}
|
|
|
|
// CancelLogistics 取消物流单号
|
|
func (r *CancelLogisticsApi) CancelLogistics(c *gin.Context) {
|
|
var req request.CancelLogisticsRequest
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"code": "500",
|
|
"msg": "参数错误: " + err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
resp, err := cancelLogisticsService.CancelLogistics(req.UserID, req.LogisticsNo)
|
|
if err != nil {
|
|
utils.ErrorLog("cancel_logistics", nil) // simple log
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"code": "500",
|
|
"msg": err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, resp)
|
|
}
|