Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 40s
feat(pay): 添加支付API基础结构 feat(miniapp): 创建支付测试小程序页面与配置 feat(wechatpay): 配置微信支付参数与证书 fix(guild): 修复成员列表查询条件 docs: 更新代码规范文档与需求文档 style: 统一前后端枚举显示与注释格式 refactor(admin): 重构用户奖励发放接口参数处理 test(title): 添加称号效果参数验证测试
34 lines
881 B
Go
34 lines
881 B
Go
package activity
|
|
|
|
import (
|
|
"context"
|
|
|
|
"bindbox-game/internal/repository/mysql/dao"
|
|
"bindbox-game/internal/repository/mysql/model"
|
|
)
|
|
|
|
// CreateIssueRewards 批量创建期奖励
|
|
// 参数: issueID 期ID, rewards 奖励创建输入数组
|
|
// 返回: 错误信息
|
|
func (s *service) CreateIssueRewards(ctx context.Context, issueID int64, rewards []CreateRewardInput) error {
|
|
return s.writeDB.Transaction(func(tx *dao.Query) error {
|
|
for _, r := range rewards {
|
|
item := &model.ActivityRewardSettings{
|
|
IssueID: issueID,
|
|
ProductID: r.ProductID,
|
|
Name: r.Name,
|
|
Weight: r.Weight,
|
|
Quantity: r.Quantity,
|
|
OriginalQty: r.OriginalQty,
|
|
Level: r.Level,
|
|
Sort: r.Sort,
|
|
IsBoss: r.IsBoss,
|
|
}
|
|
if err := tx.ActivityRewardSettings.WithContext(ctx).Create(item); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
})
|
|
}
|