This commit is contained in:
张成
2025-11-26 12:39:21 +08:00
parent 5d59000960
commit 7858459118
12 changed files with 1785 additions and 2 deletions

View File

@@ -1,6 +1,71 @@
const Framework = require("../../framework/node-core-framework.js");
module.exports = {
/**
* @swagger
* /api/user/login:
* post:
* summary: 用户登录
* description: 通过设备SN码登录返回token和用户信息
* tags: [前端-用户管理]
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - sn_code
* - device_id
* properties:
* sn_code:
* type: string
* description: 设备SN码
* example: 'GHJU'
* device_id:
* type: string
* description: 设备ID
* example: 'device_123456'
* responses:
* 200:
* description: 登录成功
* content:
* application/json:
* schema:
* type: object
* properties:
* code:
* type: integer
* description: 状态码0表示成功
* example: 0
* message:
* type: string
* description: 响应消息
* example: 'success'
* data:
* type: object
* properties:
* token:
* type: string
* description: 认证token
* example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
* user:
* type: object
* description: 用户信息
* 400:
* description: 参数错误或用户不存在
* content:
* application/json:
* schema:
* type: object
* properties:
* code:
* type: integer
* example: 400
* message:
* type: string
* example: '用户不存在'
*/
"POST /user/login": async (ctx) => {
const { sn_code, device_id } = ctx.getBody();