public void WeChatApiCustomerServiceMessageSendTest() { //Config = new Api.Config("gh_69438e79ea75", "wx95dfa97f9fca2358", "4e053f53f278347179416898e3d7883a"); Assert.AreEqual(JsonCreate.Text("OPENID", "Hello World"), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"Hello World\"}}"); Assert.AreEqual(JsonCreate.Media("OPENID", "image", "MEDIA_ID"), "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}"); Assert.AreEqual(JsonCreate.Media("OPENID", "voice", "MEDIA_ID"), "{\"touser\":\"OPENID\",\"msgtype\":\"voice\",\"voice\":{\"media_id\":\"MEDIA_ID\"}}"); Assert.AreEqual(JsonCreate.Video("OPENID", "MEDIA_ID", "MEDIA_ID", "TITLE", "DESCRIPTION"), "{\"touser\":\"OPENID\",\"msgtype\":\"video\",\"video\":{\"media_id\":\"MEDIA_ID\",\"thumb_media_id\":\"MEDIA_ID\",\"title\":\"TITLE\",\"description\":\"DESCRIPTION\"}}"); Assert.AreEqual(JsonCreate.Music("OPENID", "THUMB_MEDIA_ID", "MUSIC_URL", "HQ_MUSIC_URL", "MUSIC_TITLE", "MUSIC_DESCRIPTION"), "{\"touser\":\"OPENID\",\"msgtype\":\"music\",\"music\":{\"title\":\"MUSIC_TITLE\",\"description\":\"MUSIC_DESCRIPTION\",\"musicurl\":\"MUSIC_URL\",\"hqmusicurl\":\"HQ_MUSIC_URL\",\"thumb_media_id\":\"THUMB_MEDIA_ID\"}}"); Assert.AreEqual(JsonCreate.News("OPENID", new List <Article>() { new Article("HappyDay", "IsReallyAHappyDay", "PIC_URL", "URL"), new Article("HappyDay", "IsReallyAHappyDay", "PIC_URL", "URL") }), "{\"touser\":\"OPENID\",\"msgtype\":\"news\",\"news\":{\"articles\":[{\"title\":\"HappyDay\",\"description\":\"IsReallyAHappyDay\",\"url\":\"URL\",\"picurl\":\"PIC_URL\"},{\"title\":\"HappyDay\",\"description\":\"IsReallyAHappyDay\",\"url\":\"URL\",\"picurl\":\"PIC_URL\"}]}}"); Assert.AreEqual(JsonCreate.Media("OPENID", "mpnews", "MEDIA_ID"), "{\"touser\":\"OPENID\",\"msgtype\":\"mpnews\",\"mpnews\":{\"media_id\":\"MEDIA_ID\"}}"); Assert.AreEqual(JsonCreate.Card("OPENID", "123dsdajkasd231jhksad"), "{\"touser\":\"OPENID\",\"msgtype\":\"wxcard\",\"wxcard\":{\"card_id\":\"123dsdajkasd231jhksad\"}}"); Assert.AreEqual(JsonCreate.Text("OPENID", "HelloWorld", "test1@kftest"), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"HelloWorld\"},\"customservice\":{\"kf_account\":\"test1@kftest\"}}"); //var token = Api.GetAccessToken(Config); //Api.CustomerService.MessageSend.Text(token, "oOk2XjhrbcHP3tGgzDGAVHppo3Bs", "ApiTest"); //Api.CustomerService.MessageSend.News(token, "oOk2XjhrbcHP3tGgzDGAVHppo3Bs",new List<Api.CustomerService.MessageSend.Article>() { // new Api.CustomerService.MessageSend.Article("HappyDay","IsReallyAHappyDay","","http://www.qq.com"), // new Api.CustomerService.MessageSend.Article("HappyDay","IsReallyAHappyDay","","") //}); }
public static JsonResult Card(string access_token, string openid, string card_id, string kf_account = null) => Send(access_token, JsonCreate.Card(openid, card_id, kf_account));