2025-02-20 12:40:39 +00:00
package dao
import (
2025-06-13 14:36:54 +00:00
"encoding/json"
2025-02-20 12:40:39 +00:00
"micro-bundle/internal/model"
"micro-bundle/pb/bundle"
"micro-bundle/pkg/app"
commonErr "micro-bundle/pkg/err"
"micro-bundle/pkg/msg"
"micro-bundle/pkg/utils"
2025-06-13 06:01:29 +00:00
"strconv"
2025-06-11 06:32:51 +00:00
"time"
2025-02-20 12:40:39 +00:00
)
2025-06-13 11:25:00 +00:00
func CreateOrderRecord ( orderRecord * model . BundleOrderRecords ) ( res * bundle . CommonResponse , err error ) {
2025-02-20 12:40:39 +00:00
res = new ( bundle . CommonResponse )
2025-06-13 14:36:54 +00:00
var bundleInfo model . BundleProfile
// 查询套餐主表并预加载
err = app . ModuleClients . BundleDB . Model ( & model . BundleProfile { } ) .
Where ( "uuid = ?" , orderRecord . BundleUUID ) .
Preload ( "BundleToValueAddService" ) .
Preload ( "BundleProfileLang" , "language = ?" , orderRecord . Language ) .
First ( & bundleInfo ) . Error
if err != nil {
res . Msg = msg . ErrorBundleNotFound
return res , commonErr . ReturnError ( err , msg . ErrorBundleNotFound , "查询Bundle信息失败: " )
}
// 填充BundleCommonJson字段
if bundleJson , e := json . Marshal ( bundleInfo ) ; e == nil {
orderRecord . BundleCommonJson = bundleJson
} else {
res . Msg = msg . ErrorDataConvert
return res , commonErr . ReturnError ( e , msg . ErrorDataConvert , "Bundle信息转换失败: " )
}
2025-06-13 11:25:00 +00:00
err = app . ModuleClients . BundleDB . Model ( & model . BundleOrderRecords { } ) . Create ( orderRecord ) . Error
2025-06-10 08:11:50 +00:00
if err != nil {
2025-02-20 12:40:39 +00:00
res . Msg = msg . ErrorCreateOrderInfo
return res , commonErr . ReturnError ( err , msg . ErrorCreateOrderInfo , "创建订单信息失败: " )
}
res . Uuid = orderRecord . UUID
2025-02-22 11:16:11 +00:00
res . OrderNo = orderRecord . OrderNo
2025-02-20 12:40:39 +00:00
res . Msg = msg . SuccessCreateOrderInfo
return
}
2025-06-10 08:11:50 +00:00
// calculateAmount 计算子订单金额
2025-06-12 08:37:22 +00:00
func calculateAmount ( valueUid string , req * bundle . OrderRecord ) ( amount float64 , valueAddServiceLang * model . ValueAddServiceLang , num int32 , expirationDay string , err error ) {
2025-06-11 06:32:51 +00:00
err = app . ModuleClients . BundleDB .
2025-06-12 08:37:22 +00:00
Where ( "uuid = ? AND language = ?" , valueUid , req . Language ) .
2025-06-10 08:11:50 +00:00
First ( & valueAddServiceLang ) . Error
if err != nil {
2025-06-11 06:32:51 +00:00
return
2025-06-10 08:11:50 +00:00
}
for _ , opt := range valueAddServiceLang . Options {
2025-06-12 08:37:22 +00:00
for _ , p := range req . PriceOptionsInfo {
if p . ValueUid == valueUid && opt . Id == p . Id {
num = opt . Num
if valueAddServiceLang . PriceMode == 1 {
2025-06-10 08:11:50 +00:00
amount = float64 ( float32 ( opt . Num ) * opt . Price )
2025-06-12 08:37:22 +00:00
} else if valueAddServiceLang . PriceMode == 2 {
amount = float64 ( opt . Price )
2025-06-10 08:11:50 +00:00
}
}
}
2025-06-12 08:37:22 +00:00
2025-06-11 06:32:51 +00:00
// 计算过期时间
if valueAddServiceLang . ServiceType == 5 {
expirationDay = calculateExpirationDay ( opt . Num , valueAddServiceLang . Unit )
}
}
return
}
// calculateExpirationDay 计算到期日
func calculateExpirationDay ( num int32 , unit string ) string {
now := time . Now ( )
switch unit {
case "天" :
return now . AddDate ( 0 , 0 , int ( num ) ) . Format ( "2006-01-02" )
case "月" :
return now . AddDate ( 0 , int ( num ) , 0 ) . Format ( "2006-01-02" )
case "年" :
return now . AddDate ( int ( num ) , 0 , 0 ) . Format ( "2006-01-02" )
default :
return ""
2025-06-10 08:11:50 +00:00
}
}
2025-02-20 12:40:39 +00:00
func UpdateOrderRecord ( orderRecord * model . BundleOrderRecords ) ( res * bundle . CommonResponse , err error ) {
res = new ( bundle . CommonResponse )
2025-02-22 11:40:30 +00:00
err = app . ModuleClients . BundleDB . Model ( & model . BundleOrderRecords { } ) . Where ( "uuid = ?" , orderRecord . UUID ) . Updates ( orderRecord ) . Error
2025-02-20 12:40:39 +00:00
if err != nil {
res . Msg = msg . ErrorUpdateOrderInfo
return res , commonErr . ReturnError ( err , msg . ErrorUpdateOrderInfo , "更新订单信息失败: " )
}
res . Uuid = orderRecord . UUID
res . Msg = msg . SuccessUpdateOrderInfo
return
}
2025-02-21 13:09:54 +00:00
func UpdateOrderRecordByOrderNO ( orderRecord * model . BundleOrderRecords ) ( res * bundle . CommonResponse , err error ) {
res = new ( bundle . CommonResponse )
2025-06-12 08:37:22 +00:00
// Step 1: 先更新子订单(增值服务)的支付状态
2025-06-10 08:11:50 +00:00
valueAdd := & model . BundleOrderValueAdd {
PaymentStatus : int ( orderRecord . Status ) ,
PaymentTime : orderRecord . PayTime ,
}
2025-06-12 08:37:22 +00:00
err = app . ModuleClients . BundleDB . Model ( & model . BundleOrderValueAdd { } ) .
Where ( "order_no = ?" , orderRecord . OrderNo ) .
Updates ( valueAdd ) . Error
2025-06-10 08:11:50 +00:00
if err != nil {
res . Msg = msg . ErrorUpdateOrderInfo
2025-06-12 08:37:22 +00:00
return res , commonErr . ReturnError ( err , msg . ErrorUpdateOrderInfo , "更新增值服务支付状态失败: " )
2025-06-10 08:11:50 +00:00
}
2025-06-12 08:37:22 +00:00
// Step 2: 再更新主订单信息(如果存在)
err = app . ModuleClients . BundleDB . Model ( & model . BundleOrderRecords { } ) .
Where ( "order_no = ?" , orderRecord . OrderNo ) .
Updates ( orderRecord ) . Error
// Step 3: 返回结果(即使主订单更新失败,也视为成功)
2025-02-21 13:09:54 +00:00
res . Uuid = orderRecord . UUID
res . Msg = msg . SuccessUpdateOrderInfo
2025-06-12 08:37:22 +00:00
return res , nil
2025-02-21 13:09:54 +00:00
}
2025-02-20 12:40:39 +00:00
func OrderRecordsList ( req * bundle . OrderRecordsRequest ) ( res * bundle . OrderRecordsResponse , err error ) {
res = new ( bundle . OrderRecordsResponse )
res . OrderRecords = make ( [ ] * bundle . OrderRecord , 0 )
records := make ( [ ] * model . BundleOrderRecords , 0 )
query := app . ModuleClients . BundleDB . Model ( & model . BundleOrderRecords { } )
2025-05-09 06:44:55 +00:00
query . Joins ( "left join `micro-account`.`user` on `micro-account`.`user`.`id` = `bundle_order_records`.`customer_id`" )
2025-05-09 05:28:14 +00:00
2025-02-23 06:21:42 +00:00
if req . CustomerID != "" {
query = query . Where ( "customer_id = ?" , req . CustomerID )
}
2025-02-20 12:40:39 +00:00
if req . CustomerNum != "" {
query = query . Where ( "customer_num like ?" , "%" + req . CustomerNum + "%" )
}
if req . CustomerName != "" {
query = query . Where ( "customer_name like ?" , "%" + req . CustomerName + "%" )
}
if req . BundleName != "" {
query = query . Where ( "bundle_name like ?" , "%" + req . BundleName + "%" )
}
if req . BundleUUID != "" {
query = query . Where ( "bundle_uuid = ?" , req . BundleUUID )
}
if req . OrderNo != "" {
query = query . Where ( "order_no like ?" , "%" + req . OrderNo + "%" )
}
if req . Status != 0 {
2025-06-06 10:36:37 +00:00
query = query . Where ( "`bundle_order_records`.status = ?" , req . Status )
2025-02-20 12:40:39 +00:00
}
if req . StartSignedTime != "" {
query = query . Where ( "signed_time >= ?" , req . StartSignedTime )
}
if req . EndSignedTime != "" {
query = query . Where ( "signed_time <= ?" , req . EndSignedTime )
}
if req . StartPayTime != "" {
query = query . Where ( "pay_time >= ?" , req . StartPayTime )
}
if req . EndPayTime != "" {
query = query . Where ( "pay_time <= ?" , req . EndPayTime )
}
2025-03-28 02:54:04 +00:00
if req . IsHaveValueAdd == 1 { // 有
query = query . Where ( "value_add_bundle_uuid != ?" , "" )
} else if req . IsHaveValueAdd == 2 { // 无
query = query . Where ( "IFNULL(value_add_bundle_uuid,'') = ''" )
}
2025-05-09 05:28:14 +00:00
if req . FinancialConfirmation != 0 {
query = query . Where ( "financial_confirmation = ?" , req . FinancialConfirmation )
}
if req . TelNum != "" {
2025-05-09 06:44:55 +00:00
query = query . Where ( "`micro-account`.`user`.`tel_num` like ?" , "%" + req . TelNum + "%" )
2025-05-09 05:28:14 +00:00
}
2025-02-22 12:12:34 +00:00
count := * query
2025-02-22 12:04:35 +00:00
if req . PageSize != 0 && req . Page != 0 {
query = query . Limit ( int ( req . PageSize ) ) . Offset ( int ( req . Page - 1 ) * int ( req . PageSize ) )
}
err = query . Find ( & records ) . Error
2025-03-28 18:05:56 +00:00
2025-02-20 12:40:39 +00:00
if err != nil {
return res , commonErr . ReturnError ( err , msg . ErrorGetOrderList , "获取订单信息失败: " )
}
2025-02-22 11:19:35 +00:00
//_ = copier.CopyWithOption(&res.OrderRecords, records, copier.Option{DeepCopy: true})
for _ , record := range records {
res . OrderRecords = append ( res . OrderRecords , & bundle . OrderRecord {
2025-03-28 18:05:56 +00:00
Uuid : record . UUID ,
OrderNo : record . OrderNo ,
BundleUuid : record . BundleUUID ,
BundleName : record . BundleName ,
CustomerID : record . CustomerID ,
CustomerNum : record . CustomerNum ,
CustomerName : record . CustomerName ,
Amount : record . Amount ,
AmountType : record . AmountType ,
SignContract : record . SignContract ,
Signature : record . Signature ,
SignedTime : record . SignedTime ,
PayType : record . PayType ,
PayTime : record . PayTime ,
CheckoutSessionId : record . CheckoutSessionId ,
CheckoutSessionUrl : record . CheckoutSessionUrl ,
Status : record . Status ,
ContractNo : record . ContractNo ,
ValueAddBundleUuid : record . ValueAddBundleUUID ,
ValueAddBundleAmount : record . ValueAddBundleAmount ,
ValueAddOriginalPrice : record . ValueAddOriginalPrice ,
ValueAddDiscountPrice : record . ValueAddDiscountPrice ,
ValueAddSavedAmount : record . ValueAddSavedAmount ,
TotalAmount : record . TotalAmount ,
Num : record . Num ,
2025-03-28 22:00:18 +00:00
BundleCommonUid : record . BundleCommonUid ,
AddBundleCommonUid : record . AddBundleCommonUid ,
2025-05-09 08:10:40 +00:00
FinancialConfirmation : record . FinancialConfirmation ,
2025-06-12 08:37:22 +00:00
ExpirationTime : record . ExpirationTime ,
2025-02-22 11:19:35 +00:00
} )
}
2025-02-20 12:40:39 +00:00
var total int64
count . Count ( & total )
res . Total = int32 ( total )
return
}
2025-02-21 13:09:54 +00:00
func OrderRecordDetail ( req * bundle . OrderRecordsDetailRequest ) ( res * bundle . OrderRecord , err error ) {
2025-02-20 12:40:39 +00:00
res = new ( bundle . OrderRecord )
orderRecord := new ( model . BundleOrderRecords )
2025-02-21 13:09:54 +00:00
2025-02-22 11:40:30 +00:00
query := app . ModuleClients . BundleDB . Model ( & model . BundleOrderRecords { } )
2025-02-21 13:09:54 +00:00
if req . Uuid != "" {
query = query . Where ( "uuid = ?" , req . Uuid )
}
if req . OrderNo != "" {
query = query . Where ( "order_no = ?" , req . OrderNo )
}
2025-02-23 12:56:42 +00:00
if req . CustomerID != "" {
query = query . Where ( "customer_id = ?" , req . CustomerID )
}
2025-06-12 10:13:57 +00:00
if req . BundleUUID != "" {
query = query . Where ( "bundle_uuid = ?" , req . BundleUUID )
}
2025-02-21 13:09:54 +00:00
err = query . First ( & orderRecord ) . Error
2025-02-20 12:40:39 +00:00
if err != nil {
return res , commonErr . ReturnError ( err , msg . ErrorGetOrderInfo , "获取订单信息失败: " )
}
2025-02-23 03:51:24 +00:00
//_ = copier.CopyWithOption(&res, orderRecord, copier.Option{DeepCopy: true})
res = & bundle . OrderRecord {
2025-03-25 08:30:09 +00:00
Uuid : orderRecord . UUID ,
OrderNo : orderRecord . OrderNo ,
BundleUuid : orderRecord . BundleUUID ,
BundleName : orderRecord . BundleName ,
CustomerID : orderRecord . CustomerID ,
CustomerNum : orderRecord . CustomerNum ,
CustomerName : orderRecord . CustomerName ,
Amount : orderRecord . Amount ,
AmountType : orderRecord . AmountType ,
SignContract : orderRecord . SignContract ,
Signature : orderRecord . Signature ,
SignedTime : orderRecord . SignedTime ,
PayType : orderRecord . PayType ,
PayTime : orderRecord . PayTime ,
CheckoutSessionId : orderRecord . CheckoutSessionId ,
CheckoutSessionUrl : orderRecord . CheckoutSessionUrl ,
Status : orderRecord . Status ,
ContractNo : orderRecord . ContractNo ,
2025-03-28 01:23:17 +00:00
ValueAddBundleUuid : orderRecord . ValueAddBundleUUID ,
2025-03-25 08:30:09 +00:00
ValueAddBundleAmount : orderRecord . ValueAddBundleAmount ,
TotalAmount : orderRecord . TotalAmount ,
2025-06-12 10:13:57 +00:00
ExpirationTime : orderRecord . ExpirationTime ,
2025-02-23 03:51:24 +00:00
}
2025-02-20 12:40:39 +00:00
return
}
2025-06-12 08:37:22 +00:00
func PackagePriceAndTime ( orderRecord * bundle . OrderRecord ) ( res * bundle . PackagePriceAndTimeResponse , err error ) {
res = new ( bundle . PackagePriceAndTimeResponse )
bundleInfo := new ( model . BundleProfile )
// 查询套餐主表并预加载
err = app . ModuleClients . BundleDB . Model ( & model . BundleProfile { } ) .
Where ( "uuid = ?" , orderRecord . BundleUuid ) .
Preload ( "BundleToValueAddService" ) .
Preload ( "BundleProfileLang" , "language = ?" , orderRecord . Language ) .
First ( & bundleInfo ) . Error
if err != nil {
return res , commonErr . ReturnError ( err , msg . ErrorBundleNotFound , "查询Bundle信息失败: " )
}
var (
valueAddAmount float64
expirationTime = "9999-12-31"
)
for _ , service := range bundleInfo . BundleToValueAddService {
amount , _ , _ , day , e := calculateAmount ( service . ValueUid , orderRecord )
if e != nil {
return res , commonErr . ReturnError ( e , msg . ErrorDataConvert , "子订单金额计算失败: " )
}
if day != "" {
expirationTime = day
}
valueAddAmount = valueAddAmount + amount
}
res = & bundle . PackagePriceAndTimeResponse {
Price : float32 ( valueAddAmount ) ,
Time : expirationTime ,
}
return
}
func CreateOrderAddRecord ( req * bundle . OrderAddRecord ) ( res * bundle . CommonResponse , err error ) {
tx := app . ModuleClients . BundleDB . Begin ( )
defer func ( ) {
if r := recover ( ) ; r != nil {
tx . Rollback ( )
}
} ( )
orderNo := utils . GetOrderNo ( )
var childOrders [ ] * model . BundleOrderValueAdd
for _ , i := range req . AddPriceOptionsList {
childOrder := & model . BundleOrderValueAdd {
UUID : app . ModuleClients . SfNode . Generate ( ) . Base64 ( ) ,
2025-06-13 14:36:54 +00:00
OrderUUID : req . OrderUUID , // 修正: 这里应使用主订单UUID
2025-06-12 08:37:22 +00:00
CustomerID : req . CustomerID ,
CustomerNum : req . CustomerNum ,
CustomerName : req . CustomerName ,
ServiceType : i . ServiceType ,
CurrencyType : i . CurrencyType ,
Amount : float64 ( i . Amount ) ,
OrderNo : orderNo ,
Num : i . Num ,
Unit : i . Unit ,
ValueAddUUID : i . ValueUid ,
2025-06-12 10:13:57 +00:00
Source : 2 ,
2025-06-12 08:37:22 +00:00
PaymentStatus : 1 ,
SignContract : req . SignContract ,
Signature : req . Signature ,
SignedTime : req . SignedTime ,
2025-06-13 06:01:29 +00:00
Snapshot : req . Snapshot ,
2025-06-12 08:37:22 +00:00
}
childOrders = append ( childOrders , childOrder )
// 如果是类型5服务, 更新主订单的过期时间
if i . ServiceType == 5 && req . ExpirationDate != "" {
if err := tx . Model ( & model . BundleOrderRecords { } ) .
Where ( "uuid = ?" , req . BundleUuid ) .
Update ( "expiration_time" , req . ExpirationDate ) . Error ; err != nil {
tx . Rollback ( )
return nil , commonErr . ReturnError ( err , msg . ErrorCreateOrderInfo , "更新主订单过期时间失败: " )
}
}
}
// 批量创建子订单(提高性能)
if err = tx . Model ( & model . BundleOrderValueAdd { } ) . Create ( childOrders ) . Error ; err != nil {
tx . Rollback ( )
return res , commonErr . ReturnError ( err , msg . ErrorCreateOrderInfo , "批量创建子订单失败" )
}
// 提交事务
if err := tx . Commit ( ) . Error ; err != nil {
tx . Rollback ( )
return nil , commonErr . ReturnError ( err , msg . ErrorCreateOrderInfo , "提交事务失败: " )
}
return & bundle . CommonResponse {
Uuid : req . BundleUuid ,
OrderNo : orderNo ,
Msg : msg . SuccessCreateOrderInfo ,
} , nil
}
2025-06-13 06:01:29 +00:00
func OrderRecordsListV2 ( req * bundle . OrderRecordsRequestV2 ) ( res * bundle . OrderRecordsResponseV2 , err error ) {
res = new ( bundle . OrderRecordsResponseV2 )
var count int64
modelObj := app . ModuleClients . BundleDB . Model ( & model . BundleOrderRecords { } ) .
Select ( "bundle_order_records.*,a.name as bundle_name" ) .
Preload ( "BundleOrderValueAdd" ) .
Joins ( "left join bundle_profile a on bundle_order_records.bundle_uuid = a.uuid" )
2025-06-13 14:36:54 +00:00
//Joins("left join bundle_order_value_add on bundle_order_records.uuid = bundle_order_value_add.order_uuid")
2025-06-13 06:01:29 +00:00
if len ( req . UserIds ) != 0 {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "bundle_order_records.customer_id in ?" , req . UserIds )
2025-06-13 06:01:29 +00:00
}
if req . BundleName != "" {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "a.name like ?" , "%" + req . BundleName + "%" )
2025-06-13 06:01:29 +00:00
}
if req . PayStatus != 0 {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "bundle_order_records.status = ?" , req . PayStatus )
2025-06-13 06:01:29 +00:00
}
if req . AddPayStatus != 0 {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "exists (select 1 from bundle_order_value_add where bundle_order_value_add.order_no = bundle_order_records.order_no and bundle_order_value_add.payment_status = ?)" , req . AddPayStatus )
2025-06-13 06:01:29 +00:00
}
if req . OrderNo != "" {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "bundle_order_records.order_no = ?" , req . OrderNo )
2025-06-13 06:01:29 +00:00
}
if req . OrderAddNo != "" {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "exists (select 1 from bundle_order_value_add where bundle_order_value_add.order_no = bundle_order_records.order_no and bundle_order_value_add.order_no = ?)" , req . OrderAddNo )
2025-06-13 06:01:29 +00:00
}
if req . BundleCreateAtStart != "" && req . BundleCreateAtEnd != "" {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "bundle_order_records.created_at between ? and ?" , req . BundleCreateAtStart , req . BundleCreateAtEnd )
2025-06-13 06:01:29 +00:00
}
if req . OrderAddCreateAtStart != "" && req . OrderAddCreateAtEnd != "" {
2025-06-13 14:36:54 +00:00
modelObj = modelObj . Where ( "bundle_order_records.created_at between ? and ?" , req . OrderAddCreateAtStart , req . OrderAddCreateAtEnd )
2025-06-13 06:01:29 +00:00
}
err = modelObj . Count ( & count ) . Error
if req . PageSize != 0 && req . Page != 0 {
modelObj = modelObj . Limit ( int ( req . PageSize ) ) . Offset ( int ( req . Page - 1 ) * int ( req . PageSize ) )
}
type OrderRecords struct {
model . BundleOrderRecords
BundleName string ` json:"bundleName" `
}
var records [ ] OrderRecords
err = modelObj . Find ( & records ) . Error
if err != nil {
return nil , err
}
for _ , record := range records {
customerID , _ := strconv . ParseInt ( record . CustomerID , 10 , 64 )
orderItem := & bundle . OrderBundleRecordInfo {
OrderNo : record . OrderNo ,
BundleName : record . BundleName ,
PayStatus : int32 ( record . Status ) ,
TelNum : "" ,
CustomerName : record . CustomerName ,
BundleCreateAt : record . CreatedAt . Format ( "2006-01-02 15:04:05" ) ,
Amount : record . Amount ,
CustomerId : customerID ,
}
// 构建子订单 map, 按 orderAddNo 聚合
addMap := make ( map [ string ] * bundle . OrderAddBundleRecordInfo )
for _ , sub := range record . BundleOrderValueAdd {
orderAddNo := sub . OrderNo
// SettlementAmount 规则
settlementAmount := float32 ( sub . Amount )
if sub . OrderNo == record . OrderNo {
settlementAmount = record . TotalAmount
}
if existing , ok := addMap [ orderAddNo ] ; ok {
existing . Amount += float32 ( sub . Amount )
existing . SettlementAmount += settlementAmount
} else {
addMap [ orderAddNo ] = & bundle . OrderAddBundleRecordInfo {
OrderAddNo : orderAddNo ,
Amount : float32 ( sub . Amount ) ,
SettlementAmount : settlementAmount ,
CurrencyType : int32 ( sub . CurrencyType ) ,
//HandlingFee: float32(sub.HandlingFee),
//ExchangeRate: float32(sub.ExchangeRate),
OrderAddCreateAt : sub . CreatedAt . Format ( "2006-01-02 15:04:05" ) ,
AddPayStatus : int32 ( sub . PaymentStatus ) ,
Contract : sub . SignContract ,
Snapshot : sub . Snapshot ,
}
}
}
// 将聚合后的子订单添加到主订单返回结构中
for _ , v := range addMap {
orderItem . AddBundleInfo = append ( orderItem . AddBundleInfo , v )
}
res . BundleInfo = append ( res . BundleInfo , orderItem )
}
res . Total = int32 ( count )
res . Page = req . Page
res . PageSize = req . PageSize
return res , nil
}