分销商城(微商城)接口项目

subscibe_service.go 529B

123456789101112131415161718192021222324252627282930
  1. package service
  2. import (
  3. "errors"
  4. "time"
  5. "wsc-go/models"
  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. }