/// <summary>
 /// 发送企业文字消息
 /// </summary>
 /// <param name="listMessage"></param>
 /// <param name="userid"></param>
 private void SendQyMsg(List <string> listMessage, string userid)
 {
     foreach (var msg in listMessage)
     {
         var messageId = DateTime.Now.Ticks;
         LogHelper.Info($"[{messageId}]发送:{userid}|{msg}");
         var res = wApiHandler.Message_Send(new MessageSend()
         {
             touser  = userid,
             content = msg,
             msgtype = "text"
         });
         LogHelper.Info($"[{messageId}]结果:{res.errcode} -> {res.errmsg}");
     }
 }
Example #2
0
        /// <summary>
        /// 发送微信企业号文字消息
        /// </summary>
        /// <param name="toUsers"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public string SendText(string toUsers, string text)
        {
            var messageId = DateTime.Now.Ticks;

            LogHelper.Info($"[{messageId}]发送:{toUsers}|{text}");
            var res = wApiHandler.Message_Send(new XFramework.WeChatAPI.Entity.MessageSend()
            {
                msgtype = "text",
                touser  = toUsers,
                content = text
            });

            LogHelper.Info($"[{messageId}]结果:{res.errcode} -> {res.errmsg}");


            return(JsonConvert.SerializeObject(res));
        }