wechaty-web-panel 1.6.50 → 1.6.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,6 @@ const nedb_js_1 = __importDefault(require("./nedb.js"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const global_js_1 = __importDefault(require("./global.js"));
11
- const fs_1 = __importDefault(require("fs"));
12
11
  let rdb = null;
13
12
  function initDb() {
14
13
  if (!rdb) {
@@ -30,8 +29,13 @@ function initDb() {
30
29
  async function addRssHistory(info) {
31
30
  try {
32
31
  initDb();
33
- let doc = await rdb.update({ _id: info.id }, info, { upsert: true });
34
- return doc;
32
+ const hasExit = await rdb.find({ _id: info.id });
33
+ if (hasExit) {
34
+ return await rdb.update({ _id: info.id }, info, { upsert: true });
35
+ }
36
+ else {
37
+ return await rdb.insert(info);
38
+ }
35
39
  }
36
40
  catch (error) {
37
41
  console.log("插入数据错误", error);
@@ -6,7 +6,7 @@ exports.packageJson = void 0;
6
6
  */
7
7
  exports.packageJson = {
8
8
  "name": "wechaty-web-panel",
9
- "version": "1.6.50",
9
+ "version": "1.6.51",
10
10
  "description": "智能微秘书插件",
11
11
  "exports": {
12
12
  ".": {
@@ -22,6 +22,7 @@ async function getRssContent(info) {
22
22
  console.log('订阅源:' + info.rssUrl);
23
23
  const feed = await parser.parseURL(info.rssUrl);
24
24
  const lastItem = await (0, rssHistory_js_1.getRssHistoryById)(info.id);
25
+ console.log('上一条消息', JSON.stringify(lastItem));
25
26
  // 当存在文章的时候
26
27
  if (feed.items && feed.items.length) {
27
28
  // 当存在历史推送记录 需要判读是否推送过
@@ -1,8 +1,7 @@
1
- import nedb from "./nedb.js";
2
- import path from "path";
3
- import os from "os";
4
- import globalConfig from "./global.js";
5
- import fs from "fs";
1
+ import nedb from './nedb.js';
2
+ import path from 'path';
3
+ import os from 'os';
4
+ import globalConfig from './global.js';
6
5
  let rdb = null;
7
6
  function initDb() {
8
7
  if (!rdb) {
@@ -24,8 +23,13 @@ function initDb() {
24
23
  export async function addRssHistory(info) {
25
24
  try {
26
25
  initDb();
27
- let doc = await rdb.update({ _id: info.id }, info, { upsert: true });
28
- return doc;
26
+ const hasExit = await rdb.find({ _id: info.id });
27
+ if (hasExit) {
28
+ return await rdb.update({ _id: info.id }, info, { upsert: true });
29
+ }
30
+ else {
31
+ return await rdb.insert(info);
32
+ }
29
33
  }
30
34
  catch (error) {
31
35
  console.log("插入数据错误", error);
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const packageJson = {
5
5
  "name": "wechaty-web-panel",
6
- "version": "1.6.50",
6
+ "version": "1.6.51",
7
7
  "description": "智能微秘书插件",
8
8
  "exports": {
9
9
  ".": {
@@ -16,6 +16,7 @@ async function getRssContent(info) {
16
16
  console.log('订阅源:' + info.rssUrl);
17
17
  const feed = await parser.parseURL(info.rssUrl);
18
18
  const lastItem = await getRssHistoryById(info.id);
19
+ console.log('上一条消息', JSON.stringify(lastItem));
19
20
  // 当存在文章的时候
20
21
  if (feed.items && feed.items.length) {
21
22
  // 当存在历史推送记录 需要判读是否推送过
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wechaty-web-panel",
3
- "version": "1.6.50",
3
+ "version": "1.6.51",
4
4
  "description": "智能微秘书插件",
5
5
  "exports": {
6
6
  ".": {