package logic import ( "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" "github.com/jinzhu/copier" "micro-bundle/internal/dao" "micro-bundle/internal/model" "micro-bundle/pb/bundle" ) func CreateBundle(req *bundle.BundleProfile) (res *bundle.CommonResponse, err error) { res = new(bundle.CommonResponse) bundleProfile := new(model.BundleProfile) _ = copier.CopyWithOption(&bundleProfile, req, copier.Option{DeepCopy: true}) bundleProfile.UUID = utils.GetUUID() res, err = dao.CreateBundle(bundleProfile) return } func UpdateBundle(req *bundle.BundleProfile) (res *bundle.CommonResponse, err error) { res = new(bundle.CommonResponse) bundleProfile := new(model.BundleProfile) _ = copier.CopyWithOption(&bundleProfile, req, copier.Option{DeepCopy: true}) res, err = dao.UpdateBundle(bundleProfile) return } func DeleteBundle(req *bundle.DelBundleRequest) (res *bundle.CommonResponse, err error) { res = new(bundle.CommonResponse) res, err = dao.DeleteBundle(req.Uuid) return } func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse, err error) { res = new(bundle.BundleListResponse) res, err = dao.BundleList(req) return } func BundleDetail(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponse, err error) { res = new(bundle.BundleDetailResponse) res.Bundle = new(bundle.BundleProfile) res.Bundle, err = dao.BundleDetail(req.Uuid) if err != nil { res.Msg = err.Error() } return }