Updata:修正套餐状态判断
This commit is contained in:
parent
0e64d40489
commit
32a9bb8283
@ -11,6 +11,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"micro-bundle/pkg/msg"
|
||||||
|
|
||||||
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
"dubbo.apache.org/dubbo-go/v3/common/logger"
|
||||||
"github.com/jinzhu/copier"
|
"github.com/jinzhu/copier"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
@ -194,16 +196,16 @@ func GetBundleBalanceByUserId(req *bundle.GetBundleBalanceByUserIdReq) (*bundle.
|
|||||||
if data.Activate != 2 {
|
if data.Activate != 2 {
|
||||||
return nil, errors.New("套餐未激活")
|
return nil, errors.New("套餐未激活")
|
||||||
}
|
}
|
||||||
var bundleStatus int32
|
var IsExpired int32
|
||||||
if data.ExpiredTime < time.Now().Format("2006-01-02 15:04:05") {
|
if data.ExpiredAt.Before(time.Now()) {
|
||||||
bundleStatus = 1
|
IsExpired = msg.IsExpired //已过期
|
||||||
} else {
|
} else {
|
||||||
bundleStatus = 0
|
IsExpired = msg.NotExpired //未过期
|
||||||
}
|
}
|
||||||
result := &bundle.GetBundleBalanceByUserIdResp{
|
result := &bundle.GetBundleBalanceByUserIdResp{
|
||||||
OrderUUID: data.OrderUUID,
|
OrderUUID: data.OrderUUID,
|
||||||
BundleName: data.BundleName,
|
BundleName: data.BundleName,
|
||||||
BundleStatus: bundleStatus,
|
BundleStatus: IsExpired,
|
||||||
PayTime: data.StartAt.UnixMilli(),
|
PayTime: data.StartAt.UnixMilli(),
|
||||||
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
ExpiredTime: data.ExpiredAt.UnixMilli(),
|
||||||
PaymentAmount: data.PaymentAmount,
|
PaymentAmount: data.PaymentAmount,
|
||||||
|
|||||||
@ -120,3 +120,9 @@ const (
|
|||||||
AccountService = 4 //账号数
|
AccountService = 4 //账号数
|
||||||
AvailableTimeService = 5 //可用时长
|
AvailableTimeService = 5 //可用时长
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 套餐状态
|
||||||
|
const (
|
||||||
|
IsExpired = 1 //已过期
|
||||||
|
NotExpired = 0 //未过期
|
||||||
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user