Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
增加百度搜索答案 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdenghe authored and zhuweiyou committed Jan 25, 2018
1 parent 5e1644b commit c20d279
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 头脑王者/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

答题时,如果该题在题库中,终端会输出正确答案,手机上正确答案前面会显示一个 ``

如果本题不在题库里,会将本题正确答案记录到题库中
如果本题不在题库里,会自动打开百度搜索答案,并将本题正确答案记录到题库中

## 截图

Expand Down
5 changes: 4 additions & 1 deletion 头脑王者/src/robot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const QueryString = require('query-string')
const exec = require('child_process').exec
const Tnwz = require('./common/tnwz')
const QuizModel = require('./database/quiz-model')

Expand Down Expand Up @@ -30,6 +30,9 @@ module.exports = {
console.log('[题库有答案]', option)
return {response}
}
const search = `https://www.baidu.com/s?wd=${encodeURIComponent(this._findQuiz.quiz)}`
console.log('[百度搜答案]', search)
exec(`open ${search}`)
} else if (requestDetail.url.indexOf('/question/bat/choose') !== -1) {
// 提交完答案,会返回正确答案,如果题库没有,就存起来
if (!this._quiz) {
Expand Down

0 comments on commit c20d279

Please sign in to comment.