rocket-a


git -C '/home/opc/rocketa.git' show f703852 -- oci_func_prod/error/func.py

commit f70385251317348253f5ebffeffc00e3a1d6d563
Author: Satoshi Ujihara <satoshi_ujihara@fivegate.jp>
Date:   Thu Jan 29 17:46:01 2026 +0900

    gitignore 更新
    compser.json 更新
    本番環境oci_func 作成

diff --git a/oci_func_prod/error/func.py b/oci_func_prod/error/func.py
new file mode 100644
index 0000000..df0e7d1
--- /dev/null
+++ b/oci_func_prod/error/func.py
@@ -0,0 +1,60 @@
+import io
+import json
+import logging
+import datetime
+import urllib.parse
+
+from fdk import response
+
+dt_now = datetime.datetime.now() + datetime.timedelta(hours = 9)
+
+#error
+#101 ad_id param error
+#102 client_id param error
+#103 media_id param error
+#301 not found ad data
+#302 not found rewward data
+#401 url error (遷移先パラメータと取得パラメータの不一致)
+
+
+logging.basicConfig(level=logging.INFO)
+
+def handler(ctx, data: io.BytesIO = None):
+
+    full_url = ctx.RequestURL()
+    query_string = urllib.parse.urlparse(full_url).query
+    query_params = urllib.parse.parse_qs(query_string)
+    error = ''
+    if query_params.get('error') is not None:
+        error = query_params.get('error', [None])[0]
+    return output(ctx, error)
+
+
+
+def output(ctx, error):
+    html  = '<!doctype html>'
+    html += '<html lang="ja">'
+    html += '<head>'
+    html += '<meta charset="utf-8">'
+    html += '<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">'
+    html += '<title>Rocket A|無効のリンク</title>'
+    html += '<style>*,*::before,*::after{box-sizing: border-box;}body{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";margin:0;min-height:100vh;font-size:0.88rem;font-weight:400;line-height:1.5;color:#555;text-align:left;background-color:#ffffff;}.container .logo{margin:8rem auto 1rem;padding:3rem .5rem;width:120px;height:120px;background-color:#343a40;border-radius:50%;}.container .logo img{display:inline-block;margin:0 auto;line-height:120px;}.container h5,.container p{margin:0;padding:0;text-align:center;color:#555;}.container h5{font-size:1.5rem;font-weight:bold;line-height:1.2;margin-bottom:.5rem;}.container p,.copyright{font-size:0.88rem;}.copyright{margin:auto auto 0;padding:.5rem 0;width:100%;text-align:center;color:#fff;background-color:#343a40;}</style>'
+    html += '</head>'
+    html += '<body>'
+    html += '<div class="container">'
+    html += '<div class="logo"><img src="https://client.rocket-a.com/front/rocketa_logo_mono.png" width="100%" title="" alt=""></div>'
+    html += '<h5>無効のリンク<br />ERROR CODE:'+error+'</h5>'
+    html += '<p>誠に申し訳ございませんが、<br>この広告のリンクは現在無効となっております。</p>'
+    html += '</div>'
+    html += '<div class="copyright">Copyright (C) 2025-'
+    html += dt_now.strftime('%Y')
+    html += ' aix inc. All Rights Reserved.</div>'
+    html += '</body>'
+    html += '</html>'
+
+    return response.Response (
+        ctx,
+        status_code=404,
+        headers={"Content-Type": "text/html"},
+        response_data= html
+    )
\ No newline at end of file

diff.txt · 最終更新: by root