修改
This commit is contained in:
parent
58131f934f
commit
702846f687
@ -9,9 +9,9 @@ import (
|
||||
"micro-bundle/pkg/msg"
|
||||
)
|
||||
|
||||
func CreateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err error) {
|
||||
func CreateBundle(bundle *model.BundleProfile) (res *bundle.CommonResponse, err error) {
|
||||
res = new(bundle.CommonResponse)
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Create(&req).Error
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Create(&bundle).Error
|
||||
if err != nil {
|
||||
res.Msg = msg.ErrorCreateBundleInfo
|
||||
return res, commonErr.ReturnError(err, msg.ErrorCreateBundleInfo, "创建套餐信息失败: ")
|
||||
@ -20,9 +20,9 @@ func CreateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err err
|
||||
return
|
||||
}
|
||||
|
||||
func UpdateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err error) {
|
||||
func UpdateBundle(bundle *model.BundleProfile) (res *bundle.CommonResponse, err error) {
|
||||
res = new(bundle.CommonResponse)
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("uuid = ?", req.UUID).Updates(req).Error
|
||||
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("uuid = ?", bundle.UUID).Updates(bundle).Error
|
||||
if err != nil {
|
||||
res.Msg = msg.ErrorUpdateBundleInfo
|
||||
return res, commonErr.ReturnError(err, msg.ErrorUpdateBundleInfo, "更新套餐信息失败: ")
|
||||
@ -59,11 +59,11 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
|
||||
|
||||
count := *query
|
||||
|
||||
if err = query.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize)).Find(&bundles).Error; err != nil {
|
||||
if err = query.Find(&bundles).Error; err != nil {
|
||||
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐列表失败: ")
|
||||
}
|
||||
|
||||
_ = copier.CopyWithOption(&res.Bundles, &bundles, copier.Option{DeepCopy: true})
|
||||
_ = copier.CopyWithOption(&res.Bundles, bundles, copier.Option{DeepCopy: true})
|
||||
|
||||
var total int64
|
||||
|
||||
@ -82,6 +82,6 @@ func BundleDetail(uuid string) (res *bundle.BundleProfile, err error) {
|
||||
if err != nil {
|
||||
return res, commonErr.ReturnError(err, msg.ErrorGetBundleInfo, "获取套餐信息失败: ")
|
||||
}
|
||||
_ = copier.CopyWithOption(&res, &bundle, copier.Option{DeepCopy: true})
|
||||
_ = copier.CopyWithOption(&res, bundle, copier.Option{DeepCopy: true})
|
||||
return
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ func OrderRecordsList(req *bundle.OrderRecordsRequest) (res *bundle.OrderRecords
|
||||
return res, commonErr.ReturnError(err, msg.ErrorGetOrderList, "获取订单信息失败: ")
|
||||
}
|
||||
|
||||
_ = copier.CopyWithOption(&res.OrderRecords, &records, copier.Option{DeepCopy: true})
|
||||
_ = copier.CopyWithOption(&res.OrderRecords, records, copier.Option{DeepCopy: true})
|
||||
|
||||
var total int64
|
||||
|
||||
@ -131,6 +131,6 @@ func OrderRecordDetail(req *bundle.OrderRecordsDetailRequest) (res *bundle.Order
|
||||
if err != nil {
|
||||
return res, commonErr.ReturnError(err, msg.ErrorGetOrderInfo, "获取订单信息失败: ")
|
||||
}
|
||||
_ = copier.CopyWithOption(&res, &orderRecord, copier.Option{DeepCopy: true})
|
||||
_ = copier.CopyWithOption(&res, orderRecord, copier.Option{DeepCopy: true})
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user