private void TestAttend()
        {
            WxNotifyProducerService publisher       = WxNotifyProducerService.Instance;
            PassportService         passportService = new PassportService();
            WxNotifyInDto           wxNotify        = new WxNotifyInDto();

            wxNotify.Data = new List <WxNotifyItemInDto>()
            {
                new WxNotifyItemInDto {
                    DataKey = "first", Value = "杨宏家长,您的孩子已经到校上课。(感谢您对孩子坚持学术艺术的鼓励)"
                },
                new WxNotifyItemInDto {
                    DataKey = "keyword1", Value = $"2018.02.28 14:29"
                },
                new WxNotifyItemInDto {
                    DataKey = "keyword2", Value = "米罗小小班"
                },
                new WxNotifyItemInDto {
                    DataKey = "keyword3", Value = "302"
                },
                new WxNotifyItemInDto {
                    DataKey = "keyword4", Value = "2018-02-28 14:30-15:30"
                },
                new WxNotifyItemInDto {
                    DataKey = "remark", Value = "杨梅红深圳市东海校区 [以上信息如有误,请点击留言]"
                }
            };
            wxNotify.ToUser = passportService.GetByUserCodes(new List <string> {
                "18138878080"
            }).Where(t => !string.IsNullOrEmpty(t.UnionId)).Select(t => t.UnionId).ToList();
            wxNotify.TemplateId = 14000000000000003;
            wxNotify.Url        = "";
            publisher.Publish(wxNotify);
        }
        private void TestFeedBack()
        {
            WxNotifyProducerService publisher       = WxNotifyProducerService.Instance;
            PassportService         passportService = new PassportService();
            WxNotifyInDto           wxNotify        = new WxNotifyInDto();

            wxNotify.Data = new List <WxNotifyItemInDto>()
            {
                new WxNotifyItemInDto()
                {
                    DataKey = "first", Color = "#173177", Value = "您好!我们会尽快处理您提交的信息。 感谢您的支持!"
                },
                new WxNotifyItemInDto()
                {
                    DataKey = "keyword1", Color = "#173177", Value = "总部客服"
                },
                new WxNotifyItemInDto()
                {
                    DataKey = "keyword2", Color = "#173177", Value = "2018.02.01 15:23"
                },
                new WxNotifyItemInDto()
                {
                    DataKey = "remark", Color = "#173177", Value = "杨梅红国际私立美校深圳校区"
                }
            };
            wxNotify.ToUser = passportService.GetByUserCodes(new List <string> {
                "18138878080"
            }).Where(t => !string.IsNullOrEmpty(t.UnionId)).Select(t => t.UnionId).ToList();
            wxNotify.TemplateId = 14000000000000001;
            wxNotify.Url        = "www.ymm.cn";
            publisher.Publish(wxNotify);
        }
Пример #3
0
 /// <summary>
 /// 发送一个消息推送
 /// <para>作    者:蔡亚康</para>
 /// <para>创建时间:2019-03-14</para>
 /// </summary>
 /// <param name="data">一个消息</param>
 public void Publish(WxNotifyInDto data)
 {
     this.Publish(new List <WxNotifyInDto>()
     {
         data
     });
 }
