package service

import (
	"cc-officialweb/models"
	"cc-officialweb/utils"
)

// GetRecruit 获取招募
func GetRecruit(types string) (models.Content, error) {
	var recruit models.Content
	tx := utils.DB.Where("types = ?", types).First(&recruit)
	if tx.RowsAffected > 0 {
		return recruit, nil
	}
	return recruit, tx.Error
}

// UpdateRecruitAndNews 修改招募和新闻信息
func UpdateRecruitAndNews(types string) bool {
	var recruit models.Content
	tx := utils.DB.Where("types = ?", types).Updates(&recruit)
	if tx.RowsAffected > 0 {
		return true
	}
	return false
}
