package com.szwl.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Controller public class HppController { /** * 重定向到 hpp * @param env * @param mode * @param intendId * @param clientSecret * @param currency * @param httpServletResponse * @throws IOException */ @RequestMapping("/toHpp") public String toHpp(HttpServletRequest request,String env, String mode, String intendId, String clientSecret, String currency, HttpServletResponse httpServletResponse) throws IOException { // String url = "http://localhost:63342/payServer/templates/test.html?" + env + "&mode=" + mode + "&intend_id=" + intendId + "&client_secret=" + clientSecret + "¤cy=" + currency; // httpServletResponse.sendRedirect(url); request.setAttribute("intendId", intendId); request.setAttribute("clientSecret", clientSecret); request.setAttribute("currency", currency); return "test"; } // @GetMapping("/hpp") public String hpp(String env, String mode, String intendId, String clientSecret, String currency, Model model) { model.addAttribute("env", env); model.addAttribute("mode", mode); model.addAttribute("intend_id", intendId); model.addAttribute("client_secret", clientSecret); model.addAttribute("currency", currency); return "redirect: http://112.74.63.148:49011/#/hpp?env=" + env + "&mode=" + mode + "&intend_id=" + intendId + "&client_secret=" + clientSecret + "¤cy=" + currency; } }