- 云函数 group 和 skip 组合使用?
group 阶段按当前月、日分组 假设当前日有1000条数据,那最终结果group 的 list 中会同时取出这1000条数据吗? skip 是按所有分组中list.length求和的结果跳过吗? app.router("GetBookedByAdmin", async (ctx, next) => { try { const month = new Date().getMonth() + 1; const { identity_id, skip, limit } = event.value; const { list } = await db .collection("TestingOrders") .aggregate() .match({ "appointment.month": month, "nurse._id": identity_id, serviceState: status.TRIAGED, }) .sort({ "appointment.day": -1 }) .lookup({ from: "Users", let: { user_id: "$user_id" }, pipeline: $.pipeline() .match(_.expr($.eq(["$_id", "$$user_id"]))) .limit(1) .project({ _id: 0, avatarUrl: 1, nickName: 1, }) .done(), as: "userInfo", }) .replaceRoot({ newRoot: $.mergeObjects([$.arrayElemAt(["$userInfo", 0]), "$$ROOT"]) }) .project({ userInfo: 0 }) .group({ _id: { month: "$appointment.month", day: "$appointment.day", }, list: $.push({ _id: "$_id", appointment: "$appointment", doctor: "$doctor", location: "$location", serviceState: "$serviceState", status: "$status", symptoms: "$symptoms", user_id: "$user_id", avatarUrl: "$avatarUrl", nickName: "$nickName", }), }) .skip(skip) .limit(limit) .end(); ctx.body = { data: list }; } catch (error) { console.error("GetBookedByAdmin -> ", error); ctx.body = { data: error }; } });
2024-03-03 - 自定义组件间引入的其他自定义组件报错?
在自定义组件A中引入自定义组件modal、input-case,如果modal和input-case只引入其中一个,可以正常引入。 但是两个同时引入,就报错 [图片] { "component": true, "usingComponents": { "modal": "/components/modal/phone/phone", "input-case": "/components/input/phone/phone" } }
2024-02-06 - 小程序在 Pc 和 iPad 设置自动横屏无效?
app.json { "pages": [ "pages/index/index" ], "window": { "backgroundColor": "#F6F6F6", "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#F6F6F6", "navigationBarTitleText": "", "navigationBarTextStyle": "black", "pageOrientation": "auto" }, "sitemapLocation": "sitemap.json", "style": "v2", "lazyCodeLoading": "requiredComponents", "resizable": true } index.wxml <match-media min-width="300" max-width="600"> <view>当页面宽度在 300 ~ 600 px 之间且横屏时展示这里</view> </match-media> <match-media min-height="400" orientation="landscape"> <view>当页面高度不小于 400 px 且屏幕方向为纵向时展示这里</view> </match-media>
2024-02-04 - 小程序如何在 Pc 和 iPad 设置自动横屏?
小程序如何在 Pc 和 iPad 设置自动横屏,在手机端不允许横屏。
2024-02-03 - 云开发索引只能创建5个吗?
云开发索引只能创建5个吗?超过5创建后不显示。
2023-11-17 - wx.chooseMedia 是否可以提供文件名?
wx.chooseMedia 是否可以提供文件名。 例如做图片拼接或多图OCR识别,如果没有文件名,不好判断图片是否重复。
2023-11-15 - 有没有稳定的商品条码查询API,求推荐?
有没有稳定的商品条码查询API,求推荐?
2023-11-01 - 小程序云函数如何执行超过59秒的耗时操作?
小程序云函数如何执行超过59秒的耗时操作? 希望调用云函数成功后就返回 ctx.body = { data: "Success" }; 然后继续执行 chatAi()。 现在遇到的问题是返回后chatAi()不执行了。 // 云函数入口函数 exports.main = async (event, context) => { const wxContext = cloud.getWXContext(); const app = new TcbRouter({ event }); app.use(async (ctx, next) => { ctx.data = {}; await next(); }); app.router("UpdateReport", async (ctx, next) => { try { const { access_token } = await queryAccessToken(); const { user_id, reports_id, category_id, output, reports_type, categorys, text: extract, date, } = event.value; const object = { access_token, type: reports_type, output, input: extract || "", }; ctx.body = { data: "Success" }; chatAi( "https://zrmprpsglplhnhyeh.lambda-url.ap-southeast-1.on.aws/", object ); } catch (error) { console.error("Error in UpdateReport:", error); ctx.body = { data: error }; } }); async function chatAi(url, object) { try { await axios.post(url, object); } catch (error) { throw new Error("error" + error); } } return app.serve(); };
2023-10-03 - editor 组件中的内容无法复制粘贴?
editor 组件复制粘贴内容时,光标会失去焦点,键盘收起。无法实现复制粘贴。
2023-09-25 - 关于大模型备案?
用腾讯云或亚马逊云部署微调过的 Llama 2 是否可以申请深度合成服务算法备案
2023-09-09