(ctx, next)
| 53 | } |
| 54 | |
| 55 | async addLabels(ctx, next) { |
| 56 | // 1.获取标签和动态id |
| 57 | const { labels } = ctx; |
| 58 | const { momentId } = ctx.params; |
| 59 | |
| 60 | // 2.添加所有的标签 |
| 61 | for (let label of labels) { |
| 62 | // 2.1.判断标签是否已经和动态有关系 |
| 63 | const isExist = await momentService.hasLabel(momentId, label.id); |
| 64 | if (!isExist) { |
| 65 | await momentService.addLabel(momentId, label.id); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | ctx.body = "给动态添加标签成功~"; |
| 70 | } |
| 71 | |
| 72 | async fileInfo(ctx, next) { |
| 73 | let { filename } = ctx.params; |