コード例 #1
0
        /// <summary>
        /// 发送通知
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="da">不在同一个事务中,查询不到id</param>
        /// <returns></returns>
        private bool PushMessage(int sid, TASM_SUPPORT_Da da)
        {
            if (Entites.AppConfig.IsPush == false)
            {
                Logger.LogInformation("不发送消息通知,若需要请打开配置文件");
                return(true);
            }
            try
            {
                var model = da.SelectBySid4Push(sid);

                string title = $"您有一份新的任务,问题管理表编号[{model.CODE}],请登录售后管理系统查看详情。";

                StringBuilder content = new StringBuilder();

                content.AppendLine($"项目名称:{model.PROJECTNAME}[{model.PROJECTCODE}]");
                content.AppendLine($"问题机型:{model.MACHINENAME}[{model.MACHINESERIAL}]");

                content.AppendLine($"问题类型:{ Enum.GetName(typeof(SupportProblemType), model.TYPE)}");

                content.AppendLine($"当前处理人:{model.CONDUCTORNAME}");

                content.AppendLine($"流程节点:{Enum.GetName(typeof(SupportendPoint), model.STATUS).Replace('_', '>')}");

                content.AppendLine($"问题描述:{model.CONTENT}");

                PushHelper.PushWeChat(model.ConductorWorkId, title, content.ToString());
                return(true);
            }
            catch (Exception e)
            {
                Logger.LogInformation("" + e);
                return(false);
            }
        }