AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
[TOC] ### api接口按需查询字段 * [ ] 请求方式:http://xxx.sfrg.cn?field=username;age;gender >[danger] field 后面的字段,可以按需要加在后面查询 * [ ] 后端实现: ``` // 查询特定用户 async findOne(ctx) { const {id} = ctx.params // 获取 url?field=xxx const { field } = ctx.query // 将 url 查询字符串 转换为 +field 格式 用于 select 查询字段 const newField = field.split(';') .filter(item => item) .map(item => ` +${item}`).join('') const user = await User.findById(id).select(newField) ctx.body = user || [] } ```