Skip to content

Commit

Permalink
目录结构设定
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Sep 6, 2021
1 parent 5df92f5 commit 76a87ae
Show file tree
Hide file tree
Showing 26 changed files with 1,180 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# 测试用应用
8 changes: 8 additions & 0 deletions app/apis/manu.http.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "厂商接口",
"version": "1.0.0",
"description": "厂商API",
"group": "manu",
"guard": "bearer-jwt",
"paths": []
}
30 changes: 30 additions & 0 deletions app/apis/user.http.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "用户接口",
"version": "1.0.0",
"description": "用户API",
"group": "user",
"guard": "bearer-jwt",
"paths": [
{
"path": "/login",
"method": "POST",
"guard": "-",
"process": "plugins.user.Login",
"in": ["$payload.mobile", "$payload.password", "$payload.captcha"],
"out": {
"status": 200,
"type": "application/json"
}
},
{
"path": "/info/:id",
"method": "GET",
"process": "models.user.Find",
"in": ["$param.id", ":params"],
"out": {
"status": 200,
"type": "application/json"
}
}
]
}
6 changes: 6 additions & 0 deletions app/flows/latest.count.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function main(args, out, res) {
return {
args: args,
plugin: res.github.name,
};
}
73 changes: 73 additions & 0 deletions app/flows/latest.flow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"label": "最新信息",
"version": "1.0.0",
"description": "最新信息",
"nodes": [
{
"name": "manus",
"process": "models.manu.get",
"args": [
{
"select": ["id", "name", "short_name"],
"limit": 20,
"orders": [{ "column": "created_at", "option": "desc" }],
"wheres": [
{ "column": "status", "value": "enabled" },
{ "column": "name", "value": "{{$in.0}}", "op": "like" }
]
}
],
"script": "rank",
"outs": ["{{$out.manus}}", "{{$out.manu_ids}}"]
},
{
"name": "users",
"process": "models.user.paginate",
"args": [
{
"select": ["id", "name", "extra", "resume"],
"withs": {
"manu": { "query": { "select": ["name", "short_name"] } },
"addresses": {
"query": { "select": ["province", "city", "location"] }
}
},
"orders": [{ "column": "created_at", "option": "desc" }],
"wheres": [
{ "column": "status", "value": "enabled" },
{ "column": "manu_id", "value": "{{$res.manus.1}}", "op": "in" }
]
},
1,
20
],
"outs": ["{{$out.data}}"]
},
{
"name": "github",
"process": "plugins.user.github",
"args": [
"{{$res.users.0}}",
"{{$res.manus}}",
"{{$in.0}}",
"{{$in.1}}",
"{{$in.2}}",
"{{pluck(:$res.users, 'id', 0.618, 10)}}",
"foo",
1
]
},
{
"name": "count",
"script": "count"
}
],
"output": {
"params": "{{$in}}",
"data": {
"manus": "{{$res.manus.0}}",
"users": "{{$res.users.0}}",
"count": "{{$res.count}}"
}
}
}
18 changes: 18 additions & 0 deletions app/flows/latest.rank.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 结果集处理脚本
function main(args, manus, data) {
// 解析厂商ID
var manu_ids = [];
for (var i in manus) {
var id = manus[i].id;
if (id) {
manu_ids.push(id);
}
}

// 处理返回结果
var res = {
manus: manus,
manu_ids: manu_ids,
};
return res;
}
79 changes: 79 additions & 0 deletions app/models/address.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "地址",
"table": {
"name": "address",
"comment": "地址表",
"engine": "InnoDB"
},
"columns": [
{ "name": "id", "type": "ID" },
{
"label": "用户",
"name": "user_id",
"type": "bigInteger",
"comment": "所属用户",
"index": true
},
{
"label": "省份",
"name": "province",
"type": "string",
"length": 200,
"comment": "省份",
"index": true
},
{
"label": "城市",
"name": "city",
"type": "string",
"length": 200,
"comment": "城市",
"index": true
},
{
"label": "地址",
"name": "location",
"type": "string",
"length": 400,
"comment": "详细地址",
"index": true
},
{
"label": "状态",
"name": "status",
"type": "enum",
"default": "enabled",
"option": ["enabled", "disabled"],
"comment": "状态 enabled 开启, disabled 关闭",
"index": true
}
],
"relations": {},
"option": { "timestamps": true, "soft_deletes": true },
"values": [
{
"user_id": 1,
"province": "北京市",
"city": "丰台区",
"location": "银海星月9号楼9单元9层1024室"
},
{
"user_id": 1,
"province": "北京市",
"city": "丰台区",
"location": "北京国家数字出版基地A103"
},
{
"user_id": 2,
"province": "北京市",
"city": "海淀区",
"location": "华严北里7号楼7单元7层2048室"
},
{
"user_id": 3,
"province": "山东省",
"city": "威海市",
"location": "威海市6号楼6单元6层1056室"
}
]
}
62 changes: 62 additions & 0 deletions app/models/friends.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "好友",
"table": {
"name": "friends",
"comment": "好友关系表",
"engine": "InnoDB"
},
"columns": [
{ "name": "id", "type": "ID" },
{
"label": "用户ID",
"name": "user_id",
"type": "bigInteger",
"comment": "所属用户",
"index": true
},
{
"label": "好友用户ID",
"name": "friend_id",
"type": "bigInteger",
"comment": "好友用户ID",
"index": true
},
{
"label": "类型",
"name": "type",
"type": "enum",
"default": "monther",
"option": ["monther", "father", "friend"],
"comment": "类型 monther 母亲, father 父亲, friend 朋友",
"index": true
},
{
"label": "状态",
"name": "status",
"type": "enum",
"default": "enabled",
"option": ["enabled", "disabled"],
"comment": "状态 enabled 开启, disabled 关闭",
"index": true
}
],
"relations": {},
"option": { "timestamps": true, "soft_deletes": true },
"values": [
{
"user_id": 1,
"friend_id": 2,
"type": "monther"
},
{
"user_id": 1,
"friend_id": 3,
"type": "father"
},
{
"user_id": 2,
"friend_id": 3,
"type": "friend"
}
]
}
113 changes: 113 additions & 0 deletions app/models/manu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"name": "厂商",
"table": {
"name": "manu",
"comment": "厂商表",
"engine": "InnoDB"
},
"columns": [
{ "name": "id", "type": "ID" },
{
"label": "名称",
"name": "name",
"type": "string",
"length": 200,
"comment": "全称",
"unique": true
},
{
"label": "简称",
"name": "short_name",
"type": "string",
"length": 200,
"comment": "简称",
"index": true
},
{
"label": "类型",
"name": "type",
"type": "enum",
"option": ["服务商", "采购商", "其他"],
"comment": "厂商类型 服务商, 采购商, 其他",
"default": "服务商",
"index": true
},
{
"label": "LOGO",
"name": "logo",
"type": "string",
"length": 200,
"comment": "LOGO",
"nullable": true
},
{
"label": "简介",
"name": "summary",
"type": "string",
"length": 600,
"comment": "简介",
"nullable": true,
"index": true
},
{
"label": "官网",
"name": "link",
"type": "string",
"length": 200,
"comment": "官网地址",
"nullable": true
},
{
"label": "联系人",
"name": "contact_name",
"type": "string",
"length": 200,
"comment": "联系人",
"nullable": true,
"index": true
},
{
"label": "联系电话",
"name": "contact_mobile",
"type": "string",
"comment": "联系电话",
"nullable": true,
"index": true
},
{
"label": "详情",
"name": "desc",
"type": "text",
"comment": "介绍",
"nullable": true
},
{
"label": "排序",
"name": "rank",
"type": "integer",
"default": 9999999,
"comment": "查询排序"
},
{
"label": "状态",
"name": "status",
"type": "enum",
"default": "enabled",
"option": ["enabled", "disabled"],
"comment": "状态 enabled 开启, disabled 关闭",
"index": true
}
],
"relations": {},
"option": { "timestamps": true, "soft_deletes": true },
"values": [
{ "name": "北京云道天成科技有限公司", "short_name": "云道天成" },
{ "name": "象传高新(北京)数字科技有限公司", "short_name": "象传高新" },
{ "name": "象传智数(北京)软件科技有限公司", "short_name": "象传智数" },
{ "name": "象传智慧(北京)软件科技有限公司", "short_name": "象传智慧" },
{ "name": "象传数据服务引擎", "short_name": "服务引擎" },
{ "name": "象传数据应用开发平台", "short_name": "应用开发平台" },
{ "name": "象传数据解决方案", "short_name": "解决方案" },
{ "name": "象传数据企业服务", "short_name": "企业服务" }
]
}
Loading

0 comments on commit 76a87ae

Please sign in to comment.