|
|
@ -2,7 +2,8 @@ var express = require('express');
|
|
|
|
var router = express.Router();
|
|
|
|
var router = express.Router();
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
loginService,
|
|
|
|
loginService,
|
|
|
|
updateUserInfoService
|
|
|
|
updateUserInfoService,
|
|
|
|
|
|
|
|
getUserInfoService
|
|
|
|
} = require("../services/userService")
|
|
|
|
} = require("../services/userService")
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
formatResponse,
|
|
|
|
formatResponse,
|
|
|
@ -29,27 +30,16 @@ router.get("/whoami", async function (req, res, next) {
|
|
|
|
//获取token,然后进行解析
|
|
|
|
//获取token,然后进行解析
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
loginId,
|
|
|
|
loginId,
|
|
|
|
sex,
|
|
|
|
|
|
|
|
brithday,
|
|
|
|
|
|
|
|
region,
|
|
|
|
|
|
|
|
number
|
|
|
|
|
|
|
|
} = analysisToken(req.get("authorization"))
|
|
|
|
} = analysisToken(req.get("authorization"))
|
|
|
|
|
|
|
|
const {
|
|
|
|
res.send(formatResponse(0, "", {
|
|
|
|
loginPwd,
|
|
|
|
loginId,
|
|
|
|
...data
|
|
|
|
sex,
|
|
|
|
} = await getUserInfoService(loginId)
|
|
|
|
brithday,
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
region,
|
|
|
|
|
|
|
|
number
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
router.put("/", async function (req, res, next) {
|
|
|
|
router.put("/", async function (req, res, next) {
|
|
|
|
const {
|
|
|
|
const data = await updateUserInfoService(req.body)
|
|
|
|
token,
|
|
|
|
|
|
|
|
data
|
|
|
|
|
|
|
|
} = await updateUserInfoService(req.body)
|
|
|
|
|
|
|
|
res.setHeader("authentication", token)
|
|
|
|
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
res.send(formatResponse(0, "", data))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|