忽略
This commit is contained in:
@@ -1,47 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.MsgCenter.Util
|
||||
{
|
||||
public class UrlHelper
|
||||
{
|
||||
public static UrlMethodModel ParseUrl(string data)
|
||||
{
|
||||
var index = data.IndexOf('/');
|
||||
if (index != -1)
|
||||
{
|
||||
data = data.Substring(index + 1);
|
||||
}
|
||||
UrlMethodModel model = new UrlMethodModel();
|
||||
var token = data.Split('?');
|
||||
if (token.Length > 0)
|
||||
{
|
||||
model.Method = token[0];
|
||||
}
|
||||
if (token.Length > 1)
|
||||
{
|
||||
var kvs = token[1].Split('&');
|
||||
foreach (var item in kvs)
|
||||
{
|
||||
var kv = item.Split('=');
|
||||
if (kv.Length > 1)
|
||||
{
|
||||
var key = kv[0].ToLower();
|
||||
var value = kv[1];
|
||||
model.Args[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
public class UrlMethodModel
|
||||
{
|
||||
public string Method { get; set; } = "";
|
||||
|
||||
public Dictionary<string, string> Args { get; set; } = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.MsgCenter.Util
|
||||
{
|
||||
public class UrlHelper
|
||||
{
|
||||
public static UrlMethodModel ParseUrl(string data)
|
||||
{
|
||||
var index = data.IndexOf('/');
|
||||
if (index != -1)
|
||||
{
|
||||
data = data.Substring(index + 1);
|
||||
}
|
||||
UrlMethodModel model = new UrlMethodModel();
|
||||
var token = data.Split('?');
|
||||
if (token.Length > 0)
|
||||
{
|
||||
model.Method = token[0];
|
||||
}
|
||||
if (token.Length > 1)
|
||||
{
|
||||
var kvs = token[1].Split('&');
|
||||
foreach (var item in kvs)
|
||||
{
|
||||
var kv = item.Split('=');
|
||||
if (kv.Length > 1)
|
||||
{
|
||||
var key = kv[0].ToLower();
|
||||
var value = kv[1];
|
||||
model.Args[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
public class UrlMethodModel
|
||||
{
|
||||
public string Method { get; set; } = "";
|
||||
|
||||
public Dictionary<string, string> Args { get; set; } = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user