From 37a27654fee2333f66f7bddaf570e983b490e53a Mon Sep 17 00:00:00 2001 From: JNG <365252428@qq.com> Date: Mon, 15 Dec 2025 15:47:17 +0800 Subject: [PATCH] 11 --- pkg/service/bundle/common/msg.go | 156 +++++++++++++++++++++++++------ pkg/service/bundle/pay.go | 13 ++- 2 files changed, 136 insertions(+), 33 deletions(-) diff --git a/pkg/service/bundle/common/msg.go b/pkg/service/bundle/common/msg.go index 10a1df4..2bc6eea 100644 --- a/pkg/service/bundle/common/msg.go +++ b/pkg/service/bundle/common/msg.go @@ -2,9 +2,53 @@ package common // 套餐 const ( - MissBundleUUID = "缺少套餐UUID" - MissOrderSignature = "缺少客户签名信息" - ErrorInsertSignature = "插入签名失败" + MissBundleUUID = "缺少套餐UUID" + MissOrderSignature = "缺少客户签名信息" + ErrorInsertSignature = "插入签名失败" + CreateValueAddBundleFailed = "创建增值套餐失败" + ValueAddBundleListFailed = "增值套餐列表查询失败" + ValueAddBundleDetailFailed = "增值套餐详情查询失败" + SaveValueAddServiceFailed = "保存增值套餐失败" + ValueAddServiceListFailed = "套餐服务列表查询失败" + ValueAddServiceDetailFailed = "套餐服务详情查询失败" + ValueAddServiceLangDetailFailed = "套餐服务语言详情查询失败" + CreateBundleFailed = "创建套餐失败" + UpdateBundleFailed = "更新套餐失败" + DeleteBundleFailed = "删除套餐失败" + BundleListFailed = "套餐列表查询失败" + BundleDetailFailed = "套餐详情查询失败" + HandShelfFailed = "更新套餐上下架失败" + OnlyAddValueListByOrderNoFailed = "根据订单号查询增值套餐失败" +) + +//官网报告 +const ( + ErrorCreateReportFailed = "创建官网报告失败" + ErrorDeleteReportFailed = "删除官网报告失败" + ErrorListReportFailed = "官网报告列表查询失败" + ErrorEditReportFailed = "编辑官网报告失败" + ErrorDisplayReportFailed = "显示官网报告失败" +) + +//官网成员管理 +const ( + ErrorCreateMemberFailed = "创建官网成员失败" + ErrorDeleteMemberFailed = "删除官网成员失败" + ErrorListMemberFailed = "官网成员列表查询失败" + ErrorEditMemberFailed = "编辑官网成员失败" + ErrorDisplayMemberFailed = "显示官网成员失败" + ErrorEditBoardOfDirectorsFailed = "编辑董事会成员失败" + ErrorEditCommitteeAppointmentsFailed = "编辑委员会成员失败" + ErrorDisplayCommitteeAppointmentsFailed = "显示委员会成员失败" + ErrorEditManagementFailed = "编辑管理员失败" + ErrorDisplayManagementFailed = "显示管理员失败" + ErrorDisplayBoardOfDirectorsFailed = "显示董事会成员失败" +) + +//官网邮箱通知 +const ( + ErrorEmailAlertSubmitFailed = "提交邮箱通知失败" + ErrorGetEmailInformationListFailed = "获取邮箱通知列表失败" ) // 订单 @@ -55,31 +99,81 @@ const ( BundleUnBindingAddService = "套餐未绑定增值服务" ) -/*var EnMessages = map[string]string{ - "创建套餐信息失败": "Failed to create bundle information", - "创建套餐信息成功": "Successfully created bundle information", - "更新套餐信息失败": "Failed to update bundle information", - "更新套餐信息成功": "Successfully updated bundle information", - "删除套餐信息失败": "Failed to delete bundle information", - "删除套餐信息成功": "Successfully deleted bundle information", - "获取套餐列表失败": "Failed to get bundle list", - "获取套餐信息失败": "Failed to get bundle information", - "创建订单信息失败": "Failed to create order information", - "创建订单信息成功": "Successfully created order information", - "更新订单信息失败": "Failed to update order information", - "更新订单信息成功": "Successfully updated order information", - "获取订单信息失败": "Failed to get order information", - "获取订单列表失败": "Failed to get order list", - "缺少套餐UUID": "Missing bundle UUID", - "缺少客户签名信息": "Missing customer signature", - "插入签名失败": "Failed to insert signature", - "缺少订单号": "Missing order number", - "缺少订单信息": "Missing order information", - "非当前用户订单信息不可操作": "Cannot operate on order information of other users", - "订单已支付": "Order has been paid", - "您已购买过套餐,无法再次购买": "You have already purchased this bundle and cannot purchase again", - "查询支付信息失败": "Failed to query payment information", - "下载文件失败": "Failed to download file", - "上传文件失败": "Failed to upload file", - "时间格式错误": "Invalid time format", -}*/ +//发布 +const ( + UpdateWorkStatusFailed = "更新作品状态失败" + GetWorkDetailFailed = "获取作品详情失败" +) + +//余量 +const ( + BundleExtendFailed = "套餐扩展失败" + BundleExtendRecordsListFailed = "套餐扩展记录列表查询失败" + GetBundleBalanceListFailed = "套餐余额列表查询失败" + GetUsedRecordListFailed = "套餐使用记录列表查询失败" + GetUserBalanceFailed = "套餐余额查询失败" + ToBeComfirmedWorksFailed = "待确认作品列表查询失败" + ConfirmWorkFailed = "确认消耗余量失败" + AddBundleBalanceFailed = "添加消耗余量失败" + BundleActivateFailed = "套餐激活失败" + BundleExportFailed = "套餐余量导出失败" + SetBalanceLayoutFailed = "设置套餐余额布局失败" + GetBalanceLayoutFailed = "获取套餐余额布局失败" + InsufficientBalance = "余量不足" +) + +//数据指标 +const ( + MetricsBusinessFailed = "业务概览查询失败" + MetricsOperatingFailed = "运营数据查询失败" + MetricsBundlePurchaseExportFailed = "套餐购买数据导出失败" + MetricsArtistAccountExportFailed = "艺人账号数据导出失败" + MetricsVideoSubmitExportFailed = "视频上传数据导出失败" + MetricsBalanceDetailExportFailed = "服务使用明细数据导出失败" + BalanceMetricsExportFailed = "服务使用明细数据导出失败" +) + +//素材库 +const ( + FileListFailed = "素材库列表查询失败" + FileUsageFailed = "素材库使用情况查询失败" + GetFileInfoFailed = "素材库文件信息查询失败" + CreateFileFailed = "素材库文件创建失败" + DeleteFileFailed = "素材库文件删除失败" + SearchFileFailed = "素材库文件搜索失败" + UploadFileFailed = "素材库文件上传失败" + TusCreateFailed = "素材库文件创建失败" + TusUploadFailed = "素材库文件上传失败" + PreviewFileFailed = "素材库文件预览失败" + ActionFailed = "素材库文件操作失败" + DirDownloadFailed = "素材库文件下载失败" + InvalidUploadOffset = "无效的上传偏移量" + ERROR_OPEN_FILE = "打开文件错误" +) + +//官网 +const ( + CreateSecFilingFailed = "创建官方信息失败" + UpdateSecFilingFailed = "更新官方信息失败" + UpdateSecFilingStatusFailed = "更新官方信息状态失败" + ListSecFilingFailed = "官方信息列表查询失败" + DetailSecFilingFailed = "官方信息详情查询失败" + DeleteSecFilingFailed = "删除官方信息失败" + FilingDateIsEmpty = "数据信息为空" + GetSecFilingsFailed = "获取官方信息失败" + GetFormListFailed = "获取官方信息类型失败" + WebListSecFilingFailed = "官网官方信息列表查询失败" + + CreateGovernanceFailed = "创建治理信息失败" + DeleteGovernanceFailed = "删除治理信息失败" + ListGovernanceFailed = "治理信息列表查询失败" + EditGovernanceFailed = "编辑治理信息失败" + DisplayGovernanceFailed = "显示治理信息失败" + + CreatePressReleasesFailed = "创建新闻发布失败" + DeletePressReleasesFailed = "删除新闻发布失败" + ListPressReleasesFailed = "新闻发布列表查询失败" + EditPressReleasesFailed = "编辑新闻发布失败" + DisplayPressReleasesFailed = "显示新闻发布失败" + GetPressReleasesFailed = "获取新闻发布失败" +) diff --git a/pkg/service/bundle/pay.go b/pkg/service/bundle/pay.go index da73930..ba16b4c 100644 --- a/pkg/service/bundle/pay.go +++ b/pkg/service/bundle/pay.go @@ -2,7 +2,6 @@ package bundle import ( "context" - "dubbo.apache.org/dubbo-go/v3/common/logger" "encoding/json" "errors" "fmt" @@ -10,6 +9,7 @@ import ( "fonchain-fiee/api/bundle" "fonchain-fiee/api/order" "fonchain-fiee/api/payment" + "fonchain-fiee/pkg/cache" "fonchain-fiee/pkg/config" "fonchain-fiee/pkg/model/login" "fonchain-fiee/pkg/service" @@ -19,6 +19,9 @@ import ( "math" "net/http" "strconv" + "time" + + "dubbo.apache.org/dubbo-go/v3/common/logger" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" @@ -141,7 +144,13 @@ func CreateAntomPay(c *gin.Context) { // 获取 用户信息 userInfo := login.GetUserInfoFromC(c) - + // 创建审批 防止重复提交 + lockKey := fmt.Sprintf("create_antom_pay_%v", userInfo.ID) + reply := cache.RedisClient.SetNX(lockKey, 0, 5*time.Second) + if !reply.Val() { + service.Error(c, errors.New(common.CreateBundleFailed)) + return + } // outTradeNo就是orderNo,根据这个去查询子表的source,如果是2就时单独的子套餐,如果是1就是主套餐 orderLimit, err := service.BundleProvider.OrderListByOrderNo(context.Background(), &bundle.OrderInfoByOrderNoRequest{ OrderNo: req.OutTradeNo,