2 Star 0 Fork 0

BOBO/创想视频核心服务

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
video_buy_internal.go 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
zhouyp 提交于 2024-08-10 13:42 . feat: 视频管理、盘古币管理
package validate
import (
"context"
"gitee.com/bobo-rs/innovideo-services/enums"
"gitee.com/bobo-rs/innovideo-services/framework/dao"
"gitee.com/bobo-rs/innovideo-services/framework/model"
"gitee.com/bobo-rs/innovideo-services/framework/service"
"gitee.com/bobo-rs/innovideo-services/library/exception"
"github.com/gogf/gf/v2/frame/g"
)
// CheckVideoBillRefund 验证视频退款账单退款信息
func CheckVideoBillRefund(ctx context.Context, in model.RefundVideoBillInput) (detail *model.VideoBillRefundItem, err error) {
detail = &model.VideoBillRefundItem{}
// 获取账单详情
err = service.VideoBuy().BillModel().DetailPri(ctx, in.BillId, &detail)
if err != nil {
return nil, err
}
// 是否全额退款
if detail.Status == int(enums.VideoBuyBillStatusRefund) {
return nil, exception.New(`该账单已全额退款`)
}
// 退款盘古币不能大于账单盘古币
if in.RefundCoins > (detail.BuyPanguCoin + detail.RefundPanguCoin) {
return nil, exception.New(`退款盘古币不能大于账单盘古币`)
}
// 获取退款剧集
if total, _ := service.VideoBuy().EpisodesModel().Total(ctx, g.Map{
dao.VideoBuyEpisodes.Columns().BillId: in.BillId,
dao.VideoBuyEpisodes.Columns().EpisodesId: in.EpisodesIdSet,
}); len(in.EpisodesIdSet) == 0 || total != len(in.EpisodesIdSet) {
return nil, exception.New(`请勾选的退款剧集或剧集不存在`)
}
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/bobo-rs/innovideo-services.git
git@gitee.com:bobo-rs/innovideo-services.git
bobo-rs
innovideo-services
创想视频核心服务
v1.0.14

搜索帮助