“mitao”
2026-04-08 62f8d49c054823813dd2f5fa7dd1aee12b7cd84c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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<Void> submit(@Valid @RequestBody UserFeedbackSubmitRequest request) {
        userFeedbackAppService.submit(appAuthSessionService.requireLoginUserId(), request);
        return ApiResponse.ok(null);
    }
}