|
|
@@ -34,10 +34,18 @@ func (s *Server) MaterialList(c *gin.Context) {
|
|
|
Size: ctx.QueryInt64("size", 20),
|
|
|
}
|
|
|
|
|
|
+ // 查询系统内部分组ID(banner、task_icon、category_icon),这些分组的素材不对用户展示
|
|
|
+ var excludeGroupIds []int64
|
|
|
+ db.Table("dt_material_group").
|
|
|
+ Where("code IN ?", []string{"banner", "task_icon", "category_icon"}).
|
|
|
+ Pluck("id", &excludeGroupIds)
|
|
|
+
|
|
|
query := db.Model(&entity.DtMaterial{}).Where("status = ?", 1)
|
|
|
|
|
|
if groupId > 0 {
|
|
|
query = query.Where("group_id = ?", groupId)
|
|
|
+ } else if len(excludeGroupIds) > 0 {
|
|
|
+ query = query.Where("group_id NOT IN ?", excludeGroupIds)
|
|
|
}
|
|
|
|
|
|
if materialType != "" {
|