bindbox-game/internal/service/activity/category_lookup.go
邹方成 6ee627139c
Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 40s
feat: 新增支付测试小程序与微信支付集成
feat(pay): 添加支付API基础结构
feat(miniapp): 创建支付测试小程序页面与配置
feat(wechatpay): 配置微信支付参数与证书
fix(guild): 修复成员列表查询条件
docs: 更新代码规范文档与需求文档
style: 统一前后端枚举显示与注释格式
refactor(admin): 重构用户奖励发放接口参数处理
test(title): 添加称号效果参数验证测试
2025-11-17 00:42:08 +08:00

24 lines
564 B
Go

package activity
import (
"context"
)
// GetCategoryNames 批量查询活动分类名称
// 参数: ids 分类ID数组
// 返回: id->名称映射与错误
func (s *service) GetCategoryNames(ctx context.Context, ids []int64) (map[int64]string, error) {
result := make(map[int64]string)
if len(ids) == 0 {
return result, nil
}
items, err := s.readDB.ActivityCategories.WithContext(ctx).Where(s.readDB.ActivityCategories.ID.In(ids...)).Find()
if err != nil {
return nil, err
}
for _, v := range items {
result[v.ID] = v.Name
}
return result, nil
}