This repository has been archived by the owner on Jul 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of github.com:swordCodePractice/InternetQuestionBank
- Loading branch information
Showing
12 changed files
with
166 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
'use strict'; | ||
const db = uniCloud.database(); | ||
const userCollection = db.collection("uni-id-users"); | ||
const questionCollection = db.collection("question"); | ||
const explanationCollection = db.collection("questionExplanation"); | ||
const areaCollection = db.collection("questionArea"); | ||
const hotCollection = db.collection("opendb-search-hot"); | ||
const certificationApplyOrderCollection = db.collection("certificationApplyOrder"); | ||
const $ = db.command.aggregate | ||
exports.main = async (event, context) => { | ||
// 用户表数量 | ||
const { | ||
total: userTotal | ||
} = await userCollection.count(); | ||
// 问题数量 | ||
const questionInfo = await questionCollection.aggregate().match({ | ||
state: "pass" | ||
}).group({ | ||
_id: "$areaID", | ||
num: $.sum(1) | ||
}).end() | ||
// 解答数量 | ||
const { | ||
total: explanationTotal | ||
} = await explanationCollection.count(); | ||
// 专区信息 | ||
const { | ||
data: areaInfo | ||
} = await areaCollection.get(); | ||
// 今日热搜词 | ||
const { | ||
data: hotInfo | ||
} = await hotCollection.field({ | ||
content: true | ||
}).get(); | ||
// 出题官认证申请(只展示未处理) | ||
const { | ||
data: certificationInfo | ||
} = await certificationApplyOrderCollection.where({ | ||
state: "pending" | ||
}).skip(0).limit(10).orderBy("createTime", "desc").get(); | ||
// 构成统计数据 | ||
const mainStr = `今日用户数量: ${userTotal}个 | ||
题目数据概览: ${questionInfo.data.map(q => { | ||
return (areaInfo.find(a => a._id === q._id)).name + `(${q.num}道)` | ||
})} | ||
题解数量: ${explanationTotal}个 | ||
今日热搜词: ${hotInfo.map(h => h.content).join(",")} | ||
最近的认证申请(未处理): \n${certificationInfo.map(c => `-- 联系方式: ${c.content.contactDetails}, 擅长: ${c.content.filed}`).join("\n")} | ||
` | ||
// 发送钉钉通知 | ||
await uniCloud.callFunction({ | ||
name: "dingtalk-robot", | ||
data: { content: `${mainStr}` } | ||
}) | ||
//返回数据给客户端 | ||
return event | ||
}; |
4 changes: 4 additions & 0 deletions
4
uniCloud-aliyun/cloudfunctions/timing-satistics/timing-satistics.param.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。 | ||
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters