From 9b6549f14166255bb54105e93a881b15da22a78a Mon Sep 17 00:00:00 2001
From: lzh <1625167628@qq.com>
Date: Fri, 20 Jun 2025 10:27:00 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B3=E8=81=94=E8=AE=A2?=
 =?UTF-8?q?=E5=8D=95=E5=8F=B7=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 internal/dao/bundleExtend.go        | 1 +
 internal/logic/bundleExtendLogic.go | 2 +-
 internal/model/bundle.go            | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go
index 715fb90..2a429d5 100644
--- a/internal/dao/bundleExtend.go
+++ b/internal/dao/bundleExtend.go
@@ -136,6 +136,7 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (data mod
 		Where("bb.user_id = ?", req.UserId).
 		Where("bor.expiration_time > ?", time.Now()).
 		Where("bor.deleted_at IS NULL").
+		Order("bb.created_at desc").
 		First(&data).Error
 	if err != nil {
 		return
diff --git a/internal/logic/bundleExtendLogic.go b/internal/logic/bundleExtendLogic.go
index fb8ddc7..d06f17f 100644
--- a/internal/logic/bundleExtendLogic.go
+++ b/internal/logic/bundleExtendLogic.go
@@ -47,7 +47,7 @@ func BundleExtendRecordsList(req *bundle.BundleExtendRecordsListRequest) (*bundl
 		result := &bundle.BundleExtendRecordItem{}
 		copier.Copy(result, &m)
 		result.CreatedAt = uint64(m.CreatedAt.UnixMilli())
-		if result.Type == 2 {  // 自行购买的情况下操作人就是用户
+		if result.Type == 2 { // 自行购买的情况下操作人就是用户
 			result.OperatorName = result.UserName
 			result.OperatorPhoneNumber = result.UserPhoneNumber
 		}
diff --git a/internal/model/bundle.go b/internal/model/bundle.go
index b341802..5e11c9c 100644
--- a/internal/model/bundle.go
+++ b/internal/model/bundle.go
@@ -88,12 +88,13 @@ type BundleExtensionRecords struct {
 	ImagesAdditional            uint   `gorm:"column:images_additional;type:int(11) unsigned;comment:图文额外增加" json:"images_additional"`
 	DataAdditional              uint   `gorm:"column:data_additional;type:int(11) unsigned;comment:数据额外增加" json:"data_additional"`
 	AvailableDurationAdditional uint   `gorm:"column:available_duration_additional;type:int(11) unsigned;comment:可用时长增加" json:"available_duration_additional"`
-	TimeUnit                    uint   `gorm:"column:time_unit;type:int(11) unsigned;comment:时间单位" json:"timeUnit"`
 	Type                        int    `gorm:"column:type;type:tinyint(4);comment:类型 1:手动操作 2:自行购买" json:"type"`
 	Remark                      string `gorm:"column:remark;type:text;comment:备注" json:"remark"`
+	AssociatedOrderNumber       string `gorm:"column:associated_order_number;type:varchar(256);comment:关联订单号" json:"associatedOrderNumber"`
 	OperatorId                  int    `gorm:"column:operator_id;type:int(11);comment:操作人id" json:"operator_id"`
 	OperatorName                string `gorm:"column:operator_name;type:varchar(256)" json:"operatorName"`
 	OperatorPhoneNumber         string `gorm:"column:operator_phone_number;type:varchar(256)" json:"operatorPhoneNumber"`
+	TimeUnit                    uint   `gorm:"column:time_unit;type:int(11) unsigned;comment:时间单位" json:"timeUnit"`
 }
 
 // TableName 表名称