This commit is contained in:
蒋海成 2025-02-22 20:37:56 +08:00
parent 9c058a94f4
commit bc26fba5f5
2 changed files with 21 additions and 0 deletions

View File

@ -35,6 +35,25 @@ func CreateBundleOrderSignature(c *gin.Context) {
// 获取 用户信息 // 获取 用户信息
userInfo := login.GetUserInfoFromC(c) userInfo := login.GetUserInfoFromC(c)
// 校验 当前用户只能买一次套餐
orderRecordsListReq := bundle.OrderRecordsRequest{
CustomerID: strconv.FormatUint(userInfo.ID, 10),
}
orderRecordsList, orderRecordsListErr := service.BundleProvider.OrderRecordsList(context.Background(), &orderRecordsListReq)
if orderRecordsListErr != nil {
service.Error(c, orderRecordsListErr)
return
}
if orderRecordsList.OrderRecords != nil {
for _, order := range orderRecordsList.OrderRecords {
if order.CustomerID == strconv.FormatUint(userInfo.ID, 10) {
service.Error(c, errors.New(common.HadOrder))
return
}
}
}
req.CustomerNum = userInfo.SubNum req.CustomerNum = userInfo.SubNum
req.CustomerName = userInfo.Name req.CustomerName = userInfo.Name
req.CustomerID = strconv.FormatUint(userInfo.ID, 10) req.CustomerID = strconv.FormatUint(userInfo.ID, 10)

View File

@ -15,6 +15,8 @@ const (
NotMatchOrderInfo = "非当前用户订单信息不可操作" NotMatchOrderInfo = "非当前用户订单信息不可操作"
HadPay = "订单已支付" HadPay = "订单已支付"
HadOrder = "您已购买过套餐,无法再次购买"
) )
// stripe // stripe