This commit is contained in:
Alex55 2026-03-19 14:08:51 +02:00
parent 5c0c0e087e
commit 5adbba5b24
4 changed files with 32 additions and 2 deletions

View File

@ -1,10 +1,12 @@
from flask import Blueprint, request, jsonify
import sqlite3
# from services.rokky import ones
# from API.rok import get_order_content
import logging
main = Blueprint("main", __name__)
DB_PATH = "./files/rokky.db"
@main.route("/")
def index():
@ -47,4 +49,31 @@ def new_order():
# logging.warn(get_order_content(order_id))
logging.warn(f"newOrder: {order_id}")
return jsonify({"status": "ok"}), 200
return jsonify({"status": "ok"}), 200
@main.route("/product")
def product_update():
# получаем параметры
sku = request.args.get("rokky")
ggsale = request.args.get("ggsale")
if not sku or not ggsale:
return jsonify({"error": "Missing parameters"}), 400
conn = sqlite3.connect(DB_PATH)
cursor = conn.cursor()
# проверяем есть ли продукт с таким SKU
cursor.execute("SELECT id FROM products WHERE sku=?", (sku,))
row = cursor.fetchone()
if not row:
conn.close()
return jsonify({"error": "SKU not found"}), 404
# обновляем поле gg
cursor.execute("UPDATE products SET gg=? WHERE sku=?", (ggsale, sku))
conn.commit()
conn.close()
return jsonify({"success": True, "sku": sku, "ggsale": ggsale})

View File

@ -19,7 +19,8 @@ CREATE TABLE IF NOT EXISTS products (
price_gg TEXT,
price_sales TEXT,
price_salesgg TEXT,
gg TEXT
gg TEXT,
insale TEXT
)
""")