Skip to content

Commit

Permalink
fix: 部分动态无法获取描述
Browse files Browse the repository at this point in the history
  • Loading branch information
shanmite committed Jul 15, 2021
1 parent a0e668b commit ebf7440
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ cd lottery
进入lottery上一级目录

```bash
docker image rm shanmite/lottery_auto_docker
docker image rm -f shanmite/lottery_auto_docker
rm -rf lottery/
```

Expand Down
15 changes: 9 additions & 6 deletions lib/Public.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class Public {
obj.ctrl = (typeof extend_json === 'undefined') ? [] : strToJson(extend_json).ctrl || [];
/* 是否有官方抽奖 */
obj.hasOfficialLottery = (typeof extension === 'undefined') ? false : typeof extension.lott === 'undefined' ? false : true;
const item = cardToJson.item || {};
/* 转发者的描述 */
obj.description = item.content || item.description || '';
const { item = {} } = cardToJson;
/* 转发者的描述 后两个分别是视频动态的描述和视频本身的描述*/
obj.description = item.content || item.description || cardToJson.dynamic || cardToJson.desc || '';
if (obj.type === 1) {
/* 被转发者的UID */
obj.origin_uid = desc.origin.uid;
Expand All @@ -160,11 +160,14 @@ class Public {
false : typeof origin_extension.lott === 'undefined' ?
false : true;
const origin = cardToJson.origin || '{}';
const { user, item } = strToJson(origin);
const originToJson = strToJson(origin);
const { user, item } = originToJson;
/* 被转发者的name */
obj.origin_uname = typeof user === 'undefined' ? '' : user.name || user.uname || '';
obj.origin_uname = typeof user === 'undefined'
? '' : user.name || user.uname || '';
/* 被转发者的描述 */
obj.origin_description = typeof item === 'undefined' ? '' : item.content || item.description || '';
obj.origin_description = typeof item === 'undefined'
? '' : item.content || item.description || originToJson.dynamic || originToJson.desc || '';
}
array.push(obj);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/lottery-in-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const { sendNotify } = require('./sendNotify');
const config = require('./config');

async function createRandomDynamic(num) {
Base.tooltip.log(`准备创建${num}条随机动态`);
if (config.create_dy) {
Base.tooltip.log(`准备创建${num}条随机动态`);
const Dynamic = await Public.prototype.checkAllDynamic(GlobalVar.get("myUID"), 1);
if ((Dynamic.allModifyDynamicResArray[0] || { type: 0 }).type === 1) {
for (let index = 0; index < num; index++) {
Expand Down
3 changes: 1 addition & 2 deletions my_config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
*/
UIDs: [
31252386,
35719643,
689277291
],

Expand Down Expand Up @@ -133,7 +132,7 @@ module.exports = {
/**
* 屏蔽词
*/
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号"],
blockword: ["脚本抽奖", "恭喜", "结果", "抽奖号", "钓鱼"],

/**
* 取关白名单
Expand Down

0 comments on commit ebf7440

Please sign in to comment.