Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ghsby
o2oa
提交
5625bad1
o2oa
项目概览
ghsby
/
o2oa
落后 Fork 源项目 2880 个版本
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5625bad1
编写于
4月 29, 2022
作者:
O
o2sword
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支持自定义短信通道发送验证码
上级
ace70e09
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
38 deletion
+46
-38
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionCreate.java
...in/java/com/x/program/center/jaxrs/code/ActionCreate.java
+12
-1
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionValidate.java
.../java/com/x/program/center/jaxrs/code/ActionValidate.java
+15
-32
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionValidateCascade.java
...om/x/program/center/jaxrs/code/ActionValidateCascade.java
+15
-5
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/BaseAction.java
...main/java/com/x/program/center/jaxrs/code/BaseAction.java
+4
-0
未找到文件。
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionCreate.java
浏览文件 @
5625bad1
package
com.x.program.center.jaxrs.code
;
import
com.x.base.core.project.Applications
;
import
com.x.program.center.ThisApplication
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.container.EntityManagerContainer
;
...
...
@@ -13,6 +15,7 @@ import com.x.base.core.project.jaxrs.WrapBoolean;
import
com.x.base.core.project.jaxrs.WrapString
;
import
com.x.base.core.project.logger.Logger
;
import
com.x.base.core.project.logger.LoggerFactory
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionCreate
extends
BaseAction
{
...
...
@@ -22,7 +25,15 @@ class ActionCreate extends BaseAction {
try
(
EntityManagerContainer
emc
=
EntityManagerContainerFactory
.
instance
().
create
())
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
Wo
wo
=
new
Wo
();
if
(
BooleanUtils
.
isNotTrue
(
Config
.
collect
().
getEnable
()))
{
String
customSms
=
ThisApplication
.
context
().
applications
().
findApplicationName
(
CUSTOM_SMS_APPLICATION
);
if
(
StringUtils
.
isNotBlank
(
customSms
)
&&
Config
.
customConfig
(
CUSTOM_SMS_CONFIG_NAME
)
!=
null
){
ActionResponse
resp
=
ThisApplication
.
context
().
applications
()
.
getQuery
(
customSms
,
Applications
.
joinQueryUri
(
"sms"
,
"send"
,
"code"
,
"mobile"
,
mobile
,
"token"
,
"(0)"
));
RespWi
respWi
=
resp
.
getData
(
RespWi
.
class
);
if
(
BooleanUtils
.
isNotTrue
(
respWi
.
getValue
()))
{
throw
new
ExceptionTransferCodeError
(
resp
);
}
}
else
if
(
BooleanUtils
.
isNotTrue
(
Config
.
collect
().
getEnable
()))
{
logger
.
warn
(
"短信无法发送,系统没有启用O2云服务."
);
}
else
{
Message
message
=
new
Message
();
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionValidate.java
浏览文件 @
5625bad1
...
...
@@ -10,49 +10,32 @@ import javax.persistence.criteria.Predicate;
import
javax.persistence.criteria.Root
;
import
com.x.base.core.container.EntityManagerContainer
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ActionResponse
;
import
com.x.base.core.project.connection.ConnectionAction
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.program.center.ThisApplication
;
import
com.x.program.center.core.entity.Code
;
import
com.x.program.center.core.entity.Code_
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionValidate
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
String
mobile
,
String
answer
)
throws
Exception
{
/*try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
wo.setValue(false);
if(StringUtils.isNotEmpty(answer) && StringUtils.isNotEmpty(mobile)) {
Code code = this.get(emc, mobile);
if (null != code) {
if (answer.equals(code.getAnswer())) {
emc.beginTransaction(Code.class);
emc.remove(code);
emc.commit();
wo.setValue(true);
} else {
int vn = code.getVerifyNumber() == null ? 0 : code.getVerifyNumber();
vn++;
emc.beginTransaction(Code.class);
if (vn < 6) {
code.setVerifyNumber(vn);
} else {
emc.remove(code);
}
emc.commit();
}
}
}
result.setData(wo);
return result;
}*/
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResponse
resp
=
ConnectionAction
.
get
(
Config
.
collect
().
url
()
+
"/o2_collect_assemble/jaxrs/code/validate/mobile/"
+
mobile
+
"/answer/"
+
answer
,
null
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
resp
.
getData
(
ActionValidateCascade
.
Wo
.
class
).
getValue
());
Wo
wo
;
String
customSms
=
ThisApplication
.
context
().
applications
().
findApplicationName
(
CUSTOM_SMS_APPLICATION
);
if
(
StringUtils
.
isNotBlank
(
customSms
)
&&
Config
.
customConfig
(
CUSTOM_SMS_CONFIG_NAME
)
!=
null
){
ActionResponse
resp
=
ThisApplication
.
context
().
applications
()
.
getQuery
(
customSms
,
Applications
.
joinQueryUri
(
"sms"
,
"validate"
,
"mobile"
,
mobile
,
"answer"
,
answer
,
"token"
,
"(0)"
));
wo
=
resp
.
getData
(
Wo
.
class
);
}
else
{
ActionResponse
resp
=
ConnectionAction
.
get
(
Config
.
collect
().
url
()
+
"/o2_collect_assemble/jaxrs/code/validate/mobile/"
+
mobile
+
"/answer/"
+
answer
,
null
);
wo
=
resp
.
getData
(
Wo
.
class
);
}
result
.
setData
(
wo
);
return
result
;
}
...
...
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/ActionValidateCascade.java
浏览文件 @
5625bad1
package
com.x.program.center.jaxrs.code
;
import
com.x.base.core.project.Applications
;
import
com.x.base.core.project.config.Config
;
import
com.x.base.core.project.connection.ActionResponse
;
import
com.x.base.core.project.connection.ConnectionAction
;
import
com.x.base.core.project.http.ActionResult
;
import
com.x.base.core.project.jaxrs.WrapBoolean
;
import
com.x.program.center.ThisApplication
;
import
org.apache.commons.lang3.StringUtils
;
class
ActionValidateCascade
extends
BaseAction
{
ActionResult
<
Wo
>
execute
(
String
mobile
,
String
answer
)
throws
Exception
{
ActionResult
<
Wo
>
result
=
new
ActionResult
<>();
ActionResponse
resp
=
ConnectionAction
.
get
(
Config
.
collect
().
url
()
+
"/o2_collect_assemble/jaxrs/code/validate/mobile/"
+
mobile
+
"/answer/"
+
answer
,
null
);
Wo
wo
=
new
Wo
();
wo
.
setValue
(
resp
.
getData
(
Wo
.
class
).
getValue
());
Wo
wo
;
String
customSms
=
ThisApplication
.
context
().
applications
().
findApplicationName
(
CUSTOM_SMS_APPLICATION
);
if
(
StringUtils
.
isNotBlank
(
customSms
)
&&
Config
.
customConfig
(
CUSTOM_SMS_CONFIG_NAME
)
!=
null
){
ActionResponse
resp
=
ThisApplication
.
context
().
applications
()
.
getQuery
(
customSms
,
Applications
.
joinQueryUri
(
"sms"
,
"validate"
,
"mobile"
,
mobile
,
"answer"
,
answer
,
"token"
,
"(0)"
));
wo
=
resp
.
getData
(
Wo
.
class
);
}
else
{
ActionResponse
resp
=
ConnectionAction
.
get
(
Config
.
collect
().
url
()
+
"/o2_collect_assemble/jaxrs/code/validate/mobile/"
+
mobile
+
"/answer/"
+
answer
,
null
);
wo
=
resp
.
getData
(
Wo
.
class
);
}
result
.
setData
(
wo
);
return
result
;
}
...
...
@@ -20,4 +30,4 @@ class ActionValidateCascade extends BaseAction {
public
static
class
Wo
extends
WrapBoolean
{
}
}
\ No newline at end of file
}
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/code/BaseAction.java
浏览文件 @
5625bad1
...
...
@@ -4,4 +4,8 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
abstract
class
BaseAction
extends
StandardJaxrsAction
{
protected
static
final
String
CUSTOM_SMS_APPLICATION
=
"x_sms_assemble_control"
;
protected
static
final
String
CUSTOM_SMS_CONFIG_NAME
=
"custom_sms"
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录