diff --git a/RevokeMsgPatcher/FormMain.cs b/RevokeMsgPatcher/FormMain.cs index f7b27a6..183c1cf 100644 --- a/RevokeMsgPatcher/FormMain.cs +++ b/RevokeMsgPatcher/FormMain.cs @@ -259,7 +259,7 @@ namespace RevokeMsgPatcher private void radioButtons_CheckedChanged(object sender, EventArgs e) { - ga.RequestPageView(GetCheckedRadioButtonNameEn() + "_switch"); + ga.RequestPageView(GetCheckedRadioButtonNameEn() + "/switch", "切换标签页"); EnableAllButton(false); RadioButton radioButton = sender as RadioButton; // 切换使用不同的防撤回对象 diff --git a/RevokeMsgPatcher/Utils/GAHelper.cs b/RevokeMsgPatcher/Utils/GAHelper.cs index 426de76..2a4fefb 100644 --- a/RevokeMsgPatcher/Utils/GAHelper.cs +++ b/RevokeMsgPatcher/Utils/GAHelper.cs @@ -39,24 +39,32 @@ namespace RevokeMsgPatcher.Utils public async Task RequestPageViewAsync(string page, string title = null) { - if (!page.StartsWith("/")) + try { - page = "/" + page; + if (!page.StartsWith("/")) + { + page = "/" + page; + } + // 请求参数 + var values = new Dictionary + { + { "v", "1" }, // 当前必填1 + { "tid", tid }, + { "cid", cid }, + { "ua", UserAgent }, + { "t", "pageview" }, + { "sr", sr }, + { "dp", page }, + { "dt", title }, + }; + var content = new FormUrlEncodedContent(values); + var response = await client.PostAsync(GAUrl, content); } - // 请求参数 - var values = new Dictionary + catch (Exception ex) { - { "v", "1" }, // 当前必填1 - { "tid", tid }, - { "cid", cid }, - { "ua", UserAgent }, - { "t", "pageview" }, - { "sr", sr }, - { "dp", page }, - { "dt", title }, - }; - var content = new FormUrlEncodedContent(values); - var response = await client.PostAsync(GAUrl, content); + + Console.WriteLine("GAHelper:" + ex.Message); + } } public void RequestPageView(string page, string title = null)