KKSU
2024-07-25 adee5d271a70cbcb9ab45cec00795c9a7b34f6bf
src/main/java/cc/mrbird/febs/mall/controller/ApiMallGoodsController.java
@@ -1,10 +1,13 @@
package cc.mrbird.febs.mall.controller;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.mall.dto.ApiMallGoodsCommentDto;
import cc.mrbird.febs.mall.dto.MallGoodsQueryDto;
import cc.mrbird.febs.mall.service.IApiMallGoodsService;
import cc.mrbird.febs.mall.vo.MallGoodsCommentVo;
import cc.mrbird.febs.mall.vo.MallGoodsDetailsVo;
import cc.mrbird.febs.mall.vo.MallGoodsListVo;
import cc.mrbird.febs.websocket.WsSessionManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
@@ -21,6 +24,7 @@
@Slf4j
@Validated
@RestController
@CrossOrigin("*")
@RequiredArgsConstructor
@RequestMapping(value = "/api/goods")
@Api(value = "ApiMallGoodsController", tags = "商城商品接口类")
@@ -45,4 +49,26 @@
        return new FebsResponse().success().data(mallGoodsService.findMallGoodsDetailsById(id));
    }
    @ApiOperation(value = "获取商品评价", notes = "获取商品评价")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = MallGoodsCommentVo.class)
    })
    @PostMapping(value = "/commentByGoodsId")
    public FebsResponse commentByGoodsId(@RequestBody ApiMallGoodsCommentDto queryDto) {
        return new FebsResponse().success().data(mallGoodsService.findMallGoodsCommentByGoodsId(queryDto));
    }
    /**
     * TODO 测试
     */
    @ApiOperation(value = "模拟服务器给链接的websocket发送消息", notes = "模拟服务器给链接的websocket发送消息")
    @GetMapping(value = "/token//{inviteId}/{text}")
    public FebsResponse token(@PathVariable String inviteId, @PathVariable String text) {
        WsSessionManager.sendMsgToOne(inviteId,text);
        return new FebsResponse().success();
    }
}