Пример #4
0
        /// <summary>
        /// 发送投诉与建议的微信通知
        /// <para>作    者:郭伟佳</para>
        /// <para>创建时间:2019-03-08</para>
        /// </summary>
        /// <param name="feedbackInfo">投诉与建议信息</param>
        public void SendWxMessage(TblDatFeedback feedbackInfo)
        {
            //获取学生信息
            var studentInfo = StudentService.GetStudentInfo(feedbackInfo.StudentId);

            //请假信息
            WxNotifyInDto wxNotify = new WxNotifyInDto
            {
                Data = new List <WxNotifyItemInDto> {
                    new WxNotifyItemInDto {
                        DataKey = "first", Value = ClientConfigManager.HssConfig.WeChatTemplateTitle.FeedbackNotice
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword1", Value = WeChatTemplateContentConstants.FeedbackReceiver
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword2", Value = feedbackInfo.CreateTime.ToString("yyyy.MM.dd HH:mm")
                    },
                    new WxNotifyItemInDto {
                        DataKey = "remark", Value = feedbackInfo.SchoolName
                    }
                },
                ToUser     = StudentService.GetWxOpenId(studentInfo),
                TemplateId = WeChatTemplateConstants.FeedbackTemplateId,
                Url        = string.Empty
            };

            WxNotifyProducerService.Instance.Publish(wxNotify);
        }
        /// <summary>
        /// 补签-微信通知
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-03-15</para>
        /// </summary>
        /// <param name="className">班级名称</param>
        /// <param name="classRoom">教室</param>
        /// <param name="classTime">上课时间</param>
        /// <param name="replenishCode">补签码</param>
        /// <param name="studentId">学生Id</param>
        ///
        private void PushWeChatNotice(long studentId, string className,
                                      string classRoom, string classTime, string replenishCode)
        {
            //获取学生信息
            var stuInfo = StudentService.GetStudentInfo(studentId);
            //微信推送标题
            string title = string.Format(ClientConfigManager.HssConfig.WeChatTemplateTitle.SignReplenishNotice, stuInfo.StudentName);
            //家长确认补签地址
            string signUrl = ClientConfigManager.HssConfig.ParentsConfirmSignUrl + "?replenishCode=" + replenishCode;

            WxNotifyProducerService wxNotifyProducerService = WxNotifyProducerService.Instance;
            WxNotifyInDto           wxNotify = new WxNotifyInDto
            {
                Data = new List <WxNotifyItemInDto> {
                    new WxNotifyItemInDto {
                        DataKey = "first", Value = title
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword1", Value = className
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword2", Value = classRoom
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword3", Value = classTime
                    },
                    new WxNotifyItemInDto {
                        DataKey = "remark", Value = ScanCodeAttendConstants.Msg, Color = "#FF2500"
                    }
                },
                ToUser     = StudentService.GetWxOpenId(stuInfo),
                TemplateId = WeChatTemplateConstants.SignReplenishNotice,
                Url        = signUrl
            };

            wxNotifyProducerService.Publish(wxNotify);
        }
        /// <summary>
        /// 微信通知
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2019-03-15</para>
        /// </summary>
        private void PushWeChatNotice()
        {
            var stuInfo  = StudentService.GetStudentInfo(_request.StudentId);
            var inLesson = this._inLessonList.FirstOrDefault();

            string pushClassTime = this._outLessonList
                                   .Select(x => DateTime.Parse(x.ClassDate.ToString("yyyy-MM-dd") + " " + x.ClassBeginTime))
                                   .Min().ToString("yyyy.MM.dd HH:mm");

            //first={0}家长,您好!因{1}于{2}请假,为了保证孩子的学习效果,我们特别为孩子安排了补课,具体时间如下:
            string title =
                string.Format(
                    ClientConfigManager.HssConfig.WeChatTemplateTitle.MakeupNotice,
                    stuInfo.StudentName, stuInfo.StudentName, pushClassTime);

            //keyword1=上课时间
            var    classTimeList = this._inLessonList.Select(x => x.ClassBeginTime + "-" + x.ClassEndTime);
            string classTime     = $"{inLesson.ClassDate.ToString("yyyy.MM.dd")} {string.Join("、", classTimeList)}";

            //keyword2=班级名称
            string className = CourseService.GetByCourseId(inLesson.CourseId)?.ClassCnName ?? string.Empty;

            //keyword3=教室
            string classRoom = new ClassRoomService(inLesson.ClassRoomId)?.ClassRoomInfo?.RoomNo ?? string.Empty;

            //keyword4=老师名称
            string teacherName = TeachService.GetTeacher(inLesson.TeacherId)?.TeacherName ?? string.Empty;

            //remark=校区名称
            string schoolName = OrgService.GetSchoolBySchoolId(_schoolId)?.SchoolName ?? string.Empty;

            WxNotifyProducerService wxNotifyProducerService = WxNotifyProducerService.Instance;
            WxNotifyInDto           wxNotify = new WxNotifyInDto
            {
                Data = new List <WxNotifyItemInDto> {
                    new WxNotifyItemInDto {
                        DataKey = "first", Value = title
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword1", Value = classTime
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword2", Value = className
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword3", Value = classRoom
                    },
                    new WxNotifyItemInDto {
                        DataKey = "keyword4", Value = teacherName
                    },
                    new WxNotifyItemInDto {
                        DataKey = "remark", Value = schoolName
                    }
                },
                ToUser     = StudentService.GetWxOpenId(stuInfo),
                TemplateId = WeChatTemplateConstants.MakeupNotice,
                Url        = string.Empty
            };

            wxNotifyProducerService.Publish(wxNotify);
        }