Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 44a7030

Browse files
committed
调整node获取图片信息的方案
1 parent 6ecbcdd commit 44a7030

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

doc/deploy-srv.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
- node-srv/config 新建以下相关配置
1414
- basic.json 基本配置
1515
```
16-
imgsDomain: 图片可访问的域名配置
16+
imsDomain: 图片可访问的域名配置
1717
```
1818
```json
1919
{
2020
"port": 8005,
21-
"imgsDomain": ""
21+
"imsDomain": ""
2222
}
2323
```
2424
- mongo.json mongodb数据库配置

node-srv/controller/imgs.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,10 @@ module.exports = new Router(
4141
urn: '/' + algorithm10to64.number10to64(incr)
4242
});
4343

44-
uploadResult[index].path = baseConfig.imgsDomain + uploadResult[index].urn;
44+
uploadResult[index].path = baseConfig.imgUri + uploadResult[index].urn;
4545
}
4646
}
4747

48-
// uploadResult.every(result => {
49-
// if (result.flag) {
50-
// saveImages.push({
51-
// userId: userId,
52-
// url: result.path,
53-
// });
54-
// result.path = baseConfig.imgsDomain + result.path;
55-
// }
56-
// return true;
57-
// });
58-
5948
if (saveImages.length > 0) {
6049
imagesModel.saveMany(saveImages);
6150
}
@@ -81,8 +70,7 @@ module.exports = new Router(
8170
if (response.list) {
8271
let list = response.list;
8372
for (let index = 0; index < list.length; index++) {
84-
list[index].url = baseConfig.imgsDomain + list[index].urn; // 拼装图片服务器主域名
85-
// list[index].url = 'https://source.thankjava.com' + list[index].url; // 拼装图片服务器主域名
73+
list[index].url = baseConfig.imgUri + list[index].urn; // 拼装图片服务器主域名
8674
}
8775
}
8876
baseController.response(ctx, response);

node-srv/controller/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,6 @@ const getUserInfo = async ctx => {
119119
username: user.username,
120120
nickname: user.nickname,
121121
email: user.email.replace(baseController.REG.MAIL_ENCODE, '$1****$2'),
122-
headImg: user.headImg ? baseConfig.imgsDomain + user.headImg : null
122+
headImg: user.headImg ? baseConfig.imgUri + user.headImg : null
123123
};
124124
};

0 commit comments

Comments
 (0)