Compare commits
10 Commits
b1bde71f34
...
06d6eae188
| Author | SHA1 | Date | |
|---|---|---|---|
| 06d6eae188 | |||
| 0cef4a573e | |||
| 62e25d3079 | |||
| 1186336dd3 | |||
| 4b9bfc15a0 | |||
| 6bc617ecc3 | |||
| e0a5346302 | |||
| 433ec99628 | |||
| 4c8789ed38 | |||
| 164b683b7d |
File diff suppressed because it is too large
Load Diff
@ -3243,6 +3243,8 @@ func (m *WorkDetailResp) validate(all bool) error {
|
||||
}
|
||||
}
|
||||
|
||||
// no validation rules for BundleOrderUuid
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkDetailRespMultiError(errors)
|
||||
}
|
||||
@ -4632,6 +4634,8 @@ func (m *WorkInfoResp) validate(all bool) error {
|
||||
|
||||
// no validation rules for PublishStatus
|
||||
|
||||
// no validation rules for BundleOrderUuid
|
||||
|
||||
if len(errors) > 0 {
|
||||
return WorkInfoRespMultiError(errors)
|
||||
}
|
||||
@ -7586,6 +7590,8 @@ func (m *ToolsReq) validate(all bool) error {
|
||||
|
||||
// no validation rules for Action
|
||||
|
||||
// no validation rules for ArtistUuid
|
||||
|
||||
if len(errors) > 0 {
|
||||
return ToolsReqMultiError(errors)
|
||||
}
|
||||
@ -11373,6 +11379,8 @@ func (m *UpdateWorkAnalysisStatusReq) validate(all bool) error {
|
||||
|
||||
// no validation rules for ConfirmType
|
||||
|
||||
// no validation rules for ApprovalTime
|
||||
|
||||
if len(errors) > 0 {
|
||||
return UpdateWorkAnalysisStatusReqMultiError(errors)
|
||||
}
|
||||
@ -22161,6 +22169,8 @@ func (m *UpdateCompetitiveReportStatusReq) validate(all bool) error {
|
||||
|
||||
// no validation rules for ConfirmType
|
||||
|
||||
// no validation rules for ApprovalTime
|
||||
|
||||
if len(errors) > 0 {
|
||||
return UpdateCompetitiveReportStatusReqMultiError(errors)
|
||||
}
|
||||
@ -24885,6 +24895,112 @@ var _ interface {
|
||||
ErrorName() string
|
||||
} = UpdateMediaAccStatusRespValidationError{}
|
||||
|
||||
// Validate checks the field values on UpdateWorkScriptReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *UpdateWorkScriptReq) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on UpdateWorkScriptReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// UpdateWorkScriptReqMultiError, or nil if none found.
|
||||
func (m *UpdateWorkScriptReq) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *UpdateWorkScriptReq) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for WorkUuid
|
||||
|
||||
// no validation rules for ScriptUuid
|
||||
|
||||
if len(errors) > 0 {
|
||||
return UpdateWorkScriptReqMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateWorkScriptReqMultiError is an error wrapping multiple validation
|
||||
// errors returned by UpdateWorkScriptReq.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type UpdateWorkScriptReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m UpdateWorkScriptReqMultiError) Error() string {
|
||||
msgs := make([]string, 0, len(m))
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m UpdateWorkScriptReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// UpdateWorkScriptReqValidationError is the validation error returned by
|
||||
// UpdateWorkScriptReq.Validate if the designated constraints aren't met.
|
||||
type UpdateWorkScriptReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e UpdateWorkScriptReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e UpdateWorkScriptReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e UpdateWorkScriptReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e UpdateWorkScriptReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e UpdateWorkScriptReqValidationError) ErrorName() string {
|
||||
return "UpdateWorkScriptReqValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e UpdateWorkScriptReqValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sUpdateWorkScriptReq.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = UpdateWorkScriptReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = UpdateWorkScriptReqValidationError{}
|
||||
|
||||
// Validate checks the field values on UnbindMediaAuthReq with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
@ -25397,6 +25513,10 @@ func (m *MediaAccountsResp_Info) validate(all bool) error {
|
||||
|
||||
// no validation rules for MediaAccountName
|
||||
|
||||
// no validation rules for Expired
|
||||
|
||||
// no validation rules for LastOrderUuid
|
||||
|
||||
if len(errors) > 0 {
|
||||
return MediaAccountsResp_InfoMultiError(errors)
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ type CastClient interface {
|
||||
WorkResource(ctx context.Context, in *WorkResourceReq, opts ...grpc_go.CallOption) (*WorkResourceResp, common.ErrorWithAttachment)
|
||||
UpdateWorkResource(ctx context.Context, in *UpdateWorkResourceReq, opts ...grpc_go.CallOption) (*UpdateWorkResourceResp, common.ErrorWithAttachment)
|
||||
UpdateMediaAccStatus(ctx context.Context, in *UpdateMediaAccStatusReq, opts ...grpc_go.CallOption) (*UpdateMediaAccStatusResp, common.ErrorWithAttachment)
|
||||
UpdateWorkScript(ctx context.Context, in *UpdateWorkScriptReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment)
|
||||
UnbindMediaAuth(ctx context.Context, in *UnbindMediaAuthReq, opts ...grpc_go.CallOption) (*UnbindMediaAuthResp, common.ErrorWithAttachment)
|
||||
UpdateMediaAccInfo(ctx context.Context, in *UpdateMediaAccInfoReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment)
|
||||
@ -168,6 +169,7 @@ type CastClientImpl struct {
|
||||
WorkResource func(ctx context.Context, in *WorkResourceReq) (*WorkResourceResp, error)
|
||||
UpdateWorkResource func(ctx context.Context, in *UpdateWorkResourceReq) (*UpdateWorkResourceResp, error)
|
||||
UpdateMediaAccStatus func(ctx context.Context, in *UpdateMediaAccStatusReq) (*UpdateMediaAccStatusResp, error)
|
||||
UpdateWorkScript func(ctx context.Context, in *UpdateWorkScriptReq) (*emptypb.Empty, error)
|
||||
OAuthAccount func(ctx context.Context, in *OAuthAccountReq) (*OAuthAccountResp, error)
|
||||
UnbindMediaAuth func(ctx context.Context, in *UnbindMediaAuthReq) (*UnbindMediaAuthResp, error)
|
||||
UpdateMediaAccInfo func(ctx context.Context, in *UpdateMediaAccInfoReq) (*emptypb.Empty, error)
|
||||
@ -403,6 +405,12 @@ func (c *castClient) UpdateMediaAccStatus(ctx context.Context, in *UpdateMediaAc
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateMediaAccStatus", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) UpdateWorkScript(ctx context.Context, in *UpdateWorkScriptReq, opts ...grpc_go.CallOption) (*emptypb.Empty, common.ErrorWithAttachment) {
|
||||
out := new(emptypb.Empty)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateWorkScript", in, out)
|
||||
}
|
||||
|
||||
func (c *castClient) OAuthAccount(ctx context.Context, in *OAuthAccountReq, opts ...grpc_go.CallOption) (*OAuthAccountResp, common.ErrorWithAttachment) {
|
||||
out := new(OAuthAccountResp)
|
||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||
@ -823,6 +831,7 @@ type CastServer interface {
|
||||
WorkResource(context.Context, *WorkResourceReq) (*WorkResourceResp, error)
|
||||
UpdateWorkResource(context.Context, *UpdateWorkResourceReq) (*UpdateWorkResourceResp, error)
|
||||
UpdateMediaAccStatus(context.Context, *UpdateMediaAccStatusReq) (*UpdateMediaAccStatusResp, error)
|
||||
UpdateWorkScript(context.Context, *UpdateWorkScriptReq) (*emptypb.Empty, error)
|
||||
OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error)
|
||||
UnbindMediaAuth(context.Context, *UnbindMediaAuthReq) (*UnbindMediaAuthResp, error)
|
||||
UpdateMediaAccInfo(context.Context, *UpdateMediaAccInfoReq) (*emptypb.Empty, error)
|
||||
@ -989,6 +998,9 @@ func (UnimplementedCastServer) UpdateWorkResource(context.Context, *UpdateWorkRe
|
||||
func (UnimplementedCastServer) UpdateMediaAccStatus(context.Context, *UpdateMediaAccStatusReq) (*UpdateMediaAccStatusResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateMediaAccStatus not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) UpdateWorkScript(context.Context, *UpdateWorkScriptReq) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateWorkScript not implemented")
|
||||
}
|
||||
func (UnimplementedCastServer) OAuthAccount(context.Context, *OAuthAccountReq) (*OAuthAccountResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method OAuthAccount not implemented")
|
||||
}
|
||||
@ -1966,6 +1978,35 @@ func _Cast_UpdateMediaAccStatus_Handler(srv interface{}, ctx context.Context, de
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_UpdateWorkScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateWorkScriptReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||
args := []interface{}{}
|
||||
args = append(args, in)
|
||||
md, _ := metadata.FromIncomingContext(ctx)
|
||||
invAttachment := make(map[string]interface{}, len(md))
|
||||
for k, v := range md {
|
||||
invAttachment[k] = v
|
||||
}
|
||||
invo := invocation.NewRPCInvocation("UpdateWorkScript", args, invAttachment)
|
||||
if interceptor == nil {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
info := &grpc_go.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||
return result, result.Error()
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Cast_OAuthAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(OAuthAccountReq)
|
||||
if err := dec(in); err != nil {
|
||||
@ -3962,6 +4003,10 @@ var Cast_ServiceDesc = grpc_go.ServiceDesc{
|
||||
MethodName: "UpdateMediaAccStatus",
|
||||
Handler: _Cast_UpdateMediaAccStatus_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdateWorkScript",
|
||||
Handler: _Cast_UpdateWorkScript_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "OAuthAccount",
|
||||
Handler: _Cast_OAuthAccount_Handler,
|
||||
|
||||
@ -30,11 +30,11 @@ func InitTasks() error {
|
||||
err := cm.AddTask("refreshWorkApprovalStatus", "0 */5 * * * *", RefreshWorkApprovalStatusTask)
|
||||
err = cm.AddTask("artistAutoConfirm", "0 */1 * * * *", ArtistAutoConfirmTask)
|
||||
err = cm.AddTask("refreshPublishStatus", "0 */5 * * * *", PublishTask)
|
||||
err = cm.AddTask("scheduledPublish", "0 */1 * * * *", ScheduledPublishTask)
|
||||
err = cm.AddTask("scheduledPublish", "0 */1 * * * *", ScheduledPublishTask) //FIXME正式30分钟一次
|
||||
|
||||
err = cm.AddTask("artistAutoConfirmAnalysis", "0 */1 * * * *", ArtistAutoConfirmAnalysisTask)
|
||||
err = cm.AddTask("refreshWorkAnalysisApprovalStatus", "0 */1 * * * *", RefreshWorkAnalysisApprovalStatusTask)
|
||||
err = cm.AddTask("refreshArtistOrder", "0 */30 * * * *", RefreshArtistOrderTask)
|
||||
err = cm.AddTask("refreshArtistOrder", "0 */5 * * * *", RefreshArtistOrderTask)
|
||||
|
||||
// 每天 00:30 和 12:30 执行 Ayrshare 指标采集任务
|
||||
// err = cm.AddTask("ayrshareMetricsCollector", "0 30 0,12 * * *", AyrshareMetricsCollectorTask)
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"fonchain-fiee/api/accountFiee"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/api/cast"
|
||||
"fonchain-fiee/api/order"
|
||||
"fonchain-fiee/api/payment"
|
||||
"fonchain-fiee/pkg/cache"
|
||||
@ -329,7 +330,9 @@ func CreateAntomPay(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
go func() {
|
||||
_, _ = service.CastProvider.Tools(context.Background(), &cast.ToolsReq{Action: "artistOrderInfo", ArtistUuid: fmt.Sprint(orderLimit.UserId)})
|
||||
}()
|
||||
if req.ProductAllPrice == 0 {
|
||||
////创建对账单 todo 待修改
|
||||
_, err = service.BundleProvider.CreateReconciliation(context.Background(), &bundle.ReconciliationInfo{
|
||||
@ -581,6 +584,7 @@ func AntomWebhook(c *gin.Context) {
|
||||
fmt.Println("支付时间:", paymentTime)
|
||||
fmt.Println("支付结果状态:", resultStatus)
|
||||
fmt.Println("支付结果消息:", resultMessage)
|
||||
|
||||
/*
|
||||
* S: 当 notifyType 为PAYMENT_RESULT时,表示支付成功;当 notifyType 为PAYMENT_PENDING时,表示支付处理中。
|
||||
* F: 表示支付失败。
|
||||
@ -629,10 +633,12 @@ func AntomWebhook(c *gin.Context) {
|
||||
orderLimit, err := service.BundleProvider.OrderListByOrderNo(context.Background(), &bundle.OrderInfoByOrderNoRequest{
|
||||
OrderNo: resp.OutTradeNo,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
//购买套餐
|
||||
switch orderLimit.Type {
|
||||
case common.OrderTypePackage:
|
||||
@ -669,6 +675,9 @@ func AntomWebhook(c *gin.Context) {
|
||||
service.Error(c, errors.New("无效的订单类型"))
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
_, _ = service.CastProvider.Tools(context.Background(), &cast.ToolsReq{Action: "artistOrderInfo", ArtistUuid: fmt.Sprint(orderLimit.UserId)})
|
||||
}()
|
||||
var timeUnit uint32
|
||||
switch orderLimit.Unit {
|
||||
case "天":
|
||||
|
||||
@ -46,7 +46,15 @@ func MediaUserList(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
seen := make(map[string]struct{})
|
||||
for _, v := range resp.Data {
|
||||
if v.ArtistUuid == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[v.ArtistUuid]; ok {
|
||||
continue
|
||||
}
|
||||
seen[v.ArtistUuid] = struct{}{}
|
||||
_ = SyncAsAuth(v.ArtistUuid)
|
||||
}
|
||||
}()
|
||||
@ -235,6 +243,9 @@ func UpdateMediaAccount(ctx *gin.Context) {
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
_, _ = service.CastProvider.Tools(context.Background(), &cast.ToolsReq{Action: "artistOrderInfo", ArtistUuid: req.ArtistUuid})
|
||||
}()
|
||||
service.Success(ctx, resp)
|
||||
return
|
||||
}
|
||||
@ -885,7 +896,7 @@ func RefreshTaskUnBindAuth(taskUuid string) error {
|
||||
sheetName := "Sheet1"
|
||||
|
||||
// 设置表头
|
||||
headers := []string{"艺人名字", "账号名字", "平台名字", "授权状态", "备注"}
|
||||
headers := []string{"所属艺人", "账号", "所属平台", "授权结果", "备注"}
|
||||
for i, header := range headers {
|
||||
cell := fmt.Sprintf("%c1", 'A'+i)
|
||||
excelFile.SetCellValue(sheetName, cell, header)
|
||||
|
||||
@ -7,16 +7,140 @@ import (
|
||||
"fonchain-fiee/api/aryshare"
|
||||
"fonchain-fiee/api/cast"
|
||||
"fonchain-fiee/cmd/config"
|
||||
"fonchain-fiee/pkg/common/qwen"
|
||||
modelQwen "fonchain-fiee/pkg/model/qwen"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/check"
|
||||
"fonchain-fiee/pkg/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/xuri/excelize/v2"
|
||||
)
|
||||
|
||||
func Test(ctx *gin.Context) {
|
||||
action := ctx.PostForm("action")
|
||||
if action == "" {
|
||||
// 打开Excel文件
|
||||
excelPath := "./data/脚本.xlsx"
|
||||
f, err := excelize.OpenFile(excelPath)
|
||||
if err != nil {
|
||||
service.Error(ctx, fmt.Errorf("打开Excel文件失败: %v", err))
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
// 获取第一个工作表名称
|
||||
sheets := f.GetSheetList()
|
||||
if len(sheets) == 0 {
|
||||
service.Error(ctx, errors.New("Excel文件中没有工作表"))
|
||||
return
|
||||
}
|
||||
sheetName := sheets[0]
|
||||
|
||||
// 读取所有行
|
||||
rows, err := f.GetRows(sheetName)
|
||||
if err != nil {
|
||||
service.Error(ctx, fmt.Errorf("读取工作表失败: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
if len(rows) < 2 {
|
||||
service.Error(ctx, errors.New("Excel文件中没有数据行"))
|
||||
return
|
||||
}
|
||||
|
||||
// 找到"标题"和"脚本"列的索引
|
||||
header := rows[0]
|
||||
titleColIndex := -1
|
||||
scriptColIndex := -1
|
||||
|
||||
for i, cell := range header {
|
||||
if cell == "标题" {
|
||||
titleColIndex = i
|
||||
}
|
||||
if cell == "脚本" {
|
||||
scriptColIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
if titleColIndex == -1 || scriptColIndex == -1 {
|
||||
service.Error(ctx, errors.New("未找到'标题'或'脚本'列"))
|
||||
return
|
||||
}
|
||||
|
||||
// 统计处理信息
|
||||
processedCount := 0
|
||||
errorCount := 0
|
||||
|
||||
// 遍历数据行(从第2行开始,跳过表头)
|
||||
for i := 1; i < len(rows); i++ {
|
||||
row := rows[i]
|
||||
|
||||
// 确保行有足够的列
|
||||
if len(row) <= titleColIndex || len(row) <= scriptColIndex {
|
||||
continue
|
||||
}
|
||||
|
||||
title := row[titleColIndex]
|
||||
script := ""
|
||||
if len(row) > scriptColIndex {
|
||||
script = row[scriptColIndex]
|
||||
}
|
||||
|
||||
// 如果脚本列为空且标题不为空,则请求千问API
|
||||
if script == "" && title != "" {
|
||||
// 调用千问API生成脚本
|
||||
resp, err := qwen.Chat(modelQwen.ChatRequest{
|
||||
Model: "qwen3-max",
|
||||
Messages: []modelQwen.Message{
|
||||
{
|
||||
Role: "user",
|
||||
Content: []modelQwen.Content{
|
||||
{
|
||||
Type: "text",
|
||||
Text: fmt.Sprintf("请为以下标题生成一个视频脚本:\n%s", title),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Seed: 0,
|
||||
EnableSearch: false,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
// 记录错误但继续处理下一行
|
||||
errorCount++
|
||||
continue
|
||||
}
|
||||
|
||||
// 获取生成的脚本内容
|
||||
generatedScript := ""
|
||||
if len(resp.Choices) > 0 {
|
||||
generatedScript = resp.Choices[0].Message.Content
|
||||
}
|
||||
|
||||
// 将生成的脚本写入Excel
|
||||
cellName, _ := excelize.CoordinatesToCellName(scriptColIndex+1, i+1)
|
||||
if err := f.SetCellValue(sheetName, cellName, generatedScript); err != nil {
|
||||
errorCount++
|
||||
continue
|
||||
}
|
||||
processedCount++
|
||||
}
|
||||
}
|
||||
|
||||
// 保存Excel文件
|
||||
if err := f.Save(); err != nil {
|
||||
service.Error(ctx, fmt.Errorf("保存Excel文件失败: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(ctx, map[string]interface{}{
|
||||
"message": "处理完成",
|
||||
"processed": processedCount,
|
||||
"errors": errorCount,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if action == "getPost" {
|
||||
|
||||
@ -491,7 +491,8 @@ func WorkDetail(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
// 检查用户套餐余量
|
||||
func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum) (confirmFailType cast.ConfirmFailENUM, err error) {
|
||||
// otherFields 补充的字段 第一个是workUuid 第二个是orderUuid
|
||||
func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum, otherFields ...string) (confirmFailType cast.ConfirmFailENUM, err error) {
|
||||
zap.L().Info("CheckUserBundleBalance", zap.Any("userID", userID))
|
||||
confirmFailType = cast.ConfirmFailENUM_ConfirmFailENUM_NO
|
||||
resp, err := service.BundleProvider.GetBundleBalanceByUserId(context.Background(), &bundle.GetBundleBalanceByUserIdReq{UserId: userID})
|
||||
@ -505,7 +506,6 @@ func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum)
|
||||
err = errors.New("套餐已过期")
|
||||
return
|
||||
}
|
||||
//FIXME 判断用户是新购还是续费,新购就提示验收失败,套餐已过期,续费就继续扣减
|
||||
switch balanceType {
|
||||
case modelCast.BalanceTypeAccountValue:
|
||||
if resp.AccountConsumptionNumber >= resp.AccountNumber {
|
||||
@ -514,12 +514,26 @@ func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum)
|
||||
return
|
||||
}
|
||||
case modelCast.BalanceTypeImageValue:
|
||||
//判断用户是新购还是续费,新购就提示验收失败,套餐已过期,续费就继续扣减
|
||||
if len(otherFields) >= 2 {
|
||||
confirmFailType, err = CheckOrderRenewal(otherFields[1], resp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if resp.ImageExtendConsumptionNumber >= resp.ImageExtendNumber {
|
||||
confirmFailType = cast.ConfirmFailENUM_ConfirmFailENUM_NOTENOUGH
|
||||
err = errors.New(e.ErrorBalanceInsufficient)
|
||||
return
|
||||
}
|
||||
case modelCast.BalanceTypeVideoValue:
|
||||
if len(otherFields) >= 2 {
|
||||
//判断用户是新购还是续费,新购就提示验收失败,套餐已过期,续费就继续扣减
|
||||
confirmFailType, err = CheckOrderRenewal(otherFields[1], resp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if resp.VideoExtendConsumptionNumber >= resp.VideoExtendNumber {
|
||||
confirmFailType = cast.ConfirmFailENUM_ConfirmFailENUM_NOTENOUGH
|
||||
err = errors.New(e.ErrorBalanceInsufficient)
|
||||
@ -535,6 +549,20 @@ func CheckUserBundleBalance(userID int32, balanceType modelCast.BalanceTypeEnum)
|
||||
return
|
||||
}
|
||||
|
||||
func CheckOrderRenewal(workBindOrderUuid string, resp *bundle.GetBundleBalanceByUserIdResp) (cast.ConfirmFailENUM, error) {
|
||||
if resp.PurchaseType == 2 {
|
||||
return cast.ConfirmFailENUM_ConfirmFailENUM_NO, nil
|
||||
}
|
||||
if resp.PurchaseType == 1 {
|
||||
// 证明是新购套餐
|
||||
if resp.OrderUUID != workBindOrderUuid {
|
||||
return cast.ConfirmFailENUM_ConfirmFailENUM_EXPIRED, errors.New("套餐已过期")
|
||||
}
|
||||
return cast.ConfirmFailENUM_ConfirmFailENUM_NO, nil
|
||||
}
|
||||
return cast.ConfirmFailENUM_ConfirmFailENUM_NO, nil
|
||||
}
|
||||
|
||||
func Publish(ctx *gin.Context) {
|
||||
var (
|
||||
req *cast.PublishReq
|
||||
@ -689,7 +717,7 @@ func PostAS(ctx context.Context, workUuid string, publishSource cast.PublishSour
|
||||
zap.L().Info("post 2", zap.Any("workUuid", workUuid))
|
||||
var mediaUrls []string
|
||||
var isVideo bool
|
||||
var urlResp *UploadMediaResponse
|
||||
//var urlResp *UploadMediaResponse
|
||||
if workDetail.WorkCategory == 1 {
|
||||
isVideo = false
|
||||
// 先用服务器上的文件,不上传到第三方
|
||||
@ -1354,7 +1382,7 @@ func autoConfirm(ctx context.Context, workUuid string) (err error) {
|
||||
}
|
||||
var resp *bundle.AddBundleBalanceResp = nil
|
||||
var confirmFailType cast.ConfirmFailENUM
|
||||
confirmFailType, err = CheckUserBundleBalance(int32(userID), checkType)
|
||||
confirmFailType, err = CheckUserBundleBalance(int32(userID), checkType, []string{workUuid, infoResp.BundleOrderUuid}...)
|
||||
if err != nil {
|
||||
isFailed = true
|
||||
confirmRemark = err.Error()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user