package db

import (
	"applet/app/db/model"
	"applet/app/utils"
	"xorm.io/xorm"
)

func GetActivityCate(eg *xorm.Engine, storeId string) *[]model.CommunityTeamActivityCate {
	var data []model.CommunityTeamActivityCate
	ids := []string{"0"}
	if utils.StrToInt(storeId) > 0 {
		ids = append(ids, storeId)
	}
	err := eg.Where("is_show=1").In("store_id", ids).OrderBy("sort desc,id desc").Find(&data)
	if err != nil {
		return nil
	}
	return &data
}
func GetActivity(eg *xorm.Engine, cid []int) *[]model.CommunityTeamActivity {
	var data []model.CommunityTeamActivity
	err := eg.Where("is_show=1").In("cid", cid).OrderBy("sort desc,id desc").Find(&data)
	if err != nil {
		return nil
	}
	return &data
}
