Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
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
lanbaoming
jiedao-api-boot-master
Commits
dc9561e9
Commit
dc9561e9
authored
Nov 27, 2024
by
honghy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注释回调接口
parent
c24b0851
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
67 deletions
+67
-67
SmsCallbackController.java
...le/system/controller/admin/sms/SmsCallbackController.java
+67
-67
No files found.
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsCallbackController.java
View file @
dc9561e9
package
cn
.
iocoder
.
yudao
.
module
.
system
.
controller
.
admin
.
sms
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.extra.servlet.ServletUtil
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.util.json.JsonUtils
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.framework.sms.core.client.impl.sendchamp.SendChampSmsClient
;
import
cn.iocoder.yudao.framework.sms.core.enums.SmsChannelEnum
;
import
cn.iocoder.yudao.module.system.service.sms.SmsLogService
;
import
cn.iocoder.yudao.module.system.service.sms.SmsSendService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
/**
* @author ECIT-2
*/
@Api
(
tags
=
"管理后台 - 短信回调"
)
@RestController
@RequestMapping
(
"/system/sms/callback"
)
public
class
SmsCallbackController
{
@Resource
private
SmsSendService
smsSendService
;
@Resource
private
SmsLogService
smsLogService
;
@PostMapping
(
"/yunpian"
)
@ApiOperation
(
value
=
"云片短信的回调"
,
notes
=
"参见 https://www.yunpian.com/official/document/sms/zh_cn/domestic_push_report 文档"
)
@ApiImplicitParam
(
name
=
"sms_status"
,
value
=
"发送状态"
,
required
=
true
,
example
=
"[{具体内容}]"
,
dataTypeClass
=
String
.
class
)
@OperateLog
(
enable
=
false
)
public
String
receiveYunpianSmsStatus
(
@RequestParam
(
"sms_status"
)
String
smsStatus
)
throws
Throwable
{
String
text
=
URLUtil
.
decode
(
smsStatus
);
// decode 解码参数,因为它被 encode
smsSendService
.
receiveSmsStatus
(
SmsChannelEnum
.
YUN_PIAN
.
getCode
(),
text
);
return
"SUCCESS"
;
// 约定返回 SUCCESS 为成功
}
@PostMapping
(
"/aliyun"
)
@ApiOperation
(
value
=
"阿里云短信的回调"
,
notes
=
"参见 https://help.aliyun.com/document_detail/120998.html 文档"
)
@OperateLog
(
enable
=
false
)
public
CommonResult
<
Boolean
>
receiveAliyunSmsStatus
(
HttpServletRequest
request
)
throws
Throwable
{
String
text
=
ServletUtil
.
getBody
(
request
);
smsSendService
.
receiveSmsStatus
(
SmsChannelEnum
.
ALIYUN
.
getCode
(),
text
);
return
success
(
true
);
}
@PostMapping
(
"/sendchamp"
)
@ApiOperation
(
value
=
"sendchamp短信的回调"
)
@OperateLog
(
enable
=
false
)
public
CommonResult
<
Boolean
>
receiveSendchampSmsStatus
(
HttpServletRequest
request
)
{
String
text
=
ServletUtil
.
getBody
(
request
);
SendChampSmsClient
.
SmsReceiveStatus
smsReceiveStatus
=
JsonUtils
.
parseObject
(
text
,
SendChampSmsClient
.
SmsReceiveStatus
.
class
);
smsLogService
.
updateSendChampReceive
(
smsReceiveStatus
);
return
success
(
true
);
}
}
//
package cn.iocoder.yudao.module.system.controller.admin.sms;
//
//
import cn.hutool.core.util.URLUtil;
//
import cn.hutool.extra.servlet.ServletUtil;
//
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
//
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
//
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
//
import cn.iocoder.yudao.framework.sms.core.client.impl.sendchamp.SendChampSmsClient;
//
import cn.iocoder.yudao.framework.sms.core.enums.SmsChannelEnum;
//
import cn.iocoder.yudao.module.system.service.sms.SmsLogService;
//
import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
//
import io.swagger.annotations.Api;
//
import io.swagger.annotations.ApiImplicitParam;
//
import io.swagger.annotations.ApiOperation;
//
import org.springframework.web.bind.annotation.PostMapping;
//
import org.springframework.web.bind.annotation.RequestMapping;
//
import org.springframework.web.bind.annotation.RequestParam;
//
import org.springframework.web.bind.annotation.RestController;
//
//
import javax.annotation.Resource;
//
import javax.servlet.http.HttpServletRequest;
//
//
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
//
/
//
**
//
* @author ECIT-2
//
*/
//
@Api(tags = "管理后台 - 短信回调")
//
@RestController
//
@RequestMapping("/system/sms/callback")
//
public class SmsCallbackController {
//
//
@Resource
//
private SmsSendService smsSendService;
//
//
@Resource
//
private SmsLogService smsLogService;
//
//
@PostMapping("/yunpian")
//
@ApiOperation(value = "云片短信的回调", notes = "参见 https://www.yunpian.com/official/document/sms/zh_cn/domestic_push_report 文档")
//
@ApiImplicitParam(name = "sms_status", value = "发送状态", required = true, example = "[{具体内容}]", dataTypeClass = String.class)
//
@OperateLog(enable = false)
//
public String receiveYunpianSmsStatus(@RequestParam("sms_status") String smsStatus) throws Throwable {
//
String text = URLUtil.decode(smsStatus); // decode 解码参数,因为它被 encode
//
smsSendService.receiveSmsStatus(SmsChannelEnum.YUN_PIAN.getCode(), text);
//
return "SUCCESS"; // 约定返回 SUCCESS 为成功
//
}
//
//
@PostMapping("/aliyun")
//
@ApiOperation(value = "阿里云短信的回调", notes = "参见 https://help.aliyun.com/document_detail/120998.html 文档")
//
@OperateLog(enable = false)
//
public CommonResult<Boolean> receiveAliyunSmsStatus(HttpServletRequest request) throws Throwable {
//
String text = ServletUtil.getBody(request);
//
smsSendService.receiveSmsStatus(SmsChannelEnum.ALIYUN.getCode(), text);
//
return success(true);
//
}
//
//
@PostMapping("/sendchamp")
//
@ApiOperation(value = "sendchamp短信的回调")
//
@OperateLog(enable = false)
//
public CommonResult<Boolean> receiveSendchampSmsStatus(HttpServletRequest request) {
//
String text = ServletUtil.getBody(request);
//
SendChampSmsClient.SmsReceiveStatus smsReceiveStatus = JsonUtils.parseObject(text, SendChampSmsClient.SmsReceiveStatus.class);
//
smsLogService.updateSendChampReceive(smsReceiveStatus);
//
return success(true);
//
}
//
}
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