增加了api文档
This commit is contained in:
@@ -11,6 +11,7 @@ import soulsoft_web_mvc.annotations.*
|
||||
import simcu::simapi.communications.*
|
||||
import simcu::simapi.configurations.*
|
||||
import simcu::simapi.helpers.*
|
||||
import simcu::simapi.annotations.{SimApiAuth as SimApiAuthAttribute}
|
||||
import simcu::simapi.openapi.annotations.*
|
||||
|
||||
/**
|
||||
@@ -29,8 +30,8 @@ public class SimApiCommonController <: SimApiBaseController {
|
||||
* 抛 SimApiException,由异常中间件统一输出。
|
||||
*/
|
||||
@HttpGet["exception/{code}"]
|
||||
@SimApiDoc[tags:"公共",summary:"异常报错"]
|
||||
public func exceptionHandler(@FromRoute[] code: Int64): Unit { // cjlint-ignore !G.FUN.02 注解绑定参数误报
|
||||
@SimApiDoc[ignore: true]
|
||||
public func exceptionHandler(@FromRoute[] code: Int64) { // cjlint-ignore !G.FUN.02 注解绑定参数误报
|
||||
SimApiError.error(code: code)
|
||||
}
|
||||
|
||||
@@ -39,7 +40,17 @@ public class SimApiCommonController <: SimApiBaseController {
|
||||
* 动态注册:路由路径由 SimApiRouteOptions.webConfigRoute 决定(见 simapi_extensions.cj)。
|
||||
*/
|
||||
public func webConfig(): HashMap<String, Any> {
|
||||
webConfigMap()
|
||||
var versionMap = HashMap<String, Any>()
|
||||
versionMap["SimApi"] = SimApiUtil.simApiVersion
|
||||
versionMap["App"] = SimApiUtil.appVersion
|
||||
var map = HashMap<String, Any>()
|
||||
for ((key, value) in _options.webConfig) {
|
||||
map[key] = value
|
||||
}
|
||||
if (_options.webConfigIncludeVersion) {
|
||||
map["Versions"] = versionMap
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
|
||||
@@ -47,26 +58,8 @@ public class SimApiCommonController <: SimApiBaseController {
|
||||
* POST /user/info:获取已登录用户信息(需登录)。
|
||||
* 动态注册:路由路径由 SimApiRouteOptions.userInfoRoute 决定(见 simapi_extensions.cj)。
|
||||
*/
|
||||
@SimApiAuthAttribute
|
||||
public func userInfo(): SimApiLoginItem {
|
||||
requireLogin()
|
||||
loginInfo
|
||||
}
|
||||
|
||||
private func versionsMap(): HashMap<String, Any> {
|
||||
var map = HashMap<String, Any>()
|
||||
map["SimApi"] = SimApiUtil.simApiVersion
|
||||
map["App"] = SimApiUtil.appVersion
|
||||
map
|
||||
}
|
||||
|
||||
private func webConfigMap(): HashMap<String, Any> {
|
||||
var map = HashMap<String, Any>()
|
||||
for ((key, value) in _options.webConfig) {
|
||||
map[key] = value
|
||||
}
|
||||
if (_options.webConfigIncludeVersion) {
|
||||
map["Versions"] = versionsMap()
|
||||
}
|
||||
map
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user