删除重复促销接口
Change-Id: Ie8c3853f3d0436c9a1ef2fc5687ff89fc8a4c58b
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index d38745b..188fe38 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,57 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="AutoImportSettings">
- <option name="autoReloadType" value="SELECTIVE" />
- </component>
- <component name="ChangeListManager">
- <list default="true" id="f008fe30-0711-42e2-bb33-17dcfdbad387" name="Changes" comment="pom">
- <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/main/java/com/example/myproject/controller/PromotionController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/myproject/controller/PromotionController.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/main/java/com/example/myproject/mapper/PromotionMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/myproject/mapper/PromotionMapper.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/main/java/com/example/myproject/service/serviceImpl/PromotionServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/myproject/service/serviceImpl/PromotionServiceImpl.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/main/java/com/example/myproject/service/serviceImpl/TorrentServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/example/myproject/service/serviceImpl/TorrentServiceImpl.java" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/target/classes/com/example/myproject/mapper/PromotionMapper.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/example/myproject/mapper/PromotionMapper.class" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/target/classes/com/example/myproject/service/serviceImpl/PromotionServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/example/myproject/service/serviceImpl/PromotionServiceImpl.class" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/target/classes/com/example/myproject/service/serviceImpl/TorrentServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/example/myproject/service/serviceImpl/TorrentServiceImpl.class" afterDir="false" />
- </list>
- <option name="SHOW_DIALOG" value="false" />
- <option name="HIGHLIGHT_CONFLICTS" value="true" />
- <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
- <option name="LAST_RESOLUTION" value="IGNORE" />
- </component>
- <component name="FileTemplateManagerImpl">
- <option name="RECENT_TEMPLATES">
- <list>
- <option value="Class" />
- </list>
- </option>
- </component>
- <component name="Git.Settings">
- <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
- <option name="ROOT_SYNC" value="SYNC" />
- </component>
- <component name="HighlightingSettingsPerFile">
- <setting file="file://$PROJECT_DIR$/src/main/java/com/example/myproject/config/WebConfig.java" root0="FORCE_HIGHLIGHTING" />
- <setting file="file://$PROJECT_DIR$/src/main/java/com/example/myproject/service/PostService.java" root0="FORCE_HIGHLIGHTING" />
- </component>
- <component name="MarkdownSettingsMigration">
- <option name="stateVersion" value="1" />
- </component>
- <component name="ProblemsViewState">
- <option name="selectedTabId" value="CurrentFile" />
- </component>
- <component name="ProjectColorInfo">{
+ <component name="AutoImportSettings">
+ <option name="autoReloadType" value="SELECTIVE" />
+ </component>
+ <component name="ChangeListManager">
+ <list default="true" id="f008fe30-0711-42e2-bb33-17dcfdbad387" name="Changes" comment="pom">
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+ </list>
+ <option name="SHOW_DIALOG" value="false" />
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+ <option name="LAST_RESOLUTION" value="IGNORE" />
+ </component>
+ <component name="FileTemplateManagerImpl">
+ <option name="RECENT_TEMPLATES">
+ <list>
+ <option value="Class" />
+ </list>
+ </option>
+ </component>
+ <component name="Git.Settings">
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+ <option name="ROOT_SYNC" value="SYNC" />
+ </component>
+ <component name="HighlightingSettingsPerFile">
+ <setting file="file://$PROJECT_DIR$/src/main/java/com/example/myproject/config/WebConfig.java" root0="FORCE_HIGHLIGHTING" />
+ <setting file="file://$PROJECT_DIR$/src/main/java/com/example/myproject/service/PostService.java" root0="FORCE_HIGHLIGHTING" />
+ </component>
+ <component name="MarkdownSettingsMigration">
+ <option name="stateVersion" value="1" />
+ </component>
+ <component name="ProblemsViewState">
+ <option name="selectedTabId" value="CurrentFile" />
+ </component>
+ <component name="ProjectColorInfo">{
"associatedIndex": 0
}</component>
- <component name="ProjectId" id="2vZNfNTEFyHApdxmHZ7Y0rlJjKB" />
- <component name="ProjectLevelVcsManager" settingsEditedManually="true">
- <ConfirmationsSetting value="2" id="Add" />
- </component>
- <component name="ProjectViewState">
- <option name="hideEmptyMiddlePackages" value="true" />
- <option name="showLibraryContents" value="true" />
- </component>
- <component name="PropertiesComponent">{
+ <component name="ProjectId" id="2vZNfNTEFyHApdxmHZ7Y0rlJjKB" />
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true">
+ <ConfirmationsSetting value="2" id="Add" />
+ </component>
+ <component name="ProjectViewState">
+ <option name="hideEmptyMiddlePackages" value="true" />
+ <option name="showLibraryContents" value="true" />
+ </component>
+ <component name="PropertiesComponent">{
"keyToString": {
"ASKED_ADD_EXTERNAL_FILES": "true",
"JUnit.UserControllerTest.executor": "Run",
@@ -83,201 +76,201 @@
]
}
}</component>
- <component name="RecentsManager">
- <key name="CopyFile.RECENT_KEYS">
- <recent name="D:\Desktop\echo后端\echo-backend\images" />
- <recent name="D:\Desktop\echo后端\echo-backend\uploads\dynamic" />
- <recent name="D:\PT\echo-backend\src\main\java\com\example\myproject\config" />
- <recent name="D:\PT\echo-backend\src\main\java\com\example\myproject\service" />
- <recent name="D:\PT\echo-backend\src\main\java\com\example\myproject\controller" />
- </key>
- <key name="MoveFile.RECENT_KEYS">
- <recent name="D:\study\学习资源\大三下\school\echo-backend\src\main\resources\mapper" />
- </key>
- </component>
- <component name="RunManager" selected="应用程序.MyProjectApplication">
- <configuration name="MyProjectApplication" type="Application" factoryName="Application" temporary="true">
- <option name="MAIN_CLASS_NAME" value="com.example.myproject.MyProjectApplication" />
- <module name="echo-backend" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.example.myproject.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="MyProjectApplication" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
- <option name="MAIN_CLASS_NAME" value="com.example.myproject.MyProjectApplication" />
- <module name="echo-backend" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.example.myproject.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="TorrentControllerTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
- <module name="echo-backend" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.example.myproject.controller.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
- <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.TorrentControllerTest" />
- <option name="TEST_OBJECT" value="class" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="UserControllerTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
- <module name="echo-backend" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.example.myproject.controller.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
- <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.UserControllerTest" />
- <option name="TEST_OBJECT" value="class" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="UserControllerTest.testUpdateUserAvatar" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
- <module name="echo-backend" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.example.myproject.controller.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
- <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.UserControllerTest" />
- <option name="METHOD_NAME" value="testUpdateUserAvatar" />
- <option name="TEST_OBJECT" value="method" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="UserControllerTest.testUploadUserAvatar" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
- <module name="echo-backend" />
- <extension name="coverage">
- <pattern>
- <option name="PATTERN" value="com.example.myproject.controller.*" />
- <option name="ENABLED" value="true" />
- </pattern>
- </extension>
- <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
- <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.UserControllerTest" />
- <option name="METHOD_NAME" value="testUploadUserAvatar" />
- <option name="TEST_OBJECT" value="method" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <configuration name="MyProjectApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
- <module name="echo-backend" />
- <option name="SPRING_BOOT_MAIN_CLASS" value="com.example.myproject.MyProjectApplication" />
- <method v="2">
- <option name="Make" enabled="true" />
- </method>
- </configuration>
- <recent_temporary>
- <list>
- <item itemvalue="应用程序.MyProjectApplication" />
- <item itemvalue="JUnit.UserControllerTest.testUploadUserAvatar" />
- <item itemvalue="JUnit.UserControllerTest.testUpdateUserAvatar" />
- <item itemvalue="JUnit.UserControllerTest" />
- <item itemvalue="JUnit.TorrentControllerTest" />
- </list>
- </recent_temporary>
- </component>
- <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
- <component name="TaskManager">
- <task active="true" id="Default" summary="Default task">
- <changelist id="f008fe30-0711-42e2-bb33-17dcfdbad387" name="Changes" comment="" />
- <created>1744348740342</created>
- <option name="number" value="Default" />
- <option name="presentableId" value="Default" />
- <updated>1744348740342</updated>
- <workItem from="1749007243227" duration="1245000" />
- <workItem from="1749033374884" duration="7535000" />
- <workItem from="1749048857906" duration="4388000" />
- <workItem from="1749109821491" duration="5517000" />
- <workItem from="1749206945935" duration="4467000" />
- </task>
- <task id="LOCAL-00001" summary="pom">
- <option name="closed" value="true" />
- <created>1749011916131</created>
- <option name="number" value="00001" />
- <option name="presentableId" value="LOCAL-00001" />
- <option name="project" value="LOCAL" />
- <updated>1749011916131</updated>
- </task>
- <task id="LOCAL-00002" summary="pom">
- <option name="closed" value="true" />
- <created>1749012141761</created>
- <option name="number" value="00002" />
- <option name="presentableId" value="LOCAL-00002" />
- <option name="project" value="LOCAL" />
- <updated>1749012141761</updated>
- </task>
- <option name="localTasksCounter" value="3" />
- <servers />
- </component>
- <component name="TypeScriptGeneratedFilesManager">
- <option name="version" value="3" />
- </component>
- <component name="Vcs.Log.Tabs.Properties">
- <option name="TAB_STATES">
- <map>
- <entry key="MAIN">
+ <component name="RecentsManager">
+ <key name="CopyFile.RECENT_KEYS">
+ <recent name="D:\Desktop\echo后端\echo-backend\images" />
+ <recent name="D:\Desktop\echo后端\echo-backend\uploads\dynamic" />
+ <recent name="D:\PT\echo-backend\src\main\java\com\example\myproject\config" />
+ <recent name="D:\PT\echo-backend\src\main\java\com\example\myproject\service" />
+ <recent name="D:\PT\echo-backend\src\main\java\com\example\myproject\controller" />
+ </key>
+ <key name="MoveFile.RECENT_KEYS">
+ <recent name="D:\study\学习资源\大三下\school\echo-backend\src\main\resources\mapper" />
+ </key>
+ </component>
+ <component name="RunManager" selected="应用程序.MyProjectApplication">
+ <configuration name="MyProjectApplication" type="Application" factoryName="Application" temporary="true">
+ <option name="MAIN_CLASS_NAME" value="com.example.myproject.MyProjectApplication" />
+ <module name="echo-backend" />
+ <extension name="coverage">
+ <pattern>
+ <option name="PATTERN" value="com.example.myproject.*" />
+ <option name="ENABLED" value="true" />
+ </pattern>
+ </extension>
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <configuration name="MyProjectApplication" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
+ <option name="MAIN_CLASS_NAME" value="com.example.myproject.MyProjectApplication" />
+ <module name="echo-backend" />
+ <extension name="coverage">
+ <pattern>
+ <option name="PATTERN" value="com.example.myproject.*" />
+ <option name="ENABLED" value="true" />
+ </pattern>
+ </extension>
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <configuration name="TorrentControllerTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
+ <module name="echo-backend" />
+ <extension name="coverage">
+ <pattern>
+ <option name="PATTERN" value="com.example.myproject.controller.*" />
+ <option name="ENABLED" value="true" />
+ </pattern>
+ </extension>
+ <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
+ <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.TorrentControllerTest" />
+ <option name="TEST_OBJECT" value="class" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <configuration name="UserControllerTest" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
+ <module name="echo-backend" />
+ <extension name="coverage">
+ <pattern>
+ <option name="PATTERN" value="com.example.myproject.controller.*" />
+ <option name="ENABLED" value="true" />
+ </pattern>
+ </extension>
+ <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
+ <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.UserControllerTest" />
+ <option name="TEST_OBJECT" value="class" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <configuration name="UserControllerTest.testUpdateUserAvatar" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
+ <module name="echo-backend" />
+ <extension name="coverage">
+ <pattern>
+ <option name="PATTERN" value="com.example.myproject.controller.*" />
+ <option name="ENABLED" value="true" />
+ </pattern>
+ </extension>
+ <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
+ <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.UserControllerTest" />
+ <option name="METHOD_NAME" value="testUpdateUserAvatar" />
+ <option name="TEST_OBJECT" value="method" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <configuration name="UserControllerTest.testUploadUserAvatar" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
+ <module name="echo-backend" />
+ <extension name="coverage">
+ <pattern>
+ <option name="PATTERN" value="com.example.myproject.controller.*" />
+ <option name="ENABLED" value="true" />
+ </pattern>
+ </extension>
+ <option name="PACKAGE_NAME" value="com.example.myproject.controller" />
+ <option name="MAIN_CLASS_NAME" value="com.example.myproject.controller.UserControllerTest" />
+ <option name="METHOD_NAME" value="testUploadUserAvatar" />
+ <option name="TEST_OBJECT" value="method" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <configuration name="MyProjectApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
+ <module name="echo-backend" />
+ <option name="SPRING_BOOT_MAIN_CLASS" value="com.example.myproject.MyProjectApplication" />
+ <method v="2">
+ <option name="Make" enabled="true" />
+ </method>
+ </configuration>
+ <recent_temporary>
+ <list>
+ <item itemvalue="应用程序.MyProjectApplication" />
+ <item itemvalue="JUnit.UserControllerTest.testUploadUserAvatar" />
+ <item itemvalue="JUnit.UserControllerTest.testUpdateUserAvatar" />
+ <item itemvalue="JUnit.UserControllerTest" />
+ <item itemvalue="JUnit.TorrentControllerTest" />
+ </list>
+ </recent_temporary>
+ </component>
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+ <component name="TaskManager">
+ <task active="true" id="Default" summary="Default task">
+ <changelist id="f008fe30-0711-42e2-bb33-17dcfdbad387" name="Changes" comment="" />
+ <created>1744348740342</created>
+ <option name="number" value="Default" />
+ <option name="presentableId" value="Default" />
+ <updated>1744348740342</updated>
+ <workItem from="1749007243227" duration="1245000" />
+ <workItem from="1749033374884" duration="7535000" />
+ <workItem from="1749048857906" duration="4388000" />
+ <workItem from="1749109821491" duration="5517000" />
+ <workItem from="1749206945935" duration="4467000" />
+ </task>
+ <task id="LOCAL-00001" summary="pom">
+ <option name="closed" value="true" />
+ <created>1749011916131</created>
+ <option name="number" value="00001" />
+ <option name="presentableId" value="LOCAL-00001" />
+ <option name="project" value="LOCAL" />
+ <updated>1749011916131</updated>
+ </task>
+ <task id="LOCAL-00002" summary="pom">
+ <option name="closed" value="true" />
+ <created>1749012141761</created>
+ <option name="number" value="00002" />
+ <option name="presentableId" value="LOCAL-00002" />
+ <option name="project" value="LOCAL" />
+ <updated>1749012141761</updated>
+ </task>
+ <option name="localTasksCounter" value="3" />
+ <servers />
+ </component>
+ <component name="TypeScriptGeneratedFilesManager">
+ <option name="version" value="3" />
+ </component>
+ <component name="Vcs.Log.Tabs.Properties">
+ <option name="TAB_STATES">
+ <map>
+ <entry key="MAIN">
+ <value>
+ <State>
+ <option name="FILTERS">
+ <map>
+ <entry key="branch">
<value>
- <State>
- <option name="FILTERS">
- <map>
- <entry key="branch">
- <value>
- <list>
- <option value="master" />
- </list>
- </value>
- </entry>
- </map>
- </option>
- </State>
+ <list>
+ <option value="master" />
+ </list>
</value>
- </entry>
- </map>
- </option>
- </component>
- <component name="VcsManagerConfiguration">
- <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
- <MESSAGE value="pom" />
- <option name="LAST_COMMIT_MESSAGE" value="pom" />
- </component>
- <component name="XDebuggerManager">
- <breakpoint-manager>
- <breakpoints>
- <line-breakpoint enabled="true" type="java-method">
- <url>file://$PROJECT_DIR$/src/test/java/com/example/myproject/controller/UserControllerTest.java</url>
- <line>235</line>
- <properties class="com.example.myproject.controller.UserControllerTest" method="testUploadUserAvatar">
- <option name="EMULATED" value="true" />
- <option name="WATCH_EXIT" value="false" />
- </properties>
- <option name="timeStamp" value="1" />
- </line-breakpoint>
- </breakpoints>
- </breakpoint-manager>
- </component>
+ </entry>
+ </map>
+ </option>
+ </State>
+ </value>
+ </entry>
+ </map>
+ </option>
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
+ <MESSAGE value="pom" />
+ <option name="LAST_COMMIT_MESSAGE" value="pom" />
+ </component>
+ <component name="XDebuggerManager">
+ <breakpoint-manager>
+ <breakpoints>
+ <line-breakpoint enabled="true" type="java-method">
+ <url>file://$PROJECT_DIR$/src/test/java/com/example/myproject/controller/UserControllerTest.java</url>
+ <line>235</line>
+ <properties class="com.example.myproject.controller.UserControllerTest" method="testUploadUserAvatar">
+ <option name="EMULATED" value="true" />
+ <option name="WATCH_EXIT" value="false" />
+ </properties>
+ <option name="timeStamp" value="1" />
+ </line-breakpoint>
+ </breakpoints>
+ </breakpoint-manager>
+ </component>
</project>
\ No newline at end of file
diff --git a/src/main/java/com/example/myproject/controller/TorrentController.java b/src/main/java/com/example/myproject/controller/TorrentController.java
index ef62c26..b0abc9c 100644
--- a/src/main/java/com/example/myproject/controller/TorrentController.java
+++ b/src/main/java/com/example/myproject/controller/TorrentController.java
@@ -234,68 +234,9 @@
}
}
- @SaCheckLogin
- @Operation(summary = "创建促销活动")
- @PostMapping("/promotions")
- public Result createPromotion(@RequestBody @Validated PromotionCreateDTO promotionDTO) {
- try {
- // 验证用户权限(只有管理员可以创建促销)
-// if (!StpUtil.hasRole("admin")) {
-// return Result.error("没有权限创建促销活动");
-// }
-//
- Promotion promotion = promotionService.createPromotion(promotionDTO);
- return Result.ok(promotion);
- } catch (Exception e) {
- return Result.error("创建促销失败: " + e.getMessage());
- }
- }
- @SaCheckLogin
- @Operation(summary = "获取促销活动列表")
- @GetMapping("/promotions")
- public Result getPromotions() {
- try {
- List<Promotion> promotions = promotionService.getAllActivePromotions();
- return Result.ok(promotions);
- } catch (Exception e) {
- return Result.error("获取促销列表失败: " + e.getMessage());
- }
- }
- @SaCheckLogin
- @Operation(summary = "获取促销详情")
- @GetMapping("/promotions/{promotionId}")
- public Result getPromotionDetails(@PathVariable Long promotionId) {
- try {
- Promotion promotion = promotionService.getPromotionById(promotionId);
- if (promotion == null) {
- return Result.error("促销活动不存在");
- }
- return Result.ok(promotion);
- } catch (Exception e) {
- return Result.error("获取促销详情失败: " + e.getMessage());
- }
- }
- @SaCheckLogin
- @Operation(summary = "删除促销活动")
- @DeleteMapping("/promotions/{promotionId}")
- public Result deletePromotion(@PathVariable Long promotionId) {
- try {
- Long userId = StpUtil.getLoginIdAsLong();
- // 查询用户
- var userOpt = userRepository.findById(userId);
- if (userOpt.isEmpty() || !"admin".equals(userOpt.get().getRole())) {
- return Result.error("没有权限删除促销活动");
- }
-
- promotionService.deletePromotion(promotionId);
- return Result.ok();
- } catch (Exception e) {
- return Result.error("删除促销失败: " + e.getMessage());
- }
- }
@GetMapping("/announce")
public ResponseEntity<byte[]> announce(TrackerProtocol trackerProtocol, HttpServletRequest request, @RequestParam(value = "info_hash") String encodedInfoHash){
log.info("client report: {}", trackerProtocol);
diff --git a/target/classes/com/example/myproject/controller/PromotionController.class b/target/classes/com/example/myproject/controller/PromotionController.class
index 75a63cc..2de5158 100644
--- a/target/classes/com/example/myproject/controller/PromotionController.class
+++ b/target/classes/com/example/myproject/controller/PromotionController.class
Binary files differ
diff --git a/target/classes/com/example/myproject/controller/TorrentController.class b/target/classes/com/example/myproject/controller/TorrentController.class
index 654356b..e05b344 100644
--- a/target/classes/com/example/myproject/controller/TorrentController.class
+++ b/target/classes/com/example/myproject/controller/TorrentController.class
Binary files differ
diff --git a/target/classes/com/example/myproject/service/serviceImpl/TorrentServiceImpl.class b/target/classes/com/example/myproject/service/serviceImpl/TorrentServiceImpl.class
index 63669c9..aa1401d 100644
--- a/target/classes/com/example/myproject/service/serviceImpl/TorrentServiceImpl.class
+++ b/target/classes/com/example/myproject/service/serviceImpl/TorrentServiceImpl.class
Binary files differ