对缺少的路由进行增加,并增加登录和退出函数封装简单的接口
This commit is contained in:
		
							parent
							
								
									80c9e55d98
								
							
						
					
					
						commit
						b0f3421082
					
				|  | @ -9,9 +9,15 @@ local accountApi = require("api.system.account") | |||
| local roleApi = require("api.system.role") | ||||
| local permissionApi = require("api.system.permission") | ||||
| local applicationApi = require("api.system.application") | ||||
| local organizationApi = require("api.system.organization") | ||||
| 
 | ||||
| local controllerApi = require("api.controller") | ||||
| 
 | ||||
| --定义相关路由,前端接口url地址 | ||||
| local routes = { | ||||
|     -------------------------------------------- | ||||
|     -----------数据表操作相关路由配置-------------- | ||||
|     -------------------------------------------- | ||||
|     --用户相关路由接口 | ||||
|     { | ||||
|         paths = { "/api/get-user" }, | ||||
|  | @ -156,7 +162,7 @@ local routes = { | |||
|         handler = applicationApi.get_application, | ||||
|     }, | ||||
|     { | ||||
|         paths = { "/api/get-organizatorganizationion-application/:id" }, | ||||
|         paths = { "/api/get-organization-application/:id" }, | ||||
|         metadata = { "metadata /api/get-organization-application/id" }, | ||||
|         methods = { "GET" }, | ||||
|         handler = applicationApi.get_organization_application, | ||||
|  | @ -185,6 +191,54 @@ local routes = { | |||
|         methods = { "PUT" }, | ||||
|         handler = applicationApi.update_application, | ||||
|     }, | ||||
|     --组织架构相关路由接口 | ||||
|     { | ||||
|         paths = { "/api/get-organization" }, | ||||
|         metadata = { "metadata get-organization" }, | ||||
|         methods = { "GET" }, | ||||
|         handler = organizationApi.get_allorganization, | ||||
|     }, | ||||
|     { | ||||
|         paths = { "/api/get-organization/:id" }, | ||||
|         metadata = { "metadata /api/get-organization/id" }, | ||||
|         methods = { "GET" }, | ||||
|         handler = organizationApi.get_organization, | ||||
|     }, | ||||
|     { | ||||
|         paths = { "/api/delete-organization/:id" }, | ||||
|         metadata = { "metadata /api/delete-organization/id" }, | ||||
|         methods = { "DELETE" }, | ||||
|         handler = organizationApi.delete_organization, | ||||
|     }, | ||||
|     { | ||||
|         paths = { "/api/add-organization" }, | ||||
|         metadata = { "metadata /api/add-organization" }, | ||||
|         methods = { "POST" }, | ||||
|         handler = organizationApi.add_organization, | ||||
|     }, | ||||
|     { | ||||
|         paths = { "/api/update-organization/:id" }, | ||||
|         metadata = { "metadata /api/update-organization/id" }, | ||||
|         methods = { "PUT" }, | ||||
|         handler = organizationApi.update_organization, | ||||
|     }, | ||||
|     -------------------------------------------- | ||||
|     -------------用户登录相关路由配置-------------- | ||||
|     -------------------------------------------- | ||||
|     --用户登录路由接口 | ||||
|     { | ||||
|         paths = { "/api/login" }, | ||||
|         metadata = { "metadata /api/login" }, | ||||
|         methods = { "POST" }, | ||||
|         handler = controllerApi.login, | ||||
|     }, | ||||
|     --用户退出路由接口 | ||||
|     { | ||||
|         paths = { "/api/logout/:id" }, | ||||
|         metadata = { "metadata /api/logout/id" }, | ||||
|         methods = { "POST" }, | ||||
|         handler = controllerApi.logout, | ||||
|     }, | ||||
| } | ||||
| 
 | ||||
| -- 初始化路由 | ||||
|  |  | |||
							
								
								
									
										28
									
								
								src/api/controller.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/api/controller.lua
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| --- | ||||
| --- Generated by EmmyLua(https://github.com/EmmyLua) | ||||
| --- Created by admin. | ||||
| --- DateTime: 2025/10/28 11:09 | ||||
| --- | ||||
| local validator = require("util.validator") | ||||
| local helpers = require("util.helpers") | ||||
| local resp = require("util.response") | ||||
| 
 | ||||
| local _M = {} | ||||
| 
 | ||||
| --用户登录业务逻辑处理 | ||||
| function _M.login(id) | ||||
|     local code = 0 | ||||
|     local ret = "{}" | ||||
|     local result = resp:json(code, ret) | ||||
|     resp:send(result) | ||||
| end | ||||
| 
 | ||||
| --用户登出业务逻辑处理 | ||||
| function _M.logout(id) | ||||
|     local code = 0 | ||||
|     local ret = "{}" | ||||
|     local result = resp:json(code, ret) | ||||
|     resp:send(result) | ||||
| end | ||||
| 
 | ||||
| return _M | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user