user_freee_button.go 821 B

12345678910111213141516171819202122232425262728
  1. package services
  2. import (
  3. "hongze/hongze_cygx/models"
  4. "hongze/hongze_cygx/utils"
  5. )
  6. // GetfreeButtonIsShow 用户免费分享按钮是否回显
  7. func GetfreeButtonIsShow(user *models.WxUserItem) (isShow bool, err error) {
  8. detail, err := models.GetConfigByCode("free_trial_card")
  9. if err != nil {
  10. return
  11. }
  12. companyDetail, err := models.GetCompanyDetailByIdGroup(user.CompanyId)
  13. if err != nil && err.Error() != utils.ErrNoRow() {
  14. return
  15. }
  16. count, err := models.CountCygxUserFreeeButton(user.UserId)
  17. if err != nil && err.Error() != utils.ErrNoRow() {
  18. return
  19. }
  20. if companyDetail != nil && companyDetail.IsSuspend == 0 {
  21. if detail.ConfigValue == "1" && (companyDetail.Status == "正式" || companyDetail.Status == "试用" || companyDetail.Status == "永续") && count == 0 {
  22. isShow = true
  23. }
  24. }
  25. return
  26. }