package shop.alien.store.controller;

import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.entity.store.vo.LifeMessageVo;
import shop.alien.store.service.PlatformLifeMessageService;

import java.util.List;

@Api(tags = {"平台-消息管理"})
@Slf4j
@RestController
@CrossOrigin
@RequestMapping("/platformLifeMessage")
@RequiredArgsConstructor
public class PlatformLifeMessageController {

    private final PlatformLifeMessageService lifeMessageService;

    @ApiOperation("消息列表")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams({@ApiImplicitParam(name = "receiverId", value = "用户phoneId", dataType = "String", paramType = "query")})
    @GetMapping("/getMessageList")
    public R<List<LifeMessageVo>> getMessageList(@RequestParam String receiverId) throws Exception {
        log.info("LifeMessageController.getMessageList?receiverId={}", receiverId);
        return R.data(lifeMessageService.getMessageList(receiverId));
    }

}
