关于查询列表接口userId
来源:10-6 编写添加评论和评论列表接口,与前端联调

骑猪跑的程序员
2020-11-10
查询列表时,不应该只查当前userId的评论吧?但是不传入userId的话又回有头像不显示的问题
写回答
1回答
-
夏小宅
2020-11-11
const user = await ctx.service.user.getUser(ctx.username); const result = await ctx.service.comment.lists(ctx.params(), user.id);
是根据用户id进行查询的,id不需要前端传递,从token中进行解析出用户名后可以得到id
022020-11-14
相似问题