post.html 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <html>
  2. <head>
  3. <title>发送通知</title>
  4. <meta charset="UTF-8">
  5. <script>
  6. function generate() {
  7. var h = document.getElementById('h').value;
  8. var url = document.getElementById('url').value;
  9. var body = document.getElementById('body').value;
  10. body = JSON.parse(body);
  11. body = JSON.stringify(body);
  12. var headers = JSON.parse(h);
  13. console.log(headers);
  14. fetch(url, {
  15. method: 'POST',
  16. headers: headers,
  17. body: body
  18. })
  19. .then(response => response.text())
  20. .then(text => {
  21. document.getElementById('to').value = text;
  22. });
  23. }
  24. </script>
  25. </head>
  26. <body>
  27. <table border="0">
  28. <tr>
  29. <td>headers:<br /><textarea id="h" cols="40" rows="15">
  30. {
  31. "Authorization": "LKLAPI-SHA256withRSA timestamp=\"1630905585\",nonce_str=\"9003323344\",signature=\"tnjIAcEISq/ClrOppv/nojeZnE/pB1wNfQC/hMTME+rQMapWzvs9v1J68ueDpVzs1RW22dNotmUVy2sM6thNFRkaOx4qQGslX6kIttwvlsJsSEIR3qrjdPdUAkbP2KDRLujspxE9X0daJ6BU+rOoJ8p4c6y1/QSOMtDJoO3EABOF4O6RFHR3N7JW8o4qcf7lOOO7D4rlAB2vw6tV8WeG+OEyJ++Q0K3V1oM5uJEIPPuJkb2qlEqVYKiYLyvIdEJ1Z5qMbC9U7rKuHdeTQPl7last/h5nd6WauzDfYPKlAjZBEPYjiDqRv6Dm+4FeNtALoy6Mg7Ruxeq1pJudfj0iKg==\""
  32. }
  33. </textarea></td>
  34. <td>post json body:<br /><textarea id="body" cols="40" rows="15">
  35. {
  36. "payOrderNo": "21090611012001970631000463034",
  37. "merchantOrderNo": "CH2021090613190866292",
  38. "orderInfo": null,
  39. "merchantNo": "822126090640003",
  40. "termId": "47781282",
  41. "tradeMerchantNo": "822126090640003",
  42. "tradeTermId": "47781282",
  43. "channelId": "10000038",
  44. "currency": "156",
  45. "amount": 1,
  46. "tradeType": "PAY",
  47. "payStatus": "S",
  48. "notifyStatus": 0,
  49. "orderCreateTime": "2021-09-06T05:19:43.000+00:00",
  50. "orderEfficientTime": "2021-09-06T05:19:43.000+00:00",
  51. "extendField": null,
  52. "payTime": "2021-09-06T05:19:43.000+00:00",
  53. "remark": "",
  54. "noticeNum": 1,
  55. "sign": null,
  56. "notifyUrl": null,
  57. "notifyMode": "2",
  58. "payInfo": "1#1#ALIPAY#0#2021090622001432581427657317",
  59. "lklOrderNo": "2021090666210003610012",
  60. "crdFlg": "92",
  61. "payerId1": "2088702852632582",
  62. "payerId2": "rob***@126.com",
  63. "smCrdFlg": "01",
  64. "tradeTime": "20210906131943",
  65. "accountChannelOrderNo": "2021090622001432581427657317",
  66. "actualPayAmount": 1,
  67. "logNo": "66210003610012"
  68. }
  69. </textarea></td>
  70. </tr>
  71. <tr>
  72. <td colspan="2">
  73. <input type="text" id="url" size="50" value="http://localhost/sdk/example/v2/notify.php" placeholder="接收通知URL地址" />
  74. <input type="button" onclick="generate()" value="Post" />
  75. </td>
  76. </tr>
  77. </table>
  78. <textarea id="to" cols="80" rows="40"></textarea><br />
  79. </body>
  80. </html>