ControlProxy/backend/yjs/search.yjs
2023-02-16 00:17:58 +08:00

111 lines
4.1 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//@张宏伟
module SearchModule{
//获取DO的数量 该接口可以用于主页的DO数量
//也可用于全领监管->总体情况概览 里面的“仓库数量”“DO数量” “DO分布情况”三项。
//可以增加一个参数用于过滤返回结果?比如模糊匹配上的就加到返回列表里。
//str.contains(arg..)
//输入参数doId如bdware.txte/Repo
//返回结果一个数组里面是doId"contains"这个参数的列表。
export function getAllRepoCount() {
return executeContract("Registry","getAllRepoCount",arg).result;
//return Global.allRepoCount;
}
export function getAllUserCount() {
return executeContract("Registry","getAllUserCount",arg).result;
//return Global.allRepoCount;
}
export function getAllSearchCount() {
return executeContract("Registry","getAllSearchCount",arg).result;
//return Global.allRepoCount;
}
export function getAllUpdateCount() {
return executeContract("Registry","getAllUpdateCount",arg).result;
//return Global.allRepoCount;
}
export function getAllDoCount() {
return executeContract("Registry","getAllDoCount",arg).result;
//return Global.allRepoCount;
}
//不确定
//{"open":51,"close":49}
export function getAllIndexCount() {
return executeContract("Registry","getAllIndexCount",arg).result;
//return Global.allRepoCount;
}
export function getDoCount(arg){
return executeContract("Registry","getDoCount",arg);
//return {
//"data":[{
// "doId":"bdware.txte/Repo1","count":10}
// ,{
// "doId":"bdware.txte/Repo2","count":12}
// ]};
}
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){
var res=executeContract("Registry","searchByRange",arg);
return res.result;
}
//支持模糊查询、按创建时间查询。
//输入参数:
//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);
var res=executeContract("Registry","searchByMultiTag",arg);
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};
}
}