This commit is contained in:
laodaming
2023-09-26 11:40:27 +08:00
parent 47a1ecfc79
commit 01cc115a60
8 changed files with 143 additions and 82 deletions

View File

@@ -11,22 +11,22 @@ import (
"fusenapi/server/product/internal/types"
)
func CaculateProductPriceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func CalculateProductPriceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CaculateProductPriceReq
var req types.CalculateProductPriceReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewCaculateProductPriceLogic(r.Context(), svcCtx)
l := logic.NewCalculateProductPriceLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.CaculateProductPrice(&req, userinfo)
resp := l.CalculateProductPrice(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@@ -79,8 +79,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodPost,
Path: "/api/product/caculate_product_price",
Handler: CaculateProductPriceHandler(serverCtx),
Path: "/api/product/calculate_product_price",
Handler: CalculateProductPriceHandler(serverCtx),
},
{
Method: http.MethodGet,