# voice-web-admin **Repository Path**: xmnzp/voice-web-admin ## Basic Information - **Project Name**: voice-web-admin - **Description**: voice-web 对应的后台管理系统 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-05-26 - **Last Updated**: 2024-05-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 个人开发记录 #### 日志记录 1.邮箱发送失败,控制台出现错误日志 `Could not connect to SMTP host: smtp.qq.com, port: 465, response: -1 SpringBoot发送邮件` 解决方法: 在`application` 关于`email`添加`ssh`安全配置 ```yml spring: email: properties: mail.smtp.ssl.enable: true ``` 2.修复时间问题,新增数据的事件与现在的时间存在时区的差异 解决方法,在数据库连接配置后面加上时区`serverTimezone=Asia/Shanghai` 3. 解决前后端分离开发出现的跨域问题 + 在`controller`层添加注解`@Corsorigin` + 添加全局配置 ```java @Configuration public class CorsMappingConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { String mapping = "dev/**"; // 所有请求,也可配置成特定请求,如/api/** String origins = "*"; // 所有来源,也可以配置成特定的来源才允许跨域,如http://www.xxxx.com String methods = "*"; // 所有方法,GET、POST、PUT等 String headers ="*"; //所有的请求头 registry.addMapping(mapping).allowedOrigins(origins).allowedMethods(methods).allowedHeaders(headers); } } ``` 4. 解决前端调用请求时出现报错 `Required String parameter '×××' is not present` **场景**,这采用`swaggerui`注解和`@RequestParam`,后者默认参数为必填,前面这是`api`文档层显示的必填 所有,去掉默认,`@ApiParam`默认为false,`@RequestParam`默认为`true`,前后需保持一直