Skip to content

Commit

Permalink
Merge pull request #15 from Team2-ModernSE/dev
Browse files Browse the repository at this point in the history
Add Search Page & Bugfix
  • Loading branch information
mizunashi-sh authored Dec 15, 2020
2 parents 6d39ad5 + 240028d commit f7e13af
Show file tree
Hide file tree
Showing 17 changed files with 1,140 additions and 201 deletions.
6 changes: 6 additions & 0 deletions cloudfunctions/getExp/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"permissions": {
"openapi": [
]
}
}
41 changes: 41 additions & 0 deletions cloudfunctions/getExp/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init()
const db = cloud.database()
const _ = db.command
const $ = _.aggregate

// 云函数入口函数
exports.main = async (event, context) => {
const wxContext = cloud.getWXContext()

return db.collection('experiment').aggregate()
.lookup({
from: 'order',
localField: '_id',
foreignField: 'expId',
as: 'orderInfo'
})
.match({
isActive: true,
orderInfo: _.or($.cond([
_.elemMatch({
examineeId: wxContext.OPENID
}),
false,
true
],
),_.size(0))
})
.project({
orderInfo: 0
})
.end({
success: function (res) {
return res
},
fail: function (err) {
return err
}
})
}
Loading

0 comments on commit f7e13af

Please sign in to comment.