| @@ -13,7 +13,7 @@ | |||
| <link href="style.css" rel="stylesheet"> | |||
| </head> | |||
| <body> | |||
| <div class="container" style="margin-top: 100px; min-height: 300px; text-align: center;"> | |||
| <div class="container" style="margin-top: 100px; min-height: 300px; text-align: center; max-width: 500px;"> | |||
| <form id="payment" name="payment" action="/choosePayment " method="POST"> | |||
| <input type="hidden" name="id" value="{{ .Id}}"/> | |||
| <input type="hidden" name="sign" value="{{ .Sign}}"/> | |||
| @@ -43,6 +43,5 @@ | |||
| <script src="assets/js/jquery.min.js"></script> | |||
| <script src="assets/js/popper.js"></script> | |||
| <script src="bootstrap/js/bootstrap.min.js"></script> | |||
| <title>选择支付通道</title> | |||
| </body> | |||
| </html> | |||
| @@ -0,0 +1,54 @@ | |||
| <!DOCTYPE html> | |||
| <html lang="en"> | |||
| <head> | |||
| <meta charset="utf-8"> | |||
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |||
| <meta name="description" content=""> | |||
| <meta name="author" content=""> | |||
| <title>Blank Template for Bootstrap</title> | |||
| <!-- Bootstrap core CSS --> | |||
| <link href="bootstrap/css/bootstrap.css" rel="stylesheet"> | |||
| <!-- Custom styles for this template --> | |||
| <link href="style.css" rel="stylesheet"> | |||
| </head> | |||
| <body> | |||
| <div class="container" style="margin-top: 100px;"> | |||
| <div class="row"> | |||
| <div class="col-md-4"> | |||
| <h3></h3> | |||
| <p></p> | |||
| </div> | |||
| <div class="col-md-4"> | |||
| <h3 class="text-center">出错了</h3> | |||
| <p></p> | |||
| <div class="card text-white bg-danger mb-3"> | |||
| <div class="card-header text-center">错误</div> | |||
| <div class="card-body"> | |||
| <h5 class="card-title">很抱歉</h5> | |||
| <p class="card-text">您所输入的信息,或者执行的操作已经出错。下面是相应的出错信息</p> | |||
| <p class="card-text" style="background-color: #a58080; margin-top: 20px; margin-bottom: 20px; padding-top: 20px; padding-bottom: 20px; text-align: center; color: #000000; font-weight: 900;">{{.ErrorMessage}}</p> | |||
| <p class="card-text">您可以尝试返回上一步修改错误,但是如果不能修复,请您重新开启支付操作。</p> | |||
| </div> | |||
| <button onclick="goBack()" type="button" class="btn btn-blue btn-light">返回</button> | |||
| <script> | |||
| function goBack() { | |||
| window.history.back(); | |||
| } | |||
| </script> | |||
| </div> | |||
| </div> | |||
| <div class="col-md-4"> | |||
| <h3></h3> | |||
| <p></p> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <!-- Bootstrap core JavaScript | |||
| ================================================== --> | |||
| <!-- Placed at the end of the document so the pages load faster --> | |||
| <script src="assets/js/jquery.min.js"></script> | |||
| <script src="assets/js/popper.js"></script> | |||
| <script src="bootstrap/js/bootstrap.min.js"></script> | |||
| </body> | |||
| </html> | |||
| @@ -1 +1 @@ | |||
| {"files":{"dashboard.html":{"frameworks":["form","pg.insight.events","pg.css.grid","pg.image.overlay","pg.code-validator","pg.project.items","pg.asset.manager","bs4","pg.html","pg.components"],"last_page_width":1024},"index.html":{"frameworks":["PG","pg.insight.events","pg.asset.manager","pg.css.grid","pg.project.items","pg.image.overlay","pg.code-validator","bs4","pg.html","pg.components"],"last_page_width":1024},"rpnAskNameAndCard.html":{"frameworks":["PG","pg.insight.events","pg.css.grid","pg.image.overlay","pg.code-validator","pg.project.items","pg.asset.manager","bs4","pg.html","pg.components"],"last_page_width":1024}},"breakpoints":["576px","768px","992px","1200px"],"frameworks":["PG","pg.insight.events","pg.css.grid","pg.image.overlay","pg.code-validator","pg.project.items","pg.asset.manager","bs4","pg.html","pg.components"],"template_framework_id":"bootstrap"} | |||
| {"files":{"dashboard.html":{"frameworks":["form","pg.insight.events","pg.css.grid","pg.image.overlay","pg.code-validator","pg.project.items","pg.asset.manager","bs4","pg.html","pg.components"],"last_page_width":1024},"index.html":{"frameworks":["PG","pg.insight.events","pg.asset.manager","pg.project.items","pg.css.grid","pg.code-validator","pg.image.overlay","bs4","pg.html","pg.components"],"last_page_width":1024},"rpnAskNameAndCard.html":{"frameworks":["PG","pg.insight.events","pg.asset.manager","pg.css.grid","pg.project.items","pg.image.overlay","pg.code-validator","bs4","pg.html","pg.components"],"last_page_width":1024},"error.html":{"frameworks":["PG","pg.insight.events","pg.css.grid","pg.image.overlay","pg.code-validator","pg.project.items","pg.asset.manager","bs4","pg.html","pg.components"],"last_page_width":1024},"StartPay.html":{"frameworks":["PG","pg.insight.events","pg.asset.manager","pg.project.items","pg.code-validator","pg.css.grid","pg.image.overlay","bs4","pg.html","pg.components"],"last_page_width":1024}},"breakpoints":["576px","768px","992px","1200px"],"frameworks":["PG","pg.insight.events","pg.css.grid","pg.image.overlay","pg.code-validator","pg.project.items","pg.asset.manager","bs4","pg.html","pg.components"],"template_framework_id":"bootstrap"} | |||
| @@ -13,7 +13,7 @@ | |||
| <link href="style.css" rel="stylesheet"> | |||
| </head> | |||
| <body> | |||
| <div class="container" style="margin-top: 100px;"> | |||
| <div class="container" style="margin-top: 100px; max-width: 500px;"> | |||
| <div class="card text-center"> | |||
| <div class="card-header">-------</div> | |||
| <div class="card-body"> | |||
| @@ -3,6 +3,7 @@ package main | |||
| import ( | |||
| "log" | |||
| "net/http" | |||
| "text/template" | |||
| ) | |||
| func main() { | |||
| @@ -24,3 +25,13 @@ func main() { | |||
| http.ListenAndServe(":8080", nil) | |||
| log.Println("Server started on: http://localhost:8080") | |||
| } | |||
| func errPage(w http.ResponseWriter, code int, msg string) { | |||
| var data struct { | |||
| ErrorMessage string | |||
| } | |||
| data.ErrorMessage = msg | |||
| w.WriteHeader(code) | |||
| t := template.Must(template.ParseFiles("PG/error.html")) | |||
| t.Execute(w, data) | |||
| } | |||
| @@ -44,7 +44,7 @@ func StartPay(w http.ResponseWriter, r *http.Request) { | |||
| } | |||
| func askForPaymentSelection(w http.ResponseWriter, row LeanworkRequest) { | |||
| t := template.Must(template.ParseFiles("PG/index.html")) | |||
| t := template.Must(template.ParseFiles("PG/StartPay.html")) | |||
| //tmpl.ExecuteTemplate(w, "StartPay", row) | |||
| t.Execute(w, row) | |||
| } | |||
| @@ -162,8 +162,7 @@ func rpnNotify(w http.ResponseWriter, r *http.Request) { | |||
| //receive RPN user name and card number | |||
| func rpnNameAndCard(w http.ResponseWriter, r *http.Request) { | |||
| if r.Method != "POST" { | |||
| w.WriteHeader(http.StatusMethodNotAllowed) | |||
| fmt.Fprintf(w, "invalid request") | |||
| errPage(w, http.StatusMethodNotAllowed, "invalid request") | |||
| return | |||
| } | |||
| r.ParseForm() | |||
| @@ -174,8 +173,7 @@ func rpnNameAndCard(w http.ResponseWriter, r *http.Request) { | |||
| rpn_type := r.FormValue("rpnType") | |||
| if !(id != "" && sign != "" && user_name != "" && user_card != "") { | |||
| w.WriteHeader(http.StatusBadRequest) | |||
| fmt.Fprintf(w, "missing parameters") | |||
| errPage(w, http.StatusBadRequest, "missing parameters") | |||
| return | |||
| } | |||