scrm-go

org_info_service.go 860B

123456789101112131415161718192021222324252627282930313233
  1. package org_service
  2. import (
  3. "SCRM/models"
  4. "SCRM/service"
  5. "time"
  6. )
  7. func GetOrgTypes() (ots []*models.OrgType, err error) {
  8. err = service.UserReadDB().Model(&models.OrgType{}).Where("status=1").Order("sort_no").Find(&ots).Error
  9. return
  10. }
  11. func UpdateOrgInfo(org *Org) (err error) {
  12. err = service.UserWriteDB().Model(&models.Org{}).Where("id=?", org.Id).Update(org).Error
  13. return
  14. }
  15. func GetIllnessList() (ills []*models.Illness, err error) {
  16. err = service.UserReadDB().Where("status=1").Find(&ills).Error
  17. return
  18. }
  19. func CreateOrgGalleryItem(item *models.OrgGallery) (err error) {
  20. err = service.UserWriteDB().Create(item).Error
  21. return
  22. }
  23. func DeleteOrgGalleryItem(id int64) (err error) {
  24. err = service.UserWriteDB().Model(&models.OrgGallery{}).Where("id=?", id).Update(map[string]interface{}{"Status": 0, "Mtime": time.Now().Unix()}).Error
  25. return
  26. }