/// <summary> /// 发送图文消息(客服) /// </summary> /// <param name="msg"></param> /// <param name="access_token">访问令牌</param> /// <returns></returns> public static RequestResultBaseModel SendmpNewsByKF(kfmpNewsMsg msg, string access_token) { if (null == msg || string.IsNullOrWhiteSpace(msg.touser)) { throw new ArgumentException("参数错误", nameof(msg.touser)); } if (null == msg.mpnews || string.IsNullOrWhiteSpace(msg.mpnews.media_id)) { throw new ArgumentException("图文消息条数限制在8条以内"); } if (null == msg.customservice || string.IsNullOrWhiteSpace(msg.customservice.kf_account)) { throw new ArgumentException("customservice参数不能为空"); } string jsonString = JsonHelper.Serialize(msg); return(SendToWeCart(jsonString, access_token)); }
public static string SendmpNewsByKF(kfmpNewsMsg msg) { if (null == msg || string.IsNullOrWhiteSpace(msg.touser)) { return(string.Empty); } if (null == msg.mpnews || string.IsNullOrWhiteSpace(msg.mpnews.media_id)) { throw new ArgumentException("图文消息条数限制在8条以内"); } 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); }