提交 eab26cd5 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

- 更新表结构,解决部分clientDB操作没有权限的问题

上级 2ceb3534
此差异已折叠。
## 2.0.2(2022-09-19)
- 更新表结构,解决部分clientDB操作没有权限的问题
## 2.0.1(2022-09-16) ## 2.0.1(2022-09-16)
- 更改默认值 - 更改默认值
## 2.0.0(2022-09-16) ## 2.0.0(2022-09-16)
......
{ {
"name" : "uni-starter", "name": "",
"appid" : "__UNI__07F7150", "appid": "",
"description" : "", "description": "云端一体应用快速开发基本项目模版",
"versionName" : "1.0.0", "versionName": "",
"versionCode" : "100", "versionCode": "100",
"transformPx" : false, "transformPx": false,
"app-plus" : { "app-plus": {
"usingComponents" : true, "usingComponents": true,
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler": "uni-app",
"compilerVersion" : 3, "compilerVersion": 3,
"splashscreen" : { "splashscreen": {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender": true,
"waiting" : true, "waiting": true,
"autoclose" : true, "autoclose": true,
"delay" : 0 "delay": 0
},
"modules" : {},
"distribute" : {
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
"ios" : {},
"sdkConfigs" : {}
}
}, },
"quickapp" : {}, "modules": {
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
}, },
"mp-alipay" : { "distribute": {
"usingComponents" : true "android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
"ios": {
},
"sdkConfigs": {
}
}
},
"quickapp": {
},
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
}, },
"mp-baidu" : { "usingComponents": true
"usingComponents" : true },
}, "mp-alipay": {
"mp-toutiao" : { "usingComponents": true
"usingComponents" : true },
}, "mp-baidu": {
"uniStatistics" : { "usingComponents": true
"enable" : false },
}, "mp-toutiao": {
"vueVersion" : "2" "usingComponents": true
} },
"uniStatistics": {
"enable": false
},
"vueVersion": "2"
}
\ No newline at end of file
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "2.0.1", "version": "2.0.2",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"bsonType": "object", "bsonType": "object",
"permission": { "permission": {
"update": "doc._id == auth.uid", "update": "doc._id == auth.uid",
"read": "doc._id == auth.uid" "read": true
}, },
"properties": { "properties": {
"_id": { "_id": {
...@@ -12,14 +12,16 @@ ...@@ -12,14 +12,16 @@
"bsonType": "string", "bsonType": "string",
"description": "支付宝平台openid", "description": "支付宝平台openid",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"apple_openid": { "apple_openid": {
"bsonType": "string", "bsonType": "string",
"description": "苹果登录openid", "description": "苹果登录openid",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"avatar": { "avatar": {
...@@ -39,7 +41,8 @@ ...@@ -39,7 +41,8 @@
"title": "备注", "title": "备注",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false "write": false,
"read": false
} }
}, },
"dcloud_appid": { "dcloud_appid": {
...@@ -47,7 +50,8 @@ ...@@ -47,7 +50,8 @@
"description": "允许登录的客户端的appid列表", "description": "允许登录的客户端的appid列表",
"foreignKey": "opendb-app-list.appid", "foreignKey": "opendb-app-list.appid",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"department_id": { "department_id": {
...@@ -61,7 +65,8 @@ ...@@ -61,7 +65,8 @@
"enumType": "tree", "enumType": "tree",
"title": "部门", "title": "部门",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"email": { "email": {
...@@ -71,7 +76,8 @@ ...@@ -71,7 +76,8 @@
"title": "邮箱", "title": "邮箱",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"email_confirmed": { "email_confirmed": {
...@@ -89,7 +95,8 @@ ...@@ -89,7 +95,8 @@
], ],
"title": "邮箱验证状态", "title": "邮箱验证状态",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"gender": { "gender": {
...@@ -111,14 +118,16 @@ ...@@ -111,14 +118,16 @@
], ],
"title": "性别", "title": "性别",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"invite_time": { "invite_time": {
"bsonType": "timestamp", "bsonType": "timestamp",
"description": "受邀时间", "description": "受邀时间",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"inviter_uid": { "inviter_uid": {
...@@ -126,21 +135,24 @@ ...@@ -126,21 +135,24 @@
"description": "用户全部上级邀请者", "description": "用户全部上级邀请者",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"last_login_date": { "last_login_date": {
"bsonType": "timestamp", "bsonType": "timestamp",
"description": "最后登录时间", "description": "最后登录时间",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"last_login_ip": { "last_login_ip": {
"bsonType": "string", "bsonType": "string",
"description": "最后登录时 IP 地址", "description": "最后登录时 IP 地址",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"mobile": { "mobile": {
...@@ -150,7 +162,8 @@ ...@@ -150,7 +162,8 @@
"title": "手机号码", "title": "手机号码",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"mobile_confirmed": { "mobile_confirmed": {
...@@ -168,14 +181,16 @@ ...@@ -168,14 +181,16 @@
], ],
"title": "手机号验证状态", "title": "手机号验证状态",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"my_invite_code": { "my_invite_code": {
"bsonType": "string", "bsonType": "string",
"description": "用户自身邀请码", "description": "用户自身邀请码",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"nickname": { "nickname": {
...@@ -207,7 +222,8 @@ ...@@ -207,7 +222,8 @@
"bsonType": "object", "bsonType": "object",
"description": "实名认证信息", "description": "实名认证信息",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
}, },
"properties": { "properties": {
"auth_date": { "auth_date": {
...@@ -272,14 +288,16 @@ ...@@ -272,14 +288,16 @@
"bsonType": "timestamp", "bsonType": "timestamp",
"description": "注册时间", "description": "注册时间",
"forceDefaultValue": { "forceDefaultValue": {
"$env": "now" "$env": "now",
"read": "doc._id == auth.uid"
} }
}, },
"register_ip": { "register_ip": {
"bsonType": "string", "bsonType": "string",
"description": "注册时 IP 地址", "description": "注册时 IP 地址",
"forceDefaultValue": { "forceDefaultValue": {
"$env": "clientIP" "$env": "clientIP",
"read": "doc._id == auth.uid"
} }
}, },
"role": { "role": {
...@@ -291,7 +309,8 @@ ...@@ -291,7 +309,8 @@
}, },
"foreignKey": "uni-id-roles.role_id", "foreignKey": "uni-id-roles.role_id",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
}, },
"title": "角色" "title": "角色"
}, },
...@@ -299,7 +318,8 @@ ...@@ -299,7 +318,8 @@
"bsonType": "int", "bsonType": "int",
"description": "用户积分,积分变更记录可参考:uni-id-scores表定义", "description": "用户积分,积分变更记录可参考:uni-id-scores表定义",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"status": { "status": {
...@@ -307,7 +327,8 @@ ...@@ -307,7 +327,8 @@
"defaultValue": 0, "defaultValue": 0,
"description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝", "description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
}, },
"enum": [{ "enum": [{
"text": "正常", "text": "正常",
...@@ -330,7 +351,10 @@ ...@@ -330,7 +351,10 @@
}, },
"token": { "token": {
"bsonType": "array", "bsonType": "array",
"description": "用户token" "description": "用户token",
"permission": {
"read": "doc._id == auth.uid"
}
}, },
"username": { "username": {
"bsonType": "string", "bsonType": "string",
...@@ -363,14 +387,16 @@ ...@@ -363,14 +387,16 @@
} }
}, },
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"wx_unionid": { "wx_unionid": {
"bsonType": "string", "bsonType": "string",
"description": "微信unionid", "description": "微信unionid",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"qq_openid": { "qq_openid": {
...@@ -387,14 +413,16 @@ ...@@ -387,14 +413,16 @@
} }
}, },
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
}, },
"qq_unionid": { "qq_unionid": {
"bsonType": "string", "bsonType": "string",
"description": "QQ unionid", "description": "QQ unionid",
"permission": { "permission": {
"write": false "write": false,
"read": "doc._id == auth.uid"
} }
} }
}, },
......
const fs = require('fs'); const fs = require('fs');
module.exports = function(){ module.exports = function(){
console.log('开始执行脚本change_after'); console.log('开始执行脚本change_after');
/* let changelog = fs.readFileSync(process.cwd() + '/changelog.md', 'utf-8').split("##")[1].split("\n").slice(1).join(' '); let changelog = fs.readFileSync(process.cwd() + '/changelog.md', 'utf-8').split("##")[1].split("\n").slice(1).join(' ');
console.log(changelog); console.log(changelog);
// 这里是修改完相关敏感配置后执行的脚本,你可以在这里自定义逻辑, // 这里是修改完相关敏感配置后执行的脚本,你可以在这里自定义逻辑,
// 比如执行git提交命令 // 比如执行git提交命令
var shell = require("shelljs"); var shell = require("shelljs");
var exec = shell.exec; var exec = shell.exec;
...@@ -23,5 +22,5 @@ module.exports = function(){ ...@@ -23,5 +22,5 @@ module.exports = function(){
shell.exit(1); shell.exit(1);
} }
shell.exec(`echo git success ${changelog}`); shell.exec(`echo git success ${changelog}`);
*/
} }
\ No newline at end of file
//脚本文件目录 __dirname //脚本文件目录 __dirname
//运行脚本的目录,即:项目的目录 process.cwd() //运行脚本的目录,即:项目的目录 process.cwd()
//配置文件 //配置文件
const fs = require('fs'), const fs = require('fs'),
Hjson = require('hjson'), Hjson = require('hjson'),
config = Hjson.rt.parse(fs.readFileSync(__dirname+'/config.js', 'utf-8')) config = Hjson.rt.parse(fs.readFileSync(__dirname + '/config.js', 'utf-8'))
const change_after = require('./change_after') const change_after = require('./change_after')
if(process.argv[2] == 'change'){ if (process.argv[2] == 'change') {
change(config,()=>{ change(config, () => {
console.log('脚本change已经执行成功'); console.log('脚本change已经执行成功');
change_after() change_after()
}) })
}else{ } else {
recovery(config) recovery(config)
} }
function change(config,callback){ function change(config, callback) {
const total = Object.keys(config).length const total = Object.keys(config).length
let index = 0; let index = 0;
for (let fileName in config) { for (let fileName in config) {
let path = process.cwd() + fileName let path = process.cwd() + fileName
let copyPath = __dirname + '/copy' + fileName let copyPath = __dirname + '/copy' + fileName
let fileText = fs.readFileSync(path, 'utf-8') let fileText = fs.readFileSync(path, 'utf-8')
//保持原文件名先备份一份到/uni_modules_tools/copy目录下,然后再覆盖 //保持原文件名先备份一份到/uni_modules_tools/copy目录下,然后再覆盖
writeFileRecursive(copyPath, fileText, function(err) { //创建目录并写入文件 writeFileRecursive(copyPath, fileText, function(err) { //创建目录并写入文件
if (err) { if (err) {
return console.log(err); return console.log(err);
} }
//改写 //改写
let HfileObj = Hjson.rt.parse(fileText) let HfileObj = Hjson.rt.parse(fileText)
//递归合并,为了保留注释内容 //递归合并,为了保留注释内容
mergeJSON(HfileObj,config[fileName]) mergeJSON(HfileObj, config[fileName])
fs.writeFile(path, Hjson.rt.stringify(HfileObj, { fs.writeFile(path, Hjson.rt.stringify(HfileObj, {
quotes: 'all', quotes: 'all',
separator: true, separator: true,
multiline: "off", multiline: "off",
bracesSameLine: true bracesSameLine: true
}), function(err) { }), function(err) {
if (err) { if (err) {
return console.log(err); return console.log(err);
} }
index++ index++
if(index == total){ if (index == total) {
callback() callback()
} }
}) })
}) })
} }
} }
function recovery(){ function recovery() {
let paths = Object.keys(config) let paths = Object.keys(config)
console.log(paths); console.log(paths);
paths.forEach(path=>{ paths.forEach(path => {
console.log(__dirname + '/copy' + path); console.log(__dirname + '/copy' + path);
let oldFile = fs.readFileSync(__dirname + '/copy' + path) let oldFile = fs.readFileSync(__dirname + '/copy' + path)
console.log(process.cwd() + path); console.log(process.cwd() + path);
fs.writeFile(process.cwd() + path, oldFile, function(err) { fs.writeFile(process.cwd() + path, oldFile, function(err) {
if (err) { if (err) {
console.log(err); console.log(err);
return return
} }
// fs.unlinkSync(__dirname + path+'.lock') // fs.unlinkSync(__dirname + path+'.lock')
}) })
}) })
} }
//创建目录并写入文件 //创建目录并写入文件
function writeFileRecursive(path, buffer, callback) { function writeFileRecursive(path, buffer, callback) {
...@@ -93,11 +93,15 @@ function writeFileRecursive(path, buffer, callback) { ...@@ -93,11 +93,15 @@ function writeFileRecursive(path, buffer, callback) {
//递归合并,为了保留注释内容 //递归合并,为了保留注释内容
function mergeJSON(minor, main) { function mergeJSON(minor, main) {
for (var key in main) { for (var key in main) {
if (typeof(main[key]) != 'object' ) { if (typeof(main[key]) != 'object') {
minor[key] = main[key]; minor[key] = main[key];
}else{ } else {
console.log('[',minor[key], main[key],']'); if(minor&&main){
mergeJSON(minor[key], main[key]); console.log('[', minor[key], main[key], ']');
mergeJSON(minor[key], main[key]);
}else{
console.log({minor,main});
}
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册