package com.emoon.openplatform.controller;

import com.emoon.common.core.domain.R;
import com.emoon.openplatform.service.IAskInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author destiny
 * @description:
 * @date 2025/10/25 23:24
 */
@Slf4j
@RestController
@RequestMapping("/askInfo")
@RequiredArgsConstructor
public class AskInfoController {

    private final IAskInfoService askInfoService;

    @GetMapping("/reply")
    public R<Boolean> reply(@RequestParam String token, @RequestParam String reply) {
        Integer cnt = askInfoService.updateReplyByToken(token, reply);
        if (cnt == 0) {
            return R.fail("更新失败");
        }
        return R.ok();
    }
}
