diff --git a/pkg/service/bundle/bundleBalance.go b/pkg/service/bundle/bundleBalance.go index 43e8335..0ea5962 100644 --- a/pkg/service/bundle/bundleBalance.go +++ b/pkg/service/bundle/bundleBalance.go @@ -302,6 +302,11 @@ func WorkAnalysisConfirm(c *gin.Context) { // 确认数据分析并扣除余量 return } + if balanceInfoRes.BundleStatus == common.BundleExpired { + service.Error(c, errors.New("套餐已过期")) + return + } + analysisInfoRes, err := service.CastProvider.GetWorkAnalysis(c, &cast.GetWorkAnalysisDetailReq{ Uuid: req.Uuid, }) diff --git a/pkg/service/cast/analysis.go b/pkg/service/cast/analysis.go index ae53fc1..1b208ce 100644 --- a/pkg/service/cast/analysis.go +++ b/pkg/service/cast/analysis.go @@ -1,4 +1,4 @@ -package cast +package cast import ( "context" @@ -13,6 +13,7 @@ import ( modelCast "fonchain-fiee/pkg/model/cast" "fonchain-fiee/pkg/model/login" "fonchain-fiee/pkg/service" + "fonchain-fiee/pkg/service/bundle/common" "fonchain-fiee/pkg/utils" "strconv" "sync" @@ -609,6 +610,22 @@ func autoConfirmAnalysis(ctx context.Context, analysisUuid string) (err error) { isFailed = true } + if balanceInfoRes.BundleStatus == common.BundleExpired { + confirmRemark = "套餐已过期" + // 直接提交 + _, err = service.CastProvider.UpdateWorkAnalysisStatus(context.Background(), &cast.UpdateWorkAnalysisStatusReq{ + WorkAction: cast.WorkActionENUM_CONFIRM, + Uuid: analysisUuid, + ConfirmRemark: confirmRemark, + ConfirmStatus: 3, + }) + if err != nil { + zap.L().Error("autoConfirmAnalysis UpdateWorkAnalysisStatus", zap.Any("err", err)) + return + } + return + } + var addBalanceReq bundle.AddBundleBalanceReq addBalanceReq.UserId = int32(userID) // 检查数据分析余量 diff --git a/pkg/service/cast/report.go b/pkg/service/cast/report.go index 16b25eb..59ff30a 100644 --- a/pkg/service/cast/report.go +++ b/pkg/service/cast/report.go @@ -520,6 +520,11 @@ func UpdateCompetitiveReportStatus(ctx *gin.Context) { return } + if balanceInfoRes.BundleStatus == common.BundleExpired { + service.Error(ctx, errors.New("套餐已过期")) + return + } + if balanceInfoRes.CompetitiveConsumptionNumber >= balanceInfoRes.CompetitiveNumber { service.Error(ctx, errors.New("竞品报告余额不足")) return @@ -946,6 +951,22 @@ func autoConfirmReport(ctx context.Context, reportUuid string) (err error) { isFailed = true } + if balanceInfoRes.BundleStatus == common.BundleExpired { + confirmRemark = "套餐已过期" + // 直接提交 + _, err = service.CastProvider.UpdateCompetitiveReportStatus(context.Background(), &cast.UpdateCompetitiveReportStatusReq{ + WorkAction: cast.WorkActionENUM_CONFIRM, + Uuid: reportUuid, + ConfirmRemark: confirmRemark, + ConfirmStatus: 3, + }) + if err != nil { + zap.L().Error("autoConfirmReport UpdateCompetitiveReportStatus", zap.Any("err", err)) + return + } + return + } + var addBalanceReq bundle.AddBundleBalanceReq addBalanceReq.UserId = int32(userID) // 检查竞品报告余量