package com.yami.shop.platform.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yami.shop.bean.model.ProdComm;
import com.yami.shop.bean.po.CommPo;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.common.util.R;
import com.yami.shop.service.ProdCommService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/platform/prodComm")
@Api(tags = "评论接口")
@AllArgsConstructor
public class ProdCommController {

    private final ProdCommService prodCommService;

    @GetMapping("/backendCommList")
    @ApiOperation(value = "后台管理-用户评价")
    public R<IPage<ProdComm>> backendCommList(PageParam<ProdComm> page, CommPo po) {
        return R.SUCCESS(prodCommService.backendCommList(page,po));
    }

    @GetMapping("/backendCommAudit")
    @ApiOperation(value = "后台管理-用户评价-(审核，1:通过，0:待审核， -1：不通过审核)")
    public R<Void> backendCommAudit(Long prodCommId, Integer status) {
        prodCommService.backendCommAudit(prodCommId,status);
        return R.SUCCESS();
    }

    @GetMapping("/reply")
    @ApiOperation(value = "后台-商家回复")
    public R<Void> reply(Long prodCommId, String replyContent) {
        prodCommService.reply(prodCommId,replyContent);
        return R.SUCCESS();
    }


}
