downview.jsp 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%
  4. String temp = "";
  5. if(request.getAttribute("userId") != null){
  6. temp = request.getAttribute("userId").toString();
  7. }else{
  8. response.sendRedirect("login.page");
  9. }
  10. %>
  11. <% String strClientIp = request.getHeader("X-Forwarded-For");
  12. if (strClientIp == null || strClientIp.length() == 0 || "unknown".equalsIgnoreCase(strClientIp)) {
  13. strClientIp = request.getHeader("Proxy-Client-IP");
  14. }
  15. if (strClientIp == null || strClientIp.length() == 0 || "unknown".equalsIgnoreCase(strClientIp)) {
  16. strClientIp = request.getHeader("WL-Proxy-Client-IP");
  17. }
  18. if (strClientIp == null || strClientIp.length() == 0 || "unknown".equalsIgnoreCase(strClientIp)) {
  19. strClientIp = request.getHeader("HTTP_CLIENT_IP");
  20. }
  21. if (strClientIp == null || strClientIp.length() == 0 || "unknown".equalsIgnoreCase(strClientIp)) {
  22. strClientIp = request.getHeader("HTTP_X_FORWARDED_FOR");
  23. }
  24. if (strClientIp == null || strClientIp.length() == 0 || "unknown".equalsIgnoreCase(strClientIp)) {
  25. strClientIp = request.getRemoteAddr();
  26. }
  27. %>
  28. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  29. <html>
  30. <head>
  31. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  32. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">
  33. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  34. <title>다운로드 페이지</title>
  35. <link rel="stylesheet" type="text/css" href="./resource/css/style.css" />
  36. </head>
  37. <body>
  38. <div class="text-center">
  39. <img src="./resource/image/download_logo_new.png" style="width:300px; padding-top: 60px;"/><br/>
  40. </div>
  41. <hr class="middle-line"/>
  42. <div class="text-center download-box" onclick="download('android')">
  43. <img src="./resource/image/android.png"/>
  44. <span>Android Download</span>
  45. </div>
  46. <div class="text-center download-box" onclick="download('ios')">
  47. <img src="./resource/image/apple.png" class="os-icon"/>
  48. <span>IOS Download</span>
  49. </div>
  50. </body>
  51. <script type="text/javascript">
  52. // 1: 사내개발, 2: 개발서버, 3: 운영서버
  53. var gServerKind = 3;
  54. var gClientIp = "<%= strClientIp %>";
  55. var loginId = "<%= temp%>";
  56. var localId = localStorage.getItem("userId");
  57. if(loginId != localId && loginId != "root"){
  58. //window.location.href = "http://localhost:8080/mplus-deploy/login.page";
  59. if( gServerKind == 1)
  60. window.location.href = "http://192.168.1.18:48080/mplus-deploy/login.page";
  61. else if( gServerKind == 2)
  62. window.location.href = "https://nps.kuh.ac.kr/mplus-deploy-dev/login.page";
  63. else if( gServerKind == 3)
  64. window.location.href = "https://nps.kuh.ac.kr/mplus-deploy/login.page";
  65. else
  66. window.location.href = "http://192.168.1.18:48080/mplus-deploy/login.page";
  67. }
  68. function download(type){
  69. if(type=='android'){
  70. processDownloadLog( "android", "1.0");
  71. //location.href="https://smart-sev1.iseverance.com/mplus_deploy/file/mplus-android.apk";
  72. //location.href="http://192.168.1.18:48080/mplus-deploy/file/mplus-android.apk";
  73. if( gServerKind == 1)
  74. window.location.href = "https://dev1.lemonhc.com/store/mcare-plus/kunkuk/android/kunkuk-local-debug.apk";
  75. else if( gServerKind == 2)
  76. window.location.href = "https://dev1.lemonhc.com/store/mcare-plus/kunkuk/android/kunkuk-dev-debug.apk";
  77. else if( gServerKind == 3)
  78. //window.location.href = "https://dev1.lemonhc.com/store/mcare-plus/kunkuk/android/kunkuk-product-debug.apk";
  79. window.location.href = "https://nps.kuh.ac.kr/mplus-deploy/file/kunkuk-product-debug.apk";
  80. else
  81. window.location.href = "http://192.168.1.18:48080/mplus-deploy/file/mplus-android.apk";
  82. }else{
  83. processDownloadLog( "iOS", "2.0");
  84. //location.href="itms-services://?action=download-manifest&url=https://smart-sev1.iseverance.com/mplus_deploy/file/manifest.plist";
  85. //location.href="http://192.168.1.18:48080/mplus-deploy/file/mplus-ios.ipa";
  86. if( gServerKind == 1)
  87. window.location.href = "itms-services://?action=download-manifest&url=https://dev1.lemonhc.com/store/mcare-plus/kunkuk/ios/lemon/manifest.plist";
  88. else if( gServerKind == 2)
  89. window.location.href = "itms-services://?action=download-manifest&url=https://dev1.lemonhc.com/store/mcare-plus/kunkuk/ios/dev/manifest.plist";
  90. else if( gServerKind == 3)
  91. //window.location.href = "itms-services://?action=download-manifest&url=https://dev1.lemonhc.com/store/mcare-plus/kunkuk/ios/store/manifest.plist";
  92. window.location.href = "itms-services://?action=download-manifest&url=https://nps.kuh.ac.kr/mplus-deploy/file/manifest.plist";
  93. else
  94. window.location.href = "http://192.168.1.18:48080/mplus-deploy/file/mplus-ios.ipa";
  95. }
  96. }
  97. // 로그인 이력을 기록함
  98. var processDownloadLog = function( appKind, appVersion){
  99. var param = {
  100. userId: loginId,
  101. userNm: loginId,
  102. appKind: appKind,
  103. appVersion: appVersion,
  104. userIp: gClientIp,
  105. currentDt: strYYYYMMDDHHMMSS( new Date())
  106. };
  107. inputDownloadLog( param, function( result){ console.log( result);});
  108. };
  109. //=================================== 공통 라이브러리를 복사함 { =================================
  110. //다운로드 이력 로그 전송
  111. var tmpJsonURL = "";
  112. if( gServerKind == 1)
  113. tmpJsonURL = "http://192.168.1.18:48080/mcare-plus/mobile/deployment/inputDownloadLog.json";
  114. else if( gServerKind == 2)
  115. tmpJsonURL = "https://nps.kuh.ac.kr/mcare-plus-dev/mobile/deployment/inputDownloadLog.json";
  116. else if( gServerKind == 3)
  117. tmpJsonURL = "https://nps.kuh.ac.kr/mcare-plus/mobile/deployment/inputDownloadLog.json";
  118. else
  119. tmpJsonURL = "http://192.168.1.18:48080/mcare-plus/mobile/deployment/inputDownloadLog.json";
  120. var inputDownloadLog = function(param, callback){
  121. $.ajax ({
  122. url : tmpJsonURL,
  123. type : "POST",
  124. contentType: "application/json",
  125. data: JSON.stringify(param),
  126. success: function(response){
  127. if(response.result!=undefined){
  128. callback(response.result);
  129. }else{
  130. console.log(response.msg);
  131. }
  132. },
  133. error : function(XHR, textStatus, errorThrown) {
  134. //self.loading("hide");
  135. if (XHR.status == 0) {
  136. alert("You are offline!! Please Check Your Network.");
  137. } else if (XHR.status == 404) {
  138. alert("Requested URL not found.");
  139. } else if (XHR.status == 500) {
  140. alert("Internel Server Error.");
  141. } else if (textStatus == "parsererror") {
  142. alert("Error. Parsing JSON Request failed.");
  143. } else if (textStatus == "timeout") {
  144. alert("Request Time out.");
  145. } else {
  146. alert("Unknow Error. " + XHR.responseText);
  147. }
  148. console.log("code:" + XHR.status + "\n" + "message:" + XHR.responseText + "\n" + "error:" + errorThrown);
  149. },
  150. beforeSend: function(){
  151. //self.loading("show");
  152. },
  153. complete:function(){
  154. //self.loading("hide");
  155. }
  156. });
  157. };
  158. //=================================== 공통 라이브러리를 복사함 } =================================
  159. // 날짜를 YYYYMMDDHHMMSS 로 출력 처리
  160. var pad2 = function(n) { return n < 10 ? '0' + n : n };
  161. var strYYYYMMDDHHMMSS = function( date){
  162. //var date = new Date();
  163. //console.log(date.getFullYear().toString() + pad2(date.getMonth() + 1) + pad2( date.getDate()) + pad2( date.getHours()) + pad2( date.getMinutes()) + pad2( date.getSeconds()));
  164. return date.getFullYear().toString() + pad2(date.getMonth() + 1) + pad2( date.getDate()) + pad2( date.getHours()) + pad2( date.getMinutes()) + pad2( date.getSeconds());
  165. };
  166. </script>
  167. </html>