Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -17,6 +17,21 @@ public class DObject : Dictionary<string, object>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加字典
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="codePath">以.号分隔的多级路径</param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public void AddRange(Dictionary<string, object>? dicts)
|
||||||
|
{
|
||||||
|
if (dicts == null) return;
|
||||||
|
foreach (var item in dicts)
|
||||||
|
{
|
||||||
|
this[item.Key] = item.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 将平面结构转换为树形嵌套结构
|
/// 将平面结构转换为树形嵌套结构
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ origin=password&code=&account=admin&login_type=&jnpf_ticket=&socialsOptions.IsCu
|
|||||||
@vmid=30060151588373
|
@vmid=30060151588373
|
||||||
|
|
||||||
### 获取一条数据
|
### 获取一条数据
|
||||||
GET {{host}}/api/tnb/vengine/{{vmid}}/get?whcode=007
|
GET {{host}}/api/tnb/vengine/{{vmid}}/get?whcode=007&q={"whcode":">>002"}
|
||||||
Authorization: {{token}}
|
Authorization: {{token}}
|
||||||
|
|
||||||
### 获取多条数据
|
### 获取多条数据
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Tnb.Core;
|
using Tnb.Core;
|
||||||
|
|
||||||
namespace Tnb.Vengine.Domain;
|
namespace Tnb.Vengine.Domain;
|
||||||
@@ -44,16 +45,22 @@ public class VmGetInput : VmBaseInput
|
|||||||
public void LoadFromHttpContext(HttpContext? context)
|
public void LoadFromHttpContext(HttpContext? context)
|
||||||
{
|
{
|
||||||
if (context == null) return;
|
if (context == null) return;
|
||||||
|
var qStr = context.Request.Query["q"].ToString();
|
||||||
|
if (!string.IsNullOrEmpty(qStr))
|
||||||
|
{
|
||||||
|
var arg = JsonConvert.DeserializeObject<DObject>(qStr);
|
||||||
|
q.AddRange(arg);
|
||||||
|
}
|
||||||
string[] filter = new string[] { "id", "q", "o" };
|
string[] filter = new string[] { "id", "q", "o" };
|
||||||
foreach (var item in context.Request.Query.Where(a => !filter.Contains(a.Key)))
|
foreach (var item in context.Request.Query.Where(a => !filter.Contains(a.Key)))
|
||||||
{
|
{
|
||||||
if (item.Value.Count > 1)
|
if (item.Value.Count > 1)
|
||||||
{
|
{
|
||||||
q.Add(item.Key, item.Value.ToArray());
|
q[item.Key] = item.Value.ToArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q.Add(item.Key, item.Value.ToString());
|
q[item.Key] = item.Value.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,16 +108,22 @@ public class VmQueryInput : VmBaseInput
|
|||||||
public void LoadFromHttpContext(HttpContext? context)
|
public void LoadFromHttpContext(HttpContext? context)
|
||||||
{
|
{
|
||||||
if (context == null) return;
|
if (context == null) return;
|
||||||
|
var qStr = context.Request.Query["q"].ToString();
|
||||||
|
if (!string.IsNullOrEmpty(qStr))
|
||||||
|
{
|
||||||
|
var arg = JsonConvert.DeserializeObject<DObject>(qStr);
|
||||||
|
q.AddRange(arg);
|
||||||
|
}
|
||||||
string[] filter = new string[] { "pnum", "psize", "sort", "k", "q", "o" };
|
string[] filter = new string[] { "pnum", "psize", "sort", "k", "q", "o" };
|
||||||
foreach (var item in context.Request.Query.Where(a => !filter.Contains(a.Key)))
|
foreach (var item in context.Request.Query.Where(a => !filter.Contains(a.Key)))
|
||||||
{
|
{
|
||||||
if (item.Value.Count > 1)
|
if (item.Value.Count > 1)
|
||||||
{
|
{
|
||||||
q.Add(item.Key, item.Value.ToArray());
|
q[item.Key] = item.Value.ToArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
q.Add(item.Key, item.Value.ToString());
|
q[item.Key] = item.Value.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user