1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package services
- import (
- "errors"
- "hongze/hongze_web_mfyx/models"
- )
- func GetScheduleAndSpecilList(user *models.WxUserItem, condition string, startSize, pageSize int) (items []*models.ActivityDetail, err error) {
-
- var pars []interface{}
- condition += ` AND my.user_id = ?`
- pars = append(pars, user.UserId)
-
-
- list, e := models.GetScheduleAndSpecilList(condition, pars, startSize, pageSize)
- if e != nil {
- err = errors.New("GetScheduleAndSpecilList, Err: " + e.Error())
- return
- }
- var activityIds []int
- var activitySpecilalIds []int
- for k, v := range list {
- if v.SourceType == 2 {
- activitySpecilalIds = append(activitySpecilalIds, v.ActivityId)
-
- if v.ActivityType == 2 {
- list[k].ActivityType = 0
- }
- list[k].IsShowSignup = true
- } else {
- activityIds = append(activityIds, v.ActivityId)
- }
- }
-
- if len(activityIds) > 0 {
-
- mapSignUp, e := GetActivitySignUpUserMap(activityIds, user)
- if e != nil {
- err = errors.New("GetActivitySignUpUserMap, Err: " + e.Error())
- return
- }
- for k, v := range list {
- if v.SourceType != 2 {
- if _, ok := mapSignUp[v.ActivityId]; ok {
- list[k].IsSignup = 1
- }
- }
- }
-
- mapAppointment, e := GetActivityAppointmentUserMap(activityIds, user)
- if e != nil {
- err = errors.New("GetActivityAppointmentUserMap, Err: " + e.Error())
- return
- }
- for k, v := range list {
- if v.SourceType != 2 {
- if _, ok := mapAppointment[v.ActivityId]; ok {
- list[k].IsAppointment = 1
- }
- }
- }
-
- mapReminder, e := GetActivityReminderUserMasp(activityIds, user)
- if e != nil {
- err = errors.New("GetActivityReminderUserMasp, Err: " + e.Error())
- return
- }
- for k, v := range list {
- if v.SourceType != 2 {
- if _, ok := mapReminder[v.ActivityId]; ok {
- list[k].IsCancelMeetingReminder = 1
- }
- }
- }
- }
- items = list
- return
- }
|