AppController.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.ghsc.partybuild.controller;
  2. import com.ghsc.partybuild.AppConfig;
  3. import com.ghsc.partybuild.model.CfUsers;
  4. import com.ghsc.partybuild.service.LogService;
  5. import com.ghsc.partybuild.service.RoleService;
  6. import com.ghsc.partybuild.service.UserService;
  7. import com.ghsc.partybuild.shiro.JwtUtils;
  8. import com.ghsc.partybuild.util.RemoteHelper;
  9. import com.ghsc.partybuild.util.StringUtils;
  10. import lombok.extern.slf4j.Slf4j;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.stereotype.Controller;
  15. import org.springframework.web.bind.annotation.GetMapping;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RequestParam;
  18. import javax.servlet.http.Cookie;
  19. import javax.servlet.http.HttpServletRequest;
  20. import javax.servlet.http.HttpServletResponse;
  21. import java.io.FileInputStream;
  22. import java.io.UnsupportedEncodingException;
  23. import java.net.URLEncoder;
  24. import java.util.HashMap;
  25. import java.util.List;
  26. import java.util.Map;
  27. @Slf4j
  28. @Controller
  29. @RequestMapping(value = "/")
  30. public class AppController {
  31. private final Logger logger;
  32. @Autowired
  33. private AppConfig appConfig;
  34. @Autowired
  35. private UserService userService;
  36. @Autowired
  37. private JwtUtils jwtUtils;
  38. @Autowired
  39. private RoleService roleService;
  40. @Autowired
  41. private LogService logService;
  42. @Autowired
  43. RemoteHelper remoteHelper;
  44. @Autowired
  45. private StringUtils stringUtils;
  46. public AppController() {
  47. logger = LoggerFactory.getLogger(this.getClass());
  48. }
  49. @GetMapping("")
  50. public String Web(HttpServletRequest request, HttpServletResponse response) {
  51. return "redirect:/app/main/index.html";
  52. }
  53. @GetMapping("web")
  54. public String Web() {
  55. return "redirect:/mobile/index.html";
  56. }
  57. @GetMapping("mobile")
  58. public String mobile(String routePath, String code) throws UnsupportedEncodingException {
  59. log.info("mobile:routePath=" + routePath + ",code=" + code);
  60. if (!stringUtils.IsNullOrEmpty(routePath))
  61. return "redirect:/mobile/index.html/#/index?routePath=" + URLEncoder.encode(routePath, "UTF-8") + "&code=" + code;
  62. return "redirect:/mobile/index.html/#/index?code=" + (!stringUtils.IsNullOrEmpty(code) ? code : "");
  63. }
  64. }