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() { return ApiResponse.success(agreementService.listMiniAgreements()); } /** * 按协议编码查询后台配置的协议正文和更新时间。 * * @param code 小程序允许访问的协议编码 * @return 协议标题、正文和最后更新时间 */ @GetMapping("/{code}") public ApiResponse detail(@PathVariable String code) { return ApiResponse.success(agreementService.getMiniAgreement(code)); } }