content.go 573 B

1234567891011121314151617181920212223242526
  1. package service
  2. import (
  3. "cc-officialweb/models"
  4. "cc-officialweb/utils"
  5. )
  6. // GetRecruit 获取招募
  7. func GetRecruit(types string) (models.Content, error) {
  8. var recruit models.Content
  9. tx := utils.DB.Where("types = ?", types).First(&recruit)
  10. if tx.RowsAffected > 0 {
  11. return recruit, nil
  12. }
  13. return recruit, tx.Error
  14. }
  15. // UpdateRecruitAndNews 修改招募和新闻信息
  16. func UpdateRecruitAndNews(types string) bool {
  17. var recruit models.Content
  18. tx := utils.DB.Where("types = ?", types).Updates(&recruit)
  19. if tx.RowsAffected > 0 {
  20. return true
  21. }
  22. return false
  23. }