|
@@ -27,7 +27,7 @@ const wx = {
|
|
|
// secret: "148b350f8bbd2daed7c2f75a8b4411aa", // 填写用户自己的密钥
|
|
|
};
|
|
|
//統壹處理區域
|
|
|
-router.use(async function(req, res, next) {
|
|
|
+router.use(async function (req, res, next) {
|
|
|
await asynnext(req, res, next);
|
|
|
//// make sure we go to the next routes and don't stop here
|
|
|
//res.end("");
|
|
@@ -38,7 +38,7 @@ router.use(async function(req, res, next) {
|
|
|
*/
|
|
|
function asynnext(req, res, next) {
|
|
|
//異步處理
|
|
|
- return new Promise(async(resolve, reject) => {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
next();
|
|
|
//resolve(true);aa
|
|
|
});
|
|
@@ -59,7 +59,7 @@ router.route("/b").all((req, res, next) => {
|
|
|
});
|
|
|
|
|
|
// yym获取微信openID
|
|
|
-router.get("/weChatCode", async(req, res) => {
|
|
|
+router.get("/weChatCode", async (req, res) => {
|
|
|
console.log(req.query);
|
|
|
let response = await axios.get("https://api.weixin.qq.com/sns/jscode2session", {
|
|
|
params: {
|
|
@@ -79,11 +79,11 @@ router.post("/login", (req, res) => {
|
|
|
let { openid } = req.body;
|
|
|
postmysql3(req, res, "insert_user");
|
|
|
let token = jwt.sign({
|
|
|
- openid,
|
|
|
- },
|
|
|
+ openid,
|
|
|
+ },
|
|
|
"secret", {
|
|
|
- expiresIn: "10s",
|
|
|
- }
|
|
|
+ expiresIn: "10s",
|
|
|
+ }
|
|
|
);
|
|
|
|
|
|
res.send({
|
|
@@ -97,7 +97,7 @@ router.post("/login", (req, res) => {
|
|
|
router.post("/selectUser", (req, res) => {
|
|
|
console.log(req.body);
|
|
|
// let { openid } = req.body;
|
|
|
- postmysql3(req,res, "Select_user");
|
|
|
+ postmysql3(req, res, "Select_user");
|
|
|
// console.log(res.end);
|
|
|
});
|
|
|
|
|
@@ -146,6 +146,31 @@ router.post("/deleteMyPublish", (req, res) => {
|
|
|
postmysql3(req, res, "delete_mypublish");
|
|
|
});
|
|
|
|
|
|
+//查询当前的活动是否是当前的用户发布的 xlh
|
|
|
+router.post("/selectPublisher", (req, res) => {
|
|
|
+ postmysql3(req, res, "select_activity_publisher");
|
|
|
+});
|
|
|
+
|
|
|
+//报名申请加入 zwb
|
|
|
+router.post("/insertActivityEnroll", (req, res) => {
|
|
|
+ // console.log(req.body);
|
|
|
+ postmysql3(req, res, "insert_activity_enroll");
|
|
|
+
|
|
|
+ res.send({
|
|
|
+ msg: "上传成功",
|
|
|
+ });
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+// 查询我的活动 zwb
|
|
|
+router.post("/selectActivityEnroll", (req, res) => {
|
|
|
+ postmysql3(req, res, "select_activity_enroll");
|
|
|
+});
|
|
|
+
|
|
|
+//查询用户是否报名 zwb
|
|
|
+router.post("/selectActivityEnrollid", (req, res) => {
|
|
|
+ postmysql3(req, res, "select_activity_enroll_ID");
|
|
|
+});
|
|
|
|
|
|
//查询全部活动
|
|
|
router.route("/selectAct").all((req, res, next) => {
|
|
@@ -159,64 +184,64 @@ router.route("/selectAct").all((req, res, next) => {
|
|
|
|
|
|
|
|
|
|
|
|
-queryString = function(url) {
|
|
|
+queryString = function (url) {
|
|
|
var a = url.split("?");
|
|
|
var json = querystring.parse(a[1]);
|
|
|
return json;
|
|
|
};
|
|
|
|
|
|
//post存儲過程處理
|
|
|
-postmysql = function(req, res, functionname) {
|
|
|
+postmysql = function (req, res, functionname) {
|
|
|
//mode的處理
|
|
|
if (req.body[0]) {
|
|
|
p = Object.values(req.body[0]);
|
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
|
//執行存儲過程
|
|
|
- mysql.usselect(p, function(ret) {
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
res.end(JSON.stringify(ret));
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//post存儲過程處理
|
|
|
-postmysql2 = function(req, res, functionname) {
|
|
|
+postmysql2 = function (req, res, functionname) {
|
|
|
//mode的處理
|
|
|
if (req.body) {
|
|
|
p = Object.values(req.body)[0].split(",");
|
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
|
//執行存儲過程
|
|
|
- mysql.usselect(p, function(ret) {
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
res.end(JSON.stringify(ret));
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//post存儲過程處理
|
|
|
-postmysql3 = function(req, res, functionname) {
|
|
|
+postmysql3 = function (req, res, functionname) {
|
|
|
//mode的處理
|
|
|
if (req.body) {
|
|
|
p = Object.values(req.body);
|
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
|
//執行存儲過程
|
|
|
- mysql.usselect(p, function(ret) {
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
res.end(JSON.stringify(ret));
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//get獲取數據庫信息
|
|
|
-getmysql = function(req, res, functionname, ...p) {
|
|
|
+getmysql = function (req, res, functionname, ...p) {
|
|
|
p = p || [];
|
|
|
p.unshift(_mysqlLabor[0], _mysqlLabor[1], functionname);
|
|
|
//執行存儲過程
|
|
|
- mysql.usselect(p, function(ret) {
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
res.end(JSON.stringify(ret));
|
|
|
}); //
|
|
|
};
|
|
|
|
|
|
//post存储过程处理
|
|
|
|
|
|
-userpostmysql = function(req, res, functionname) {
|
|
|
+userpostmysql = function (req, res, functionname) {
|
|
|
//mode的处理
|
|
|
|
|
|
if (req.body.mode) {
|
|
@@ -226,7 +251,7 @@ userpostmysql = function(req, res, functionname) {
|
|
|
|
|
|
//执行存储过程
|
|
|
|
|
|
- mysql.usselect(p, function(ret) {
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
res.end(JSON.stringify(ret));
|
|
|
});
|
|
|
}
|
|
@@ -234,14 +259,14 @@ userpostmysql = function(req, res, functionname) {
|
|
|
|
|
|
//get获取数据库信息
|
|
|
|
|
|
-usergetmysql = function(req, res, functionname, ...p) {
|
|
|
+usergetmysql = function (req, res, functionname, ...p) {
|
|
|
p = p || [];
|
|
|
|
|
|
p.unshift(_mysqluser[0], _mysqluser[1], functionname);
|
|
|
|
|
|
//执行存储过程
|
|
|
|
|
|
- mysql.usselect(p, function(ret) {
|
|
|
+ mysql.usselect(p, function (ret) {
|
|
|
res.end(JSON.stringify(ret));
|
|
|
}); //
|
|
|
};
|