cygx_activity_special_trip.go 1020 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package cygx
  2. import (
  3. "errors"
  4. "hongze/hz_crm_api/models"
  5. "hongze/hz_crm_api/models/cygx"
  6. "strconv"
  7. "strings"
  8. )
  9. // 校验该用户是否有报名权限
  10. func CheckaddSpecialSignuUserPower(wxuser *models.WxUser, activityInfo *cygx.ActivitySpecialDetail) (havePower bool) {
  11. companyId := wxuser.CompanyId
  12. companyPermission, _ := cygx.GetCompanyPermission(companyId)
  13. if companyPermission == "" {
  14. return
  15. }
  16. userType, _ := GetSpecialUserType(wxuser)
  17. if strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(userType)) && strings.Contains(companyPermission, activityInfo.ChartPermissionName) {
  18. havePower = true
  19. }
  20. return
  21. }
  22. func GetSpecialTripUserMap(activityId int) (mapUserId map[int]int, err error) {
  23. list, e := cygx.GetCygxActivitySpecialTripListByActivityId(activityId)
  24. if e != nil {
  25. err = errors.New("GetCygxActivitySpecialTripListByActivityId, Err: " + e.Error())
  26. return
  27. }
  28. mapUid := make(map[int]int)
  29. for _, v := range list {
  30. mapUid[v.UserId] = v.UserId
  31. }
  32. mapUserId = mapUid
  33. return
  34. }