Skip to content

Commit

Permalink
release 1.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
giscafer committed Jun 6, 2018
1 parent d554f23 commit 0b4ac28
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 11 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,32 @@ web微信自动回复,(web微信!!!非微信公众号)
- ……(持续更新)



### Tips

代码`./modules/poetry.js` 诗词的数量设置小了,内存够的同学可以分开(>3G),最大见注释

```
// 云服务器内存小,所以设置小值
let songLen = 5; //最大254
let tangLen = 5; //最大58
```

## Usage

- npm install
- node index
- node index

运行后扫码二维码登录微信即可

## Screenshot

![screenshot](./screenshot/screenshot.jpg) ![screenshot4](./screenshot/screenshot4.jpg)

![screenshot2](./screenshot/screenshot2.jpg)
![screenshot5](./screenshot/screenshot5.jpg) ![screenshot2](./screenshot/screenshot2.jpg)


![screenshot3](./screenshot/screenshot3.jpg)

## Relation

Expand Down
30 changes: 22 additions & 8 deletions modules/poetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@ const fs = require('fs');
const _ = require('../utils/util');
const random = require('../utils/random');

// 云服务器内存小,所以设置小值
let songLen = 5; //最大254
let tangLen = 5; //最大58

// 异步缓存song词
let songArray = [];
for (let i = 0; i < 254; i++) {
fs.readFile(`./data/poetry/poet.song.${i*1000}.json`, 'utf-8', (err, data) => {
for (let i = 0; i < songLen; i++) {
fs.readFile(`./data/poetry/poet.song.${i * 1000}.json`, 'utf-8', (err, data) => {
if (!err) {
songArray = songArray.concat(JSON.parse(data));
}
if (i === 253) {
if (i === songLen - 1) {
console.log('缓存宋词:', songArray.length);
}
});
}
// 异步缓存唐诗
let tangArray = [];
for (let i = 0; i < 58; i++) {
fs.readFile(`./data/poetry/poet.tang.${i*1000}.json`, 'utf-8', (err, data) => {
for (let i = 0; i < tangLen; i++) {
fs.readFile(`./data/poetry/poet.tang.${i * 1000}.json`, 'utf-8', (err, data) => {
if (!err) {
tangArray = tangArray.concat(JSON.parse(data));
}
if (i === 57) {
if (i === tangLen - 1) {
console.log('缓存唐诗:', tangArray.length);
}
});
Expand All @@ -43,7 +47,12 @@ const song = (title) => {
return songArray[index];
}
for (const poetry of songArray) {
if (poetry.title == title || poetry.title.includes(title) || poetry.author.includes(title)) {
if (poetry.title == title) {
return poetry;
}
}
for (const poetry of songArray) {
if (poetry.title.includes(title) || poetry.author.includes(title)) {
return poetry;
}
}
Expand All @@ -57,7 +66,12 @@ const tang = (title) => {
return tangArray[index];
}
for (const poetry of tangArray) {
if (poetry.title == title || poetry.title.includes(title) || poetry.author.includes(title)) {
if (poetry.title == title) {
return poetry;
}
}
for (const poetry of tangArray) {
if (poetry.title.includes(title) || poetry.author.includes(title)) {
return poetry;
}
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "wechat-autoreply",
"version": "1.1.0",
"version": "1.2.1",
"description": "web微信自动回复",
"main": "index.js",
"scripts": {
"start": "node index",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand Down
Binary file modified screenshot/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/screenshot3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshot/screenshot4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/screenshot5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0b4ac28

Please sign in to comment.