This commit is contained in:
2021-02-24 09:06:18 +08:00
parent 2ef9823b2f
commit f458c472f7
3 changed files with 37 additions and 5 deletions

View File

@@ -76,8 +76,35 @@ let findshop = async (ctx, next) => {
ctx.body = await dbs.find("shop")
}
let logins = async(ctx,next)=>{
let {user , pwd} = ctx.request.body
console.log(123)
if(user == "admin" && pwd == "123"){
ctx.body = JSON.stringify({
code: 200,
msg:"登录成功",
data:{
name:"admin",
age:18,
quxain: "admin"
}
})
}else{
ctx.body = JSON.stringify({
code: 200,
msg:"登录成功",
data:{
name:"user",
age:18,
quxain: "user"
}
})
}
}
module.exports = {
"GET /":index,
"POST /addshop": addshop,
"GET /findshop": findshop
"GET /findshop": findshop,
"POST /login": logins
}