Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ssssssss-team
magic-api
提交
9543b9f2
M
magic-api
项目概览
ssssssss-team
/
magic-api
10 个月 前同步成功
通知
41
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
magic-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9543b9f2
编写于
10月 11, 2021
作者:
M
mxd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
请求参数、`Header`支持`Date`类型
上级
c0017888
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
0 deletion
+34
-0
magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/MagicAPIAutoConfiguration.java
...gicapi/spring/boot/starter/MagicAPIAutoConfiguration.java
+2
-0
magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/MagicAPIProperties.java
...ssss/magicapi/spring/boot/starter/MagicAPIProperties.java
+14
-0
magic-api/src/main/java/org/ssssssss/magicapi/model/DataType.java
...i/src/main/java/org/ssssssss/magicapi/model/DataType.java
+16
-0
magic-editor/src/console/src/components/layout/magic-request.vue
...ditor/src/console/src/components/layout/magic-request.vue
+2
-0
未找到文件。
magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/MagicAPIAutoConfiguration.java
浏览文件 @
9543b9f2
...
...
@@ -49,6 +49,7 @@ import org.ssssssss.magicapi.exception.MagicAPIException;
import
org.ssssssss.magicapi.interceptor.*
;
import
org.ssssssss.magicapi.logging.LoggerManager
;
import
org.ssssssss.magicapi.model.Constants
;
import
org.ssssssss.magicapi.model.DataType
;
import
org.ssssssss.magicapi.modules.*
;
import
org.ssssssss.magicapi.provider.*
;
import
org.ssssssss.magicapi.provider.impl.*
;
...
...
@@ -510,6 +511,7 @@ public class MagicAPIAutoConfiguration implements WebMvcConfigurer, WebSocketCon
MagicBackupService
magicBackupService
)
throws
NoSuchMethodException
{
logger
.
info
(
"magic-api工作目录:{}"
,
magicResource
);
AsyncCall
.
setThreadPoolExecutorSize
(
properties
.
getThreadPoolExecutorSize
());
DataType
.
DATE_PATTERNS
=
properties
.
getDatePattern
();
// 设置响应结果的code值
ResponseCodeConfig
responseCodeConfig
=
properties
.
getResponseCodeConfig
();
Constants
.
RESPONSE_CODE_SUCCESS
=
responseCodeConfig
.
getSuccess
();
...
...
magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/MagicAPIProperties.java
浏览文件 @
9543b9f2
...
...
@@ -114,6 +114,13 @@ public class MagicAPIProperties {
*/
private
boolean
showSql
=
true
;
/**
* 请求参数日期格式
*
* @since 1.5.2
*/
private
String
[]
datePattern
=
new
String
[]{
"yyyy-MM-dd"
,
"yyyy-MM-dd HH:mm:ss"
,
"yyyyMMddHHmmss"
,
"yyyyMMdd"
};
@NestedConfigurationProperty
private
SecurityConfig
securityConfig
=
new
SecurityConfig
();
...
...
@@ -380,4 +387,11 @@ public class MagicAPIProperties {
this
.
showSql
=
showSql
;
}
public
String
[]
getDatePattern
()
{
return
datePattern
;
}
public
void
setDatePattern
(
String
[]
datePattern
)
{
this
.
datePattern
=
datePattern
;
}
}
magic-api/src/main/java/org/ssssssss/magicapi/model/DataType.java
浏览文件 @
9543b9f2
package
org.ssssssss.magicapi.model
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.ssssssss.magicapi.modules.RequestModule
;
import
org.ssssssss.script.functions.ObjectConvertExtension
;
import
org.ssssssss.script.reflection.JavaInvoker
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.util.Date
;
import
static
org
.
ssssssss
.
script
.
reflection
.
JavaReflection
.
findInvoker
;
...
...
@@ -14,6 +18,7 @@ import static org.ssssssss.script.reflection.JavaReflection.findInvoker;
* @author mxd
*/
public
enum
DataType
{
/**
* Object 类型
*/
...
...
@@ -61,6 +66,11 @@ public enum DataType {
*/
Short
(
true
,
findInvoker
(
BigDecimal
.
class
,
"shortValue"
),
"number"
),
/**
* Date类型
*/
Date
(
findInvoker
(
DataType
.
class
,
"parseDate"
,
new
Class
<?>[]{
String
.
class
}),
false
,
true
,
"string"
),
/**
* MultipartFile 类型
*/
...
...
@@ -82,6 +92,8 @@ public enum DataType {
private
String
javascriptType
;
public
static
String
[]
DATE_PATTERNS
;
DataType
(
boolean
isNumber
,
JavaInvoker
<
Method
>
invoker
,
boolean
needName
,
boolean
needValue
,
String
javascriptType
)
{
this
.
isNumber
=
isNumber
;
this
.
invoker
=
invoker
;
...
...
@@ -122,4 +134,8 @@ public enum DataType {
public
java
.
lang
.
String
getJavascriptType
()
{
return
javascriptType
;
}
public
static
java
.
util
.
Date
parseDate
(
String
value
)
throws
ParseException
{
return
DateUtils
.
parseDate
(
value
,
DATE_PATTERNS
);
}
}
magic-editor/src/console/src/components/layout/magic-request.vue
浏览文件 @
9543b9f2
...
...
@@ -216,6 +216,7 @@
{
value
:
'
String
'
,
text
:
'
String
'
},
{
value
:
'
Boolean
'
,
text
:
'
Boolean
'
},
{
value
:
'
Integer
'
,
text
:
'
Integer
'
},
{
value
:
'
Date
'
,
text
:
'
Date
'
},
{
value
:
'
Double
'
,
text
:
'
Double
'
},
{
value
:
'
Long
'
,
text
:
'
Long
'
},
{
value
:
'
Short
'
,
text
:
'
Short
'
},
...
...
@@ -226,6 +227,7 @@
{
value
:
'
String
'
,
text
:
'
String
'
},
{
value
:
'
Boolean
'
,
text
:
'
Boolean
'
},
{
value
:
'
Integer
'
,
text
:
'
Integer
'
},
{
value
:
'
Date
'
,
text
:
'
Date
'
},
{
value
:
'
Double
'
,
text
:
'
Double
'
},
{
value
:
'
Long
'
,
text
:
'
Long
'
},
{
value
:
'
Short
'
,
text
:
'
Short
'
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录