feat: 实现微信小程序后端接口与用户认证系统
新增微信登录/注册合一接口、资料完善接口和token刷新接口 重构用户服务层,支持自动维护用户类型和资料完整度 引入JWT认证中间件和请求验证中间件 更新文档与测试用例,支持dist构建部署
This commit is contained in:
27
back-end/src/utils/logger.js
Normal file
27
back-end/src/utils/logger.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function createLog(method, message, meta = {}) {
|
||||
const payload = {
|
||||
time: new Date().toISOString(),
|
||||
method,
|
||||
message,
|
||||
...meta,
|
||||
}
|
||||
return JSON.stringify(payload)
|
||||
}
|
||||
|
||||
function info(message, meta) {
|
||||
console.log(createLog('INFO', message, meta))
|
||||
}
|
||||
|
||||
function warn(message, meta) {
|
||||
console.warn(createLog('WARN', message, meta))
|
||||
}
|
||||
|
||||
function error(message, meta) {
|
||||
console.error(createLog('ERROR', message, meta))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
info,
|
||||
warn,
|
||||
error,
|
||||
}
|
||||
Reference in New Issue
Block a user