user_activity_permission.go 792 B

123456789101112131415161718192021222324252627282930313233
  1. package services
  2. import (
  3. "hongze/hongze_cygx/models"
  4. "hongze/hongze_cygx/utils"
  5. )
  6. func CheckActivityUserPermission(user *models.WxUserItem) (sellerMobile, sellerRealName string, err error) {
  7. companyPermission, e := models.GetCompanyPermission(user.CompanyId)
  8. if e != nil {
  9. err = e
  10. return
  11. }
  12. if companyPermission == "" {
  13. companyPermissionNoStatus, e := models.GetCompanyPermissionByUserNoStatus(user.CompanyId)
  14. if e != nil {
  15. err = e
  16. return
  17. }
  18. if companyPermissionNoStatus != "" {
  19. sellerItemQy, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
  20. if e != nil && e.Error() != utils.ErrNoRow() {
  21. err = e
  22. return
  23. }
  24. if sellerItemQy != nil {
  25. sellerMobile = sellerItemQy.Mobile
  26. sellerRealName = sellerItemQy.RealName
  27. }
  28. }
  29. }
  30. return
  31. }