//package com.boman.wechat.controller;
//
//import com.boman.domain.dto.WxMsgDto;
//import com.boman.wechat.service.WxPushService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.PrintWriter;
//import java.util.Map;
//import java.util.Objects;
//
//import static com.boman.wechat.utils.CheckAuthUtils.*;
//
///**
// * 微信登录验证
// *
// * @author zhong.h
// */
//@RestController
//@RequestMapping("/check/auth")
//public class CheckPushMsgAuthController {
//
//    private static final Logger LOGGER = LoggerFactory.getLogger(CheckPushMsgAuthController.class);
//
//    @GetMapping
//    public String pushMsg(HttpServletRequest request, HttpServletResponse response) {
//        // 微信加密签名，signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数。
//        String signature = request.getParameter(SIGNATURE);
//        // 时间戳
//        String timestamp = request.getParameter(TIMESTAMP);
//        // 随机数
//        String nonce = request.getParameter(NONCE);
//        // 随机字符串
//        String echostr = request.getParameter(ECHOSTR);
//        String authorization = request.getParameter(AUTHORIZATION);
//        LOGGER.info("接收来自微信的消息, signature: {}, timestamp: {}, nonce: {}, echostr: {}, authorization: {}"
//                , signature, timestamp, nonce, echostr, authorization);
////        PrintWriter out = null;
////        try {
////            out = response.getWriter();
//            if (checkSignature(signature, timestamp, nonce)) {
////                out.print(echostr);
////                out.flush();
//                return echostr;
//            }
////        } catch (Exception e) {
////            e.printStackTrace();
////        } finally {
////            if (Objects.nonNull(out)) {
////                out.close();
////            }
////        }
//
//        return echostr;
//    }
//
//
//}
