-
$.post("http://localhost:3000/go2",{money:that.money,time:that.time,
-
name:that.name,num:that.num,zhi:that.zhi,city:that.city,xin:that.xin,shou:that.shou
-
-
},function(data){
-
-
that.msg = Number(data[0].money)+Number(that.money)
-
$.post("http://localhost:3000/go",{money:that.msg,time:that.time,
-
name:that.name,num:that.num,shou:that.shou
-
-
},function(data){
-
//console.log(data)
-
if(data=="成功"){
-
alert("数据更新成功")
-
that.$router.push("/wodeqian")
-
}else{
-
alert("数据更新失败")
-
}
-
})
-
-
})
-
-
-
}
-
-
}
-
}
-
app.post("/go", function(req, res) {
-
-
res.header("Access-Control-Allow-Origin","*")
-
-
// console.log(req.body)
-
// console.log(req.query)
-
-
-
let money = req.body.money;
-
let time = req.body.time;
-
let name = req.body.name;
-
let num = req.body.num;
-
let zhi = req.body.zhi;
-
let city = req.body.city;
-
let xin = req.body.xin;
-
let shou = req.body.shou;
-
console.log("222222222222222222222222222222222222222222")
-
console.log(shou)
-
mongodb.connect(url1,function (err,database) {
-
database.collection("users",function(err,coll){
-
coll.find({PhoneNumber:shou}).toArray(function(err,data){
-
if(data.length>0){
-
coll.updateOne({PhoneNumber:shou},{$set:{money:money,time:time,name:name,num:num}},function(){
-
res.send("成功")
-
database.close();
-
})
-
-
}
-
})
-
})
-
-
})
-
-
})
-
// mongodb.connect(url1,function (err,database) {
-
// database.collection("user",function(err,coll){
-
// coll.find({name:name}).toArray(function(err,data){
-
// if(data.length>0){
-
// res.send("已存在")
-
// database.close();
-
// }else{
-
// coll.save({money:money,time:time,name:name,num:num,zhi:zhi,city:city,xin:xin,shou:shou},function(){
-
// res.send("成功")
-
// database.close();
-
// })
-
// }
-
// })
-
// })
-
// })
-
-
-
-
-
app.post("/go2", function(req, res) {
-
-
res.header("Access-Control-Allow-Origin","*")
-
-
console.log(req.body)
-
console.log(req.query)
-
-
-
let money = req.body.money;
-
let time = req.body.time;
-
let name = req.body.name;
-
let num = req.body.num;
-
let zhi = req.body.zhi;
-
let city = req.body.city;
-
let xin = req.body.xin;
-
let shou = req.body.shou;
-
-
//console.log("注册")
-
mongodb.connect(url1,function (err,database) {
-
database.collection("users",function(err,coll){
-
coll.find({PhoneNumber:shou}).toArray(function(err,data){
-
if(data.length>0){
-
// console.log("11111111111111111111111111111111111111")
-
// console.log(data)
-
res.send(data)
-
-
database.close()
-
}
-
})
-
})
-
-
})
-
-
})