Beispiel #1
0
 public JsonResult SendServiceNotice(Guid sid, string oid)
 {
     WxServiceNotice notice = new WxServiceNotice();
     notice.touser = oid;
     notice.template_id = "Ikb2gb1JH5p9ZTTycb8i0RghIMlRqiyb48Be7EwZCK0";
     notice.url = "http://www.baidu.com";
     notice.topcolor = "#ff6666";
     notice.data = "{\"first\":{\"value\":\"尊敬的陈杰,您收到一条新的ITSM事件,请及时在ITDC公众账号中处理。\\n\\n\",\"color\":\"#ff6666\"},"
                   + "\"keynote1\":{\"value\":\"201410290099\",\"color\":\"#ff6666\"},"
                   + "\"keynote2\":{\"value\":\"2014-10-29\",\"color\":\"#666666\"},"
                   + "\"remark\":{\"value\":\"事件描述:我的打印机坏掉了,麻烦帮我处理下哦。\\n员工姓名:陈杰\\n所在部门:商品部\\n事发地点:雅莹商业园\",\"color\":\"#333333\"}}";
     if (ElegantWM.WeiXin.Common.SendServiceNotice(sid.ToString(), notice))
         return Json(ResultMsg.Success("服务通知发送成功!"));
     else
         return Json(ResultMsg.Failure("服务通知发送失败!"));
 }
        /// <summary>
        /// 获奖之后,微信通知用户
        /// </summary>
        private void SendWxSvrNotice(string oid, string sum)
        {
            try
            {

                //获取申请人的openId
                Guid sid = Guid.Parse("74111E62-F8D7-4D63-805E-36E14A930F04");
                WxServiceNotice notice = new WxServiceNotice();
                notice.touser = oid;
                notice.template_id = "2j8tjIyRstLSBdZC86rquwsc6HhHrmFd1roz3pI72f4";
                notice.url = "http://it.hwafashion.com/game/JOREALLanternFestival/Index?sid=FEF432AF-D0AE-4876-8200-931F47BEF854";
                notice.topcolor = "#ff6666";
                notice.data = "{\"first\":{\"value\":\"尊敬的" + "用户" + ",恭喜获取卓莱雅礼券。\\n\\n\",\"color\":\"#66cc33\"},"
                              + "\"keyword1\":{\"value\":\"春装代金券" + "\",\"color\":\"#66cc33\"},"
                              + "\"keyword2\":{\"value\":\"" + sum + "\",\"color\":\"#666666\"},"
                              + "\"keyword3\":{\"value\":\"" + DateTime.Now.ToString() + "\",\"color\":\"#666666\"},"
                              + "\"remark\":{\"value\":\"描述:" + "凭此券到雅莹奥莱自营线下门店购买春装即可抵用" + "\",\"color\":\"#333333\"}}";
                ElegantWM.WeiXin.Common.SendServiceNotice("74111E62-F8D7-4D63-805E-36E14A930F04", notice);
            }
            catch (Exception error)
            {
                //log.Error(error.Message);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 发送服务通知
 /// </summary>
 /// <param name="sid"></param>
 /// <param name="menuJson"></param>
 /// <returns></returns>
 public static bool SendServiceNotice(string sid, WxServiceNotice notice)
 {
     string url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + GetTokenId(sid);
     string json = "{\"touser\":\"" + notice.touser + "\","
                  + "\"template_id\":\"" + notice.template_id + "\","
                  + "\"url\":\"" + notice.url + "\","
                  + "\"topcolor\":\"" + notice.topcolor + "\","
                  + "\"data\":" + notice.data + "}";
     string rst = HttpCrossDomain.Post(url, json);
     if (rst.Contains("\"errcode\":0"))
         return true;
     else
         throw new Exception("发送通知服务失败:" + rst + ",JSON=" + json);
 }
Beispiel #4
0
        /// <summary>
        /// 派工完成,微信通知用户
        /// </summary>
        private void SendWxSvrNotice(ITSM_Event evt)
        {
            //获取工程师的openId
            Guid sid = Guid.Parse("5E43EF3D-451F-49FC-86DA-8EDC32D08398");
            string egr = evt.Engineer;
            IEnumerable<WX_LK_FansC3AM> fans = WMFactory.WXLKFansC3AM.FindByConditions(null, f => f.AccountId == sid && f.UserName == egr);
            if (fans.Count() != 1)
            {
                log.Error("找不到工程师的OPENID:" + egr);
                return;
            }
            WxServiceNotice notice = new WxServiceNotice();
            notice.touser = fans.First().OpenId;
            notice.template_id = "Ikb2gb1JH5p9ZTTycb8i0RghIMlRqiyb48Be7EwZCK0";
            notice.url = "http://it.hwafashion.com/IT/SM/EventReport?sid=5E43EF3D-451F-49FC-86DA-8EDC32D08398";
            notice.topcolor = "#ff6666";
            notice.data = "{\"first\":{\"value\":\"尊敬的" + egr + ",事件经理分配了新的ITSM事件,请及时在ITDC公众账号中处理。\\n\\n\",\"color\":\"#ff6666\"},"
                          + "\"keynote1\":{\"value\":\"" + evt.Code + "\",\"color\":\"#ff6666\"},"
                          + "\"keynote2\":{\"value\":\"" + evt.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") + "\",\"color\":\"#ff6666\"},"
                          + "\"remark\":{\"value\":\"事件描述:" + evt.EventDesc.Replace("'", "").Replace("\"", "").Replace("\r", "").Replace("\n", "")
                                                + "\\n员工姓名:" + evt.ReqMan
                                                + "\\n所在部门:" + evt.ReqCom + "," + evt.ReqDept
                                                + "\\n办公地点:" + evt.ReqIncident + "\",\"color\":\"#333333\"}}";
            ElegantWM.WeiXin.Common.SendServiceNotice("5E43EF3D-451F-49FC-86DA-8EDC32D08398", notice);

        }
Beispiel #5
0
 private bool SendWxSvrNoticeWhenOver(ITSM_Event evt)
 {
     try
     {
         //获取申请人的openId
         Guid sid = Guid.Parse("5E43EF3D-451F-49FC-86DA-8EDC32D08398");
         string reqMan = evt.ReqMan;
         IEnumerable<WX_LK_FansC3AM> fans = WMFactory.WXLKFansC3AM.FindByConditions(null, f => f.AccountId == sid && f.UserName == reqMan);
         if (fans.Count() != 1)
         {
             log.Error("找不到事件提出人的OPENID:" + evt.ReqMan);
             return false;
         }
         WxServiceNotice notice = new WxServiceNotice();
         notice.touser = fans.First().OpenId;
         notice.template_id = "Ikb2gb1JH5p9ZTTycb8i0RghIMlRqiyb48Be7EwZCK0";
         notice.url = "http://it.hwafashion.com/IT/SM/Survey/" + evt.Id.ToString() + "?sid=5E43EF3D-451F-49FC-86DA-8EDC32D08398&oid=" + notice.touser;
         notice.topcolor = "#ff6666";
         notice.data = "{\"first\":{\"value\":\"尊敬的" + reqMan + ",您提交的事件申请,工程师“" + evt.Engineer + "”已经为您处理完成,请对我们的服务进行评价,谢谢您的支持!\\n\\n\",\"color\":\"#ff6666\"},"
                       + "\"keynote1\":{\"value\":\"" + evt.Code + "\",\"color\":\"#ff6666\"},"
                       + "\"keynote2\":{\"value\":\"" + evt.CreateTime.ToString("yyyy-MM-dd HH:mm:ss") + "\",\"color\":\"#666666\"},"
                       + "\"remark\":{\"value\":\"事件描述:" + evt.EventDesc.Replace("'", "").Replace("\"", "").Replace("\r", "").Replace("\n", "")
                                             + "\\n所在部门:" + evt.ReqCom + "," + evt.ReqDept
                                             + "\\n办公地点:" + evt.ReqIncident
                                             + "\\n\\n解决方案:" + evt.EventSolution.Replace("'", "").Replace("\"", "").Replace("\r", "").Replace("\n", "")
                                             + "\",\"color\":\"#333333\"}}";
         return ElegantWM.WeiXin.Common.SendServiceNotice("5E43EF3D-451F-49FC-86DA-8EDC32D08398", notice);
     }
     catch (Exception error)
     {
         log.Error(error.Message);
         return false;
     }
 }