diff --git a/manifest.json b/manifest.json index da54b1881cea6b8e11516a7e816ad48b0d7c1397..ab80e99cbc1484791ced39a33c539ec9d44b388e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,71 +1,68 @@ { - "name": "", - "appid": "", - "description": "云端一体应用快速开发基本项目模版", - "versionName": "", - "versionCode": "100", - "transformPx": false, - "app-plus": { - "usingComponents": true, - "nvueStyleCompiler": "uni-app", - "compilerVersion": 3, - "splashscreen": { - "alwaysShowBeforeRender": true, - "waiting": true, - "autoclose": true, - "delay": 0 + "name" : "uni-starter", + "appid" : "__UNI__8E9C31E", + "description" : "云端一体应用快速开发基本项目模版", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + "modules" : {}, + "distribute" : { + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + "ios" : {}, + "sdkConfigs" : { + "push" : { + "unipush" : null + } + } + } }, - "modules": { + "quickapp" : {}, + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true }, - "distribute": { - "android": { - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - "ios": { - }, - "sdkConfigs": { - "push": { - "unipush": null - } - } - } - }, - "quickapp": { - }, - "mp-weixin": { - "appid": "", - "setting": { - "urlCheck": false + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false }, - "usingComponents": true - }, - "mp-alipay": { - "usingComponents": true - }, - "mp-baidu": { - "usingComponents": true - }, - "mp-toutiao": { - "usingComponents": true - }, - "uniStatistics": { - "enable": false - }, - "vueVersion": "2" -} \ No newline at end of file + "vueVersion" : "2" +} diff --git a/pages/grid/grid.test.js b/pages/grid/grid.test.js index aa680aeefe55c5a160f684ce3c1de3281a0dfd21..c68a0ea4cccc5594210081ab2ab793d4ba0fe358 100644 --- a/pages/grid/grid.test.js +++ b/pages/grid/grid.test.js @@ -27,7 +27,9 @@ describe('pages/grid/grid.vue', () => { } if (process.env.UNI_PLATFORM === "mp-weixin") { const uniGrid = await page.$('uni-grid') + await page.waitFor(300) await uniGrid.callMethod('change') + await page.waitFor(500) } }) }); \ No newline at end of file diff --git a/pages/list/detail.vue b/pages/list/detail.vue index 34b3789f6e3eccfa7bf3de09c4b59553c3a50593..be8d257a7c365c3ea678d0a79c399cea48bdd09a 100644 --- a/pages/list/detail.vue +++ b/pages/list/detail.vue @@ -19,8 +19,8 @@ + + + \ No newline at end of file diff --git a/uniCloud-aliyun/cloudfunctions/uni-portal/index.js b/uniCloud-aliyun/cloudfunctions/uni-portal/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f45fb9ccd601b18e9deae6328440bade3f093271 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-portal/index.js @@ -0,0 +1,25 @@ +'use strict'; +const success = { + success: true +} +const fail = { + success: false +} +const createPublishHtml = require('./createPublishHtml') + +exports.main = async (event, context) => { + //event为客户端上传的参数 + console.log('event : ', event) + + let res = {}; + let params = event.data || event.params; + + switch (event.action) { + case 'createPublishHtml': + res = createPublishHtml(params.id) + break; + } + + //返回数据给客户端 + return res +}; diff --git a/uniCloud-aliyun/cloudfunctions/uni-portal/package.json b/uniCloud-aliyun/cloudfunctions/uni-portal/package.json new file mode 100644 index 0000000000000000000000000000000000000000..354f947c09a6b2398f94e931cf006c7f00a8228a --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-portal/package.json @@ -0,0 +1,7 @@ +{ + "name": "uni-portal", + "dependencies": {}, + "extensions": { + "uni-cloud-jql": {} + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/cloudfunctions/uni-sms-co/build-template-data.js b/uniCloud-aliyun/cloudfunctions/uni-sms-co/build-template-data.js new file mode 100644 index 0000000000000000000000000000000000000000..0057d409cf9413edefa4f6a3d8eb6615d35ddfa2 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-sms-co/build-template-data.js @@ -0,0 +1,26 @@ +module.exports = (templateData, user) => { + const data = {} + for (const template of templateData) { + const isDynamic = /\{.*?\}/.test(template.value) + + // 仅支持uni-id-users + if (isDynamic) { + const [collection, field] = template.value.replace(/\{|\}/g, '').split('.') + data[template.field] = collection === 'uni-id-users' ? user[field] || template.value: template.value + } else { + data[template.field] = template.value + } + // switch (template.type) { + // case 'static': + // data[template.field] = template.value + // break + // case 'dynamic': + // data[template.field] = user[template.value] || '' + // break + // default: + // throw new Error(`template type [${template.type}] not supported`) + // } + } + + return data +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-sms-co/index.obj.js b/uniCloud-aliyun/cloudfunctions/uni-sms-co/index.obj.js new file mode 100644 index 0000000000000000000000000000000000000000..ba57c66a05d982021f46fbdeed40f4fa72c2009e --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-sms-co/index.obj.js @@ -0,0 +1,374 @@ +// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj +// jsdoc语法提示教程:https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129 +const createConfig = require('uni-config-center') +const buildTemplateData = require('./build-template-data') +const { parserDynamicField, checkIsStaticTemplate } = require('./utils') +const schemaNameAdapter = require('./schema-name-adapter') + +const uniSmsCo = uniCloud.importObject('uni-sms-co') +const db = uniCloud.database() +const smsConfig = createConfig({ + pluginId: 'uni-sms-co' +}).config() + +function errCode(code) { + return 'uni-sms-co-' + code +} + +const tableNames = { + template: 'opendb-sms-template', + task: 'opendb-sms-task', + log: 'opendb-sms-log' +} + +module.exports = { + _before: async function () { // 通用预处理器 + if (!smsConfig.smsKey || smsConfig.smsKey.length <= 20 || !smsConfig.smsSecret || smsConfig.smsSecret.length <= 20) { + throw new Error('请先配置smsKey和smsSecret') + } + + this.tableNames = tableNames + + /** + * 优化 schema 的命名规范,需要兼容 uni-admin@2.1.6 以下版本 + * 如果是在uni-admin@2.1.6版本以上创建的项目可以将其注释 + * */ + await schemaNameAdapter.call(this) + }, + _after: function (error, result) { + if (error) { + if (error instanceof Error) { + return { + errCode: 'error', + errMsg: error.message + } + } + + if (error.errCode) { + return error + } + + throw error + } + + return result + }, + /** + * 创建短信任务 + * @param {Object} to + * @param {Boolean} to.all=false 全部用户发送 + * @param {String} to.type=user to.all=true时用来区分发送类型 + * @param {Array} to.receiver 用户ID's / 用户标签ID's + * @param {String} templateId 短信模板ID + * @param {Array} templateData 短信模板数据 + * @param {String} options.taskName 任务名称 + */ + async createSmsTask(to, templateId, templateData, options = {}) { + if (!templateId) { + return { + errCode: errCode('template-id-required'), + errMsg: '缺少templateId' + } + } + + if (!to.all && (!to.receiver || to.receiver.length <= 0)) { + return { + errCode: errCode('send-users-is-null'), + errMsg: '请选择要发送的用户' + } + } + + const clientInfo = this.getClientInfo() + + const {data: templates} = await db.collection(this.tableNames.template).where({_id: templateId}).get() + if (templates.length <= 0) { + return { + errCode: errCode('template-not-found'), + errMsg: '短信模板不存在' + } + } + const [template] = templates + + // 创建短信任务 + const task = await db.collection(this.tableNames.task).add({ + app_id: clientInfo.appId, + name: options.taskName, + template_id: templateId, + template_contnet: template.content, + vars: templateData, + to, + send_qty: 0, + success_qty: 0, + fail_qty: 0, + create_date: Date.now() + }) + + uniSmsCo.createUserSmsMessage(task.id) + + return new Promise(resolve => setTimeout(() => resolve({ + errCode: 0, + errMsg: '任务创建成功', + taskId: task.id + }), 300)) + }, + async createUserSmsMessage(taskId, execData = {}) { + const parallel = 100 + let beforeId + const { data: tasks } = await db.collection(this.tableNames.task).where({ _id: taskId }).get() + + if (tasks.length <= 0) { + return { + errCode: errCode('task-id-not-found'), + errMsg: '任务ID不存在' + } + } + + const [task] = tasks + const query = { + mobile: db.command.exists(true) + } + + // 指定用户发送 + if (!task.to.all && task.to.type === 'user') { + let index = 0 + if (execData.beforeId) { + const i = task.to.receiver.findIndex(id => id === execData.beforeId) + index = i !== -1 ? i + 1 : 0 + } + + const receiver = task.to.receiver.slice(index, index + parallel) + query._id = db.command.in(receiver) + beforeId = receiver[receiver.length - 1] + } + + // 指定用户标签 + if (task.to.type === 'userTags') { + query.tags = db.command.in(task.to.receiver) + } + + // 全部用户 + if (task.to.all && execData.beforeId) { + query._id = db.command.gt(execData.beforeId) + } + + // 动态数据仅支持uni-id-users表字段 + const dynamicField = parserDynamicField(task.vars) + const userFields = dynamicField['uni-id-users'] ? dynamicField['uni-id-users'].reduce((res, field) => { + res[field] = true + return res + }, {}): {} + const { data: users } = await db.collection('uni-id-users') + .where(query) + .field({ + mobile: true, + ...userFields + }) + .limit(parallel) + .orderBy('_id', 'asc') + .get() + + if (users.length <= 0) { + // 更新要发送的短信数量 + const count = await db.collection(this.tableNames.log).where({ task_id: taskId }).count() + await db.collection(this.tableNames.task).where({ _id: taskId }).update({ + send_qty: count.total + }) + + // 开始发送 + uniSmsCo.sendSms(taskId) + + return new Promise(resolve => setTimeout(() => resolve({ + errCode: 0, + errMsg: '创建完成' + }), 500)) + } + + if (!beforeId) { + beforeId = users[users.length - 1]._id + } + + let docs = [] + for (const user of users) { + const varData = await buildTemplateData(task.vars, user) + docs.push({ + uid: user._id, + task_id: taskId, + mobile: user.mobile, + var_data: varData, + status: 0, + create_date: Date.now() + }) + } + + await db.collection(this.tableNames.log).add(docs) + + uniSmsCo.createUserSmsMessage(taskId, { beforeId }) + + return new Promise(resolve => setTimeout(() => resolve(), 500)) + }, + async sendSms(taskId) { + const { data: tasks } = await db.collection(this.tableNames.task).where({ _id: taskId }).get() + if (tasks.length <= 0) { + console.warn(`task [${taskId}] not found`) + return + } + + const [task] = tasks + const isStaticTemplate = !task.vars.length + + let sendData = { + appId: task.app_id, + smsKey: smsConfig.smsKey, + smsSecret: smsConfig.smsSecret, + templateId: task.template_id, + data: {} + } + + const { data: records } = await db.collection(this.tableNames.log) + .where({ task_id: taskId, status: 0 }) + .limit(isStaticTemplate ? 50 : 1) + .field({ mobile: true, var_data: true }) + .get() + + if (records.length <= 0) { + return { + errCode: 0, + errMsg: '发送完成' + } + } + + if (isStaticTemplate) { + sendData.phoneList = records.reduce((res, user) => { + res.push(user.mobile) + return res + }, []) + } else { + const [record] = records + sendData.phone = record.mobile + sendData.data = record.var_data + } + + try { + // await sendSms(sendData) + await uniCloud.sendSms(sendData) + // 修改发送状态为已发送 + await db.collection(this.tableNames.log).where({ + _id: db.command.in(records.map(record => record._id)) + }).update({ + status: 1, + send_date: Date.now() + }) + // 更新任务的短信成功数 + await db.collection(this.tableNames.task).where({ _id: taskId }) + .update({ + success_qty: db.command.inc(records.length) + }) + } catch (e) { + console.error('[sendSms Fail]', e) + // 修改发送状态为发送失败 + await db.collection(this.tableNames.log).where({ + _id: db.command.in(records.map(record => record._id)) + }).update({ + status: 2, + reason: e.errMsg || '未知原因', + send_date: Date.now() + }) + // 更新任务的短信失败数 + await db.collection(this.tableNames.task).where({ _id: taskId }) + .update({ + fail_qty: db.command.inc(records.length) + }) + } + + uniSmsCo.sendSms(taskId) + + return new Promise(resolve => setTimeout(() => resolve(), 500)) + }, + async template() { + const {data: templates = []} = await db.collection(this.tableNames.template).get() + return templates + }, + async task (id) { + const {data: tasks} = await db.collection(this.tableNames.task).where({_id: id}).get() + if (tasks.length <= 0) { + return null + } + + return tasks[0] + }, + async updateTemplates (templates) { + if (templates.length <= 0) { + return { + errCode: errCode('template-is-null'), + errMsg: '缺少模板信息' + } + } + + let group = [] + for (const template of templates) { + group.push( + db.collection(this.tableNames.template).doc(String(template.templateId)).set({ + name: template.templateName, + content: template.templateContent, + type: template.templateType, + sign: template.templateSign + }) + ) + } + + await Promise.all(group) + + return { + errCode: 0, + errMsg: '更新成功' + } + }, + async preview (to, templateId, templateData) { + const count = 1 + let query = { + mobile: db.command.exists(true) + } + + // 指定用户发送 + if (!to.all && to.type === 'user') { + const receiver = to.receiver.slice(0, 10) + query._id = db.command.in(receiver) + } + + // 指定用户标签 + if (to.type === 'userTags') { + query.tags = db.command.in(to.receiver) + } + + const {data: users} = await db.collection('uni-id-users').where(query).limit(count).get() + console.log({users, query}) + if (users.length <= 0) { + return { + errCode: errCode('users-is-null'), + errMsg: '请添加要发送的用户' + } + } + + const {data: templates} = await db.collection(this.tableNames.template).where({_id: templateId}).get() + if (templates.length <= 0) { + return { + errCode: errCode('template-not-found'), + errMsg: '模板不存在' + } + } + const [template] = templates + + let docs = [] + for (const user of users) { + const varData = buildTemplateData(templateData, user) + const content = template.content.replace(/\$\{(.*?)\}/g, ($1, param) => varData[param] || $1) + docs.push(`【${template.sign}】${content}`) + } + + return { + errCode: 0, + errMsg: '', + list: docs + } + } +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-sms-co/package.json b/uniCloud-aliyun/cloudfunctions/uni-sms-co/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f989531605c19d008e49d5f70bad988d726c2239 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-sms-co/package.json @@ -0,0 +1,10 @@ +{ + "name": "uni-sms-co", + "dependencies": { + "uni-config-center": "file:../../../uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center" + }, + "extensions": { + "uni-cloud-sms": {}, + "uni-cloud-jql": {} + } +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-sms-co/schema-name-adapter.js b/uniCloud-aliyun/cloudfunctions/uni-sms-co/schema-name-adapter.js new file mode 100644 index 0000000000000000000000000000000000000000..cf002937eb75009cf44e08a3241fff91a144ac5a --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-sms-co/schema-name-adapter.js @@ -0,0 +1,15 @@ +const db = uniCloud.database() + +module.exports = async function () { + try { + const count = await db.collection('batch-sms-template').count() + + if (count.total > 0) { + this.tableNames = { + template: 'batch-sms-template', + task: 'batch-sms-task', + log: 'batch-sms-result' + } + } + } catch (e) {} +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-sms-co/utils.js b/uniCloud-aliyun/cloudfunctions/uni-sms-co/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..edf34b8252e3f63395ae1f66b1449dcceca42d5c --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-sms-co/utils.js @@ -0,0 +1,42 @@ +exports.chunk = function (arr, num) { + const list = [] + let current = [] + + for (const item of arr) { + current.push(item); + if (current.length === num) { + list.push(current) + current = [] + } + } + + if (current.length) list.push(current) + + return list +} + +exports.checkIsStaticTemplate = function (data = []) { + let isStatic = data.length <= 0 + + for (const template of data) { + if (template.type === 'static') { + isStatic = true + break + } + } + + return isStatic +} + +exports.parserDynamicField = function (templateData) { + return templateData.reduce((res, template) => { + if (/\{.*?\}/.test(template.value)) { + const [collection, field] = template.value.replace(/\{|\}/g, '').split('.') + if (!res[collection]) { + res[collection] = [] + } + res[collection].push(field) + } + return res + }, {}) +} \ No newline at end of file diff --git a/uniCloud-aliyun/cloudfunctions/uni-stat-cron/index.js b/uniCloud-aliyun/cloudfunctions/uni-stat-cron/index.js new file mode 100644 index 0000000000000000000000000000000000000000..685c330264d4526e14e374a72ebb4b4ab5fc0bb7 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-stat-cron/index.js @@ -0,0 +1,6 @@ +'use strict'; +const uniStat = require('uni-stat') +exports.main = async (event, context) => { + //数据跑批处理函数 + return await uniStat.initStat().cron(context) +}; diff --git a/uniCloud-aliyun/cloudfunctions/uni-stat-cron/package.json b/uniCloud-aliyun/cloudfunctions/uni-stat-cron/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f8b0486778d98fba18c6df4dbbbb80ac7ca339e9 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-stat-cron/package.json @@ -0,0 +1,27 @@ +{ + "name": "uni-stat-cron", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "uni-stat": "file:../common/uni-stat" + }, + "cloudfunction-config": { + "concurrency": 1, + "memorySize": 512, + "timeout": 600, + "triggers": [ + { + "name": "uni-stat-cron", + "type": "timer", + "config": "0 0 * * * * *" + } + ] + }, + "extensions": {} +} \ No newline at end of file diff --git a/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/index.obj.js b/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/index.obj.js new file mode 100644 index 0000000000000000000000000000000000000000..dac8354dfd9963330c7878f913ff0e01d8199af4 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/index.obj.js @@ -0,0 +1,29 @@ +const uniStat = require('uni-stat') +const uniID = require('uni-id-common') +module.exports = { + report: async function (params = {}) { + //客户端信息 + const clientInfo = this.getClientInfo() + //云服务信息 + const cloudInfo = this.getCloudInfo() + //token信息 + const token = this.getUniIdToken() + //当前登录用户id + let uid + if(token) { + const tokenRes = await uniID.createInstance({ + clientInfo + }).checkToken(token) + + if(tokenRes.uid) { + uid = tokenRes.uid + } + } + //数据上报 + return await uniStat.initReceiver().report(params, { + ...clientInfo, + ...cloudInfo, + uid + }) + } +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/package.json b/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/package.json new file mode 100644 index 0000000000000000000000000000000000000000..2535f1766c2d055832314559c5ae46c7aa40fdd6 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-stat-receiver/package.json @@ -0,0 +1,16 @@ +{ + "name": "uni-stat-receiver", + "dependencies": { + "uni-stat": "file:../common/uni-stat", + "uni-id-common": "file:../../../uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common" + }, + "cloudfunction-config": { + "concurrency": 1, + "memorySize": 128, + "timeout": 60, + "triggers": [] + }, + "extensions": { + "uni-cloud-jql": {} + } +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/checkVersion/index.js b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/checkVersion/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e38892c90770e0fe83b8f2dfe89697e084936298 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/checkVersion/index.js @@ -0,0 +1,167 @@ +'use strict'; +module.exports = async (event, context) => { + /** + * 检测升级 使用说明 + * 上传包: + * 1. 根据传参,先检测传参是否完整,appid appVersion wgtVersion 必传 + * 2. 先从数据库取出所有该平台(从上下文读取平台信息,默认 Andriod)的所有线上发行更新 + * 3. 再从所有线上发行更新中取出版本最大的一版。如果可以,尽量先检测wgt的线上发行版更新 + * 4. 使用上步取出的版本包的版本号 和传参 appVersion、wgtVersion 来检测是否有更新,必须同时大于这两项,否则返回暂无更新 + * 5. 如果库中 wgt包 版本大于传参 appVersion,但是不满足 min_uni_version < appVersion,则不会使用wgt更新,会接着判断库中 app包version 是否大于 appVersion + */ + + let { + appid, + appVersion, + wgtVersion, + } = event; + + const platform_Android = 'Android'; + const platform_iOS = 'iOS'; + const package_app = 'native_app'; + const package_wgt = 'wgt'; + const app_version_db_name = 'opendb-app-versions' + + let platform = platform_Android; + + // 云函数URL化请求 + if (event.headers) { + let body; + try { + if (event.httpMethod.toLocaleLowerCase() === 'get') { + body = event.queryStringParameters; + } else { + body = JSON.parse(event.body); + } + } catch (e) { + return { + code: 500, + msg: '请求错误' + }; + } + + appid = body.appid; + appVersion = body.appVersion; + wgtVersion = body.wgtVersion; + + platform = /iPhone|iPad/.test(event.headers) ? platform_iOS : platform_Android; + } else if (context.OS) { + platform = context.OS === 'android' ? + platform_Android : + context.OS === 'ios' ? + platform_iOS : + platform_Android; + } + + if (appid && appVersion && wgtVersion && platform) { + const collection = uniCloud.database().collection(app_version_db_name); + + const record = await collection.where({ + appid, + platform, + stable_publish: true + }) + .orderBy('create_date', 'desc') + .get(); + + if (record && record.data && record.data.length > 0) { + const appVersionInDb = record.data.find(item => item.type === package_app) || {}; + const wgtVersionInDb = record.data.find(item => item.type === package_wgt) || {}; + const hasAppPackage = !!Object.keys(appVersionInDb).length; + const hasWgtPackage = !!Object.keys(wgtVersionInDb).length; + + // 取两个版本中版本号最大的包,版本一样,使用wgt包 + let stablePublishDb = hasAppPackage ? + hasWgtPackage ? + compare(wgtVersionInDb.version, appVersionInDb.version) >= 0 ? + wgtVersionInDb : + appVersionInDb : + appVersionInDb : + wgtVersionInDb; + + const { + version, + min_uni_version + } = stablePublishDb; + + // 库中的version必须满足同时大于appVersion和wgtVersion才行,因为上次更新可能是wgt更新 + const appUpdate = compare(version, appVersion) === 1; // app包可用更新 + const wgtUpdate = compare(version, wgtVersion) === 1; // wgt包可用更新 + + if (Object.keys(stablePublishDb).length && appUpdate && wgtUpdate) { + // 判断是否可用wgt更新 + if (min_uni_version && compare(min_uni_version, appVersion) < 1) { + return { + code: 101, + message: 'wgt更新', + ...stablePublishDb + }; + } else if (hasAppPackage && compare(appVersionInDb.version, appVersion) === 1) { + return { + code: 102, + message: '整包更新', + ...appVersionInDb + }; + } + } + + return { + code: 0, + message: '当前版本已经是最新的,不需要更新' + }; + } + + return { + code: -101, + message: '暂无更新或检查appid是否填写正确' + }; + } + + return { + code: -102, + message: '请检查传参是否填写正确' + }; +}; + +/** + * 对比版本号,如需要,请自行修改判断规则 + * 支持比对 ("3.0.0.0.0.1.0.1", "3.0.0.0.0.1") ("3.0.0.1", "3.0") ("3.1.1", "3.1.1.1") 之类的 + * @param {Object} v1 + * @param {Object} v2 + * v1 > v2 return 1 + * v1 < v2 return -1 + * v1 == v2 return 0 + */ +function compare(v1 = '0', v2 = '0') { + v1 = String(v1).split('.') + v2 = String(v2).split('.') + const minVersionLens = Math.min(v1.length, v2.length); + + let result = 0; + for (let i = 0; i < minVersionLens; i++) { + const curV1 = Number(v1[i]) + const curV2 = Number(v2[i]) + + if (curV1 > curV2) { + result = 1 + break; + } else if (curV1 < curV2) { + result = -1 + break; + } + } + + if (result === 0 && (v1.length !== v2.length)) { + const v1BiggerThenv2 = v1.length > v2.length; + const maxLensVersion = v1BiggerThenv2 ? v1 : v2; + for (let i = minVersionLens; i < maxLensVersion.length; i++) { + const curVersion = Number(maxLensVersion[i]) + if (curVersion > 0) { + v1BiggerThenv2 ? result = 1 : result = -1 + break; + } + } + } + + return result; +} diff --git a/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/index.js b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7fbaae834365803b747dae57283959cb054cde46 --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/index.js @@ -0,0 +1,91 @@ +'use strict'; +const success = { + success: true +} +const fail = { + success: false +} +const checkVersion = require('./checkVersion') + +exports.main = async (event, context) => { + //event为客户端上传的参数 + + const db = uniCloud.database() + const appListDBName = 'opendb-app-list' + const appVersionDBName = 'opendb-app-versions' + let res = {}; + + if (event.headers) { + try { + if (event.httpMethod.toLocaleLowerCase() === 'get') { + event = event.queryStringParameters; + } else { + event = JSON.parse(event.body); + } + } catch (e) { + return { + code: 500, + msg: '请求错误' + }; + } + } + + let params = event.data || event.params; + switch (event.action) { + case 'checkVersion': + res = await checkVersion(event, context) + break; + case 'deleteFile': + res = await uniCloud.deleteFile({ + fileList: params.fileList + }) + break; + case 'setNewAppData': + params.value.create_date = Date.now() + res = await db.collection(appListDBName).doc(params.id).set(params.value) + break; + case 'getAppInfo': + let dbAppList + try { + dbAppList = db.collection(appListDBName) + } catch (e) {} + + if (!dbAppList) return fail; + + const dbAppListRecord = await dbAppList.where({ + appid: params.appid + }).get() + + if (dbAppListRecord && dbAppListRecord.data.length) + return Object.assign({}, success, dbAppListRecord.data[0]) + + //返回数据给客户端 + return fail + break; + case 'getAppVersionInfo': + let dbVersionList + try { + dbVersionList = db.collection(appVersionDBName) + } catch (e) {} + + if (!dbVersionList) return fail; + + const dbVersionListrecord = await dbVersionList.where({ + appid: params.appid, + platform: params.platform, + type: "native_app", + stable_publish: true + }) + .orderBy('create_date', 'desc') + .get(); + + if (dbVersionListrecord && dbVersionListrecord.data && dbVersionListrecord.data.length > 0) + return Object.assign({}, dbVersionListrecord.data[0], success) + + return fail + break; + } + + //返回数据给客户端 + return res +}; diff --git a/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/package.json b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ae7bc6c7da94cd00c37cbfcaca65e50244a2a1ad --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/package.json @@ -0,0 +1,7 @@ +{ + "name": "uni-app-manager", + "dependencies": {}, + "extensions": { + "uni-cloud-jql": {} + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/uni-app-manager.param.json b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/uni-app-manager.param.json new file mode 100644 index 0000000000000000000000000000000000000000..e43d322ec03246028f7a5270177af6ae228fa23e --- /dev/null +++ b/uniCloud-aliyun/cloudfunctions/uni-upgrade-center/uni-app-manager.param.json @@ -0,0 +1,10 @@ +// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。 + +// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam + +{ + "action": "checkVersion", + "appid": "__UNI__HelloUNIApp", + "appVersion": "1.0.0", + "wgtVersion": "1.0.0" +} diff --git a/uniCloud-aliyun/database/db_init.json b/uniCloud-aliyun/database/db_init.json index 20f4b1f4bd95d20ea2c4187ef839e9b37d658840..8a0734060c9b1f65a82204a062706eef297e3be9 100644 --- a/uniCloud-aliyun/database/db_init.json +++ b/uniCloud-aliyun/database/db_init.json @@ -1,70 +1,59 @@ -// 在本文件中可配置云数据库初始化,数据格式见:https://uniapp.dcloud.io/uniCloud/cf-database?id=db_init +// 在本文件中可配置云数据库初始化,数据格式见:https://uniapp.dcloud.io/uniCloud/hellodb?id=db-init // 编写完毕后对本文件点右键,可按配置规则创建表和添加数据 { - "opendb-verify-codes": { - "data": [] - }, - "uni-id-roles": { - "data": [] - }, - "uni-id-permissions": { - "data": [] - }, - "uni-id-log": { - "data": [] + "uni-id-users": { + "data": [{ + "_id": "_uni_starter_test_user_id", + "username": "uni-starter预置用户名", + "nickname": "测试用户昵称", + "avatar": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", + "mobile": "18888888888", + "mobile_confirmed": 1 + }] }, - "opendb-admin-menus": { + "opendb-banner": { "data": [{ - "menu_id": "system_management", - "name": "系统管理", - "icon": "uni-icons-gear", - "url": "", - "sort": 1000, - "parent_id": "", - "permission": [], - "enable": true, - "create_date": 1602662469396 - }, { - "menu_id": "system_user", - "name": "用户管理", - "icon": "uni-icons-person", - "url": "/pages/system/user/list", - "sort": 1010, - "parent_id": "system_management", - "permission": [], - "enable": true, - "create_date": 1602662469398 - }, { - "menu_id": "system_role", - "name": "角色管理", - "icon": "uni-icons-personadd", - "url": "/pages/system/role/list", - "sort": 1020, - "parent_id": "system_management", - "permission": [], - "enable": true, - "create_date": 1602662469397 - }, { - "menu_id": "system_permission", - "name": "权限管理", - "icon": "uni-icons-locked", - "url": "/pages/system/permission/list", - "sort": 1030, - "parent_id": "system_management", - "permission": [], - "enable": true, - "create_date": 1602662469396 - }, { - "menu_id": "system_menu", - "name": "菜单管理", - "icon": "uni-icons-settings", - "url": "/pages/system/menu/list", - "sort": 1040, - "parent_id": "system_management", - "permission": [], - "enable": true, - "create_date": 1602662469396 - }] + "status": true, + "bannerfile": { + "name": "094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg", + "extname": "jpg", + "fileType": "image", + "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/b88a7e17-35f0-4d0d-bc32-93f8909baf03.jpg", + "size": 70880, + "image": { + "width": 500, + "height": 333, + "location": "blob:http://localhost:8081/a3bfaab4-7ee6-44d5-a171-dc8225d83598" + }, + "path": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/b88a7e17-35f0-4d0d-bc32-93f8909baf03.jpg" + }, + "open_url": "https://www.dcloud.io/", + "title": "测试", + "sort": 1, + "category_id": "", + "description": "" + }, + { + "status": true, + "bannerfile": { + "name": "094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg", + "extname": "jpg", + "fileType": "image", + "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/9db94cb4-a5e0-4ed9-b356-b42a392b3112.jpg", + "size": 70880, + "image": { + "width": 500, + "height": 333, + "location": "blob:http://localhost:8081/1a6f718a-4012-476a-9172-590fef2cc518" + }, + "path": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/9db94cb4-a5e0-4ed9-b356-b42a392b3112.jpg" + }, + "open_url": "https://www.dcloud.io/", + "title": "", + "category_id": "", + "description": "" + } + ] }, "opendb-news-articles": { "data": [{ @@ -73,7 +62,7 @@ "content": "

随着微信、阿里、百度、头条、QQ纷纷推出小程序,开发者的开发维护成本持续上升,负担过重。这点已经成为共识,现在连小程序平台厂商也充分意识到了。

\n

阿里小程序团队,为了减轻开发者的负担,在官方的小程序开发者工具中整合了多端框架。

\n

经过阿里团队仔细评估,uni-app 在产品完成度、跨平台支持度、开发者社区、可持续发展等多方面优势明显,最终选定 uni-app内置于阿里小程序开发工具中,为开发者提供多端开发解决方案。

\n

经过之前1个月的公测,10月10日,阿里小程序正式发布0.70版开发者工具,通过 uni-app 实现多端开发,成为本次版本更新的亮点功能!

\n

如下图,在阿里小程序工具左侧主导航选择 uni-app,创建项目,即可开发。

\n
\n


阿里小程序开发工具更新说明详见:https://docs.alipay.com/mini/ide/0.70-stable

\n

 

\n

集成uni-app,这对于阿里团队而言,并不是一个容易做出的决定。毕竟 uni-app 是一个三方产品,要经过复杂的评审流程。

\n

这一方面突显出阿里团队以开发者需求为本的优秀价值观,另一方面也证明 uni-app的产品确实过硬。

\n

很多开发者都有多端需求,但又没有足够精力去了解、评估 uni-app,而处于观望态度。现在大家可以更放心的使用 uni-app 了,它没有让阿里失望,也不会让你失望。

\n

自从uni-app推出以来,DCloud也取得了高速的发展,目前拥有370万开发者,框架运行在4.6亿手机用户设备上,月活达到1.35亿(仅包括部分接入DCloud统计平台的数据)。并且数据仍在高速增长中,在市场占有率上处于遥遥领先的位置。

\n

本次阿里小程序工具集成 uni-app,会让 uni-app 继续快速爆发,取得更大的成功。

\n

后续DCloud还将深化与阿里的合作,在serverless等领域给开发者提供更多优质服务。

\n

使用多端框架开发各端应用,是多赢的模式。开发者减轻了负担,获得了更多新流量。而小程序平台厂商,也能保证自己平台上的各种应用可以被及时的更新。

\n

DCloud欢迎更多小程序平台厂商,与我们一起合作,为开发者、平台、用户的多赢而努力。

\n

进一步了解uni-app,详见:https://uniapp.dcloud.io

\n

欢迎扫码关注DCloud公众号,转发消息到朋友圈。

", "avatar": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-gacrhzeynhss7c6d04/249516a0-3941-11eb-899d-733ae62bed2f.jpg", "type": 0, - "user_id": "123", + "user_id": "_uni_starter_test_user_id", "comment_count": 0, "like_count": 0, "comment_status": 0, @@ -99,59 +88,536 @@ "stable_publish": false, "type": "native_app", "create_date": 1616771628150 + }], + "index": [{ + "IndexName": "appid", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "appid", + "Direction": "1" + }, { + "Name": "uni_platform", + "Direction": "1" + }, { + "Name": "create_env", + "Direction": "1" + }], + "MgoIsUnique": false + } + }, { + "IndexName": "查找上线发行应用", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "appid", + "Direction": "1" + }, { + "Name": "platform", + "Direction": "1" + }, { + "Name": "stable_publish", + "Direction": "1" + }, { + "Name": "uni_platform", + "Direction": "1" + }, { + "Name": "create_env", + "Direction": "1" + }], + "MgoIsUnique": false + } }] }, - "uni-id-users": { - "data": [{ - "_id": "123", - "username": "预置用户", - "nickname": "测试", - "avatar": "https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-dc-site/d84c6de0-6080-11eb-bdc1-8bd33eb6adaa.png", - "mobile": "18888888888", - "mobile_confirmed": 1 + "opendb-verify-codes": { + "data": [] + }, + "opendb-app-list": { + "data": [], + "index": [{ + "IndexName": "appid", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "appid", + "Direction": "1" + }], + "MgoIsUnique": true + } + }, { + "IndexName": "name", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "name", + "Direction": "1" + }], + "MgoIsUnique": false + } }] }, - "opendb-banner": { + "uni-id-roles": { + "data": [] + }, + "uni-id-permissions": { + "data": [] + }, + "uni-id-log": { + "data": [] + }, + "opendb-admin-menus": { "data": [{ - "status": true, - "bannerfile": { - "name": "094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg", - "extname": "jpg", - "fileType": "image", - "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/b88a7e17-35f0-4d0d-bc32-93f8909baf03.jpg", - "size": 70880, - "image": { - "width": 500, - "height": 333, - "location": "blob:http://localhost:8081/a3bfaab4-7ee6-44d5-a171-dc8225d83598" - }, - "path": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/b88a7e17-35f0-4d0d-bc32-93f8909baf03.jpg" + "menu_id": "index", + "name": "首页", + "icon": "uni-icons-home", + "url": "/", + "sort": 100, + "parent_id": "", + "permission": [], + "enable": true, + "create_date": 1602662469396 + }, { + "menu_id": "system_management", + "name": "系统管理", + "icon": "admin-icons-fl-xitong", + "url": "", + "sort": 1000, + "parent_id": "", + "permission": [], + "enable": true, + "create_date": 1602662469396 + }, { + "menu_id": "system_user", + "name": "用户管理", + "icon": "admin-icons-manager-user", + "url": "/pages/system/user/list", + "sort": 1010, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1602662469398 + }, { + "menu_id": "system_role", + "name": "角色管理", + "icon": "admin-icons-manager-role", + "url": "/pages/system/role/list", + "sort": 1020, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1602662469397 + }, { + "menu_id": "system_permission", + "name": "权限管理", + "icon": "admin-icons-manager-permission", + "url": "/pages/system/permission/list", + "sort": 1030, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1602662469396 + }, { + "menu_id": "system_menu", + "name": "菜单管理", + "icon": "admin-icons-manager-menu", + "url": "/pages/system/menu/list", + "sort": 1040, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1602662469396 + }, { + "menu_id": "system_app", + "name": "应用管理", + "icon": "admin-icons-manager-app", + "url": "/pages/system/app/list", + "sort": 1035, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1602662469399 + }, { + "menu_id": "system_update", + "name": "App升级中心", + "icon": "uni-icons-cloud-upload", + "url": "/uni_modules/uni-upgrade-center/pages/version/list", + "sort": 1036, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1656491532434 + }, { + "menu_id": "system_tag", + "name": "标签管理", + "icon": "admin-icons-manager-tag", + "url": "/pages/system/tag/list", + "sort": 1037, + "parent_id": "system_management", + "permission": [], + "enable": true, + "create_date": 1602662479389 + }, { + "permission": [], + "enable": true, + "menu_id": "safety_statistics", + "name": "安全审计", + "icon": "admin-icons-safety", + "url": "", + "sort": 3100, + "parent_id": "", + "create_date": 1638356430871 + }, { + "permission": [], + "enable": true, + "menu_id": "safety_statistics_user_log", + "name": "用户日志", + "icon": "", + "url": "/pages/system/safety/list", + "sort": 3101, + "parent_id": "safety_statistics", + "create_date": 1638356430871 + }, { + "permission": [], + "enable": true, + "menu_id": "uni-stat", + "name": "uni 统计", + "icon": "admin-icons-tongji", + "url": "", + "sort": 2100, + "parent_id": "", + "create_date": 1638356430871 + }, { + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device", + "name": "设备统计", + "icon": "admin-icons-shebeitongji", + "url": "", + "sort": 2120, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-device", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device-overview", + "name": "概况", + "icon": "", + "url": "/pages/uni-stat/device/overview/overview", + "sort": 2121, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-device", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device-activity", + "name": "活跃度", + "icon": "", + "url": "/pages/uni-stat/device/activity/activity", + "sort": 2122, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-device", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device-trend", + "name": "趋势分析", + "icon": "", + "url": "/pages/uni-stat/device/trend/trend", + "sort": 2123, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-device", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device-retention", + "name": "留存", + "icon": "", + "url": "/pages/uni-stat/device/retention/retention", + "sort": 2124, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-device", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device-comparison", + "name": "平台对比", + "icon": "", + "url": "/pages/uni-stat/device/comparison/comparison", + "sort": 2125, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-device", + "permission": [], + "enable": true, + "menu_id": "uni-stat-device-stickiness", + "name": "粘性", + "icon": "", + "url": "/pages/uni-stat/device/stickiness/stickiness", + "sort": 2126, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "menu_id": "uni-stat-user", + "name": "注册用户统计", + "icon": "admin-icons-yonghutongji", + "url": "", + "sort": 2122, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-user", + "permission": [], + "enable": true, + "menu_id": "uni-stat-user-overview", + "name": "概况", + "icon": "", + "url": "/pages/uni-stat/user/overview/overview", + "sort": 2121, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-user", + "permission": [], + "enable": true, + "menu_id": "uni-stat-user-activity", + "name": "活跃度", + "icon": "", + "url": "/pages/uni-stat/user/activity/activity", + "sort": 2122, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-user", + "permission": [], + "enable": true, + "icon": "", + "menu_id": "uni-stat-user-trend", + "name": "趋势分析", + "url": "/pages/uni-stat/user/trend/trend", + "sort": 2123, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-user", + "permission": [], + "enable": true, + "menu_id": "uni-stat-user-retention", + "name": "留存", + "icon": "", + "url": "/pages/uni-stat/user/retention/retention", + "sort": 2124, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-user", + "permission": [], + "enable": true, + "menu_id": "uni-stat-user-comparison", + "name": "平台对比", + "icon": "", + "url": "/pages/uni-stat/user/comparison/comparison", + "sort": 2125, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-user", + "permission": [], + "enable": true, + "menu_id": "uni-stat-user-stickiness", + "name": "粘性", + "icon": "", + "url": "/pages/uni-stat/user/stickiness/stickiness", + "sort": 2126, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "menu_id": "uni-stat-page-analysis", + "name": "页面统计", + "icon": "admin-icons-page-ent", + "url": "", + "sort": 2123, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-page-analysis", + "permission": [], + "enable": true, + "menu_id": "uni-stat-page-res", + "name": "受访页", + "icon": "", + "url": "/pages/uni-stat/page-res/page-res", + "sort": 2131, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-page-analysis", + "permission": [], + "enable": true, + "menu_id": "uni-stat-page-ent", + "name": "入口页", + "icon": "", + "url": "/pages/uni-stat/page-ent/page-ent", + "sort": 2132, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "menu_id": "uni-stat-senceChannel", + "name": "渠道/场景值分析", + "icon": "admin-icons-qudaofenxi", + "url": "", + "sort": 2150, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-senceChannel", + "permission": [], + "enable": true, + "menu_id": "uni-stat-senceChannel-scene", + "name": "场景值(小程序)", + "icon": "", + "url": "/pages/uni-stat/scene/scene", + "sort": 2151, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-senceChannel", + "permission": [], + "enable": true, + "menu_id": "uni-stat-senceChannel-channel", + "name": "渠道(app)", + "icon": "", + "url": "/pages/uni-stat/channel/channel", + "sort": 2152, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "menu_id": "uni-stat-event-event", + "name": "自定义事件", + "icon": "admin-icons-shijianfenxi", + "url": "/pages/uni-stat/event/event", + "sort": 2160, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "menu_id": "uni-stat-error", + "name": "错误统计", + "icon": "admin-icons-cuowutongji", + "url": "", + "sort": 2170, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-error", + "permission": [], + "enable": true, + "menu_id": "uni-stat-error-js", + "name": "js报错", + "icon": "", + "url": "/pages/uni-stat/error/js/js", + "sort": 2171, + "create_date": 1638356902516 + }, { + "parent_id": "uni-stat-error", + "permission": [], + "enable": true, + "menu_id": "uni-stat-error-app", + "name": "app崩溃", + "icon": "", + "url": "/pages/uni-stat/error/app/app", + "sort": 2172, + "create_date": 1638356902516 }, - "open_url": "https://www.dcloud.io/", - "title": "测试", - "sort": 1, - "category_id": "", - "description": "" - }, - { - "status": true, - "bannerfile": { - "name": "094a9dc0-50c0-11eb-b680-7980c8a877b8.jpg", - "extname": "jpg", - "fileType": "image", - "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/9db94cb4-a5e0-4ed9-b356-b42a392b3112.jpg", - "size": 70880, - "image": { - "width": 500, - "height": 333, - "location": "blob:http://localhost:8081/1a6f718a-4012-476a-9172-590fef2cc518" - }, - "path": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e/9db94cb4-a5e0-4ed9-b356-b42a392b3112.jpg" - }, - "open_url": "https://www.dcloud.io/", - "title": "", - "category_id": "", - "description": "" - }] - } -} \ No newline at end of file + { + "menu_id": "uni-stat-pay", + "name": "支付统计", + "icon": "uni-icons-circle", + "url": "", + "sort": 2122, + "parent_id": "uni-stat", + "permission": [], + "enable": true, + "create_date": 1667386977981 + }, { + "menu_id": "uni-stat-pay-overview", + "name": "概况", + "icon": "", + "url": "/pages/uni-stat/pay-order/overview/overview", + "sort": 21221, + "parent_id": "uni-stat-pay", + "permission": [], + "enable": true, + "create_date": 1667387038602 + }, + { + "menu_id": "uni-stat-pay-funnel", + "name": "转换漏斗分析", + "icon": "", + "url": "/pages/uni-stat/pay-order/funnel/funnel", + "sort": 21222, + "parent_id": "uni-stat-pay", + "permission": [], + "enable": true, + "create_date": 1668430092890 + }, + { + "menu_id": "uni-stat-pay-ranking", + "name": "价值用户排行", + "icon": "", + "url": "/pages/uni-stat/pay-order/ranking/ranking", + "sort": 21223, + "parent_id": "uni-stat-pay", + "permission": [], + "enable": true, + "create_date": 1668430128302 + }, + { + "menu_id": "uni-stat-pay-order-list", + "name": "订单明细", + "icon": "", + "url": "/pages/uni-stat/pay-order/list/list", + "sort": 21224, + "parent_id": "uni-stat-pay", + "permission": [], + "enable": true, + "create_date": 1667387078947 + } + ] + }, + "uni-id-tag": {}, + "uni-id-device": {}, + "opendb-device": {}, + "opendb-department": {}, + "opendb-sms-task": {}, + "opendb-sms-log": {}, + "opendb-sms-template": {}, + "opendb-open-data": {}, + "uni-stat-app-versions": {}, + "uni-stat-active-devices": {}, + "uni-stat-active-users": {}, + "uni-stat-app-channels": {}, + "uni-stat-app-crash-logs": {}, + "uni-stat-app-platforms": {}, + "uni-stat-error-logs": {}, + "uni-stat-error-result": {}, + "uni-stat-event-logs": {}, + "uni-stat-event-result": {}, + "uni-stat-events": {}, + "uni-stat-loyalty-result": {}, + "uni-stat-mp-scenes": {}, + "uni-stat-page-logs": {}, + "uni-stat-page-result": {}, + "uni-stat-pages": {}, + "uni-stat-result": {}, + "uni-stat-run-errors": {}, + "uni-stat-session-logs": {}, + "uni-stat-share-logs": {}, + "uni-stat-user-session-logs": {}, + "uni-pay-orders": {}, + "uni-stat-pay-result": {}, + "opendb-tempdata": {}, + "opendb-feedback": {}, + "opendb-news-categories": {}, + "opendb-news-comments": {}, + "opendb-news-favorite": {}, + "opendb-search-hot": {}, + "opendb-search-log": {}, + "opendb-sign-in": {}, + "read-news-log": {}, + "uni-id-scores": {} +} diff --git a/uniCloud-aliyun/database/opendb-admin-menus.schema.json b/uniCloud-aliyun/database/opendb-admin-menus.schema.json index cfeef1b4562a4a372fd850fcf86226c26fb58bc0..41045ed51c38f351e9a1840b67c3c5def8c7e5bd 100644 --- a/uniCloud-aliyun/database/opendb-admin-menus.schema.json +++ b/uniCloud-aliyun/database/opendb-admin-menus.schema.json @@ -2,7 +2,10 @@ "bsonType": "object", "required": ["name", "menu_id"], "permission": { - "read": true + "read": true, + "create": "'CREATE_OPENDB_ADMIN_MENUS' in auth.permission", + "update": "'UPDATE_OPENDB_ADMIN_MENUS' in auth.permission", + "delete": "'DELETE_OPENDB_ADMIN_MENUS' in auth.permission" }, "properties": { "_id": { diff --git a/uniCloud-aliyun/database/opendb-app-versions.schema.json b/uniCloud-aliyun/database/opendb-app-versions.schema.json index 6d1fa8b7959983af7649c1d55548c2672cc410bc..853798eba8f7f710773278bc45a38af46c507a67 100644 --- a/uniCloud-aliyun/database/opendb-app-versions.schema.json +++ b/uniCloud-aliyun/database/opendb-app-versions.schema.json @@ -1,11 +1,18 @@ +// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema { "bsonType": "object", - "required": ["appid", "platform", "version", "url", "contents", "type"], + "required": [ + "appid", + "uni_platform", + "version", + "type", + "create_env" + ], "permission": { - "read": false, - "create": false, - "update": false, - "delete": false + "read": "'READ_OPENDB_APP_VERSIONS' in auth.permission", + "create": "'CREATE_OPENDB_APP_VERSIONS' in auth.permission", + "update": "'UPDATE_OPENDB_APP_VERSIONS' in auth.permission", + "delete": "'DELETE_OPENDB_APP_VERSIONS' in auth.permission" }, "properties": { "_id": { @@ -56,25 +63,31 @@ }, "platform": { "bsonType": "array", - "enum": [{ - "value": "Android", - "text": "安卓" - }, { - "value": "iOS", - "text": "苹果" - }], + "enum": [ + { + "value": "Android", + "text": "安卓" + }, + { + "value": "iOS", + "text": "苹果" + } + ], "description": "更新平台,Android || iOS || [Android, iOS]", "label": "平台" }, "type": { "bsonType": "string", - "enum": [{ - "value": "native_app", - "text": "原生App安装包" - }, { - "value": "wgt", - "text": "Wgt资源包" - }], + "enum": [ + { + "value": "native_app", + "text": "原生App安装包" + }, + { + "value": "wgt", + "text": "Wgt资源包" + } + ], "description": "安装包类型,native_app || wgt", "label": "安装包类型" }, @@ -90,8 +103,8 @@ }, "url": { "bsonType": "string", - "description": "可下载安装包地址", - "label": "包地址" + "description": "可下载或跳转的链接", + "label": "链接" }, "stable_publish": { "bsonType": "bool", @@ -119,6 +132,47 @@ "componentForEdit": { "name": "uni-dateformat" } + }, + "uni_platform": { + "bsonType": "string", + "description": "uni平台信息,如:mp-weixin/web/ios/android", + "label": "uni 平台" + }, + "create_env": { + "bsonType": "string", + "description": "创建来源,uni-stat:uni统计自动创建,upgrade-center:升级中心管理员创建" + }, + "store_list": { + "bsonType": "array", + "description": "发布的应用市场", + "label": "应用市场", + "properties": { + "id": { + "bsonType": "string", + "description": "应用id,自动生成", + "label": "id" + }, + "name": { + "bsonType": "string", + "description": "应用名称", + "label": "应用名称" + }, + "scheme": { + "bsonType": "string", + "description": "应用 scheme", + "label": "应用 scheme" + }, + "enable": { + "bsonType": "bool", + "description": "是否启用" + }, + "priority": { + "bsonType": "int", + "description": "按照从大到小排序", + "label": "优先级" + } + } } - } -} + }, + "version": "0.0.1" +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/opendb-sms-log.schema.json b/uniCloud-aliyun/database/opendb-sms-log.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..ed66233fdbfafa031c0d230b304b97add1428b59 --- /dev/null +++ b/uniCloud-aliyun/database/opendb-sms-log.schema.json @@ -0,0 +1,63 @@ +{ + "bsonType": "object", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "task_id": { + "bsonType": "string", + "description": "任务ID", + "foreignKey": "batch-sms-task._id" + }, + "uid": { + "bsonType": "string", + "description": "用户ID", + "foreignKey": "uni-id-users._id" + }, + "mobile": { + "bsonType": "int", + "description": "手机号" + }, + "var_data": { + "bsonType": "object", + "description": "变量数据" + }, + "status": { + "bsonType": "int", + "description": "发送状态", + "defaultValue": 0, + "enum": [{ + "text": "未发送", + "value": 0 + }, { + "text": "已发送", + "value": 1 + }, { + "text": "发送失败", + "value": 2 + }] + }, + "reason": { + "bsonType": "string", + "description": "发送失败原因" + }, + "send_date": { + "bsonType": "timestamp", + "description": "发送时间" + }, + "ccreate_date": { + "bsonType": "timestamp", + "description": "创建时间", + "forceDefaultValue": { + "$env": "now" + } + } + } +} diff --git a/uniCloud-aliyun/database/opendb-sms-task.schema.json b/uniCloud-aliyun/database/opendb-sms-task.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..e7cb923d4657eeed5c13ae435093172c8ee43da5 --- /dev/null +++ b/uniCloud-aliyun/database/opendb-sms-task.schema.json @@ -0,0 +1,76 @@ +{ + "bsonType": "object", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "name": { + "bsonType": "string", + "description": "任务名称", + "trim": "both" + }, + "app_id": { + "bsonType": "string", + "description": "App ID", + "trim": "both" + }, + "template_id": { + "bsonType": "string", + "description": "短信模板ID", + "trim": "both" + }, + "template_content": { + "bsonType": "string", + "description": "短信模板内容", + "trim": "both" + }, + "vars": { + "bsonType": "array", + "description": "短信变量" + }, + "to": { + "bsonType": "object", + "description": "短信接收者信息", + "properties": { + "all": { + "bsonType": "bool", + "description": "全部用户发送" + }, + "type": { + "bsonType": "string", + "description": "to.all=true时用来区分发送类型, 可选值 user | userTags" + }, + "receiver": { + "bsonType": "array", + "description": "用户ID's \/ 用户标签ID's" + } + } + }, + "send_qty": { + "bsonType": "int", + "description": "发送总数" + }, + "success_qty": { + "bsonType": "int", + "description": "成功总数" + }, + "fail_qty": { + "bsonType": "int", + "description": "失败总数" + }, + "create_date": { + "bsonType": "timestamp", + "description": "创建时间", + "forceDefaultValue": { + "$env": "now" + } + } + } +} diff --git a/uniCloud-aliyun/database/opendb-sms-template.schema.json b/uniCloud-aliyun/database/opendb-sms-template.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..e8e571e382f2f1ed6b36be8941a8c110d2ee9bba --- /dev/null +++ b/uniCloud-aliyun/database/opendb-sms-template.schema.json @@ -0,0 +1,32 @@ +// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema +{ + "bsonType": "object", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "模板ID" + }, + "name": { + "bsonType": "string", + "description": "模板名称" + }, + "content": { + "bsonType": "string", + "description": "模板内容" + }, + "type": { + "bsonType": "int", + "description": "模板类型" + }, + "sign": { + "bsonType": "string", + "description": "模板签名" + } + } +} diff --git a/uniCloud-aliyun/database/opendb-tempdata.schema.json b/uniCloud-aliyun/database/opendb-tempdata.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..1a741f36b85d63e78ba744bc802074f257c02dac --- /dev/null +++ b/uniCloud-aliyun/database/opendb-tempdata.schema.json @@ -0,0 +1,22 @@ +{ + "bsonType": "object", + "required": ["value", "expired"], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "value": { + "description": "值" + }, + "expired": { + "description": "过期时间", + "bsonType": "timestamp" + } + } +} diff --git a/uniCloud-aliyun/database/uni-id-tag.schema.json b/uniCloud-aliyun/database/uni-id-tag.schema.json index 1d1c81531decbffebf5aa7b3bacb9c149b79d158..18ac09da4fea85513cab1c9718aa103344142e2e 100644 --- a/uniCloud-aliyun/database/uni-id-tag.schema.json +++ b/uniCloud-aliyun/database/uni-id-tag.schema.json @@ -2,10 +2,10 @@ "bsonType": "object", "required": ["tagid", "name"], "permission": { - "read": false, - "create": false, - "update": false, - "delete": false + "read": "'READ_UNI_ID_TAG' in auth.permission", + "create": "'CREATE_UNI_ID_TAG' in auth.permission", + "update": "'UPDATE_UNI_ID_TAG' in auth.permission", + "delete": "'DELETE_UNI_ID_TAG' in auth.permission" }, "properties": { "_id": { diff --git a/uniCloud-aliyun/database/uni-pay-orders.schema.json b/uniCloud-aliyun/database/uni-pay-orders.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..d3236a8e2766a457c14fb58cf4a205904c6e1d43 --- /dev/null +++ b/uniCloud-aliyun/database/uni-pay-orders.schema.json @@ -0,0 +1,241 @@ +{ + "bsonType": "object", + "required": [], + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "provider": { + "title": "支付供应商", + "bsonType": "string", + "enum": [{ + "text": "微信支付", + "value": "wxpay" + }, + { + "text": "支付宝", + "value": "alipay" + }, + { + "text": "苹果应用内支付", + "value": "appleiap" + } + ], + "description": "支付供应商 如 wxpay alipay 参考 https://uniapp.dcloud.net.cn/api/plugins/provider.html#" + }, + "provider_pay_type": { + "title": "支付方式", + "bsonType": "string", + "description": "支付供应商的支付类型(插件内部标记支付类型的标识,不需要用户传)", + "trim": "both" + }, + "uni_platform": { + "title": "应用平台", + "bsonType": "string", + "description": "uni客户端平台,如:web、mp-weixin、mp-alipay、app等", + "trim": "both" + }, + "status": { + "title": "订单状态", + "bsonType": "int", + "enum": [{ + "text": "已关闭", + "value": -1 + }, + { + "text": "未支付", + "value": 0 + }, + { + "text": "已支付", + "value": 1 + }, + { + "text": "已部分退款", + "value": 2 + }, + { + "text": "已全额退款", + "value": 3 + } + ], + "description": "订单状态 -1 已关闭 0:未支付 1:已支付 2:已部分退款 3:已全额退款", + "defaultValue": 0 + }, + "type": { + "title": "订单类型", + "bsonType": "string", + "description": "订单类型 goods:订单付款 recharge:余额充值付款 vip:vip充值付款 等等,可自定义", + "trim": "both" + }, + "order_no": { + "title": "业务系统订单号", + "bsonType": "string", + "minLength": 20, + "maxLength": 28, + "description": "业务系统订单号,控制在20-28位(不可以是24位,24位在阿里云空间可能会有问题,可重复,代表1个业务订单会有多次付款的情况)", + "trim": "both" + }, + "out_trade_no": { + "title": "支付插件订单号", + "bsonType": "string", + "description": "支付插件订单号(需控制唯一,不传则由插件自动生成)", + "trim": "both" + }, + "transaction_id": { + "title": "交易单号", + "bsonType": "string", + "description": "交易单号(支付平台订单号,由支付平台控制唯一)", + "trim": "both" + }, + "user_id": { + "title": "用户ID", + "bsonType": "string", + "description": "用户id,参考uni-id-users表", + "foreignKey": "uni-id-users._id" + }, + "nickname": { + "title": "用户昵称", + "bsonType": "string", + "description": "用户昵称冗余", + "trim": "both" + }, + "device_id": { + "bsonType": "string", + "description": "客户端设备ID" + }, + "client_ip": { + "title": "客户端IP", + "bsonType": "string", + "description": "创建支付的客户端ip", + "trim": "both" + }, + "openid": { + "title": "openid", + "bsonType": "string", + "description": "发起支付的用户openid", + "trim": "both" + }, + "description": { + "title": "支付描述", + "bsonType": "string", + "description": "支付描述,如:uniCloud个人版包月套餐", + "trim": "both" + }, + "err_msg": { + "title": "支付失败原因", + "bsonType": "string", + "description": "支付失败原因", + "trim": "both" + }, + "total_fee": { + "title": "订单总金额", + "bsonType": "int", + "description": "订单总金额,单位为分,100等于1元" + }, + "refund_fee": { + "title": "订单总退款金额", + "bsonType": "int", + "description": "订单总退款金额,单位为分,100等于1元" + }, + "refund_count": { + "title": "当前退款笔数", + "bsonType": "int", + "description": "当前退款笔数 (退款单号为 out_trade_no-refund_count)" + }, + "refund_list": { + "title": "退款详情", + "bsonType": "array", + "description": "退款详情" + }, + "provider_appid": { + "title": "开放平台appid", + "bsonType": "string", + "description": "公众号appid,小程序appid,app开放平台appid 等", + "trim": "both" + }, + "appid": { + "title": "DCloud AppId", + "bsonType": "string", + "description": "dcloud_appid", + "trim": "both" + }, + "user_order_success": { + "title": "回调状态", + "bsonType": "bool", + "description": "用户异步通知逻辑是否全部执行完成,且无异常(建议前端通过此参数是否为true来判断是否支付成功)" + }, + "custom": { + "title": "自定义数据", + "bsonType": "object", + "description": "自定义数据(用户自定义数据)" + }, + "original_data": { + "title": "异步通知原始数据", + "bsonType": "object", + "description": "异步回调通知返回的原始数据,微信v2是xml转json后的数据,微信v3和支付宝是原始json" + }, + "create_date": { + "title": "创建时间", + "bsonType": "timestamp", + "description": "创建时间", + "forceDefaultValue": { + "$env": "now" + } + }, + "pay_date": { + "title": "支付时间", + "bsonType": "timestamp", + "description": "支付时间" + }, + "notify_date": { + "title": "异步通知时间", + "bsonType": "timestamp", + "description": "订单通知支付成功时间" + }, + "cancel_date": { + "title": "取消时间", + "bsonType": "timestamp", + "description": "订单取消时间" + }, + "stat_data": { + "title": "uni统计相关数据", + "bsonType": "object", + "description": "uni统计相关数据", + "properties": { + "platform": { + "bsonType": "string", + "description": "与uni_platform唯一区别是APP区分 android 和 ios" + }, + "app_version": { + "bsonType": "string", + "description": "客户端版本号 (字符串形式)如1.0.0" + }, + "app_version_code": { + "bsonType": "string", + "description": "客户端版本号(数字形式) 如100" + }, + "app_wgt_version": { + "bsonType": "string", + "description": "客户端热更新版本号" + }, + "os": { + "bsonType": "string", + "description": "设备的操作系统 如 android ios" + }, + "ua": { + "bsonType": "string", + "description": "客户端userAgent" + }, + "channel": { + "bsonType": "string", + "description": "客户端渠道" + }, + "scene": { + "bsonType": "string", + "description": "小程序场景值" + } + } + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-active-devices.schema.json b/uniCloud-aliyun/database/uni-stat-active-devices.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..c3e2afe28fbce5426bd1640cf0318d28fe85a0df --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-active-devices.schema.json @@ -0,0 +1,67 @@ +// 活跃设备表 +{ + "bsonType": "object", + "description": "给周月维度的设备基础统计和留存统计提供数据,每日跑批合并,仅添加本周/本月首次访问的设备", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "is_new": { + "bsonType": "int", + "description": "是否为新设备", + "defaultValue": 0, + "enum": [{ + "text": "否", + "value": 0 + }, { + "text": "是", + "value": 1 + }] + }, + "dimension": { + "bsonType": "string", + "description": "时间范围 week:周,month:月", + "enum": [{ + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + }] + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/uni-stat-active-users.schema.json b/uniCloud-aliyun/database/uni-stat-active-users.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..7c3f421b0d7c5b6d41bdce6dd119d1b6cdd1921a --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-active-users.schema.json @@ -0,0 +1,55 @@ +// 活跃用户表 +{ + "bsonType": "object", + "description": "给周月维度的用户基础统计和留存统计提供数据,每日跑批合并,仅添加本周/本月首次访问的用户。", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "uid": { + "bsonType": "string", + "description": "用户编号, 对应uni-id-users._id" + }, + "dimension": { + "bsonType": "string", + "description": "时间范围 week:周,month:月", + "enum": [{ + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + }] + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/uni-stat-app-channels.schema.json b/uniCloud-aliyun/database/uni-stat-app-channels.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..3a7c1f830f489f1569f79f73c3bc19d81c6ae728 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-app-channels.schema.json @@ -0,0 +1,44 @@ +// 应用渠道表 +{ + "bsonType": "object", + "description": "提供渠道和场景值数据", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_APP_CHANNELS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "统计应用ID,对应opendb-app-list.appid", + "foreignKey": "opendb-app-list.appid" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_code": { + "bsonType": "int", + "description": "客户端上报的渠道代码" + }, + "channel_name": { + "bsonType": "string", + "description": "渠道名称,用户可编辑" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + }, + "last_modify_time": { + "bsonType": "timestamp", + "description": "最后修改时间" + } + } +} + diff --git a/uniCloud-aliyun/database/uni-stat-app-crash-logs.schema.json b/uniCloud-aliyun/database/uni-stat-app-crash-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..389e2f61ffbd03ba448cda56c96204ec81510e7c --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-app-crash-logs.schema.json @@ -0,0 +1,137 @@ +// 原生应用崩溃日志表 +{ + "bsonType": "object", + "description": "记录原生应用的崩溃日志", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_APP_CRASH_LOGS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "用户端上报的应用ID" + }, + "version": { + "bsonType": "string", + "description": "用户端上报的应用版本号。manifest.json中的version->name的值" + }, + "platform": { + "bsonType": "string", + "description": "用户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "用户端上报的渠道code\/场景值" + }, + "sdk_version": { + "bsonType": "string", + "description": "基础库版本号" + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "device_net": { + "bsonType": "string", + "description": "设备网络型号wifi\/3G\/4G\/" + }, + "device_os": { + "bsonType": "string", + "description": "系统版本:iOS平台为系统版本号,如15.1;Android平台为API等级,如30" + }, + "device_os_version": { + "bsonType": "string", + "description": "系统版本名称:iOS平台与os字段一致;Android平台为版本名称,如5.1.1" + }, + "device_vendor": { + "bsonType": "string", + "description": "设备供应商 " + }, + "device_model": { + "bsonType": "string", + "description": "设备型号" + }, + "device_is_root": { + "bsonType": "int", + "description": "是否root:1表示root;0表示未root" + }, + "device_os_name": { + "bsonType": "string", + "description": "系统名称:用于区别Android和鸿蒙,仅Android支持" + }, + "device_batt_level": { + "bsonType": "int", + "description": "设备电池电量:取值范围0-100,仅Android支持" + }, + "device_batt_temp": { + "bsonType": "string", + "description": "电池温度,仅Android支持" + }, + "device_memory_use_size": { + "bsonType": "int", + "description": "系统已使用内存,单位为Byte,仅Android支持" + }, + "device_memory_total_size": { + "bsonType": "int", + "description": "系统总内存,单位为Byte,仅Android支持" + }, + "device_disk_use_size": { + "bsonType": "int", + "description": "系统磁盘已使用大小,单位为Byte,仅Android支持" + }, + "device_disk_total_size": { + "bsonType": "int", + "description": "系统磁盘总大小,单位为Byte,仅Android支持" + }, + "device_abis": { + "bsonType": "string", + "description": "设备支持的CPU架构:多个使用,分割,如arm64-v8a,armeabi-v7a,armeabi,仅Android支持" + }, + "app_count": { + "bsonType": "int", + "description": "运行的app个数:包括运行的uni小程序数目。独立App时值为1" + }, + "app_use_memory_size": { + "bsonType": "int", + "description": "APP使用的内存量,单位为Byte" + }, + "app_webview_count": { + "bsonType": "int", + "description": "打开Webview窗口的个数" + }, + "app_use_duration": { + "bsonType": "int", + "description": "APP使用时长:单位为s" + }, + "app_run_fore": { + "bsonType": "int", + "description": "是否前台运行:1表示前台运行,0表示后台运行" + }, + "package_name": { + "bsonType": "string", + "description": "原生应用包名" + }, + "package_version": { + "bsonType": "string", + "description": "Android的apk版本名称;iOS的ipa版本名称" + }, + "page_url": { + "bsonType": "string", + "description": "页面url" + }, + "error_msg": { + "bsonType": "string", + "description": "错误信息" + }, + "create_time": { + "bsonType": "timestamp", + "description": "客户端记录到的崩溃时间" + } + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/uni-stat-app-platforms.schema.json b/uniCloud-aliyun/database/uni-stat-app-platforms.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..6c46b4f13981d5e078bcffbe5428010b56488981 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-app-platforms.schema.json @@ -0,0 +1,46 @@ +// 应用平台表 +{ + "bsonType": "object", + "description": "提供应用的平台字典", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_APP_PLATFORMS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "code": { + "bsonType": "string", + "description": "平台代码,前端上报" + }, + "name": { + "bsonType": "string", + "description": "平台名称,管理端显示" + }, + "order": { + "bsonType": "int", + "description": "序号,前端页面排序使用", + "defaultValue": 0 + }, + "enable": { + "bsonType": "bool", + "description": "是否启动", + "defaultValue": true, + "enum": [{ + "text": "否", + "value": false + }, { + "text": "是", + "value": true + }] + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-app-versions.schema.json b/uniCloud-aliyun/database/uni-stat-app-versions.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..3c7742f2d248758781031b615c3116fbfffbba60 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-app-versions.schema.json @@ -0,0 +1,38 @@ +{ + "bsonType": "object", + "description": "提供应用的版本号字典", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "统计应用ID,对应opendb-app-list.appid", + "foreignKey": "opendb-app-list.appid" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "version": { + "bsonType": "string", + "description": "应用版本" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + }, + "last_modify_time": { + "bsonType": "timestamp", + "description": "最后修改时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-error-logs.schema.json b/uniCloud-aliyun/database/uni-stat-error-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..b117bec2a6c8e4e02a4c7baddb1289d1627a8b06 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-error-logs.schema.json @@ -0,0 +1,102 @@ +// 应用错误日志表 +{ + "bsonType": "object", + "description": "记录上报的应用运行错误日志", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_ERROR_LOGS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "用户端上报的应用ID" + }, + "version": { + "bsonType": "string", + "description": "用户端上报的应用版本号" + }, + "platform": { + "bsonType": "string", + "description": "用户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "用户端上报的渠道code\/场景值" + }, + "error_type": { + "bsonType": "int", + "description": "错误类型", + "defaultValue": 0, + "enum": [{ + "text": "未知", + "value": 0 + }, { + "text": "表示webview页面js异常(uni-app项目对应vue页面)", + "value": 2 + }, { + "text": "表示uni框架js异常(仅uni-app项目)", + "value": 4 + }, { + "text": "表示控制页js异常(仅uni-app项目)", + "value": 5 + }, { + "text": "表示nvue页面js异常(仅uni-app项目)", + "value": 6 + }] + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "uid": { + "bsonType": "string", + "description": "用户编号, 对应uni-id-users._id" + }, + "os": { + "bsonType": "string", + "description": "客户端操作系统" + }, + "ua": { + "bsonType": "string", + "description": "客户端user-agent信息" + }, + "space_id": { + "bsonType": "string", + "description": "服务空间编号" + }, + "space_provider": { + "bsonType": "string", + "description": "服务空间提供商" + }, + "sdk_version": { + "bsonType": "string", + "description": "小程序基础库版本号" + }, + "platform_version": { + "bsonType": "string", + "description": "微信、支付宝宿主App的版本号" + }, + "error_msg": { + "bsonType": "string", + "description": "错误信息" + }, + "error_hash": { + "bsonType": "string", + "description": "错误hash码" + }, + "page_url": { + "bsonType": "string", + "description": "页面url" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-error-result.schema.json b/uniCloud-aliyun/database/uni-stat-error-result.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..0bb60c214e07c3107fe475579e89737b3a881bc8 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-error-result.schema.json @@ -0,0 +1,96 @@ +// 错误数据统计结果表 +{ + "bsonType": "object", + "description": "存储汇总的错误日志的数据", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_ERROR_RESULT' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "type": { + "bsonType": "string", + "description": "错误类型", + "enum": [{ + "text": "前端js错误", + "value": "js" + }, { + "text": "原生应用崩溃错误", + "value": "crash" + }] + }, + "hash": { + "bsonType": "string", + "description": "错误hash码" + }, + "msg": { + "bsonType": "string", + "description": "错误信息" + }, + "count": { + "bsonType":"int", + "description":"报错次数" + }, + "app_launch_count": { + "bsonType": "int", + "description": "本时间段App启动或从后台切到前台的次数" + }, + "last_time": { + "bsonType":"timestamp", + "description":"最近一次报错事件" + }, + "dimension": { + "bsonType": "string", + "description": "统计范围 day:按天统计,hour:按小时统计", + "enum": [{ + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + },{ + "text": "天", + "value": "day" + }, { + "text": "小时", + "value": "hour" + }] + }, + "stat_date":{ + "bsonType":"int", + "description":"统计日期,格式yyyymmdd,例:20211201" + }, + "start_time":{ + "bsonType":"timestamp", + "description":"开始时间" + }, + "end_time":{ + "bsonType":"timestamp", + "description":"结束时间" + } + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/uni-stat-event-logs.schema.json b/uniCloud-aliyun/database/uni-stat-event-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..2e109f0d7072cf7c835dfda5efcee5be1b088989 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-event-logs.schema.json @@ -0,0 +1,116 @@ +// 应用事件日志表 +{ + "bsonType": "object", + "description": "记录上报的事件日志", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_EVENT_LOGS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "客户端上报的应用ID" + }, + "version": { + "bsonType": "string", + "description": "客户端上报的应用版本号" + }, + "platform": { + "bsonType": "string", + "foreignKey": "uni-stat-app-platforms.code", + "description": "客户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "客户端上报的渠道code\/场景值" + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "uid": { + "bsonType": "string", + "description": "用户编号, 对应uni-id-users._id" + }, + "session_id": { + "bsonType": "string", + "description": "访问会话日志ID,对应uni-stat-session-logs._id", + "foreignKey": "uni-stat-session-logs._id" + }, + "page_id": { + "bsonType": "string", + "description": "页面ID,对应uni-stat-pages._id", + "foreignKey": "uni-stat-pages._id" + }, + "event_key": { + "bsonType": "string", + "description": "客户端上报的key" + }, + "param": { + "bsonType": "string", + "description": "事件参数" + }, + "sdk_version": { + "bsonType": "string", + "description": "基础库版本号" + }, + "platform_version": { + "bsonType": "string", + "description": "平台版本,如微信、支付宝宿主App版本号" + }, + "device_os": { + "bsonType": "int", + "description": "设备系统编号,1:安卓,2:iOS,3:PC" + }, + "device_os_version": { + "bsonType": "string", + "description": "设备系统版本" + }, + "device_net": { + "bsonType": "string", + "description": "设备网络型号wifi\/3G\/4G\/" + }, + "device_vendor": { + "bsonType": "string", + "description": "设备供应商 " + }, + "device_model": { + "bsonType": "string", + "description": "设备型号" + }, + "device_language": { + "bsonType": "string", + "description": "设备语言包" + }, + "device_pixel_ratio": { + "bsonType": "string", + "description": "设备像素比 " + }, + "device_window_width": { + "bsonType": "string", + "description": "设备窗口宽度 " + }, + "device_window_height": { + "bsonType": "string", + "description": "设备窗口高度" + }, + "device_screen_width": { + "bsonType": "string", + "description": "设备屏幕宽度" + }, + "device_screen_height": { + "bsonType": "string", + "description": "设备屏幕高度" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-event-result.schema.json b/uniCloud-aliyun/database/uni-stat-event-result.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..c78dff7414d911534ad7d956d277547646c32c6e --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-event-result.schema.json @@ -0,0 +1,82 @@ +// 事件统计结果表 +{ + "bsonType": "object", + "description": "存储汇总的事件日志的数据", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_EVENT_RESULT' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "event_key": { + "bsonType": "string", + "description": "事件key,对应uni-stat-events.event_key", + "foreignKey": "uni-stat-events.event_key" + }, + "event_count": { + "bsonType": "int", + "description": "触发次数" + }, + "device_count": { + "bsonType": "int", + "description": "触发该事件的设备数" + }, + "user_count": { + "bsonType": "int", + "description": "触发该事件的用户数" + }, + "dimension": { + "bsonType": "string", + "description": "统计范围 day:按天统计,hour:按小时统计", + "enum": [{ + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + }, { + "text": "天", + "value": "day" + }, { + "text": "小时", + "value": "hour" + }] + }, + "stat_date": { + "bsonType": "int", + "description": "统计日期,格式yyyymmdd,例:20211201" + }, + "start_time": { + "bsonType": "timestamp", + "description": "开始时间" + }, + "end_time": { + "bsonType": "timestamp", + "description": "结束时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-events.schema.json b/uniCloud-aliyun/database/uni-stat-events.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..f3c0d3363a22f23f30f2ee2ec447fff0473d329a --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-events.schema.json @@ -0,0 +1,38 @@ +// 应用事件表 +{ + "bsonType": "object", + "description": "提供应用的事件字典", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_EVENTS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "统计应用ID,对应opendb-app-list.appid", + "foreignKey": "opendb-app-list.appid" + }, + "event_key": { + "bsonType": "string", + "description": "事件键值" + }, + "event_name": { + "bsonType": "string", + "description": "事件名称" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + }, + "update_time": { + "bsonType": "timestamp", + "description": "last_modify_time" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-loyalty-result.schema.json b/uniCloud-aliyun/database/uni-stat-loyalty-result.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..37848b373e92cceff579efcb5c0d3e0afe4d2389 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-loyalty-result.schema.json @@ -0,0 +1,84 @@ +// 用户忠诚度统计表 +{ + "bsonType": "object", + "description": "存储汇总的设备/用户的粘性数据", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_LOYALTY_RESULT' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "visit_depth_data": { + "bsonType": "object", + "description": "访问深度数据", + "properties": { + "visit_users": { + "bsonType": "object", + "description": "访问用户数" + }, + "visit_devices": { + "bsonType": "object", + "description": "访问设备数" + }, + "visit_times": { + "bsonType": "object", + "description": "访问次数" + } + } + }, + "duration_data": { + "bsonType": "object", + "description": "访问时长数据", + "properties": { + "visit_users": { + "bsonType": "object", + "description": "访问用户数" + }, + "visit_devices": { + "bsonType": "object", + "description": "访问设备数" + }, + "visit_times": { + "bsonType": "object", + "description": "访问次数" + } + } + }, + "stat_date": { + "bsonType": "int", + "description": "统计日期,格式yyyymmdd,例:20211201" + }, + "start_time": { + "bsonType": "timestamp", + "description": "开始时间" + }, + "end_time": { + "bsonType": "timestamp", + "description": "结束时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-mp-scenes.schema.json b/uniCloud-aliyun/database/uni-stat-mp-scenes.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..c126cad7483cfd9091b9f4c9254763c3edccba73 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-mp-scenes.schema.json @@ -0,0 +1,34 @@ +// 小程序场景值对照表 +{ + "bsonType": "object", + "description": "提供应用渠道和小程序场景值的数据字典", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "platform": { + "bsonType": "string", + "description": "应用平台,对应uni-stat-app-platforms.code", + "foreignKey": "uni-stat-app-platforms.code" + }, + "scene_code": { + "bsonType": "string", + "description": "场景代码" + }, + "scene_name": { + "bsonType": "string", + "description": "场景名称" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/uni-stat-page-logs.schema.json b/uniCloud-aliyun/database/uni-stat-page-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..616e451214cc2cd48218f2495118e1a0bfebdbf4 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-page-logs.schema.json @@ -0,0 +1,79 @@ +// 应用页面访问日志表 +{ + "bsonType": "object", + "description": "记录上报的页面访问日志", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_PAGE_LOGS' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "version": { + "bsonType": "string", + "description": "用户端上报的应用版本号" + }, + "platform": { + "bsonType": "string", + "description": "用户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "用户端上报的渠道code\/场景值" + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "uid": { + "bsonType": "string", + "description": "用户编号, 对应uni-id-users._id" + }, + "session_id": { + "bsonType": "string", + "description": "访问会话日志ID,对应uni-stat-session-logs._id", + "foreignKey": "uni-stat-session-logs._id" + }, + "page_id": { + "bsonType": "string", + "description": "当前页面ID,对应uni-stat-pages._id", + "foreignKey": "uni-stat-pages._id" + }, + "previous_page_id": { + "bsonType": "string", + "description": "上级页面ID,为空表示第一个页面, 对应uni-stat-pages._id" + }, + "previous_page_duration": { + "bsonType": "int", + "description": "上级页面停留时间,单位秒,前端上报" + }, + "previous_page_is_entry": { + "bsonType": "int", + "defaultValue": 0, + "description": " 上级页面是否为入口页, 0否 1是", + "enum": [{ + "text": "否", + "value": 0 + }, { + "text": "是", + "value": 1 + }] + }, + "query_string": { + "bsonType": "string", + "description": "页面参数" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-page-result.schema.json b/uniCloud-aliyun/database/uni-stat-page-result.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..72065c2867d921d181e4e456dba1656a03d36551 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-page-result.schema.json @@ -0,0 +1,114 @@ +// 页面统计结果表 +{ + "bsonType": "object", + "description": "存储汇总的页面访问日志的数据", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_PAGE_RESULT' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "page_id": { + "bsonType": "string", + "description": "页面表ID,对应页面表ID,对应uni-stat-pages._id", + "foreignKey": "uni-stat-pages._id" + }, + "visit_times": { + "bsonType": "int", + "description": "访问次数" + }, + "visit_devices": { + "bsonType": "int", + "description": "访问设备数" + }, + "exit_times": { + "bsonType": "int", + "description": "退出次数" + }, + "duration": { + "bsonType": "int", + "description": "访问总时长,单位秒" + }, + "share_count": { + "bsonType": "int", + "description": "分享次数" + }, + "entry_devices": { + "bsonType": "int", + "description": "当前页作为入口页的设备数" + }, + "entry_users": { + "bsonType": "int", + "description": "当前页作为入口页的用户数" + }, + "entry_count": { + "bsonType": "int", + "description": "当前页作为入口页的总次数" + }, + "entry_duration": { + "bsonType": "int", + "description": "当前页作为入口时,本页面的总访问时长,单位秒" + }, + "bounce_times": { + "bsonType": "int", + "description": "跳出次数" + }, + "bounce_rate": { + "bsonType": "double", + "description": "跳出率" + }, + "dimension": { + "bsonType": "string", + "description": "统计范围 day:按天统计,hour:按小时统计", + "enum": [{ + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + }, { + "text": "天", + "value": "day" + }, { + "text": "小时", + "value": "hour" + }] + }, + "stat_date": { + "bsonType": "int", + "description": "统计日期,格式yyyymmdd,例:20211201" + }, + "start_time": { + "bsonType": "timestamp", + "description": "开始时间" + }, + "end_time": { + "bsonType": "timestamp", + "description": "结束时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-pages.schema.json b/uniCloud-aliyun/database/uni-stat-pages.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..5a074c66b29ba28de1b0929a7844cad6773748e7 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-pages.schema.json @@ -0,0 +1,34 @@ +// 应用页面表 +{ + "bsonType": "object", + "description": "提供应用的页面字典", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_PAGES' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "统计应用ID,对应opendb-app-list.appid", + "foreignKey": "opendb-app-list.appid" + }, + "path": { + "bsonType": "string", + "description": "页面路径,如`\/pages\/index\/index`" + }, + "title": { + "bsonType": "string", + "description": "页面标题" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-pay-result.schema.json b/uniCloud-aliyun/database/uni-stat-pay-result.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..ed78636499009be7caf7818150933ec35105c0be --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-pay-result.schema.json @@ -0,0 +1,169 @@ +{ + "bsonType": "object", + "description": "存储统计汇总的支付数据", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID,对应opendb-app-list.appid", + "foreignKey": "opendb-app-list.appid" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "pay_total_amount": { + "bsonType": "int", + "description": "支付金额:统计时间内,成功支付的订单金额之和(不剔除退款订单)。单位分。" + }, + "pay_order_count": { + "bsonType": "int", + "description": "支付笔数:统计时间内,成功支付的订单数,一个订单对应唯一一个订单号。(不剔除退款订单。)" + }, + "pay_user_count": { + "bsonType": "int", + "description": "支付人数:统计时间内,成功支付的人数(不剔除退款订单)。" + }, + "pay_device_count": { + "bsonType": "int", + "description": "支付设备数:统计时间内,成功支付的设备数(不剔除退款订单)。" + }, + "create_total_amount": { + "bsonType": "int", + "description": "下单金额:统计时间内,成功下单的订单金额(不剔除退款订单)。单位分。" + }, + "create_order_count": { + "bsonType": "int", + "description": "下单笔数:统计时间内,成功下单的订单笔数(不剔除退款订单)。" + }, + "create_user_count": { + "bsonType": "int", + "description": "下单人数:统计时间内,成功下单的客户数,一人多次下单记为一人(不剔除退款订单)。" + }, + "create_device_count": { + "bsonType": "int", + "description": "下单设备数:统计时间内,成功下单的设备数,一台设备多次访问被计为一台(不剔除退款订单)。" + }, + "refund_total_amount": { + "bsonType": "int", + "description": "成功退款金额:统计时间内,成功退款的金额。以成功退款时间点为准。单位分。" + }, + "refund_order_count": { + "bsonType": "int", + "description": "成功退款订单数:统计时间内,成功退款的订单数。以成功退款时间点为准。" + }, + "refund_user_count": { + "bsonType": "int", + "description": "成功退款人数:统计时间内,成功退款的人数(不剔除退款订单)。" + }, + "refund_device_count": { + "bsonType": "int", + "description": "成功退款设备数:统计时间内,成功退款的设备数(不剔除退款订单)。" + }, + "activity_user_count": { + "bsonType": "int", + "description": "访问人数:统计时间内,访问人数,一人多次访问被计为一人(只统计已登录的用户)。" + }, + "activity_device_count": { + "bsonType": "int", + "description": "访问设备数:统计时间内,访问设备数,一台设备多次访问被计为一台(包含未登录的用户)。" + }, + "new_user_count": { + "bsonType": "int", + "description": "新增注册人数:统计时间内,注册人数。" + }, + "new_device_count": { + "bsonType": "int", + "description": "新增新设备数:统计时间内,新设备数。" + }, + "new_user_create_order_count": { + "bsonType": "int", + "description": "新用户下单人数:统计时间内,新增注册人数中下单的人数。" + }, + "new_user_pay_order_count": { + "bsonType": "int", + "description": "新用户支付人数:统计时间内,新增注册人数中下成功支付的人数。" + }, + "dimension": { + "bsonType": "string", + "description": "统计范围 hour:按小时统计,day:按天统计,week:按周统计,month:按月统计 quarter:按季度统计 year:按年统计", + "enum": [{ + "text": "年", + "value": "year" + }, { + "text": "季度", + "value": "quarter" + }, { + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + }, { + "text": "天", + "value": "day" + }, { + "text": "小时", + "value": "hour" + }] + }, + "create_date": { + "bsonType": "timestamp", + "description": "创建时间" + }, + "start_time": { + "bsonType": "timestamp", + "description": "统计开始时间" + }, + "end_time": { + "bsonType": "timestamp", + "description": "统计结束时间" + }, + "stat_date": { + "bsonType": "object", + "description": "统计日期参数", + "properties": { + "date_str": { + "bsonType": "string", + "description": "如:2021-07-27" + }, + "year": { + "bsonType": "int", + "description": "年" + }, + "month": { + "bsonType": "int", + "description": "月" + }, + "day": { + "bsonType": "int", + "description": "日" + }, + "hour": { + "bsonType": "int", + "description": "时" + } + } + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-result.schema.json b/uniCloud-aliyun/database/uni-stat-result.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..53edd172ccccaf20ba2637ba2d46c2b4c7dd46f7 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-result.schema.json @@ -0,0 +1,156 @@ +// 应用统计结果表 +{ + "bsonType": "object", + "description": "存储统计汇总的会话数据包括不限于设备\/用户的数量、访问量、活跃度(日活、周活、月活)、留存率(日留存、周留存、月留存)、跳出率、访问时长等数据", + "required": [], + "permission": { + "read": "'READ_UNI_STAT_RESULT' in auth.permission", + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "应用ID,对应opendb-app-list.appid", + "foreignKey": "opendb-app-list.appid" + }, + "platform_id": { + "bsonType": "string", + "description": "应用平台ID,对应uni-stat-app-platforms._id", + "foreignKey": "uni-stat-app-platforms._id" + }, + "channel_id": { + "bsonType": "string", + "description": "渠道\/场景值ID,对应uni-stat-app-channels._id", + "foreignKey": "uni-stat-app-channels._id" + }, + "version_id": { + "bsonType": "string", + "description": "应用版本ID,对应opendb-app-versions._id", + "foreignKey": "opendb-app-versions._id" + }, + "total_users": { + "bsonType": "int", + "description": "历史累计总用户数" + }, + "new_user_count": { + "bsonType": "int", + "description": "本时间段新增用户数" + }, + "active_user_count": { + "bsonType": "int", + "description": "本时间段活跃用户数" + }, + "total_devices": { + "bsonType": "int", + "description": "历史累计总设备数" + }, + "new_device_count": { + "bsonType": "int", + "description": "本时间段新增设备数" + }, + "user_session_times": { + "bsonType": "int", + "description": "本时间段用户的会话次数" + }, + "active_device_count": { + "bsonType": "int", + "description": "本时间段活跃设备数" + }, + "app_launch_count": { + "bsonType": "int", + "description": "本时间段App启动或从后台切到前台的次数" + }, + "error_count": { + "bsonType": "int", + "description": "本时间段报错次数" + }, + "duration": { + "bsonType": "int", + "description": "时间段内,所有会话访问总时长,单位秒" + }, + "user_duration": { + "bsonType": "int", + "description": "本次登录用户的会话总时长,单位为秒" + }, + "avg_device_session_time": { + "bsonType": "int", + "description": "设备的次均停留时长,单位秒" + }, + "avg_device_time": { + "bsonType": "int", + "defaultValue": "设均停留时长(平均每台设备的停留时长),单位秒" + }, + "avg_user_session_time": { + "bsonType": "int", + "description": "用户的次均停留时长,单位秒" + }, + "avg_user_time": { + "bsonType": "int", + "defaultValue": "人均停留时长(平均每个登录用户的停留时长),单位秒" + }, + "bounce_times": { + "bsonType": "int", + "description": "跳出次数" + }, + "bounce_rate": { + "bsonType": "double", + "description": "跳出率" + }, + "retention": { + "bsonType": "object", + "description": "留存信息", + "properties": { + "active_user": { + "bsonType": "object", + "description": "活跃用户留存信息" + }, + "new_user": { + "bsonType": "object", + "description": "新增用户留存信息" + }, + "active_device": { + "bsonType": "object", + "description": "活跃设备留存信息" + }, + "new_device": { + "bsonType": "object", + "description": "新增设备留存信息" + } + } + }, + "dimension": { + "bsonType": "string", + "description": "统计范围 day:按天统计,hour:按小时统计", + "enum": [{ + "text": "月", + "value": "month" + }, { + "text": "周", + "value": "week" + }, { + "text": "天", + "value": "day" + }, { + "text": "小时", + "value": "hour" + }] + }, + "stat_date": { + "bsonType": "int", + "description": "统计日期,格式yyyymmdd,例:20211201" + }, + "start_time": { + "bsonType": "timestamp", + "description": "开始时间" + }, + "end_time": { + "bsonType": "timestamp", + "description": "结束时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-run-errors.schema.json b/uniCloud-aliyun/database/uni-stat-run-errors.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..8dfecb3163a8ce2ea0411b0a3e86cfa2aef8eb50 --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-run-errors.schema.json @@ -0,0 +1,33 @@ +// 运行错误日志表 +{ + "bsonType": "object", + "description": "记录数据统计时运行出错的日志", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "mod": { + "bsonType": "string", + "description": "运行模块" + }, + "params": { + "bsonType": "object", + "description": "运行参数" + }, + "error": { + "bsonType": "string", + "description": "错误信息" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-session-logs.schema.json b/uniCloud-aliyun/database/uni-stat-session-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..352c3f10203de8c71324a931e3276d591f2061ca --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-session-logs.schema.json @@ -0,0 +1,192 @@ +// 应用会话日志表 +{ + "bsonType": "object", + "description": "记录设备访问时产生的会话日志", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "客户端上报的应用ID" + }, + "version": { + "bsonType": "string", + "description": "客户端上报的应用版本号" + }, + "platform": { + "bsonType": "string", + "description": "客户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "客户端上报的渠道code\/场景值" + }, + "type": { + "bsonType": "string", + "description": "会话类型", + "defaultValue": 1, + "enum": [{ + "text": "正常进入上报", + "value": 1 + }, { + "text": "后台进前台超时上报", + "value": 2 + }, { + "text": "页面停留超时上报", + "value": 3 + }] + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "last_visit_user_id": { + "bsonType": "string", + "description": "本次会话最终访问用户的ID, uni-id-users._id,客户端上报" + }, + "is_first_visit": { + "bsonType": "int", + "description": "是否为首次访问", + "defaultValue": 0, + "enum": [{ + "text": "否", + "value": 0 + }, { + "text": "是", + "value": 1 + }] + }, + "first_visit_time": { + "bsonType": "timestamp", + "description": "用户首次访问时间" + }, + "last_visit_time": { + "bsonType": "timestamp", + "description": "用户最后一次访问时间" + }, + "total_visit_count": { + "bsonType": "int", + "description": "用户累计访问次数,客户端上报" + }, + "entry_page_id": { + "bsonType": "string", + "description": "本次会话入口页面ID, 同uni-stat-pagesd" + }, + "exit_page_id": { + "bsonType": "string", + "description": "本次会话退出页面ID, 同uni-stat-pagesd" + }, + "page_count": { + "bsonType": "int", + "description": "本次会话浏览的页面数" + }, + "event_count": { + "bsonType": "int", + "description": "本次会话产生的事件数" + }, + "duration": { + "bsonType": "int", + "description": "本次会话时长,单位为秒,服务端计算" + }, + "sdk_version": { + "bsonType": "string", + "description": "基础库版本号" + }, + "platform_version": { + "bsonType": "string", + "description": "平台版本,如微信、支付宝宿主App版本号" + }, + "device_os": { + "bsonType": "int", + "description": "设备系统编号,1:安卓,2:iOS,3:PC" + }, + "device_os_version": { + "bsonType": "string", + "description": "设备系统版本" + }, + "device_net": { + "bsonType": "string", + "description": "设备网络型号wifi\/3G\/4G\/" + }, + "device_vendor": { + "bsonType": "string", + "description": "设备供应商 " + }, + "device_model": { + "bsonType": "string", + "description": "设备型号" + }, + "device_language": { + "bsonType": "string", + "description": "设备语言包" + }, + "device_pixel_ratio": { + "bsonType": "string", + "description": "设备像素比 " + }, + "device_window_width": { + "bsonType": "string", + "description": "设备窗口宽度 " + }, + "device_window_height": { + "bsonType": "string", + "description": "设备窗口高度" + }, + "device_screen_width": { + "bsonType": "string", + "description": "设备屏幕宽度" + }, + "device_screen_height": { + "bsonType": "string", + "description": "设备屏幕高度" + }, + "location_ip": { + "bsonType": "string", + "description": "ip" + }, + "location_latitude": { + "bsonType": "double", + "description": "纬度" + }, + "location_longitude": { + "bsonType": "double", + "description": "经度" + }, + "location_country": { + "bsonType": "string", + "description": "国家" + }, + "location_province": { + "bsonType": "string", + "description": "省份" + }, + "location_city": { + "bsonType": "string", + "description": "城市" + }, + "is_finish": { + "bsonType": "int", + "defaultValue": 0, + "description": "本次会话是否结束,0:否,1是", + "enum": [{ + "text": "否", + "value": 0 + }, { + "text": "是", + "value": 1 + }] + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} diff --git a/uniCloud-aliyun/database/uni-stat-share-logs.schema.json b/uniCloud-aliyun/database/uni-stat-share-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..b527dc129ec7d98bd524def4254edb3fa50ff15d --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-share-logs.schema.json @@ -0,0 +1,55 @@ +// 应用分享日志表 +{ + "bsonType": "object", + "description": "记录触发分享事件的日志", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "客户端上报的应用ID" + }, + "version": { + "bsonType": "string", + "description": "客户端上报的应用版本号" + }, + "platform": { + "bsonType": "string", + "description": "客户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "客户端上报的渠道code\/场景值" + }, + "device_id": { + "bsonType": "string", + "description": "客户端携带的设备标识" + }, + "uid": { + "bsonType": "string", + "description": "用户编号, 对应uni-id-users._id" + }, + "session_id": { + "bsonType": "string", + "description": "访问会话日志ID,对应uni-stat-session-logs._id", + "foreignKey": "uni-stat-session-logs._id" + }, + "page_id": { + "bsonType": "string", + "description": "当前页面ID,对应uni-stat-pagesd", + "foreignKey": "uni-stat-pagesd" + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} \ No newline at end of file diff --git a/uniCloud-aliyun/database/uni-stat-user-session-logs.schema.json b/uniCloud-aliyun/database/uni-stat-user-session-logs.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..6af735318ded885f0ee94d359ad0dabc5b8d4aad --- /dev/null +++ b/uniCloud-aliyun/database/uni-stat-user-session-logs.schema.json @@ -0,0 +1,82 @@ +// 用户会话日志表 +{ + "bsonType": "object", + "description": "记录登录用户的会话日志", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "appid": { + "bsonType": "string", + "description": "客户端携带的应用ID" + }, + "version": { + "bsonType": "string", + "description": "客户端上报的应用版本号" + }, + "platform": { + "bsonType": "string", + "description": "客户端上报的平台code" + }, + "channel": { + "bsonType": "string", + "description": "客户端上报的渠道code\/场景值" + }, + "session_id": { + "bsonType": "string", + "description": "访问会话日志ID,对应uni-stat-session-logs._id", + "foreignKey": "uni-stat-session-logs._id" + }, + "uid": { + "bsonType": "string", + "description": "本次会话最终访问用户的ID, uni-id-users._id" + }, + "last_visit_time": { + "bsonType": "timestamp", + "description": "用户最后一次访问时间" + }, + "entry_page_id": { + "bsonType": "string", + "description": "本次会话入口页面ID, 同uni-stat-pagesd" + }, + "exit_page_id": { + "bsonType": "string", + "description": "本次会话退出页面ID, 同uni-stat-pagesd" + }, + "page_count": { + "bsonType": "int", + "description": "本次会话浏览的页面数" + }, + "event_count": { + "bsonType": "int", + "description": "本次会话产生的事件数" + }, + "duration": { + "bsonType": "int", + "description": "本次会话时长,单位为秒,服务端计算" + }, + "is_finish": { + "bsonType": "int", + "defaultValue": 0, + "description": "本次会话是否结束,0:否,1是", + "enum": [{ + "text": "否", + "value": 0 + }, { + "text": "是", + "value": 1 + }] + }, + "create_time": { + "bsonType": "timestamp", + "description": "创建时间" + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json new file mode 100644 index 0000000000000000000000000000000000000000..65b6ec5caa14f4d770ccba38074fc488c07d02f7 --- /dev/null +++ b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json @@ -0,0 +1,58 @@ +{ + "passwordSecret": "passwordSecret8899", + "tokenSecret": "token8899", + "tokenExpiresIn": 7200, + "tokenExpiresThreshold": 600, + "passwordErrorLimit": 6, + "bindTokenToDevice": false, + "passwordErrorRetryTime": 3600, + "autoSetInviteCode": false, + "forceInviteCode": false, + "app": { + "tokenExpiresIn": 2592000, + "oauth": { + "weixin": { + "appid": "填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appid", + "appsecret": "填写来源微信开放平台https://open.weixin.qq.com/创建的应用的appsecret" + }, + "apple": { + "bundleId": "苹果开发者后台获取的bundleId" + } + } + }, + "mp-weixin": { + "oauth": { + "weixin": { + "appid": "微信小程序登录所用的appid、appsecret需要在对应的小程序管理控制台获取", + "appsecret": "微信小程序后台获取的appsecret" + } + } + }, + "mp-alipay": { + "oauth": { + "alipay": { + "appid": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr", + "privateKey": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr" + } + } + }, + "service": { + "sms": { + "name": "应用名称,对应短信模版的name", + "codeExpiresIn": 300, + "smsKey": "短信密钥key,开通短信服务处可以看到", + "smsSecret": "短信密钥secret,开通短信服务处可以看到", + "sence": { + "bind-mobile": { + "templateId": "", + "codeExpiresIn": 240 + } + } + }, + "univerify": { + "appid": "", + "apiKey": "", + "apiSecret": "" + } + } +} diff --git a/vue.config.js b/vue.config.js index 98ac382ca2978dcd6289c4043fcc1e8b39a510aa..735fc6a469a9b14492c7c1b3ed85ee7355adfaf4 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,8 +1,8 @@ console.log('----vue.config.js----') process.env.UNI_CLOUD_PROVIDER = JSON.stringify([{ "provider": "aliyun", //阿里云 - "clientSecret": "", - "spaceId": "", + "clientSecret": "SEPWNQ91E3Ymgn6ThQ6u8w==", + "spaceId": "52b18b34-3a3e-4861-89a0-c362c7634787", /* "provider": "tencent", "spaceId": "" */ }])