From 69ac59610a18082e6e2b47969f277b4fbaf4c2d9 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 18 Dec 2025 10:22:09 +0800 Subject: [PATCH 1/5] =?UTF-8?q?Updata=EF=BC=9A=E8=B0=83=E6=95=B4=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E6=97=B6=E9=97=B4=E5=92=8C=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index fb7cfe5..73a17f4 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -537,13 +537,13 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error { } func GetWaitConfirmWorkList() (data []model.CastWork, err error) { - twentyFourHoursAgo := time.Now().Add(-24 * time.Hour).Format("2006-01-02 15:04:05") + twentyFourHoursAgo := time.Now().Add(-48 * time.Hour).Format("2006-01-02 15:04:05") err = app.ModuleClients.BundleDB.Model(&model.CastWork{}). Where("deleted_at = 0"). Where("status = ?", 4). Where("submit_time >= ?", twentyFourHoursAgo). Order("submit_time asc"). - Limit(10). + Limit(60). Find(&data).Error if err != nil { return From 55dbf93c73f59596fd5b4e08a1d6c510773ee8c8 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 18 Dec 2025 10:36:38 +0800 Subject: [PATCH 2/5] =?UTF-8?q?Updata=EF=BC=9A=E5=9B=9E=E9=80=80=E8=87=B3?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index 73a17f4..fb7cfe5 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -537,13 +537,13 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error { } func GetWaitConfirmWorkList() (data []model.CastWork, err error) { - twentyFourHoursAgo := time.Now().Add(-48 * time.Hour).Format("2006-01-02 15:04:05") + twentyFourHoursAgo := time.Now().Add(-24 * time.Hour).Format("2006-01-02 15:04:05") err = app.ModuleClients.BundleDB.Model(&model.CastWork{}). Where("deleted_at = 0"). Where("status = ?", 4). Where("submit_time >= ?", twentyFourHoursAgo). Order("submit_time asc"). - Limit(60). + Limit(10). Find(&data).Error if err != nil { return From f12da7b70a1bfc54ce34bacc90a2b2a399b8c36d Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 18 Dec 2025 14:28:30 +0800 Subject: [PATCH 3/5] =?UTF-8?q?Updata=EF=BC=9A=E6=9B=B4=E6=96=B0=E9=9A=8F?= =?UTF-8?q?=E6=9C=BA=E7=A1=AE=E8=AE=A4=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index fb7cfe5..c9e7493 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -3,6 +3,7 @@ package dao import ( "errors" "fmt" + "math/rand" "micro-bundle/internal/model" "micro-bundle/pb/bundle" "micro-bundle/pkg/app" @@ -537,13 +538,14 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error { } func GetWaitConfirmWorkList() (data []model.CastWork, err error) { - twentyFourHoursAgo := time.Now().Add(-24 * time.Hour).Format("2006-01-02 15:04:05") + randomHours := rand.Intn(22) + 1 // 1-22小时 + randomTimeAgo := time.Now().Add(-time.Duration(randomHours) * time.Hour).Format("2006-01-02 15:04:05") err = app.ModuleClients.BundleDB.Model(&model.CastWork{}). Where("deleted_at = 0"). Where("status = ?", 4). - Where("submit_time >= ?", twentyFourHoursAgo). + Where("submit_time >= ?", randomTimeAgo). Order("submit_time asc"). - Limit(10). + Limit(5). Find(&data).Error if err != nil { return From 97ac650055d953705ad1642ae230491b14c3ff05 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 18 Dec 2025 15:15:01 +0800 Subject: [PATCH 4/5] =?UTF-8?q?Updata=EF=BC=9A=E6=9B=B4=E6=96=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dao/bundleExtend.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/dao/bundleExtend.go b/internal/dao/bundleExtend.go index c9e7493..0ee4b87 100644 --- a/internal/dao/bundleExtend.go +++ b/internal/dao/bundleExtend.go @@ -538,12 +538,15 @@ func ConfirmWork(req *bundle.ConfirmWorkReq) error { } func GetWaitConfirmWorkList() (data []model.CastWork, err error) { - randomHours := rand.Intn(22) + 1 // 1-22小时 - randomTimeAgo := time.Now().Add(-time.Duration(randomHours) * time.Hour).Format("2006-01-02 15:04:05") + randomHours := rand.Intn(22) + 2 // 2-22小时 + now := time.Now() + startTime := now.Add(-time.Duration(randomHours+2) * time.Hour).Format("2006-01-02 15:04:05") + endTime := now.Add(-time.Duration(randomHours) * time.Hour).Format("2006-01-02 15:04:05") err = app.ModuleClients.BundleDB.Model(&model.CastWork{}). Where("deleted_at = 0"). Where("status = ?", 4). - Where("submit_time >= ?", randomTimeAgo). + Where("submit_time > ?", startTime). + Where("submit_time < ?", endTime). Order("submit_time asc"). Limit(5). Find(&data).Error From da925cc342f56e0b4083dd9b0ae114b82e150f8c Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Thu, 18 Dec 2025 17:24:56 +0800 Subject: [PATCH 5/5] =?UTF-8?q?Updata=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/bundleExtendLogic.go | 8 ++++++++ pb/bundle.proto | 2 +- pb/bundle/bundle.pb.go | 12 ++++++------ pkg/msg/msg.go | 6 ++++++ 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/internal/logic/bundleExtendLogic.go b/internal/logic/bundleExtendLogic.go index 06f168c..013465c 100644 --- a/internal/logic/bundleExtendLogic.go +++ b/internal/logic/bundleExtendLogic.go @@ -8,6 +8,7 @@ import ( "micro-bundle/internal/dao" "micro-bundle/internal/model" "micro-bundle/pb/bundle" + "micro-bundle/pkg/msg" "strconv" "time" @@ -194,9 +195,16 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle. if data.Activate != 2 { return nil, errors.New("套餐未激活") } + var IsExpired int32 + if data.ExpiredAt.Before(time.Now()) { + IsExpired = msg.IsExpired + } else { + IsExpired = msg.NotExpired + } result := &bundle.GetBundleBalanceByUserIdResp{ OrderUUID: data.OrderUUID, BundleName: data.BundleName, + BundleStatus: IsExpired, PayTime: data.StartAt.UnixMilli(), ExpiredTime: data.ExpiredAt.UnixMilli(), PaymentAmount: data.PaymentAmount, diff --git a/pb/bundle.proto b/pb/bundle.proto index 69a622d..b690b92 100644 --- a/pb/bundle.proto +++ b/pb/bundle.proto @@ -1046,7 +1046,7 @@ message GetBundleBalanceByUserIdResp{ string orderUUID = 1; string bundleUuid = 2; // 套餐ID uuid string bundleName = 3; // 套餐名称 - string bundleStatus = 4; // 套餐名称 + int32 bundleStatus = 4; // 套餐状态是否过期 1 是 0 否 int64 payTime = 5; int64 expiredTime = 6; string paymentAmount = 7; diff --git a/pb/bundle/bundle.pb.go b/pb/bundle/bundle.pb.go index 3183a18..f666244 100644 --- a/pb/bundle/bundle.pb.go +++ b/pb/bundle/bundle.pb.go @@ -8590,9 +8590,9 @@ type GetBundleBalanceByUserIdResp struct { unknownFields protoimpl.UnknownFields OrderUUID string `protobuf:"bytes,1,opt,name=orderUUID,proto3" json:"orderUUID"` - BundleUuid string `protobuf:"bytes,2,opt,name=bundleUuid,proto3" json:"bundleUuid"` // 套餐ID uuid - BundleName string `protobuf:"bytes,3,opt,name=bundleName,proto3" json:"bundleName"` // 套餐名称 - BundleStatus string `protobuf:"bytes,4,opt,name=bundleStatus,proto3" json:"bundleStatus"` // 套餐名称 + BundleUuid string `protobuf:"bytes,2,opt,name=bundleUuid,proto3" json:"bundleUuid"` // 套餐ID uuid + BundleName string `protobuf:"bytes,3,opt,name=bundleName,proto3" json:"bundleName"` // 套餐名称 + BundleStatus int32 `protobuf:"varint,4,opt,name=bundleStatus,proto3" json:"bundleStatus"` // 套餐状态是否过期 1 是 0 否 PayTime int64 `protobuf:"varint,5,opt,name=payTime,proto3" json:"payTime"` ExpiredTime int64 `protobuf:"varint,6,opt,name=expiredTime,proto3" json:"expiredTime"` PaymentAmount string `protobuf:"bytes,7,opt,name=paymentAmount,proto3" json:"paymentAmount"` @@ -8672,11 +8672,11 @@ func (x *GetBundleBalanceByUserIdResp) GetBundleName() string { return "" } -func (x *GetBundleBalanceByUserIdResp) GetBundleStatus() string { +func (x *GetBundleBalanceByUserIdResp) GetBundleStatus() int32 { if x != nil { return x.BundleStatus } - return "" + return 0 } func (x *GetBundleBalanceByUserIdResp) GetPayTime() int64 { @@ -16713,7 +16713,7 @@ var file_pb_bundle_proto_rawDesc = []byte{ 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x55, 0x75, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x75, 0x6e, - 0x64, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x64, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72, diff --git a/pkg/msg/msg.go b/pkg/msg/msg.go index 4ac5216..bdc862c 100644 --- a/pkg/msg/msg.go +++ b/pkg/msg/msg.go @@ -120,3 +120,9 @@ const ( AccountService = 4 //账号数 AvailableTimeService = 5 //可用时长 ) + +// 是否过期 +const ( + IsExpired = 1 //是 + NotExpired = 0 //否 +)