Browse Source

预约纪要模板消息推送bug修改

xingzai 2 years ago
parent
commit
9b50fdc94b
2 changed files with 11 additions and 6 deletions
  1. 6 4
      models/activity_appointment.go
  2. 5 2
      services/article.go

+ 6 - 4
models/activity_appointment.go

@@ -131,15 +131,17 @@ func CancelcygxActivityAppointment(item *CygxActivityAppointment) (lastId int64,
 }
 
 type CygxAppointmentAndActivity struct {
-	Mobile       string `description:"手机号"`
-	ActivityName string `description:"所属销售"`
+	Mobile         string `description:"手机号"`
+	ActivityName   string `description:"所属销售"`
+	ActivityTypeId int    `description:"活动类型"`
 }
 
 //通过活动ID获取预约列表
 func GetAppointmentListByActivityId(activityIds, activityTypeIds string) (items []*CygxAppointmentAndActivity, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			m.*,a.activity_name
+			m.*,a.activity_name,
+			a.activity_type_id
 		FROM
 			cygx_activity_appointment AS m
 			INNER JOIN cygx_activity AS a ON a.activity_id = m.activity_id 
@@ -147,7 +149,7 @@ func GetAppointmentListByActivityId(activityIds, activityTypeIds string) (items
 			a.activity_id IN ( ` + activityIds + ` ) 
 			AND a.activity_type_id IN (` + activityTypeIds + `) 
 			AND DATE_SUB( CURDATE(), INTERVAL 14 DAY ) <= date( a.activity_time ) 
-			AND a.active_state = 3`
+			AND a.active_state = 3 	GROUP BY m.mobile`
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 5 - 2
services/article.go

@@ -308,7 +308,7 @@ func GetArticleListByApi(cont context.Context) (err error) {
 			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "GetArticleListByApi ErrMsg:"+err.Error(), utils.EmailSendToUsers)
 		}
 	}()
-	requestUrl := "https://vmp.hzinsights.com/v2api/articles/mp?take=10&skip=0&publish_status=2,4&order=publish_date&sort=DESC"
+	requestUrl := "https://vmp.hzinsights.com/v2api/articles/mp?take=100&skip=0&publish_status=2,4&order=publish_date&sort=DESC"
 	method := "GET"
 	client := &nhttp.Client{}
 	req, err := nhttp.NewRequest(method, requestUrl, nil)
@@ -666,7 +666,6 @@ func GetArticleListByApi(cont context.Context) (err error) {
 					}
 				}
 			}
-
 			//类型ID 医药(医享会:28 、药调研:301)、消费【渠道新声:32】、科技【科技前言:79】、智造【匠心智造:84】或者是纪要做消息模板推送
 			fmt.Println(v.CategoryId)
 			if v.IsSummary == 1 || (v.CategoryId == 28 || v.CategoryId == 301 || v.CategoryId == 32 || v.CategoryId == 79 || v.CategoryId == 84) {
@@ -714,6 +713,10 @@ func GetArticleListByApi(cont context.Context) (err error) {
 											}
 										}
 										appointmentActivityName = strings.TrimRight(appointmentActivityName, ",")
+										if vApp.ActivityTypeId == 5 && v.CategoryId != 301 {
+											continue
+										}
+
 										if vApp.Mobile != "" {
 											openIdListByAppointment, err := models.GetUserRecordListByMobile(4, vApp.Mobile)
 											if err != nil {