mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 04:08:43 +08:00 
			
		
		
		
	移除云片短信渠道,解决云片的安全风险
This commit is contained in:
		@@ -1,17 +1,14 @@
 | 
			
		||||
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.module.system.service.sms.SmsSendService;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
 | 
			
		||||
import cn.iocoder.yudao.framework.sms.core.enums.SmsChannelEnum;
 | 
			
		||||
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;
 | 
			
		||||
@@ -28,17 +25,6 @@ public class SmsCallbackController {
 | 
			
		||||
    @Resource
 | 
			
		||||
    private SmsSendService smsSendService;
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/yunpian")
 | 
			
		||||
    @PermitAll
 | 
			
		||||
    @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")
 | 
			
		||||
    @PermitAll
 | 
			
		||||
    @ApiOperation(value = "阿里云短信的回调", notes = "参见 https://help.aliyun.com/document_detail/120998.html 文档")
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,27 @@
 | 
			
		||||
package cn.iocoder.yudao.module.system.job;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
 | 
			
		||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
 | 
			
		||||
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
 | 
			
		||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 | 
			
		||||
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
 | 
			
		||||
import org.springframework.stereotype.Component;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Component
 | 
			
		||||
@TenantJob // 标记多租户
 | 
			
		||||
public class DemoJob implements JobHandler {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private AdminUserMapper adminUserMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String execute(String param) throws Exception {
 | 
			
		||||
        System.out.println("当前租户:" + TenantContextHolder.getTenantId());
 | 
			
		||||
        List<AdminUserDO> users = adminUserMapper.selectList();
 | 
			
		||||
        return "用户数量:" + users.size();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user