package com.iamberry.rst.controllers.wechat; import com.iamberry.wechat.core.entity.WechatUtils; import com.iamberry.wechat.tools.ResponseJson; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; @Controller @RequestMapping("/wechat/getTest") public class TestController { @ResponseBody @RequestMapping(value = "/test") public ResponseJson test(HttpServletRequest request ) throws Exception { String openId = WechatUtils.getUserBySession(request).getUserOpenid(); ResponseJson rj =new ResponseJson(200, "测试成功+"+openId, 200); return rj; } }