package com.tcm.training.admin.app.user.controller; import com.tcm.training.admin.app.auth.service.AppAuthSessionService; import com.tcm.training.admin.common.ApiResponse; import com.tcm.training.admin.system.dto.UserFeedbackSubmitRequest; import com.tcm.training.admin.system.service.UserFeedbackAppService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; /** * APP 用户意见反馈接口。 */ @Validated @RestController @RequestMapping({"/api/app", "/api/v1/app"}) public class AppUserFeedbackController { private final UserFeedbackAppService userFeedbackAppService; private final AppAuthSessionService appAuthSessionService; /** * 注入 APP 用户反馈服务。 */ public AppUserFeedbackController(UserFeedbackAppService userFeedbackAppService, AppAuthSessionService appAuthSessionService) { this.userFeedbackAppService = userFeedbackAppService; this.appAuthSessionService = appAuthSessionService; } /** * 提交 APP 用户意见反馈,游客访问时按全局规则返回 401。 */ @PostMapping("/user-feedbacks") public ApiResponse submit(@Valid @RequestBody UserFeedbackSubmitRequest request) { userFeedbackAppService.submit(appAuthSessionService.requireLoginUserId(), request); return ApiResponse.ok(null); } }