自动递增

This commit is contained in:
2019-11-19 13:37:11 +08:00
parent d6e08d9ed5
commit 073211bd97
3 changed files with 53 additions and 11 deletions

View File

@@ -6,15 +6,13 @@ var loginup = async (ctx,next) => {
await dbs.find('admin').then((res)=>{
arr = res.data
})
console.timeEnd("asd")
if(arr.length == 0){
await dbs.add('admin',{name:"admin",pwd:"123456"})
await dbs.find('admin').then((res)=>{
arr = res.data
})
}
console.timeEnd("asd")
//判断用户名密码
if(ctx.request.body.name == arr[0].name && ctx.request.body.pwd == arr[0].pwd){
//颁发token