From 8772e13308c99c34c74023e1925b493ce93ac678 Mon Sep 17 00:00:00 2001 From: linju-json Date: Mon, 7 Jun 2021 15:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E8=A1=A8=E5=90=8D=E7=A7=B0uni-verify=E4=B8=BAopendb-verify-cod?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- changelog.md | 4 +++ package.json | 4 +-- .../cloudfunctions/uni-id-cf/index.js | 2 +- uni_modules_tools/change_after.js | 25 +++++++++++++++++++ uni_modules_tools/main.js | 21 ++++++++++++---- 6 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 uni_modules_tools/change_after.js diff --git a/.gitignore b/.gitignore index 269295a..7e6f186 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ unpackage/ .hbuilderx node_modules -.DS_Store \ No newline at end of file +.DS_Store +uni_modules_tools/copy \ No newline at end of file diff --git a/changelog.md b/changelog.md index 85ff0ba..4a93f5a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## 1.0.14(2021-06-07) +修改错误的表名称uni-verify为opendb-verify-codes +## 1.0.13(2021-06-04) +新增一键登陆界面的第三方快捷登陆按钮 ## 1.0.12(2021-05-28) 修复拦截器在ios app端会报错:Unhandled promise...的问题 ## 1.0.10(2021-05-27) diff --git a/package.json b/package.json index 921eacb..ebf3c99 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "id": "uni-starter", "displayName": "uni-starter", - "version": "1.0.12", + "version": "1.0.14", "description": "云端一体应用快速开发模版", "keywords": [ "uni-starter", @@ -12,7 +12,7 @@ ], "repository": "https://codechina.csdn.net/dcloud/uni-starter.git", "engines": { - "HBuilderX": "^3.1.16" + "HBuilderX": "^3.1.17" }, "dcloudext": { "category": [ diff --git a/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js b/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js index 01def7f..b2fc696 100644 --- a/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js +++ b/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js @@ -219,7 +219,7 @@ exports.main = async (event, context) => { type: params.type }) // 简单限制一下客户端调用频率 - const ipLimit = await db.collection('uni-verify').where({ + const ipLimit = await db.collection('opendb-verify-codes').where({ ip: context.CLIENTIP, created_at: dbCmd.gt(Date.now() - 60000) }).get() diff --git a/uni_modules_tools/change_after.js b/uni_modules_tools/change_after.js new file mode 100644 index 0000000..502f3e7 --- /dev/null +++ b/uni_modules_tools/change_after.js @@ -0,0 +1,25 @@ +const fs = require('fs'); +module.exports = function(){ + console.log('开始执行脚本change_after'); + let changelog = fs.readFileSync(process.cwd()+'/changelog.md', 'utf-8').split("\n")[1]; + console.log(changelog); + + // 这里是修改完相关敏感配置后执行的脚本,你可以在这里自定义逻辑, + // 比如执行git提交命令 + var shell = require("shelljs"); + var exec = shell.exec; + + if (exec('git add .').code !== 0) { + shell.echo('Error: Git add failed'); + shell.exit(1); + } + if (exec(`git commit -am "${changelog}"`).code !== 0) { + shell.echo('Error: Git commit failed'); + shell.exit(1); + } + if (exec('git push').code !== 0) { + shell.echo('Error: Git commit failed'); + shell.exit(1); + } + shell.exec(`echo git success ${changelog}`); +} \ No newline at end of file diff --git a/uni_modules_tools/main.js b/uni_modules_tools/main.js index 4e2b476..9b0c593 100644 --- a/uni_modules_tools/main.js +++ b/uni_modules_tools/main.js @@ -5,27 +5,34 @@ const fs = require('fs'), Hjson = require('hjson'), config = Hjson.rt.parse(fs.readFileSync(__dirname+'/config.js', 'utf-8')) - +const change_after = require('./change_after') if(process.argv[2] == 'change'){ - change(config) + change(config,()=>{ + console.log('脚本change已经执行成功'); + change_after() + }) }else{ recovery(config) } -function change(config){ +function change(config,callback){ + const total = Object.keys(config).length + let index = 0; for (let fileName in config) { let path = process.cwd() + fileName let copyPath = __dirname + '/copy' + fileName let fileText = fs.readFileSync(path, 'utf-8') - //保持原文件名先备份一份到脚本目录下 - writeFileRecursive(copyPath, fileText, function(err) { + //保持原文件名先备份一份到/uni_modules_tools/copy目录下,然后再覆盖 + writeFileRecursive(copyPath, fileText, function(err) { //创建目录并写入文件 if (err) { return console.log(err); } //改写 let HfileObj = Hjson.rt.parse(fileText) + //递归合并,为了保留注释内容 mergeJSON(HfileObj,config[fileName]) + fs.writeFile(path, Hjson.rt.stringify(HfileObj, { quotes: 'all', separator: true, @@ -35,6 +42,10 @@ function change(config){ if (err) { return console.log(err); } + index++ + if(index == total){ + callback() + } }) }) } -- GitLab