From 2cfb4f0b3ed0c995fa530a474cc4f9ca4bf4a4ae Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Mon, 25 Aug 2025 10:05:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B7=BB=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=AE=BE=E5=A4=87=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DockerFile | 5 ++ pom.xml | 5 ++ .../videotablet/VideoTabletApplication.java | 4 ++ .../videotablet/config/FilePath.java | 7 +++ .../videotablet/config/FileService.java | 15 ++++++ .../videotablet/config/SecurityConfig.java | 1 + .../videotablet/config/WebConfig.java | 8 +-- .../controller/BindSnController.java | 4 +- .../controller/DevicesController.java | 38 +++++++++++++ .../controller/ManageSnController.java | 54 +++++++++++++++++++ .../controller/TencentTrtcController.java | 36 ++++++++++++- .../videotablet/entity/Contacts.java | 16 ++++++ .../videotablet/entity/DeviceInfo.java | 3 ++ .../entity/TabletDefaultSettings.java | 21 ++++++++ .../onekeycall/videotablet/entity/User.java | 3 +- .../mapper/TabletDefaultSettingsMapper.java | 16 ++++++ .../repository/DeviceSnRepository.java | 5 +- .../TabletDefaultSettingsRepository.java | 8 +++ .../videotablet/service/DeviceSnService.java | 6 +++ .../resources/application-debug.properties | 8 ++- .../resources/application-prod.properties | 8 ++- .../resources/application-test.properties | 8 ++- .../mapper/TabletDefaultSettingsMapper.xml | 27 ++++++++++ 23 files changed, 290 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/onekeycall/videotablet/config/FilePath.java create mode 100644 src/main/java/com/onekeycall/videotablet/config/FileService.java create mode 100644 src/main/java/com/onekeycall/videotablet/entity/Contacts.java create mode 100644 src/main/java/com/onekeycall/videotablet/entity/TabletDefaultSettings.java create mode 100644 src/main/java/com/onekeycall/videotablet/mapper/TabletDefaultSettingsMapper.java create mode 100644 src/main/java/com/onekeycall/videotablet/repository/TabletDefaultSettingsRepository.java create mode 100644 src/main/resources/mapper/TabletDefaultSettingsMapper.xml diff --git a/DockerFile b/DockerFile index 342401d..dd920c1 100644 --- a/DockerFile +++ b/DockerFile @@ -1,6 +1,11 @@ FROM eclipse-temurin:21-jdk-jammy MAINTAINER TongTongStudio RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak +RUN mkdir /data +RUN mkdir /data/uploads/ +RUN mkdir /data/uploads/tablet/ +RUN mkdir /data/uploads/tablet/avatar/ + VOLUME /tmp ADD target/*.jar app.jar EXPOSE 8088 diff --git a/pom.xml b/pom.xml index 546f33e..f807715 100644 --- a/pom.xml +++ b/pom.xml @@ -101,6 +101,11 @@ spring-security-oauth2 2.5.2.RELEASE + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 3.0.3 + org.projectlombok diff --git a/src/main/java/com/onekeycall/videotablet/VideoTabletApplication.java b/src/main/java/com/onekeycall/videotablet/VideoTabletApplication.java index a0e114a..d6e8f07 100644 --- a/src/main/java/com/onekeycall/videotablet/VideoTabletApplication.java +++ b/src/main/java/com/onekeycall/videotablet/VideoTabletApplication.java @@ -1,8 +1,12 @@ package com.onekeycall.videotablet; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; +@EnableScheduling +@MapperScan({"com.onekeycall.videotablet.mapper",}) @SpringBootApplication public class VideoTabletApplication { diff --git a/src/main/java/com/onekeycall/videotablet/config/FilePath.java b/src/main/java/com/onekeycall/videotablet/config/FilePath.java new file mode 100644 index 0000000..df4393a --- /dev/null +++ b/src/main/java/com/onekeycall/videotablet/config/FilePath.java @@ -0,0 +1,7 @@ +package com.onekeycall.videotablet.config; + +public class FilePath { + public static final String TABLET_PATH = "tablet"; + public static final String AVATAR_PATH = "avatar"; + +} diff --git a/src/main/java/com/onekeycall/videotablet/config/FileService.java b/src/main/java/com/onekeycall/videotablet/config/FileService.java new file mode 100644 index 0000000..7ebd077 --- /dev/null +++ b/src/main/java/com/onekeycall/videotablet/config/FileService.java @@ -0,0 +1,15 @@ +package com.onekeycall.videotablet.config; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +public class FileService { + @Value("${file.upload.path}") + private String uploadPath; + + // 使用uploadPath操作外部文件 + public void processFile(String fileName) { + String fullPath = uploadPath + fileName; + // 文件操作逻辑... + } +} \ No newline at end of file diff --git a/src/main/java/com/onekeycall/videotablet/config/SecurityConfig.java b/src/main/java/com/onekeycall/videotablet/config/SecurityConfig.java index 673edb5..736f411 100644 --- a/src/main/java/com/onekeycall/videotablet/config/SecurityConfig.java +++ b/src/main/java/com/onekeycall/videotablet/config/SecurityConfig.java @@ -30,6 +30,7 @@ public class SecurityConfig { .requestMatchers("/public/**").permitAll() .requestMatchers("/sn/**").permitAll() .requestMatchers("/user/**").permitAll() + .requestMatchers("/rtc/**").permitAll() .requestMatchers("/admin/**").hasRole("ADMIN") // .requestMatchers("/user/**").hasAnyRole("USER", "ADMIN") .requestMatchers("/user/**").permitAll() diff --git a/src/main/java/com/onekeycall/videotablet/config/WebConfig.java b/src/main/java/com/onekeycall/videotablet/config/WebConfig.java index f4ccbfd..de2e5eb 100644 --- a/src/main/java/com/onekeycall/videotablet/config/WebConfig.java +++ b/src/main/java/com/onekeycall/videotablet/config/WebConfig.java @@ -2,12 +2,14 @@ package com.onekeycall.videotablet.config; import com.onekeycall.videotablet.interceptor.TokenInterceptor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -//@Configuration -//public class WebConfig implements WebMvcConfigurer { +@Configuration +public class WebConfig implements WebMvcConfigurer { // @Autowired // private TokenInterceptor tokenInterceptor; // @@ -17,4 +19,4 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; // .addPathPatterns("/user/**") // 保护用户相关端点 // .excludePathPatterns("/public/**"); // 开放登录注册 // } -//} +} diff --git a/src/main/java/com/onekeycall/videotablet/controller/BindSnController.java b/src/main/java/com/onekeycall/videotablet/controller/BindSnController.java index 3c842f5..17a9eaa 100644 --- a/src/main/java/com/onekeycall/videotablet/controller/BindSnController.java +++ b/src/main/java/com/onekeycall/videotablet/controller/BindSnController.java @@ -150,7 +150,7 @@ public class BindSnController { /** * 获取平板sn绑定状态 - * + * 标准的通过平板获取接口,需要 Device-Token Device-ID Device-Sig * @param deviceToken * @param deviceId * @param deviceSig @@ -158,7 +158,7 @@ public class BindSnController { * @return */ // TODO: 2025/8/22 Device_Token在docker无法被接收到,使用Device-Token代替 - @PostMapping("/get_bind_statu") + @GetMapping("/get_bind_statu") public Result getBindStatus( @RequestHeader("Device-Token") String deviceToken, @RequestHeader("Device-ID") String deviceId, @RequestHeader("Device-Sig") String deviceSig, diff --git a/src/main/java/com/onekeycall/videotablet/controller/DevicesController.java b/src/main/java/com/onekeycall/videotablet/controller/DevicesController.java index 7c7e8d4..726934b 100644 --- a/src/main/java/com/onekeycall/videotablet/controller/DevicesController.java +++ b/src/main/java/com/onekeycall/videotablet/controller/DevicesController.java @@ -1,10 +1,15 @@ package com.onekeycall.videotablet.controller; +import com.onekeycall.videotablet.entity.DeviceInfo; +import com.onekeycall.videotablet.result.Result; import com.onekeycall.videotablet.service.DeviceSnService; import com.onekeycall.videotablet.utils.JwtUtil; +import com.onekeycall.videotablet.utils.TextUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("/sn") public class DevicesController { @@ -13,5 +18,38 @@ public class DevicesController { @Autowired private DeviceSnService deviceSnService; + @GetMapping("/get_sn_list") + public Result register(@RequestHeader("Authorization") String authHeader, @RequestHeader("Device-ID") String deviceId, + @RequestParam(value = "user_id") String userId, @RequestParam(value = "sn", required = false) String sn) { + // 1. 校验 Authorization 头 + if (!authHeader.startsWith("Bearer ")) { + return Result.error().message("Invalid Authorization header"); + } + String token = authHeader.substring(7); // 去掉 "Bearer " 前缀 + // 2. 校验 Token + if (!jwtUtil.validateAccessToken(userId, token, deviceId)) { + return Result.error().message("Invalid token"); + } + + if (TextUtils.isEmpty(sn)) { + List deviceInfos = deviceSnService.findByUserId(userId); + if (deviceInfos == null || deviceInfos.isEmpty()) { + return Result.notFound().message("sn not found"); + } else { + return Result.ok().data("deviceInfos", deviceInfos); + } + }else { + DeviceInfo deviceInfo = deviceSnService.findBySn(sn); + if (deviceInfo == null) { + return Result.notFound().message("sn not found"); + } + + if(!deviceInfo.getUserId().equals(userId)) { + return Result.error().message("sn not belong to user"); + } + + return Result.ok().data("deviceInfo", deviceInfo); + } + } } diff --git a/src/main/java/com/onekeycall/videotablet/controller/ManageSnController.java b/src/main/java/com/onekeycall/videotablet/controller/ManageSnController.java index 74920bd..ac26963 100644 --- a/src/main/java/com/onekeycall/videotablet/controller/ManageSnController.java +++ b/src/main/java/com/onekeycall/videotablet/controller/ManageSnController.java @@ -1,17 +1,26 @@ package com.onekeycall.videotablet.controller; +import com.onekeycall.videotablet.config.FilePath; import com.onekeycall.videotablet.entity.DeviceInfo; +import com.onekeycall.videotablet.entity.TabletDefaultSettings; +import com.onekeycall.videotablet.mapper.TabletDefaultSettingsMapper; +import com.onekeycall.videotablet.repository.TabletDefaultSettingsRepository; import com.onekeycall.videotablet.result.Result; import com.onekeycall.videotablet.service.DeviceSnService; import com.onekeycall.videotablet.service.UserService; import com.onekeycall.videotablet.utils.CXAESUtil; import com.onekeycall.videotablet.utils.JwtUtil; import com.onekeycall.videotablet.utils.TextUtils; +import org.apache.tomcat.util.http.fileupload.FileUploadException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import java.io.File; +import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; @@ -21,12 +30,57 @@ import java.util.Map; public class ManageSnController { Logger logger = LoggerFactory.getLogger(ManageSnController.class); + @Value("${file.upload.path}") + private String uploadPath; + @Autowired private JwtUtil jwtUtil; @Autowired private UserService userService; @Autowired private DeviceSnService deviceSnService; + @Autowired + private TabletDefaultSettingsMapper tabletDefaultSettingsMapper; + @Autowired + private TabletDefaultSettingsRepository tabletDefaultSettingsRepository; + + @PostMapping("/tablet/upload_avatar") + public Result uploadAvatar(@RequestParam("file") MultipartFile multipartFile) { + String avatarPath = uploadPath + File.separator + FilePath.TABLET_PATH + File.separator + FilePath.AVATAR_PATH + File.separator; + + File fileDir = new File(avatarPath); + if (!fileDir.exists()) { + fileDir.mkdirs(); + } + + String originalFilename = multipartFile.getOriginalFilename(); + logger.info("originalFilename:" + originalFilename); + File file = new File(avatarPath + File.separator + originalFilename); + logger.info("file path = " + file.getAbsolutePath()); + + try { + multipartFile.transferTo(file); + } catch (IOException e) { + logger.error(e.getMessage()); + return Result.error().message("upload avatarPath failed"); + } + + // 检查是否存在默认设置记录 + TabletDefaultSettings tabletDefaultSettings = tabletDefaultSettingsMapper.getDefaultSettings(); + + if (tabletDefaultSettings == null) { + // 如果不存在,则创建新记录 + tabletDefaultSettings = new TabletDefaultSettings(); + tabletDefaultSettings.setDefaultAvatar(originalFilename); + tabletDefaultSettingsMapper.insertDefaultSettings(tabletDefaultSettings); + } else { + // 如果存在,则更新记录 + tabletDefaultSettings.setDefaultAvatar(originalFilename); + tabletDefaultSettingsMapper.updateDefaultSettings(tabletDefaultSettings); + } + + return Result.ok(); + } @PostMapping("/add_sn") public Result addSn( diff --git a/src/main/java/com/onekeycall/videotablet/controller/TencentTrtcController.java b/src/main/java/com/onekeycall/videotablet/controller/TencentTrtcController.java index 599ab02..5901ea1 100644 --- a/src/main/java/com/onekeycall/videotablet/controller/TencentTrtcController.java +++ b/src/main/java/com/onekeycall/videotablet/controller/TencentTrtcController.java @@ -6,6 +6,7 @@ import com.onekeycall.videotablet.service.DeviceSnService; import com.onekeycall.videotablet.service.UserService; import com.onekeycall.videotablet.tencent.trtc.TLSSigAPIv2; import com.onekeycall.videotablet.utils.JwtUtil; +import com.onekeycall.videotablet.utils.TextUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -14,7 +15,7 @@ import java.util.HashMap; import java.util.Map; @RestController -@RequestMapping("/public") +@RequestMapping("/rtc") public class TencentTrtcController { @Autowired private JwtUtil jwtUtil; @@ -38,12 +39,43 @@ public class TencentTrtcController { return Result.error().message("Invalid token"); } - TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(1600100994, "ccc0d591fe50bd9c05df7e3182256eb43fd83d1127ae7dc01a3d256dd80f3ae2"); + TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(1600103026, "78c08f86a7a1fa17bb76e1fdce824e983ce44fda132f470ad03dc868176a3afa"); String sig = tlsSigAPIv2.genUserSig(userId); Map map = new HashMap<>(); map.put("sig", sig); map.put("expire", Instant.now().getEpochSecond() + TLSSigAPIv2.EXPIRETIME); return Result.ok().data(map); } + + @GetMapping("/get_tablet_trtc_sig") + public Result getTabletTrtcSig( + @RequestHeader("Device-Token") String deviceToken, @RequestHeader("Device-ID") String deviceId, + @RequestHeader("Device-Sig") String deviceSig, + @RequestParam(value = "sn") String sn + ) { + if (!jwtUtil.validateDeviceToken(deviceToken, deviceId, sn)) { + return Result.error().message("Invalid token"); + } + + DeviceInfo deviceInfo = deviceSnService.findBySn(sn); + if (deviceInfo == null) { + return Result.notFound().message("sn not found"); + } + + if (!deviceInfo.getBindSig().equals(deviceSig)) { + return Result.error().message("device sig not match"); + } + + if (TextUtils.isEmpty(deviceInfo.getBindPhone())) { + return Result.error().message("sn not bind"); + } + + TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(1600103026, "78c08f86a7a1fa17bb76e1fdce824e983ce44fda132f470ad03dc868176a3afa"); + String sig = tlsSigAPIv2.genUserSig(sn); + Map map = new HashMap<>(); + map.put("sig", sig); + map.put("expire", Instant.now().getEpochSecond() + TLSSigAPIv2.EXPIRETIME); + return Result.ok().data(map); + } } diff --git a/src/main/java/com/onekeycall/videotablet/entity/Contacts.java b/src/main/java/com/onekeycall/videotablet/entity/Contacts.java new file mode 100644 index 0000000..acd269c --- /dev/null +++ b/src/main/java/com/onekeycall/videotablet/entity/Contacts.java @@ -0,0 +1,16 @@ +package com.onekeycall.videotablet.entity; + +import jakarta.persistence.*; +import lombok.Data; + +@Data +@Entity +@Table(name = "tablet_default_settings") +public class Contacts { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id",unique = true, nullable = false) + private Long id; + + +} diff --git a/src/main/java/com/onekeycall/videotablet/entity/DeviceInfo.java b/src/main/java/com/onekeycall/videotablet/entity/DeviceInfo.java index 1d91d1e..b6b6948 100644 --- a/src/main/java/com/onekeycall/videotablet/entity/DeviceInfo.java +++ b/src/main/java/com/onekeycall/videotablet/entity/DeviceInfo.java @@ -27,6 +27,9 @@ public class DeviceInfo { @Column(name = "device_alias") private String deviceAlias; + @Column(name = "tablet_avatar") + private String tabletAvatar; + @Convert(converter = AesAttributeConverter.class) @Column(name = "user_id") private String userId; diff --git a/src/main/java/com/onekeycall/videotablet/entity/TabletDefaultSettings.java b/src/main/java/com/onekeycall/videotablet/entity/TabletDefaultSettings.java new file mode 100644 index 0000000..3ec6b18 --- /dev/null +++ b/src/main/java/com/onekeycall/videotablet/entity/TabletDefaultSettings.java @@ -0,0 +1,21 @@ +package com.onekeycall.videotablet.entity; + +import jakarta.persistence.*; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +@Data +@Entity +@Table(name = "tablet_default_settings") +public class TabletDefaultSettings { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id",unique = true, nullable = false) + private Long id; + + @Column(name = "default_avatar", unique = true, nullable = false) + private String defaultAvatar; + +} diff --git a/src/main/java/com/onekeycall/videotablet/entity/User.java b/src/main/java/com/onekeycall/videotablet/entity/User.java index a188922..214a274 100644 --- a/src/main/java/com/onekeycall/videotablet/entity/User.java +++ b/src/main/java/com/onekeycall/videotablet/entity/User.java @@ -24,11 +24,10 @@ public class User implements UserDetails { @Column(name = "id") private Long id; - // 使用@Convert注解指定转换器 - @Convert(converter = AesAttributeConverter.class) @Column(name = "user_id", unique = true, nullable = false) private String userId; + // 使用@Convert注解指定转换器 @Convert(converter = AesAttributeConverter.class) @Column private String nickname; diff --git a/src/main/java/com/onekeycall/videotablet/mapper/TabletDefaultSettingsMapper.java b/src/main/java/com/onekeycall/videotablet/mapper/TabletDefaultSettingsMapper.java new file mode 100644 index 0000000..c8a58d4 --- /dev/null +++ b/src/main/java/com/onekeycall/videotablet/mapper/TabletDefaultSettingsMapper.java @@ -0,0 +1,16 @@ +package com.onekeycall.videotablet.mapper; + +import com.onekeycall.videotablet.entity.TabletDefaultSettings; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface TabletDefaultSettingsMapper { + // 获取默认设置 + TabletDefaultSettings getDefaultSettings(); + + // 更新默认设置 + int updateDefaultSettings(TabletDefaultSettings tabletDefaultSettings); + + // 新增默认设置 + int insertDefaultSettings(TabletDefaultSettings tabletDefaultSettings); +} diff --git a/src/main/java/com/onekeycall/videotablet/repository/DeviceSnRepository.java b/src/main/java/com/onekeycall/videotablet/repository/DeviceSnRepository.java index 957cbab..5b4353b 100644 --- a/src/main/java/com/onekeycall/videotablet/repository/DeviceSnRepository.java +++ b/src/main/java/com/onekeycall/videotablet/repository/DeviceSnRepository.java @@ -3,6 +3,9 @@ package com.onekeycall.videotablet.repository; import com.onekeycall.videotablet.entity.DeviceInfo; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface DeviceSnRepository extends JpaRepository { - DeviceInfo findBySn(String deviceId); + List findByUserId(String userId); + DeviceInfo findBySn(String sn); } diff --git a/src/main/java/com/onekeycall/videotablet/repository/TabletDefaultSettingsRepository.java b/src/main/java/com/onekeycall/videotablet/repository/TabletDefaultSettingsRepository.java new file mode 100644 index 0000000..2ac4b04 --- /dev/null +++ b/src/main/java/com/onekeycall/videotablet/repository/TabletDefaultSettingsRepository.java @@ -0,0 +1,8 @@ +package com.onekeycall.videotablet.repository; + +import com.onekeycall.videotablet.entity.TabletDefaultSettings; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface TabletDefaultSettingsRepository extends JpaRepository { + TabletDefaultSettings getTabletDefaultSettingsById(Long id); +} diff --git a/src/main/java/com/onekeycall/videotablet/service/DeviceSnService.java b/src/main/java/com/onekeycall/videotablet/service/DeviceSnService.java index 2e8e117..99661e9 100644 --- a/src/main/java/com/onekeycall/videotablet/service/DeviceSnService.java +++ b/src/main/java/com/onekeycall/videotablet/service/DeviceSnService.java @@ -5,6 +5,8 @@ import com.onekeycall.videotablet.repository.DeviceSnRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class DeviceSnService { private final DeviceSnRepository deviceSnRepository; @@ -14,6 +16,10 @@ public class DeviceSnService { this.deviceSnRepository = deviceSnRepository; } + public List findByUserId(String userId) { + return deviceSnRepository.findByUserId(userId); + } + public DeviceInfo findBySn(String sn) { return deviceSnRepository.findBySn(sn); } diff --git a/src/main/resources/application-debug.properties b/src/main/resources/application-debug.properties index c7fc142..e9bb760 100644 --- a/src/main/resources/application-debug.properties +++ b/src/main/resources/application-debug.properties @@ -1,5 +1,6 @@ spring.application.name=VideoTablet server.port=8088 +file.upload.path=/data/uploads/ ## mysql 数据连接信息 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -41,7 +42,7 @@ logging.file.name=app.log logging.file.path=/var/log/myapp # 设置日志级别 -logging.level.root=INFO//////////////////////////////////////////////////////////////////////////// +logging.level.root=INFO logging.level.com.example=DEBUG @@ -51,4 +52,7 @@ logging.pattern.file=%d{yyyy-MM-dd} [%thread] %-5level %logger - %msg%n # 日志文件切割(默认10MB分割,保留7天) logging.logback.rollingpolicy.max-file-size=10MB -logging.logback.rollingpolicy.max-history=30 \ No newline at end of file +logging.logback.rollingpolicy.max-history=30 + +mybatis.type-aliases-package=com.onekeycall.videotablet.entity +mybatis.mapperLocations=classpath:mapper/*.xml \ No newline at end of file diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index b2aeafe..d39b3dd 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -1,5 +1,6 @@ spring.application.name=VideoTablet server.port=8088 +file.upload.path=/data/uploads/ ## mysql 数据连接信息 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -41,7 +42,7 @@ logging.file.name=app.log logging.file.path=/var/log/myapp # 设置日志级别 -logging.level.root=INFO//////////////////////////////////////////////////////////////////////////// +logging.level.root=INFO logging.level.com.example=DEBUG @@ -51,4 +52,7 @@ logging.pattern.file=%d{yyyy-MM-dd} [%thread] %-5level %logger - %msg%n # 日志文件切割(默认10MB分割,保留7天) logging.logback.rollingpolicy.max-file-size=10MB -logging.logback.rollingpolicy.max-history=30 \ No newline at end of file +logging.logback.rollingpolicy.max-history=30 + +mybatis.type-aliases-package=com.onekeycall.videotablet.entity +mybatis.mapperLocations=classpath:mapper/*.xml \ No newline at end of file diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index b2aeafe..d39b3dd 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,5 +1,6 @@ spring.application.name=VideoTablet server.port=8088 +file.upload.path=/data/uploads/ ## mysql 数据连接信息 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver @@ -41,7 +42,7 @@ logging.file.name=app.log logging.file.path=/var/log/myapp # 设置日志级别 -logging.level.root=INFO//////////////////////////////////////////////////////////////////////////// +logging.level.root=INFO logging.level.com.example=DEBUG @@ -51,4 +52,7 @@ logging.pattern.file=%d{yyyy-MM-dd} [%thread] %-5level %logger - %msg%n # 日志文件切割(默认10MB分割,保留7天) logging.logback.rollingpolicy.max-file-size=10MB -logging.logback.rollingpolicy.max-history=30 \ No newline at end of file +logging.logback.rollingpolicy.max-history=30 + +mybatis.type-aliases-package=com.onekeycall.videotablet.entity +mybatis.mapperLocations=classpath:mapper/*.xml \ No newline at end of file diff --git a/src/main/resources/mapper/TabletDefaultSettingsMapper.xml b/src/main/resources/mapper/TabletDefaultSettingsMapper.xml new file mode 100644 index 0000000..e318694 --- /dev/null +++ b/src/main/resources/mapper/TabletDefaultSettingsMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + UPDATE tablet_default_settings + + default_avatar = #{defaultAvatar} + + WHERE id = #{id} + + + + + INSERT INTO tablet_default_settings (default_avatar) + VALUES (#{defaultAvatar}) + +