package com.iformall.controller;

import com.iformall.common.ResultData;
import com.iformall.domain.po.msg.WxMsgRecord;
import com.iformall.mq.MqBaseProducer;
import com.iformall.mq.impl.RabbitMqMessageProducer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Api(description = "登录相关接口")
public class HomeController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Value("${version}")
    private String version;

    @Autowired
    private MqBaseProducer mqBaseProducer;

    @Autowired
    private RabbitMqMessageProducer rabbitMqMessageProducer;


    @ApiOperation("获取后端版本号")
    @GetMapping("/version")
    public ResultData version() {
        return new ResultData(version);
    }

    @GetMapping("/mqtest")
    public ResultData mqtest() {
        mqBaseProducer.sendMessage(new WxMsgRecord(), "topic-1", "tag-1", "key-1");
        return new ResultData();
    }
}