private async Task <bool> HasMessage() { try { if (!ApiHelper.IsLogin()) { return(false); } // http://message.bilibili.com/api/msg/query.room.list.do?access_key=a36a84cc8ef4ea2f92c416951c859a25&actionKey=appkey&appkey=c1b107428d337928&build=414000&page_size=100&platform=android&ts=1461404884000&sign=5e212e424761aa497a75b0fb7fbde775 string url = string.Format("http://message.bilibili.com/api/notify/query.notify.count.do?_device=wp&_ulv=10000&access_key={0}&actionKey=appkey&appkey={1}&build=5250000&platform=android&ts={2}", ApiHelper.access_key, ApiHelper.AndroidKey.Appkey, ApiHelper.GetTimeSpan); url += "&sign=" + ApiHelper.GetSign(url); string results = await WebClientClass.GetResults(new Uri(url)); MessageModel model = JsonConvert.DeserializeObject <MessageModel>(results); if (model.code == 0) { MessageModel list = JsonConvert.DeserializeObject <MessageModel>(model.data.ToString()); message = list; if (list.reply_me != 0 || list.chat_me != 0 || list.notify_me != 0 || list.praise_me != 0 || list.at_me != 0) { return(true); } else { return(false); } } else { return(false); } } catch (Exception) { return(false); //Utils.ShowMessageToast("读取通知失败", 3000); } }
public static async Task SetRegions() { try { string url = string.Format("https://app.bilibili.com/x/v2/region/index?appkey={0}&build={2}&mobi_app=android&platform=android&ts={1}", ApiHelper.AndroidKey.Appkey, GetTimeSpan, ApiHelper.build); url += "&sign=" + ApiHelper.GetSign(url); string results = await WebClientClass.GetResults(new Uri(url)); RegionModel model = JsonConvert.DeserializeObject <RegionModel>(results); if (model.code == 0) { model.data.RemoveAll(x => (x.name == "会员购" || x.name == "游戏中心") || x.logo == "" || x.name == "漫画" || x.name.Contains("赛事") || x.name.Contains("课堂")); regions = model.data; // model.data.ForEach(x => x.emojis.ForEach(y => emojis.Add(y))); } } catch (Exception) { } }