更新主页的内容
This commit is contained in:
parent
3f5ef6623e
commit
6cf24562ad
|
@ -47,6 +47,8 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" />
|
||||||
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
|
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
|
||||||
|
<PackageReference Include="RestClient" Version="3.1024.23771" />
|
||||||
|
<PackageReference Include="RestSharp" Version="111.4.0" />
|
||||||
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,11 @@ using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using RustTools.DataList;
|
using RustTools.DataList;
|
||||||
|
using RustTools.muqing;
|
||||||
using RustTools.Services;
|
using RustTools.Services;
|
||||||
using RustTools.ViewModels;
|
using RustTools.ViewModels;
|
||||||
using Windows.UI.WindowManagement;
|
using Windows.UI.WindowManagement;
|
||||||
|
using System.Threading;
|
||||||
namespace RustTools.Views;
|
namespace RustTools.Views;
|
||||||
public sealed partial class HomePage : Page
|
public sealed partial class HomePage : Page
|
||||||
{
|
{
|
||||||
|
@ -32,18 +34,21 @@ public sealed partial class HomePage : Page
|
||||||
Pictures.Add(item.picture);
|
Pictures.Add(item.picture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StartAsync();
|
StartAsync();
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
private void StartAsync()
|
|
||||||
|
private async Task StartAsync()
|
||||||
{
|
{
|
||||||
var modListResponse = JsonConvert.DeserializeObject<ModListResponse>(ViewModel.str);
|
var v = wl.post("/php/mod.php?action=random", new string[][]{
|
||||||
if (modListResponse == null)
|
new string[] { "number", "6" }});
|
||||||
|
|
||||||
|
var modListResponse = JsonConvert.DeserializeObject<ModListResponse>(v);
|
||||||
|
if (modListResponse != null)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
conns.Clear();
|
conns.Clear();
|
||||||
newlist.Clear();
|
|
||||||
foreach (var item in modListResponse.Data)
|
foreach (var item in modListResponse.Data)
|
||||||
{
|
{
|
||||||
//https://rust.coldmint.top
|
//https://rust.coldmint.top
|
||||||
|
@ -56,9 +61,30 @@ public sealed partial class HomePage : Page
|
||||||
ImageUrl = item.Icon.Replace("..", "https://rust.coldmint.top")
|
ImageUrl = item.Icon.Replace("..", "https://rust.coldmint.top")
|
||||||
};
|
};
|
||||||
conns.Add(contact);
|
conns.Add(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var vv = wl.post("/php/mod.php?action=list", new string[][]{
|
||||||
|
new string[] { "sortMode", "latestTime" },
|
||||||
|
new string[] { "limit", "6" },
|
||||||
|
new string[] { "tag", "" }});
|
||||||
|
modListResponse = JsonConvert.DeserializeObject<ModListResponse>(vv);
|
||||||
|
if (modListResponse != null)
|
||||||
|
{
|
||||||
|
newlist.Clear();
|
||||||
|
foreach (var item in modListResponse.Data)
|
||||||
|
{
|
||||||
|
//https://rust.coldmint.top
|
||||||
|
if (item.Icon.Equals(""))
|
||||||
|
{
|
||||||
|
item.Icon = "/Assets/image/image.svg";
|
||||||
|
}
|
||||||
|
var contact = new Contact(item.Name, item.Description, item.UpdateTime + " " + item.CoinNumber + "´ÎÏÂÔØ")
|
||||||
|
{
|
||||||
|
ImageUrl = item.Icon.Replace("..", "https://rust.coldmint.top")
|
||||||
|
};
|
||||||
newlist.Add(contact);
|
newlist.Add(contact);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Contact
|
public class Contact
|
||||||
|
|
17
RustTools/muqing/gj.cs
Normal file
17
RustTools/muqing/gj.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace RustTools.muqing;
|
||||||
|
|
||||||
|
class gj
|
||||||
|
{
|
||||||
|
public static void sc(object obj)
|
||||||
|
{
|
||||||
|
obj ??= "null";
|
||||||
|
Debug.WriteLine(obj);
|
||||||
|
}
|
||||||
|
}
|
28
RustTools/muqing/wl.cs
Normal file
28
RustTools/muqing/wl.cs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using RestSharp;
|
||||||
|
namespace RustTools.muqing;
|
||||||
|
|
||||||
|
class wl
|
||||||
|
{
|
||||||
|
public static string api = "https://rust.coldmint.top";
|
||||||
|
public static string post(string url, string[][] p)
|
||||||
|
{
|
||||||
|
var client = new RestClient(api);
|
||||||
|
var request = new RestRequest(url, Method.Post);
|
||||||
|
for (var i = 0; i < p.Length; i++)
|
||||||
|
{
|
||||||
|
request.AddParameter(p[i][0], p[i][1]);
|
||||||
|
}
|
||||||
|
var response = client.Execute(request);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
#pragma warning disable CS8603 // 可能返回 null 引用。
|
||||||
|
return response.Content;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user