ControlProxy/backend/yjs/search.yjs

110 lines
4.1 KiB
Plaintext
Raw Normal View History

2022-04-19 01:26:59 +00:00
//@张宏伟
module SearchModule{
//获取DO的数量 该接口可以用于主页的DO数量
//也可用于全领监管->总体情况概览 里面的“仓库数量”“DO数量” “DO分布情况”三项。
//可以增加一个参数用于过滤返回结果?比如模糊匹配上的就加到返回列表里。
//str.contains(arg..)
//输入参数doId如bdware.txte/Repo
//返回结果一个数组里面是doId"contains"这个参数的列表。
export function getAllRepoCount() {
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getAllRepoCount",arg).result;
2022-04-19 01:26:59 +00:00
//return Global.allRepoCount;
}
export function getAllUserCount() {
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getAllUserCount",arg).result;
2022-04-19 01:26:59 +00:00
//return Global.allRepoCount;
}
export function getAllSearchCount() {
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getAllSearchCount",arg).result;
2022-04-19 01:26:59 +00:00
//return Global.allRepoCount;
}
export function getAllUpdateCount() {
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getAllUpdateCount",arg).result;
2022-04-19 01:26:59 +00:00
//return Global.allRepoCount;
}
export function getAllDoCount() {
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getAllDoCount",arg).result;
2022-04-19 01:26:59 +00:00
//return Global.allRepoCount;
}
//不确定
//{"open":51,"close":49}
export function getAllIndexCount() {
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getAllIndexCount",arg).result;
2022-04-19 01:26:59 +00:00
//return Global.allRepoCount;
}
export function getDoCount(arg){
2022-06-30 16:46:10 +00:00
return executeContract("Registry","getDoCount",arg);
2022-04-19 01:26:59 +00:00
//return {
//"data":[{
// "doId":"bdware.txte/Repo1","count":10}
// ,{
// "doId":"bdware.txte/Repo2","count":12}
// ]};
}
2022-06-25 03:11:03 +00:00
2022-04-19 01:26:59 +00:00
export function testCount(arg){
return {"data":"key"};
}
//=====全域监管:数字对象溯源 针对单个DO的通过SQL查询来实现。
//根据 doId --> 找到“数字对象世系”
//86.500.1/Repo.1/Doab
//根据 doId+时间范围+interval+protocol --> 不同operation的统计数据 AuditProxy)
//countDORecordByDate()
//{"doId":xxxx,"startTime","endTime","interval","eventPrefix":["doip_create","doip_update"]}
//{"eventxxx":[1,2,3],"event2":[1,2,3]}
//根据 doId +查找条件(时间范围 protocol operation user?) +offset/count -->总数+指定条数的数组AuditProxy)
// queryDoRecordByDate
//{"doId":xxxx,"startTime","endTime","eventPrefix":["doip_create","doip_update"]}
//{"count":xx, "data":[{doip_request的某一行。},]}
// queryDoRecordByOffset
//{"doId":xxxx,"offset","count","eventPrefix":["doip_create","doip_update"]}
//{"total":xx,"count":xx, "data":[{doip_request的某一行。},]}
//==============
//DO的元数据
//{
// "date": "...",
// "owner": "...",
// "type": "...",
// "description": "...",
// "schema": "...",
//}
//做成可以根据创建时间范围;标识模糊
//{"type":"creatTime","count":10,"offset":"0","from":"1141363811328","to":"1941363811328"}
export function getDoFilter(arg){
2022-06-30 16:46:10 +00:00
var res=executeContract("Registry","searchByRange",arg);
2022-04-19 01:26:59 +00:00
return res.result;
}
2022-06-25 03:11:03 +00:00
2022-04-19 01:26:59 +00:00
//支持模糊查询、按创建时间查询。
//输入参数:
//type要查询的字段
//keyword:要查询的关键字
//count可选项缺省为20
//offset可选项缺省为0
////{"params":[{"type":"owner","keyword":"说明"},{"type":"doid","keyword":"aibd"}],"count":"10","offset":"0"}
//返回:{"data":[{},{},{}],"count":3}
@ArgSchema({"!params":[{"!type":"string","!keyword":"integer"}],"count":"integer","offset":"integer"})
export function search(arg){
arg = convertArgToJson(arg);
2022-06-30 16:46:10 +00:00
var res=executeContract("Registry","searchByMultiTag",arg);
2022-04-19 01:26:59 +00:00
return res.result;
//ret=[];
//ret.push({
// "doId":"bdware.ss/Repo1/Do.a","name":"数字对象a","meta":{},"owner":"zzz","createTime":1641885492715}
// );
//ret.push({
// "doId":"bdware.ss/Repo1/Do.b","name":"数字对象b","meta":{},"owner":"zzz","createTime":1641885322715}
// );
//ret.push({
// "doId":"bdware.ss/Repo1/Do.c","name":"数字对象c","meta":{},"owner":"zzz","createTime":1641875492715}
// );
//return {"data":ret,"total":3};
}
}