个人案例
- 小云名片
超简单的多重身份名片生成工具
小云名片扫码体验
- Teem
Teem,真的可以见到陌生人
社交破冰扫码体验
- 数据库,字段= 和 _.or不能同时用吗?
[图片]
2021-09-13 - 云开发的数据库 group后的数据怎么建立索引?
表结构: { "_id": "14139e1261001208004a2a434b330a9c", "created": "2021-07-27T14:02:48.598Z", "createdMS": 1627394568333, "createdStr": "2021-07-27 22:02:48", "gas": "0", "mobile": "188000000000", "openid": "2898364888888", "modified": "2021-07-27T14:02:54.229Z", "modifiedMS": 1627394574216, "modifiedStr": "2021-07-27 22:02:54", "payType": "WXMINI", "price": 1, "priceBeforeDiscount": 1, "priceBeforeDiscountYuan": "0.01", "priceYuan": "0.01", "printer": "550112792", "sfid": 100401, "sfname": "柜台", "sid": 1004, "sname": "奇点风暴加油站", "status": "YIZHIFU", "wxOrder": "QDPAY1621111672020" }, 这是查询语句: const res = await db.collection('order').aggregate().match({ status: 'YIZHIFU', modifiedMS: _.and(_.gte(lastMonthStartMS), _.lte(lastMonthEndMS)) }).project({ _id: 0, sid: 1, mobile: 1, openid: 1, }) .group({ _id: { sid: '$sid',// 1 mobile: '$mobile',// 1 openid: '$openid',// 1 }, ordertimes: $.sum(1), }) .match({ ordertimes: _.gte(size)// 2 }) .end() 1、2那边怎么建索引呢?查询好慢
2021-09-08 - 云开发数据库如何实现这个效果?
在一张表里有数据: {"_id":"14139e126137625f0a8b0a4c3302e3f1","totalCount":2,"sid":1007,"mobile":"11111111111","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a4d0bfdd883","totalCount":1,"sid":1007,"mobile":"22222222222","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a4e4d80ff30","totalCount":4,"sid":1007,"mobile":"33333333333","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a4f134e77c9","totalCount":7,"sid":1007,"mobile":"44444444444","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a5074d7bbd1","totalCount":9,"sid":1004,"mobile":"55555555555","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a510e0f2cc5","totalCount":3,"sid":1004,"mobile":"66666666666","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a521c515d4f","totalCount":9,"sid":1003,"mobile":"77777777777","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a532ae56f69","totalCount":4,"sid":1003,"mobile":"88888888888","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a542f40ea28","totalCount":2,"sid":1003,"mobile":"99999999999","createdDayStr":"2021-9-7","calcStart":"2021-08-01 00:00:00","calcEnd":"2021-08-31 23:59:59"} {"_id":"14139e126137625f0a8b0a4c3302e3f1","totalCount":2,"sid":1007,"mobile":"11111111111","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a4d0bfdd883","totalCount":1,"sid":1007,"mobile":"22222222222","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a4e4d80ff30","totalCount":3,"sid":1007,"mobile":"33333333333","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a4f134e77c9","totalCount":9,"sid":1007,"mobile":"44444444444","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a5074d7bbd1","totalCount":4,"sid":1004,"mobile":"55555555555","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a510e0f2cc5","totalCount":6,"sid":1004,"mobile":"66666666666","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a521c515d4f","totalCount":1,"sid":1003,"mobile":"77777777777","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a532ae56f69","totalCount":4,"sid":1003,"mobile":"88888888888","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} {"_id":"14139e126137625f0a8b0a542f40ea28","totalCount":6,"sid":1003,"mobile":"99999999999","createdDayStr":"2021-9-7","calcStart":"2021-09-01 00:00:00","calcEnd":"2021-09-30 23:59:59"} 需要求出: calcStart~calcEnd 在 2021-8-1 00:00:00~2021-8-31 23:59:59 和 2021-9-1 00:00:00~2021-9-30 23:59:59 两个自然月里 totalCount >= 4 按 sid 分组后的手机号出现的次数,怎么写?折腾半天,脑子有点晕。。 {"sid":"1007","count":1, "mobileSum":1},// 同一手机号满足 sid=1007 在 8月和9月 totalCount=1,记录数有 1 个 {"sid":"1007","count":2, "mobileSum":2},// 同一手机号满足 sid=1007 在 8月和9月 totalCount=2,记录数有 2 个 {"sid":"1007","count":3, "mobileSum":4},// 同一手机号满足 sid=1007 在 8月和9月 totalCount=3,记录数有 4 个 . . . {"sid":"1007","count":10, "mobileSum":9},// 同一手机号满足 sid=1007 在 8月和9月 totalCount=10,记录数有 9 个 {"sid":"1004","count":1, "mobileSum":0},// 同一手机号满足 sid=1004 在 8月和9月 totalCount=1,记录数有 0 个 {"sid":"1004","count":2, "mobileSum":10},// 同一手机号满足 sid=1004 在 8月和9月 totalCount=2,记录数有 10 个 . . .
2021-09-08 - 云函数设置超时时间不起作用?执行超时?
错误日志: Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID d89f3fc7-0f26-11ec-bf28-1e91c1a398bb, cloud function service error code -504002, error message Error: collection.aggregate:fail -501001 resource system error. [FailedOperation.Timeout] Execution request timeout, Please check optimize your request(such as index), but if the problem persists, contact us. at Object.toSDKError (:25279/var/user/node_modules/wx-server-sdk/index.js:8089) at Object.checkError (:25279/var/user/node_modules/wx-server-sdk/index.js:1422) at Promise (:25279/var/user/node_modules/wx-server-sdk/index.js:1161) at process._tickCallback (:25279/appservice/internal/process/next_tick.js:68); at cloud.callFunction api; at new g (VM206 WAService.js:2) at c (VM206 WAService.js:2) at I (VM206 WAService.js:2) at Function.success (VM206 WAService.js:2) at C (VM206 WAService.js:2) at VM206 WAService.js:2 at u (VM206 WAService.js:2) at Function.<anonymous> (VM206 WAService.js:2) at C (VM206 WAService.js:2) at VM206 WAService.js:2(env: macOS,mp,1.05.2107090; lib: 2.14.1) 云函数设置了超时60s,不起作用,运行了大概5秒就报错。 [图片]
2021-09-06 - 云开发,数据库返回的JSON数据如何再插入数据库?
通过 WEB API 请求返回的数据,data里的数据有 \ " 等等,这个格式怎么插入数据库呢? 想要通过这个接口,把下面data里的数据插入数据库:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseAdd.html // 这个是查询数据库返回的数据 { "errcode": 0, "errmsg": "ok", "data": [ "{\"_id\":{\"sid\":{\"$numberDouble\":\"1003.0\"},\"mobile\":\"00000000000\"},\"totalCount\":{\"$numberInt\":\"12\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}", "{\"_id\":{\"sid\":{\"$numberDouble\":\"1003.0\"},\"mobile\":\"11111111111\"},\"totalCount\":{\"$numberInt\":\"62\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}", "{\"_id\":{\"sid\":{\"$numberDouble\":\"1003.0\"},\"mobile\":\"22222222222\"},\"totalCount\":{\"$numberInt\":\"63\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}", "{\"_id\":{\"sid\":{\"$numberDouble\":\"1004.0\"},\"mobile\":\"33333333333\"},\"totalCount\":{\"$numberInt\":\"34\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}", "{\"_id\":{\"sid\":{\"$numberDouble\":\"1005.0\"},\"mobile\":\"44444444444\"},\"totalCount\":{\"$numberInt\":\"84\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}", "{\"_id\":{\"sid\":{\"$numberDouble\":\"1007.0\"},\"mobile\":\"55555555555\"},\"totalCount\":{\"$numberInt\":\"28\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}", "{\"_id\":{\"sid\":{\"$numberDouble\":\"1006.0\"},\"mobile\":\"66666666666\"},\"totalCount\":{\"$numberInt\":\"30\"},\"created\":\"{\\\"$date\\\":{\\\"offset\\\":0}}\",\"createdMS\":{\"$numberLong\":\"1630921631001\"},\"createdStr\":\"2021-09-06 17:47:11\",\"createdDayStr\":\"2021-09-06\"}" ] } // 我想通过这段代码把上面的data里的数据加到数据库里 JSONArray data = res.getJSONArray("data"); // 发送请求 http api String querystr = "db.collection('ordercollect').add({\n" + " data: " + data + "\n" + "})"; JSONObject body = new JSONObject(); body.put("env", env); body.put("query", querystr); 文档里的data格式: [图片]
2021-09-06 - weui 扩展组件 mp-uploader 无法显示 云存储中的cloudID图片?
组件:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/extended/weui/uploader.html WXML 代码: <view class="page"> <view class="page__bd"> <mp-cells> <mp-cell> <mp-uploader bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uplaodFile}}" files="{{files}}" max-count="5" title="真实照片上传" tips="非真实照片将受到警告" delete="{{true}}"></mp-uploader> </mp-cell> </mp-cells> </view> </view> JS 代码: //... /** * 页面的初始数据 */ data: { files: ['cloud://cloud1-3g0985ox05f41f2d.636c-cloud1-3g0985ox05f41f2d-1307053970/cuser/od1W_5Wuu0W12WuS0-0gD4jchsew/1630378121140.jpg', 'cloud://cloud1-3g0985ox05f41f2d.636c-cloud1-3g0985ox05f41f2d-1307053970/cuser/od1W_5Wuu0W12WuS0-0gD4jchsew/1630378121141.jpg'] }, 结果: [图片]
2021-08-31 - button getPhoneNumber 授权发短信后,返回的cloudID为空?
代码 // 获取手机号 getPhoneNumber: function (event) { var _this = this let cloudID = event.detail.cloudID //开放数据ID console.log("cloudID = " + cloudID) const db = wx.cloud.database() if (!cloudID) { // 发短信验证就会走这里 console.log('未获取到 cloudID') } else { consoloe.log('获取到 cloudID'); // 调用云函数获取手机号 wx.cloud.callFunction({ name: 'getphone', data: { cloudID: cloudID } }).then(res => { //... } } }
2021-08-21 - button 绑定获取手机号,如何模拟出发送验证码的场景进行测试?
如题,因为获取手机号后的js逻辑里有弹窗逻辑,客户反馈获取验证码后弹窗关不掉。我测试获取手机号从来没有要发短信验证的,没办法模拟这个场景进行测试,怎么弄呢?
2021-08-20 - 该身份证已登记超过5次,什么时候能开放更多?
[图片] 5个实在太少了,现在想注册新的小程序都没办法搞,还要找人,很多时候找别人是不值得信任的,怎么破?
2021-08-20 - 微信代金券:无法收到「EXPIRED」回调。
https://pay.weixin.qq.com/wiki/doc/apiv3_partner/apis/chapter9_1_15.shtml 「USED」 是可以收到回调的,「EXPIRED」暂时一条未收到。
2021-08-17