Ejemplo n.º 1
0
        public static void SendMessage(string app, string toUser, string message)
        {
            var    env = IocManager.Instance.Resolve <IHostingEnvironment>();
            var    appConfiguration = env.GetAppConfiguration();
            string corpId           = appConfiguration["SenparcWeixinSetting:CorpId"];
            string secret           = appConfiguration[string.Format("SenparcWeixinSetting:{0}:Secret", app)];
            string agentId          = appConfiguration[string.Format("SenparcWeixinSetting:{0}:AgentId", app)];
            var    accessToken      = AccessTokenContainer.GetToken(corpId, secret);

            MassApi.SendTextAsync(accessToken, agentId, message, toUser);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 发送文本消息到给定的用户;
 /// </summary>
 /// <param name="userOpenId"></param>
 /// <param name="content"></param>
 public Task <MassResult> SendMessageAsync(string userOpenId, string content)
 {
     // userOpenId = "qy01c0f1cc0310c7002848a37e2e";
     return(MassApi.SendTextAsync(AccessToken, Config.AppId, content, CorrectUserOpenId(userOpenId)));
     //return MassApi.SendTextAsync(AccessToken, userOpenId, null, null, Config.AgentId,  content);
 }