scrm-go

subscibe_service.go 531B

123456789101112131415161718192021222324252627282930
  1. package org_service
  2. import (
  3. "SCRM/models"
  4. "errors"
  5. "time"
  6. )
  7. func GetOrgSubscibeState(subscibe *models.ServeSubscibe) (err error) {
  8. if subscibe == nil {
  9. err = errors.New("没有订阅信息")
  10. return
  11. }
  12. //免费试用版2,永久免费版9 不过期
  13. if subscibe.State == 9 || subscibe.State == 2 {
  14. return
  15. }
  16. timeNow := time.Now().Unix()
  17. if timeNow < subscibe.PeriodStart || timeNow > subscibe.PeriodEnd {
  18. subscibe.State = 3
  19. }
  20. if subscibe.State != 1 && subscibe.State != 8 {
  21. subscibe.State = 3
  22. }
  23. return
  24. }