public TecTrialRemindTemplate GenerateData(string toUserOpenId, RTrialLog eTrialLog) { string first = $"有用户预约了您的试听课."; string remark = $"接待人:{eTrialLog.SalesName}"; var data = new { first = new TemplateField() { value = first, color = "#EB6B13" }, keyword1 = new TemplateField() { value = eTrialLog.UserRealName, color = "#FFC753" }, keyword2 = new TemplateField() { value = $"{ eTrialLog.CourseName} | { eTrialLog.TrialTimeStr }" }, keyword3 = new TemplateField() { value = $"{ eTrialLog.TrialDateStr}", color = "#FFBA00" }, keyword4 = new TemplateField() { value = $"{ eTrialLog.TrialTimeStr }", color = "#FFBA00" }, keyword5 = new TemplateField() { value = $"高青路校区" }, remark = new TemplateField { value = remark, color = "#007ACC" }, }; TecTrialRemindTemplate obj = base.InitObject(toUserOpenId, "", "TUbR0kbed9NM8Oh-yoHnnHI20NXb83URlR6rszXpqiM"); obj.data = data; return(obj); }
public UserTrialRemindTemplate GenerateData(string toUserOpenId, RTrialLog eTrialLog) { string first = $"尊敬的{eTrialLog.UserRealName},您预约的试听课请不要忘记参加."; string remark = string.Format("如需取消,点击进入此消息后操作"); var data = new { first = new TemplateField() { value = first, color = "#EB6B13" }, keyword1 = new TemplateField() { value = eTrialLog.CourseName }, keyword2 = new TemplateField() { value = $"{ eTrialLog.TrialDateStr} | { eTrialLog.TrialTimeStr }" }, keyword3 = new TemplateField() { value = "约45分钟" }, keyword4 = new TemplateField() { value = eTrialLog.TecName }, remark = new TemplateField { value = remark, color = "#007ACC" }, }; string url = WebUrl + $"&openid={toUserOpenId}&toPage=/User/MyTrial"; UserTrialRemindTemplate obj = base.InitObject(toUserOpenId, url, "r71THWj2pi0o5FeWVBfLlkgkkgAXq7A2um59w4QYVuA"); obj.data = data; return(obj); }
public IActionResult OnPostUpdateTrial(RTrialLog updateTrial) { ResultNormal result = new ResultNormal(); var times = StaticDataSrv.TrialTime; bool needWX = false; try { if (updateTrial.Id <= 0) { result.ErrorMsg = "没有找到试听课,无法保存!"; } else { ETrialLog origTrial = _CourseSrv.GetTrialLog(updateTrial.Id); origTrial.Lesson = updateTrial.Lesson; origTrial.TrialDateTime = updateTrial.TrialDateTime; origTrial.CourseCode = updateTrial.CourseCode; var cls = _CourseSrv.GetCourseInfoClass(origTrial.CourseCode); origTrial.TecCode = cls.TecCode; origTrial.TecName = cls.TecName; origTrial.CourseType = (int)cls.CourseType; origTrial.CourseName = cls.CourseName; var ui = _UserSrv.GetUserInfo(updateTrial.OpenId); ui.Phone = updateTrial.UserPhone; ui.SalesOpenId = updateTrial.SalesOpenId; if (origTrial.TrialLogStatus == (int)TrialLogStatus.UserApply) { needWX = true; origTrial.TrialLogStatus = (int)TrialLogStatus.TecConfirm; //返佣 } _CourseSrv.SaveChanges(); //微信发送 if (needWX) { TecTrialRemindTemplate wxMessage = new TecTrialRemindTemplate(); RTrialLog rTrialLog = new RTrialLog(); rTrialLog.InitFromETrialLog(origTrial); rTrialLog.SalesOpenId = updateTrial.SalesOpenId; rTrialLog.SalesName = updateTrial.SalesName; rTrialLog.TrialTimeStr = times[rTrialLog.Lesson].TimeRange; rTrialLog.UserRealName = ui.ChildName; var teacher = _TecSrv.Get(origTrial.TecCode); if (teacher != null) { // teacher.UserOpenId = "oh6cV1QhPLj6XPesheYUQ4XtuGTs"; wxMessage.data = wxMessage.GenerateData(teacher.UserOpenId, rTrialLog); result = WXApi.SendTemplateMessage <TecTrialRemindTemplate>(wxMessage); result.IntMsg = 10; } } } } catch (Exception ex) { result.ErrorMsg = ex.Message; } return(new JsonResult(result)); }