ソースを参照

我的日程相关按钮添加展示

xingzai 2 年 前
コミット
51ff932dec

+ 6 - 0
models/activity.go

@@ -192,6 +192,8 @@ type ActivityDetail struct {
 	VideoDetail             *CygxActivityVideoListResp `description:"视频数据"`
 	FileType                int                        `description:"类型: 1-音频; 2-视频"`
 	SourceType              int                        `description:"活动来源。 1:活动 、2:专项产业调研"`
+	TripImgLink             string                     `description:"专项产业调研行程链接"`
+	ActivityTimeEnd         string                     `description:"专项产业调研活动预期结束时间"`
 }
 
 type CygxActivityResp struct {
@@ -380,6 +382,8 @@ func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpe
 			art.distinguished_guest,
 			art.expert,
 			art.speaker,
+			"" AS trip_img_link,
+			"" AS activity_time_end,
 			1 AS source_type,
 			art.activity_time 
 		FROM
@@ -404,6 +408,8 @@ func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpe
 			"",
 			"",
 			"",
+			art.trip_img_link_fix AS trip_img_link,
+			art.activity_time_end,
 			2 AS source_type,
 			art.activity_time 
 		FROM

+ 11 - 0
models/activity_meeting_reminder.go

@@ -154,3 +154,14 @@ func GetUserActivityMeetingReminderCount(uid int) (count int, err error) {
 	err = o.Raw(sqlCount, uid).QueryRow(&count)
 	return
 }
+
+//GetCygxReminderListByUser 获取设置会议提醒的人
+func GetCygxReminderListByUser(condition string, pars []interface{}) (item []*CygxActivityMeetingReminder, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *
+			FROM
+			cygx_activity_meeting_reminder  
+			WHERE 1 = 1 ` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}

+ 4 - 4
services/activity_button.go

@@ -31,8 +31,8 @@ func GetActivitySignUpUserMap(activityIds []int, user *models.WxUserItem) (mapUs
 	return
 }
 
-//获取用户已经预约纪要的活动  cygx_activity_meeting_reminder
-func GetActivityAppointmentUserMasp(activityIds []int, user *models.WxUserItem) (mapUserId map[int]int, err error) {
+//获取用户已经设置会议提醒的活动  cygx_activity_meeting_reminder
+func GetActivityReminderUserMasp(activityIds []int, user *models.WxUserItem) (mapUserId map[int]int, err error) {
 	userId := user.UserId
 	var condition string
 	var pars []interface{}
@@ -43,9 +43,9 @@ func GetActivityAppointmentUserMasp(activityIds []int, user *models.WxUserItem)
 	}
 	condition += ` AND user_id = ?  `
 	pars = append(pars, userId)
-	list, e := models.GetCygxAppointmentListByUser(condition, pars)
+	list, e := models.GetCygxReminderListByUser(condition, pars)
 	if e != nil {
-		err = errors.New("GetCygxActivitySpecialTripList, Err: " + e.Error())
+		err = errors.New("GetCygxReminderListByUser, Err: " + e.Error())
 		return
 	}
 	mapUid := make(map[int]int)

+ 55 - 7
services/activity_my_schedule.go

@@ -4,8 +4,12 @@ import (
 	"errors"
 	"fmt"
 	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"time"
 )
 
+//我的日程 GetScheduleAndSpecilList
 func GetScheduleAndSpecilList(user *models.WxUserItem, condition string, startSize, pageSize int) (items []*models.ActivityDetail, err error) {
 	var conditionSpecil string
 	var pars, parsSpecil []interface{}
@@ -21,14 +25,17 @@ func GetScheduleAndSpecilList(user *models.WxUserItem, condition string, startSi
 	}
 	var activityIds []int
 	var activitySpecilalIds []int
-	for _, v := range list {
-		if v.SignupType == 2 {
+	for k, v := range list {
+		if v.SourceType == 2 {
 			activitySpecilalIds = append(activitySpecilalIds, v.ActivityId)
+			if v.ActivityType == 2 {
+				list[k].ActivityType = 0
+			}
 		} else {
 			activityIds = append(activityIds, v.ActivityId)
 		}
 	}
-
+	//处理活动
 	if len(activityIds) > 0 {
 		//处理用户是否报名
 		mapSignUp, e := GetActivitySignUpUserMap(activityIds, user)
@@ -37,13 +44,12 @@ func GetScheduleAndSpecilList(user *models.WxUserItem, condition string, startSi
 			return
 		}
 		for k, v := range list {
-			if v.SignupType != 2 {
+			if v.SourceType != 2 {
 				if _, ok := mapSignUp[v.ActivityId]; ok {
 					list[k].IsSignup = 1
 				}
 			}
 		}
-
 		//处理用户是否预约纪要
 		mapAppointment, e := GetActivityAppointmentUserMap(activityIds, user)
 		if e != nil {
@@ -51,15 +57,57 @@ func GetScheduleAndSpecilList(user *models.WxUserItem, condition string, startSi
 			return
 		}
 		for k, v := range list {
-			if v.SignupType != 2 {
+			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
+				}
+			}
+		}
 	}
 
+	//处理专项产业调研
+	if len(activitySpecilalIds) > 0 {
+		//处理用户是否报名
+		UserMap, e := GetSpecialTripUserMap(activityIds, user.UserId)
+		if e != nil {
+			err = errors.New("GetSpecialTripUserMap, Err: " + e.Error())
+			return
+		}
+		for k, v := range list {
+			if v.SourceType == 2 {
+				if _, ok := UserMap[v.ActivityId]; ok {
+					list[k].IsSignup = 1
+				}
+			}
+		}
+
+		for k, v := range list {
+			if v.SourceType == 2 {
+				resultTimeStart := utils.StrTimeToTime(v.ActivityTime)  //时间字符串格式转时间格式
+				resultTimeEnd := utils.StrTimeToTime(v.ActivityTimeEnd) //时间字符串格式转时间格式
+				if resultTimeStart.After(time.Now()) {
+					list[k].ActiveState = strconv.Itoa(1)
+				} else if time.Now().After(resultTimeEnd) {
+					list[k].ActiveState = strconv.Itoa(2)
+				} else {
+					list[k].ActiveState = strconv.Itoa(3)
+				}
+			}
+		}
+	}
 	items = list
 	return
 }