修复(#84): 补齐促销管理API实现文件
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package promo
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/perfect-panel/server/internal/logic/admin/promo"
|
||||
"github.com/perfect-panel/server/internal/svc"
|
||||
"github.com/perfect-panel/server/internal/types"
|
||||
"github.com/perfect-panel/server/pkg/result"
|
||||
)
|
||||
|
||||
// Delete promo price
|
||||
func DeletePromoPriceHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
var req types.DeletePromoPriceRequest
|
||||
id, err := strconv.ParseInt(c.Param("id"), 10, 64)
|
||||
if err != nil {
|
||||
c.String(http.StatusBadRequest, "Invalid Params")
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
req.Id = id
|
||||
_ = c.ShouldBind(&req)
|
||||
if err := svcCtx.Validate(&req); err != nil {
|
||||
result.ParamErrorResult(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := promo.NewDeletePromoPriceLogic(c.Request.Context(), svcCtx)
|
||||
err = l.DeletePromoPrice(&req)
|
||||
result.HttpResult(c, nil, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user