Updata:增加套餐过期判断
This commit is contained in:
parent
9477939a5a
commit
6cd2077886
@ -8592,7 +8592,7 @@ type GetBundleBalanceByUserIdResp struct {
|
|||||||
OrderUUID string `protobuf:"bytes,1,opt,name=orderUUID,proto3" json:"orderUUID"`
|
OrderUUID string `protobuf:"bytes,1,opt,name=orderUUID,proto3" json:"orderUUID"`
|
||||||
BundleUuid string `protobuf:"bytes,2,opt,name=bundleUuid,proto3" json:"bundleUuid"` // 套餐ID uuid
|
BundleUuid string `protobuf:"bytes,2,opt,name=bundleUuid,proto3" json:"bundleUuid"` // 套餐ID uuid
|
||||||
BundleName string `protobuf:"bytes,3,opt,name=bundleName,proto3" json:"bundleName"` // 套餐名称
|
BundleName string `protobuf:"bytes,3,opt,name=bundleName,proto3" json:"bundleName"` // 套餐名称
|
||||||
BundleStatus string `protobuf:"bytes,4,opt,name=bundleStatus,proto3" json:"bundleStatus"` // 套餐名称
|
BundleStatus int32 `protobuf:"varint,4,opt,name=bundleStatus,proto3" json:"bundleStatus"` // 套餐状态是否过期 1 是 0 否
|
||||||
PayTime int64 `protobuf:"varint,5,opt,name=payTime,proto3" json:"payTime"`
|
PayTime int64 `protobuf:"varint,5,opt,name=payTime,proto3" json:"payTime"`
|
||||||
ExpiredTime int64 `protobuf:"varint,6,opt,name=expiredTime,proto3" json:"expiredTime"`
|
ExpiredTime int64 `protobuf:"varint,6,opt,name=expiredTime,proto3" json:"expiredTime"`
|
||||||
PaymentAmount string `protobuf:"bytes,7,opt,name=paymentAmount,proto3" json:"paymentAmount"`
|
PaymentAmount string `protobuf:"bytes,7,opt,name=paymentAmount,proto3" json:"paymentAmount"`
|
||||||
@ -8672,11 +8672,11 @@ func (x *GetBundleBalanceByUserIdResp) GetBundleName() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetBundleBalanceByUserIdResp) GetBundleStatus() string {
|
func (x *GetBundleBalanceByUserIdResp) GetBundleStatus() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.BundleStatus
|
return x.BundleStatus
|
||||||
}
|
}
|
||||||
return ""
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetBundleBalanceByUserIdResp) GetPayTime() int64 {
|
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,
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x70, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x70, 0x69, 0x72,
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import (
|
|||||||
bundleModel "fonchain-fiee/pkg/model/bundle"
|
bundleModel "fonchain-fiee/pkg/model/bundle"
|
||||||
modelCast "fonchain-fiee/pkg/model/cast"
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
|
"fonchain-fiee/pkg/service/bundle/common"
|
||||||
serverCast "fonchain-fiee/pkg/service/cast"
|
serverCast "fonchain-fiee/pkg/service/cast"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -113,6 +114,17 @@ func AutoManuallyConfirmWorkTask() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if balanceInfoRes.BundleStatus == common.BundleExpired {
|
||||||
|
_, err = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{
|
||||||
|
WorkAction: cast.WorkActionENUM_CONFIRM,
|
||||||
|
WorkUuid: req.WorkUuid,
|
||||||
|
ConfirmRemark: req.ConfirmRemark,
|
||||||
|
ConfirmStatus: 3,
|
||||||
|
})
|
||||||
|
log.Printf("套餐已过期,作品uuid:"+req.WorkUuid, zap.Error(err))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
wordInfoRes, err := service.CastProvider.WorkDetail(context.Background(), &cast.WorkDetailReq{
|
wordInfoRes, err := service.CastProvider.WorkDetail(context.Background(), &cast.WorkDetailReq{
|
||||||
WorkUuid: req.WorkUuid,
|
WorkUuid: req.WorkUuid,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -189,6 +189,21 @@ func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
|
|||||||
service.Error(c, errors.New(common.GetUserBalanceFailed))
|
service.Error(c, errors.New(common.GetUserBalanceFailed))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//判断套餐是否过期
|
||||||
|
if balanceInfoRes.BundleStatus == common.BundleExpired {
|
||||||
|
_, err = service.CastProvider.UpdateStatus(c, &cast.UpdateStatusReq{
|
||||||
|
WorkAction: cast.WorkActionENUM_CONFIRM,
|
||||||
|
WorkUuid: req.WorkUuid,
|
||||||
|
ConfirmRemark: req.ConfirmRemark,
|
||||||
|
ConfirmStatus: 3,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, errors.New(common.UpdateWorkStatusFailed))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Error(c, errors.New("套餐已过期"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
wordInfoRes, err := service.CastProvider.WorkDetail(c, &cast.WorkDetailReq{
|
wordInfoRes, err := service.CastProvider.WorkDetail(c, &cast.WorkDetailReq{
|
||||||
WorkUuid: req.WorkUuid,
|
WorkUuid: req.WorkUuid,
|
||||||
@ -209,6 +224,16 @@ func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if balanceInfoRes.ImageExtendConsumptionNumber >= balanceInfoRes.ImageExtendNumber { // 图文余量不足
|
if balanceInfoRes.ImageExtendConsumptionNumber >= balanceInfoRes.ImageExtendNumber { // 图文余量不足
|
||||||
|
_, err = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{
|
||||||
|
WorkAction: cast.WorkActionENUM_CONFIRM,
|
||||||
|
WorkUuid: req.WorkUuid,
|
||||||
|
ConfirmRemark: req.ConfirmRemark,
|
||||||
|
ConfirmStatus: 3,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, errors.New(common.UpdateWorkStatusFailed))
|
||||||
|
return
|
||||||
|
}
|
||||||
service.Error(c, errors.New("图文余量不足"))
|
service.Error(c, errors.New("图文余量不足"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -217,6 +242,16 @@ func WorkConfirm(c *gin.Context) { // 确认作品并扣除余量
|
|||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if balanceInfoRes.VideoExtendConsumptionNumber >= balanceInfoRes.VideoExtendNumber { // 视频余量不足
|
if balanceInfoRes.VideoExtendConsumptionNumber >= balanceInfoRes.VideoExtendNumber { // 视频余量不足
|
||||||
|
_, err = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{
|
||||||
|
WorkAction: cast.WorkActionENUM_CONFIRM,
|
||||||
|
WorkUuid: req.WorkUuid,
|
||||||
|
ConfirmRemark: req.ConfirmRemark,
|
||||||
|
ConfirmStatus: 3,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, errors.New(common.UpdateWorkStatusFailed))
|
||||||
|
return
|
||||||
|
}
|
||||||
service.Error(c, errors.New("视频余量不足"))
|
service.Error(c, errors.New("视频余量不足"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,11 @@ const (
|
|||||||
InsufficientBalance = "余量不足"
|
InsufficientBalance = "余量不足"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BundleExpired = 1
|
||||||
|
BundleNotExpired = 0
|
||||||
|
)
|
||||||
|
|
||||||
//数据指标
|
//数据指标
|
||||||
const (
|
const (
|
||||||
MetricsBusinessFailed = "业务概览查询失败"
|
MetricsBusinessFailed = "业务概览查询失败"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user