Beispiel #1
0
        /// <summary>
        /// 发送视频消息(客服)
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="access_token">访问令牌</param>
        /// <returns></returns>
        public static RequestResultBaseModel SendVideoByKF(kfVideoMsg msg, string access_token)
        {
            if (null == msg || string.IsNullOrWhiteSpace(msg.touser))
            {
                throw new ArgumentException("参数错误", nameof(msg.touser));
            }
            if (null == msg.video || string.IsNullOrWhiteSpace(msg.video.media_id) || string.IsNullOrWhiteSpace(msg.video.title))
            {
                throw new ArgumentException("video错误");
            }
            if (null == msg.customservice || string.IsNullOrWhiteSpace(msg.customservice.kf_account))
            {
                throw new ArgumentException("customservice参数不能为空");
            }

            string jsonString = JsonHelper.Serialize(msg);

            return(SendToWeCart(jsonString, access_token));
        }
Beispiel #2
0
        public static string SendVideoByKF(kfVideoMsg msg)
        {
            if (null == msg || string.IsNullOrWhiteSpace(msg.touser))
            {
                return(string.Empty);
            }
            if (null == msg.video || string.IsNullOrWhiteSpace(msg.video.media_id) || string.IsNullOrWhiteSpace(msg.video.title))
            {
                throw new ArgumentException("video错误");
            }
            if (null == msg.customservice || string.IsNullOrWhiteSpace(msg.customservice.kf_account))
            {
                throw new ArgumentException("customservice参数不能为空");
            }

            string jsonString = JsonHelper.Serialize(msg);

            if (!string.IsNullOrWhiteSpace(jsonString))
            {
                return(jsonString);
            }
            return(string.Empty);
        }