SendText() public static méthode

发送文本信息
public static SendText ( string accessTokenOrAppId, string openId, string content, int timeOut = Config.TIME_OUT, string kfAccount = "" ) : WxJsonResult
accessTokenOrAppId string
openId string
content string
timeOut int 代理请求超时时间(毫秒)
kfAccount string 客服
Résultat WxJsonResult
Exemple #1
0
        /// <summary>
        /// 发送文本信息
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="openId"></param>
        /// <param name="content"></param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <param name="kfAccount">客服</param>
        /// <returns></returns>
        public static WxJsonResult SendText(string accessTokenOrAppId, string openId, string content, int timeOut = Config.TIME_OUT, string kfAccount = "")
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                if (string.IsNullOrEmpty(kfAccount))
                {
                    return CustomApi.SendText(accessTokenOrAppId, openId, content, timeOut);
                }

                var data = new
                {
                    touser = openId,
                    msgtype = "text",
                    text = new
                    {
                        content = content
                    },
                    customservice = new
                    {
                        kf_account = kfAccount
                    }
                };

                return CommonJsonSend.Send(accessToken, URL_FORMAT, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
Exemple #2
0
        /// <summary>
        /// 发送文本客服消息
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="openId"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public override ApiResult SendText(string accessTokenOrAppId, string openId, string content)
        {
            var reuslt = CustomApi.SendText(accessTokenOrAppId, openId, content);

            return(new ApiResult((int)reuslt.errcode, reuslt.errmsg, reuslt));
        }