Merge pull request 'master' (#5) from master into dev
Reviewed-on: https://git.landaiqing.space/Schisandra-Cloud-Storage/schisandra-cloud-storage/pulls/5
This commit is contained in:
@@ -64,7 +64,7 @@ public class SchisandraAuthPermissionController {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description:查询权限信息
|
||||
* @description: 查询权限信息
|
||||
* @param: [schisandraAuthPermissionDTO]
|
||||
* @return: com.schisandra.auth.common.entity.Result
|
||||
* @author zlg
|
||||
|
@@ -1,31 +1,51 @@
|
||||
package com.schisandra.auth.application.controller;
|
||||
|
||||
|
||||
import com.schisandra.auth.common.entity.Result;
|
||||
import com.schisandra.auth.common.redis.RedisUtil;
|
||||
import com.schisandra.auth.common.utils.SmsCodeUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Classname SchisandraSmsController
|
||||
* @BelongsProject: schisandra-cloud-storage
|
||||
* @BelongsPackage: com.schisandra.auth.application.controller
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-05-08 01:41
|
||||
* @Description: TODO
|
||||
* @Version: 1.0
|
||||
*/
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sms/")
|
||||
@Slf4j
|
||||
public class SchisandraSmsController {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private final String authPhonePrefix="auth.phone";
|
||||
/**
|
||||
* @description: 发送短信验证码
|
||||
* @param: [phone]
|
||||
* @return: com.schisandra.auth.common.entity.Result
|
||||
* @author zlg
|
||||
* @date: 2024/5/8 22:53
|
||||
*/
|
||||
@GetMapping("/sendByTemplate")
|
||||
public Result sendByTemplate(String phone) {
|
||||
String prefix = redisUtil.buildKey(authPhonePrefix, phone);
|
||||
String code = SmsCodeUtils.generateValidateCode(4).toString();
|
||||
if (!redisUtil.exist(prefix)){
|
||||
SmsResponse smsResponse=SmsFactory.getBySupplier("alibaba").sendMessage(phone,code);
|
||||
if (smsResponse.isSuccess()){
|
||||
redisUtil.setNx(prefix, code, 60L,SECONDS);
|
||||
return Result.ok();
|
||||
}else {
|
||||
return Result.fail();
|
||||
}
|
||||
}else {
|
||||
return Result.fail("发送频繁,请稍后重试");
|
||||
}
|
||||
|
||||
@GetMapping("send")
|
||||
public SmsResponse send(String phone){
|
||||
SmsBlend smsBlend =SmsFactory.getSmsBlend();
|
||||
return smsBlend.sendMessage(phone, "1234");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,51 +0,0 @@
|
||||
package com.schisandra.auth.application.controller;
|
||||
|
||||
|
||||
import com.schisandra.auth.common.entity.Result;
|
||||
import com.schisandra.auth.common.redis.RedisUtil;
|
||||
import com.schisandra.auth.common.utils.SmsCodeUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sms/")
|
||||
@Slf4j
|
||||
public class SmsController {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
private final String authPhonePrefix="auth.phone";
|
||||
/**
|
||||
* @description: 发送短信验证码
|
||||
* @param: [phone]
|
||||
* @return: com.schisandra.auth.common.entity.Result
|
||||
* @author zlg
|
||||
* @date: 2024/5/8 22:53
|
||||
*/
|
||||
@GetMapping("/sendByTemplate")
|
||||
public Result sendByTemplate(String phone) {
|
||||
String prefix = redisUtil.buildKey(authPhonePrefix, phone);
|
||||
String code = SmsCodeUtils.generateValidateCode(4).toString();
|
||||
if (!redisUtil.exist(prefix)){
|
||||
SmsResponse smsResponse=SmsFactory.getBySupplier("alibaba").sendMessage(phone,code);
|
||||
if (smsResponse.isSuccess()){
|
||||
redisUtil.setNx(prefix, code, 60L,SECONDS);
|
||||
return Result.ok();
|
||||
}else {
|
||||
return Result.fail();
|
||||
}
|
||||
}else {
|
||||
return Result.fail("发送频繁,请稍后重试");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -8,6 +8,6 @@ public interface SchisandraAuthPermissionDomainService {
|
||||
Object update(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
|
||||
Object delete(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
|
||||
Object insert(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
|
||||
SchisandraAuthPermission select(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
|
||||
SchisandraAuthPermissionBO select(SchisandraAuthPermissionBO schisandraAuthPermissionBO);
|
||||
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ public interface SchisandraAuthUserDomainService {
|
||||
* @author msz
|
||||
* @return com.schisandra.auth.infra.basic.entity.SchisandraAuthUser
|
||||
*/
|
||||
SchisandraAuthUser queryById(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO);
|
||||
/**
|
||||
* @description 添加用户信息
|
||||
* @param schisandraAuthUserBO
|
||||
|
@@ -62,11 +62,12 @@ public class SchisandraAuthPermissionDomainServiceImpl implements SchisandraAuth
|
||||
* @date: 2024/4/17 17:07
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthPermission select(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {
|
||||
public SchisandraAuthPermissionBO select(SchisandraAuthPermissionBO schisandraAuthPermissionBO) {
|
||||
|
||||
SchisandraAuthPermission schisandraAuthPermission = SchisandraAuthPermissionBOConverter.INSTANCE.convertBOToEntity(schisandraAuthPermissionBO);
|
||||
|
||||
SchisandraAuthPermission schisandraAuthPermission1 =schisandraAuthPermissionService.queryById(schisandraAuthPermission.getId());
|
||||
return schisandraAuthPermission1;
|
||||
SchisandraAuthPermissionBO schisandraAuthPermissionBO1 = SchisandraAuthPermissionBOConverter.INSTANCE.convertEntityToBO(schisandraAuthPermission1);
|
||||
return schisandraAuthPermissionBO1;
|
||||
}
|
||||
}
|
||||
|
@@ -38,9 +38,10 @@ public class SchisandraAuthUserDomainServiceImpl implements SchisandraAuthUserDo
|
||||
* @date 2024/4/3 22:10
|
||||
*/
|
||||
@Override
|
||||
public SchisandraAuthUser queryById(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
public SchisandraAuthUserBO queryById(SchisandraAuthUserBO schisandraAuthUserBO) {
|
||||
SchisandraAuthUser schisandraAuthUser = schisandraAuthUserService.queryById(schisandraAuthUserBO.getId());
|
||||
return schisandraAuthUser;
|
||||
SchisandraAuthUserBO schisandraAuthUserBO1 = SchisandraAuthUserBOConverter.INSTANCE.convertEntityToBO(schisandraAuthUser);
|
||||
return schisandraAuthUserBO1;
|
||||
}
|
||||
/**
|
||||
* @description 添加用户信息
|
||||
|
@@ -67,8 +67,9 @@ sa-token:
|
||||
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||
token-style: random-32
|
||||
# 是否输出操作日志
|
||||
is-log: true
|
||||
is-log: false
|
||||
token-prefix: schisandra
|
||||
is-print: false
|
||||
|
||||
sms:
|
||||
# 标注从yml读取配置
|
||||
@@ -79,4 +80,9 @@ sms:
|
||||
isPrint: false
|
||||
HttpLog: true
|
||||
|
||||
# mybatis-plus日志
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
banner: false
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
${AnsiColor.GREEN}
|
||||
|
||||
|
||||
,---,
|
||||
,--.' | ,--, ,---,
|
||||
|
@@ -7,10 +7,10 @@
|
||||
<Properties>
|
||||
<!-- 格式化输出:%date表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %msg:日志消息,%n是换行符-->
|
||||
<!-- %logger{36} 表示 Logger 名字最长36个字符 -->
|
||||
<property name="LOG_PATTERN" value="%date{HH:mm:ss.SSS} %X{PFTID} [%thread] %-5level %logger{36} - %msg%n" />
|
||||
<property name="LOG_PATTERN" value="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx" />
|
||||
<!-- 定义日志存储的路径 -->
|
||||
<property name="FILE_PATH" value="../log" />
|
||||
<property name="FILE_NAME" value="schisandra-cloud-album.log" />
|
||||
<property name="FILE_NAME" value="schisandra-cloud-storage.log" />
|
||||
</Properties>
|
||||
|
||||
<!--https://logging.apache.org/log4j/2.x/manual/appenders.html-->
|
||||
|
Reference in New Issue
Block a user