package com.iformall.controller.callback;

import com.iformall.controller.base.BaseController;
import com.iformall.service.WxMsgCallbackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("wxMsgCallback")
public class WxMsgCallbackController extends BaseController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxMsgCallbackService wxMsgCallbackService;


    @PostMapping(value = "/receivemsg/{tenantId}")
    public void receivemsg(@PathVariable String tenantId, @RequestParam Map<String, String> param) {
        logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemsg");
        logger.info(param.toString());
        //解析param数据插入数据库中
        wxMsgCallbackService.saveOrUpdate(tenantId,param);

    }

    @RequestMapping(value = "/receivemodel/{tenantId}")
    public void receivemodel(@PathVariable String tenantId, @RequestParam Map<String, String> param) {
        logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemodel");
        logger.info(param.toString());
        //解析param数据插入数据库中
        wxMsgCallbackService.receivemodel(tenantId, param);

    }

    @RequestMapping(value = "/receiveverifymodel/{tenantId}")
    public void receiveverifymodel(@PathVariable String tenantId, @RequestParam Map<String, String> param) {
        logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receiveverifymodel");
        logger.info(param.toString());
        //解析param数据插入数据库中
        wxMsgCallbackService.receiveverifymodel(tenantId, param);

    }

}
