liujie
2026-09-14 15defa991fcd30b9fa60bab17d2230b5929bf2a2
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
44
45
46
package com.tourguide.api.mini;
 
import com.tourguide.common.api.ApiResponse;
import com.tourguide.modules.operation.dto.AgreementResponse;
import com.tourguide.modules.operation.dto.MiniAgreementSummaryResponse;
import com.tourguide.modules.operation.service.AgreementSettingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
 
/**
 * 游客小程序服务条款查询接口。
 * 仅开放游客用户协议、游客隐私权限和纯讲解服务须知,导游侧协议不会通过该接口返回。
 */
@RestController
@RequestMapping("/api/mini/agreements")
public class MiniAgreementController {
    private final AgreementSettingService agreementService;
 
    public MiniAgreementController(AgreementSettingService agreementService) {
        this.agreementService = agreementService;
    }
 
    /**
     * 查询个人中心服务条款页面需要展示的协议列表。
     *
     * @return 按用户协议、隐私权限、纯讲解服务须知顺序排列的列表
     */
    @GetMapping
    public ApiResponse<List<MiniAgreementSummaryResponse>> list() {
        return ApiResponse.success(agreementService.listMiniAgreements());
    }
 
    /**
     * 按协议编码查询后台配置的协议正文和更新时间。
     *
     * @param code 小程序允许访问的协议编码
     * @return 协议标题、正文和最后更新时间
     */
    @GetMapping("/{code}")
    public ApiResponse<AgreementResponse> detail(@PathVariable String code) {
        return ApiResponse.success(agreementService.getMiniAgreement(code));
    }
}