HppController.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.szwl.controller;
  2. import org.springframework.stereotype.Controller;
  3. import org.springframework.ui.Model;
  4. import org.springframework.web.bind.annotation.GetMapping;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import javax.servlet.http.HttpServletRequest;
  7. import javax.servlet.http.HttpServletResponse;
  8. import java.io.IOException;
  9. @Controller
  10. public class HppController {
  11. /**
  12. * 重定向到 hpp
  13. * @param env
  14. * @param mode
  15. * @param intendId
  16. * @param clientSecret
  17. * @param currency
  18. * @param httpServletResponse
  19. * @throws IOException
  20. */
  21. @RequestMapping("/toHpp")
  22. public String toHpp(HttpServletRequest request,String env, String mode, String intendId, String clientSecret, String currency, HttpServletResponse httpServletResponse) throws IOException {
  23. // String url = "http://localhost:63342/payServer/templates/test.html?" + env + "&mode=" + mode + "&intend_id=" + intendId + "&client_secret=" + clientSecret + "&currency=" + currency;
  24. // httpServletResponse.sendRedirect(url);
  25. request.setAttribute("intendId", intendId);
  26. request.setAttribute("clientSecret", clientSecret);
  27. request.setAttribute("currency", currency);
  28. return "test";
  29. }
  30. //
  31. @GetMapping("/hpp")
  32. public String hpp(String env, String mode, String intendId, String clientSecret, String currency, Model model) {
  33. model.addAttribute("env", env);
  34. model.addAttribute("mode", mode);
  35. model.addAttribute("intend_id", intendId);
  36. model.addAttribute("client_secret", clientSecret);
  37. model.addAttribute("currency", currency);
  38. return "redirect: http://112.74.63.148:49011/#/hpp?env=" + env + "&mode=" + mode + "&intend_id=" + intendId + "&client_secret=" + clientSecret + "&currency=" + currency;
  39. }
  40. }