### 验证码 无需校验参数 ##### 获取验证码 > *GET*,/captcha > 返回示例: ```json { "code": 200, "data": { "id": "ECAZBGqD6ORferpWPx9y", "img_url": "/captcha/ECAZBGqD6ORferpWPx9y.png",// 验证码图片地址 "refresh": "/captcha/ECAZBGqD6ORferpWPx9y.png?reload=1", "verify": "/captcha/ECAZBGqD6ORferpWPx9y/这里替换为正确的验证码进行验证" }, "msg": "验证码信息" } ``` #### 验证验证码 > *GET*,/captcha/:captcha_id/:captcha_value > 返回示例: ```json { "code": 200, "data": "", "msg": "验证码校验通过" } ``` ## 用户相关 ### 无需鉴权 #### 获取公钥 > *POST*,/admin/users/publickey 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 > 返回示例: ``` -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw/GsJEfppPkaZXGt7uKr q2UOsCEzrtPYz/DDUCjJzWnr725FoNqT77B33QbET995hay8j8Bcwwj7APkUYKyt RoNUOJkaWgAqpNp9/TKhulFex8ycEaI1lG0kzqPQtcNjIQyqOQ1qSyXb8BxFFN5+ zvuWdpb4lI8YxZGg9+n77qtmr2an7d4ADIsRVAejJuoDWB56RovVuiLihG71Wfam V1HhGf0ykWfyamd1HxN74hdBICbpChWPCmD/S2MwBMViM+TfCu5D15DxP5ZkADLU vV81YIKBLg6KZUV7N7oZzzJqiEmpeis4QO4ABf/KRQ9KVRe4dcJFi4E0uVCBKGm8 1QIDAQAB -----END PUBLIC KEY----- ``` > 加密参考 */test/login_test.html* > 用户发送密码必须通过加密,否则会产生错误 ```javascript const response = await fetch('http://localhost:14514/admin/users/publickey?user_name=joefalmko',{ method: 'POST', }); const publicKey = await response.text(); console.log("public key:\n",publicKey); // Encrypt the password using the public key const encrypt = new JSEncrypt(); encrypt.setPublicKey(publicKey); const encryptedPassword = encrypt.encrypt(password); console.log("encrypted password: ",encryptedPassword); ``` #### 用户注册 > *POST*,/admin/users/register 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 pass|form-data|string|必填 > 返回示例: ```json { "code": 200, "data": "", "msg": "Success" } ``` #### 用户登录 > *POST*,/admin/users/login 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 pass|form-data|string|必填 > 返回示例: ```json { "code": 200, "data": { "userId":5 "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo1LCJ1c2VyX25hbWUiOiJqb2VmYWxta28iLCJwaG9uZSI6IiIsImV4cCI6MTczMDA1OTQxMSwibmJmIjoxNzMwMDMwNjAxfQ.tqxCyPGQYPpTUJBoqZ47sfCAdxEN2thKRBPHilWHl18", "updated_at":"2024-10-27 20:03:31", "msg": "Success" } } ``` ### 需要鉴权 Header中必须包含 "Authorization": "Bearer {token}" #### 获取用户信息 > *POST*,/admin/users/info 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 > 返回示例: ```json { "code": 200, "data": { "id": 1, "user_name": "joefalmko", }, "msg": "Success" } ``` #### 更新用户名 > *POST*,/admin/users/username 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 id|form-data|int|必填 > 返回示例: ```json { "code": 200, "data": "", "msg": "Success" } ``` #### 更新密码 > *POST*,/admin/users/password 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 id|form-data|int|必填 oldpass|form-data|string|必填 newpass|form-data|string|必填 > 返回示例: ```json { "code": 200, "data": "", "msg": "Success" } ``` #### 注销用户 > *POST*,/admin/users/delete 参数字段|参数属性|类型|选项 ---|---|---|---|--- user_name|form-data|string|必填 id|form-data|int|必填 pass|form-data|string|必填 > 返回示例: ```json { "code": 200, "data": "", "msg": "Success" } ``` #### 登出用户 > *POST*,/admin/users/logout 参数字段|参数属性|类型|选项 ---|---|---|---|--- id|form-data|int|必填 > 返回示例: ```json { "code": 200, "data": "", "msg": "Success" } ``` #### token刷新 ,请将旧token放置在header头参数直接提交更新 > *post*,/admin/users/refreshtoken 参数字段|参数属性|类型|选项|默认值 ---|---|---|---|--- Authorization|Headers|string|必填|Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOjQ3LCJ1c2VyX25hbWUiOiJnb3NrZWxldG9uMS40IiwicGhvbmUiOiIiLCJleHAiOjE2MDQwNTIxNzMsIm5iZiI6MTYwNDA0ODU2M30.YNhN9_QasHc5XILQiilZvhxpPDnmC_j82y4JfYPnI7A > 返回示例: ```json { "code": 200, "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyaWQiOjQ3LCJ1c2VyX25hbWUiOiJnb3NrZWxldG9uMS40IiwicGhvbmUiOiIiLCJleHAiOjE2MDQwNTYxMDcsIm5iZiI6MTYwNDA0ODU2M30.JPE6G-9YE9UTdxHiWuvdVlD-akiIkvp6Ezf9y4_ud9M" }, "msg": "Success" } ``` #### 请求图片文字识别 > *post*,/admin/ai_recognition/pic_recognition 参数字段|参数属性|类型|选项|默认值 ---|---|---|---|--- pic|form-data|string|必填|"" (示例内容在 storage/app/test/文字识别.txt 中) > 返回示例: ```json { "code": 200, "data": { "words": "out[entry]=\nfor each basic block ∈N -{entry}\nout[B] =\nchange = true\nwhile (changes) {\n// Find: fix point solution\nchange = false\nfor each B∈N - {entry} {\noldout = out[B]\nin[B]= Uout[P]\nP∈pred[B]\nout[B] = GEN[B] ∪ (in[B]∩ PRSV[B])\nif(out[B] ≠ oldout) change = true;\n}\n}\n" }, "msg": "Success" } ``` #### 请求语音识别 > *post*,/admin/ai_recognition/voc_recognition 参数字段|参数属性|类型|选项|默认值 ---|---|---|---|--- voc|form-data|string|必填|"" (示例内容在 storage/app/test/A13_221.txt 中) > 返回示例: ```json { "code": 200, "data": { "words": "韩国的基本目标是射箭三块金牌只到三块金牌,羽毛球,两块金牌,以及举重等12块金牌。\n" }, "msg": "Success" } ```