package cn.pluss.platform.controller;

import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.entity.UserVoice;
import cn.pluss.platform.user.UserVoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author DJH
 */
@RequestMapping("/userVoice")
@RestController
public class UserVoiceController {

    @Autowired
    private UserVoiceService userVoiceService;

    @GetMapping
    public Result<Object> getVoiceSetting() {
        UserVoice userVoice = userVoiceService.apiGetVoiceSetting();
        return ResultGenerator.genSuccessResult(userVoice);
    }

    @PostMapping
    public Result<Object> setVoiceSetting(@RequestBody UserVoice userVoice) {
        userVoiceService.apiSetVoiceSetting(userVoice);
        return ResultGenerator.genSuccessResult("配置修改成功", null);
    }

}
