Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
和慭琛
take_order
Commits
d6c9aaa6
Commit
d6c9aaa6
authored
Mar 26, 2021
by
李超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加查询接口
parent
00d24079
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
6 deletions
+54
-6
index.js
...niCloud-tcb/cloudfunctions/getRelationDictionary/index.js
+0
-3
index.js
...Cloud-tcb/cloudfunctions/getRelationDictionaryV2/index.js
+45
-0
db_init.json
take-order/uniCloud-tcb/database/db_init.json
+9
-3
No files found.
take-order/uniCloud-tcb/cloudfunctions/getRelationDictionary/index.js
View file @
d6c9aaa6
'use strict'
;
'use strict'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
exports
.
main
=
async
(
event
,
context
)
=>
{
const
field_name
=
event
.
field
const
param
=
{
const
param
=
{
"classify_id"
:
event
.
classify_id
,
"classify_id"
:
event
.
classify_id
,
"system_id"
:
event
.
system_id
,
"system_id"
:
event
.
system_id
,
...
@@ -11,7 +9,6 @@ exports.main = async (event, context) => {
...
@@ -11,7 +9,6 @@ exports.main = async (event, context) => {
let
res
=
await
db
.
collection
(
"standardV2"
).
aggregate
().
match
(
param
).
group
({
let
res
=
await
db
.
collection
(
"standardV2"
).
aggregate
().
match
(
param
).
group
({
_id
:
"$"
+
event
.
field
_id
:
"$"
+
event
.
field
}).
end
();
}).
end
();
res
=
await
db
.
collection
(
'dictionary'
).
field
({
res
=
await
db
.
collection
(
'dictionary'
).
field
({
"_id"
:
true
,
"_id"
:
true
,
"name"
:
true
"name"
:
true
...
...
take-order/uniCloud-tcb/cloudfunctions/getRelationDictionaryV2/index.js
0 → 100644
View file @
d6c9aaa6
'use strict'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
const
db
=
uniCloud
.
database
()
let
res
=
await
db
.
collection
(
"standardV2"
).
field
({
"classify_id"
:
true
,
"system_id"
:
true
,
"brand_id"
:
true
}).
get
();
let
data
=
{}
let
id
=
[]
res
.
data
.
map
(
item
=>
{
id
.
push
(
item
.
classify_id
)
id
.
push
(
item
.
system_id
)
id
.
push
(
item
.
brand_id
)
if
(
data
[
item
.
classify_id
])
{
if
(
data
[
item
.
classify_id
][
item
.
system_id
])
{
if
(
data
[
item
.
classify_id
][
item
.
system_id
].
indexOf
(
item
.
brand_id
)
<
0
)
data
[
item
.
classify_id
][
item
.
system_id
].
push
(
item
.
brand_id
)
}
else
{
data
[
item
.
classify_id
][
item
.
system_id
]
=
[
item
.
brand_id
]
}
}
else
{
let
obj
=
{}
obj
[
item
.
system_id
]
=
[
item
.
brand_id
]
data
[
item
.
classify_id
]
=
obj
}
})
let
dic
=
await
db
.
collection
(
"dictionary"
).
where
({
_id
:
db
.
command
.
in
(
id
)
}).
get
()
let
dic_data
=
{}
dic
.
data
.
map
(
item
=>
{
dic_data
[
item
.
_id
]
=
item
.
name
})
let
result
=
[]
for
(
let
first
in
data
)
{
let
secondArr
=
[]
for
(
let
second
in
data
[
first
])
{
let
thirdArr
=
[]
data
[
first
][
second
].
map
(
third
=>
{
thirdArr
.
push
({
id
:
third
,
name
:
dic_data
[
third
]})
})
secondArr
.
push
({
id
:
second
,
name
:
dic_data
[
second
],
child
:
thirdArr
})
}
result
.
push
({
id
:
first
,
name
:
dic_data
[
first
],
child
:
secondArr
})
}
return
result
;
};
take-order/uniCloud-tcb/database/db_init.json
View file @
d6c9aaa6
...
@@ -77,7 +77,8 @@
...
@@ -77,7 +77,8 @@
"classify_id"
:
"79550af260555cc20afb34146966a2c4"
,
"classify_id"
:
"79550af260555cc20afb34146966a2c4"
,
"system_id"
:
"79550af260555cc20afb34156c94b32c"
,
"system_id"
:
"79550af260555cc20afb34156c94b32c"
,
"brand_id"
:
"79550af260555cc20afb3417731a827c"
,
"brand_id"
:
"79550af260555cc20afb3417731a827c"
,
"describe"
:
"已经报装新能源专用电表,不用签此放弃声明,且不用上传"
,
"main_point"
:
[
"图片清晰"
,
"图片正对"
],
"note"
:
"已经报装新能源专用电表,不用签此放弃声明,且不用上传"
,
"image_count"
:
"1"
,
"image_count"
:
"1"
,
"images"
:
"https://cloud-bak.banshouhui.com/FkxetdqtVgCN_Xz53w6KqQsEC3K-"
,
"images"
:
"https://cloud-bak.banshouhui.com/FkxetdqtVgCN_Xz53w6KqQsEC3K-"
,
"name"
:
"不需要报装声明(不需要报装必填)"
,
"name"
:
"不需要报装声明(不需要报装必填)"
,
...
@@ -88,7 +89,8 @@
...
@@ -88,7 +89,8 @@
"classify_id"
:
"79550af260555cc20afb34146966a2c4"
,
"classify_id"
:
"79550af260555cc20afb34146966a2c4"
,
"system_id"
:
"79550af260555cc20afb34156c94b32c"
,
"system_id"
:
"79550af260555cc20afb34156c94b32c"
,
"brand_id"
:
"79550af260555cc20afb341875d0f7ba"
,
"brand_id"
:
"79550af260555cc20afb341875d0f7ba"
,
"describe"
:
"已经报装新能源专用电表,不用签此放弃声明,且不用上传"
,
"main_point"
:
[],
"note"
:
"已经报装新能源专用电表,不用签此放弃声明,且不用上传"
,
"image_count"
:
"1"
,
"image_count"
:
"1"
,
"images"
:
"https://cloud-bak.banshouhui.com/FkxetdqtVgCN_Xz53w6KqQsEC3K-"
,
"images"
:
"https://cloud-bak.banshouhui.com/FkxetdqtVgCN_Xz53w6KqQsEC3K-"
,
"name"
:
"不需要报装声明(不需要报装必填)"
,
"name"
:
"不需要报装声明(不需要报装必填)"
,
...
@@ -133,7 +135,11 @@
...
@@ -133,7 +135,11 @@
"bsonType"
:
"string"
,
"bsonType"
:
"string"
,
"description"
:
"名称"
"description"
:
"名称"
},
},
"describe"
:
{
"main_point"
:{
"bsonType"
:
"array"
,
"description"
:
"描述、要求"
},
"note"
:
{
"bsonType"
:
"string"
,
"bsonType"
:
"string"
,
"description"
:
"描述、要求"
"description"
:
"描述、要求"
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment