Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
483b6bc3
Commit
483b6bc3
authored
Jul 14, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add internal code.
parent
4cab2170
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
0 deletions
+88
-0
BehaviorApiV2Controller.java
...group/xyqb/controller/api/v2/BehaviorApiV2Controller.java
+30
-0
SMSApiV2controller.java
...quantgroup/xyqb/controller/api/v2/SMSApiV2controller.java
+58
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/api/v2/BehaviorApiV2Controller.java
0 → 100644
View file @
483b6bc3
package
cn
.
quantgroup
.
xyqb
.
controller
.
api
.
v2
;
import
cn.quantgroup.xyqb.controller.req.v2.BehaviorReq
;
import
cn.quantgroup.xyqb.model.BehaviorCodeBean
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.service.v2.BehaviorContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
@RestController
@RequestMapping
(
"/api/v2/behavior"
)
public
class
BehaviorApiV2Controller
{
@Autowired
private
BehaviorContext
behaviorContext
;
/**
* 统一获取行为验证码
* @return JsonResult<SMSCodeBean>
* @see <a href="http://yapi.quantgroups.com/project/17/interface/api/65824">统一获取行为验证码</a>
*/
@PostMapping
(
"/code"
)
public
JsonResult
<
BehaviorCodeBean
>
getCode
(
@Valid
@RequestBody
BehaviorReq
behaviorReq
){
return
JsonResult
.
buildSuccessResultGeneric
(
behaviorContext
.
generate
(
behaviorReq
));
}
}
src/main/java/cn/quantgroup/xyqb/controller/api/v2/SMSApiV2controller.java
0 → 100644
View file @
483b6bc3
package
cn
.
quantgroup
.
xyqb
.
controller
.
api
.
v2
;
import
cn.quantgroup.xyqb.controller.req.v2.SMSReq
;
import
cn.quantgroup.xyqb.controller.req.v2.SMSVerifyReq
;
import
cn.quantgroup.xyqb.exception.BizException
;
import
cn.quantgroup.xyqb.exception.BizExceptionEnum
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.SMSCodeBean
;
import
cn.quantgroup.xyqb.service.v2.VerificationCodeContext
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
@RestController
@RequestMapping
(
"/api/v2/sms"
)
public
class
SMSApiV2controller
{
private
final
VerificationCodeContext
verificationCodeContext
;
public
SMSApiV2controller
(
VerificationCodeContext
verificationCodeContext
)
{
this
.
verificationCodeContext
=
verificationCodeContext
;
}
/**
* 统一获取短信验证码
*
* @return JsonResult<SMSCodeBean>
* @see <a href="http://yapi.quantgroups.com/project/17/interface/api/65709">统一获取短信验证码</a>
*/
@PostMapping
(
"/code"
)
public
JsonResult
<
SMSCodeBean
>
getCode
(
@Valid
@RequestBody
SMSReq
smsReq
)
{
if
(
smsReq
.
getCodeLength
()
!=
null
&&
(
smsReq
.
getCodeLength
()
<
4
||
smsReq
.
getCodeLength
()
>
10
))
{
throw
new
BizException
(
BizExceptionEnum
.
ERROR_PARAM
,
"密码长度只能在4到10位之间"
);
}
if
(
smsReq
.
getSceneType
()!=
null
&&(
smsReq
.
getSceneType
()<
0
||
smsReq
.
getSceneType
()>
2
)){
throw
new
BizException
(
BizExceptionEnum
.
ERROR_PARAM
,
"请输入有效的场景值"
);
}
return
JsonResult
.
buildSuccessResultGeneric
(
verificationCodeContext
.
send
(
smsReq
));
}
/**
* 统一验证短信验证码
*
* @return JsonResult<Boolean>
* @see <a href="http://yapi.quantgroups.com/project/17/interface/api/65829">...</a>
*/
@PostMapping
(
"/verify"
)
public
JsonResult
<
Boolean
>
verify
(
@Valid
@RequestBody
SMSVerifyReq
smsVerifyReq
)
{
return
JsonResult
.
buildSuccessResultGeneric
(
verificationCodeContext
.
verify
(
smsVerifyReq
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment