64 lines
1.3 KiB
Go
64 lines
1.3 KiB
Go
package bundle
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"fonchain-fiee/api/bundle"
|
|
"fonchain-fiee/pkg/service"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gin-gonic/gin/binding"
|
|
)
|
|
|
|
func CreateValueAddBundle(c *gin.Context) {
|
|
var req bundle.CreateValueAddBundleRequest
|
|
|
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
|
service.Error1(c, err)
|
|
return
|
|
}
|
|
|
|
res, err := service.BundleProvider.CreateValueAddBundle(context.Background(), &req)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
service.Error1(c, err)
|
|
return
|
|
}
|
|
|
|
service.Success1(c, res.Msg, res)
|
|
}
|
|
|
|
func ValueAddBundleList(c *gin.Context) {
|
|
var req bundle.ValueAddBundleListRequest
|
|
|
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
|
service.Error1(c, err)
|
|
return
|
|
}
|
|
|
|
res, err := service.BundleProvider.ValueAddBundleList(context.Background(), &req)
|
|
if err != nil {
|
|
service.Error1(c, err)
|
|
return
|
|
}
|
|
|
|
service.Success1(c, res.Msg, res)
|
|
}
|
|
|
|
func ValueAddBundleDetail(c *gin.Context) {
|
|
var req bundle.ValueAddBundleDetailRequest
|
|
|
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
|
service.Error1(c, err)
|
|
return
|
|
}
|
|
|
|
res, err := service.BundleProvider.ValueAddBundleDetail(context.Background(), &req)
|
|
if err != nil {
|
|
service.Error1(c, err)
|
|
return
|
|
}
|
|
|
|
service.Success1(c, res.Msg, res)
|
|
}
|