Commit 06dfc370 by Aeolus

update

parent 0023e52a
...@@ -12,6 +12,11 @@ SK_CONFIG = { ...@@ -12,6 +12,11 @@ SK_CONFIG = {
"app_secret": os.getenv("SK_MINI_PROGRAM_APPSECRET"), "app_secret": os.getenv("SK_MINI_PROGRAM_APPSECRET"),
} }
XXZN_CONFIG = {
"app_id": os.getenv("XXZN_MINI_PROGRAM_APPID"),
"app_secret": os.getenv("XXZN_MINI_PROGRAM_APPSECRET"),
}
XX_PAY_CONFIG = { XX_PAY_CONFIG = {
"mch_id": os.getenv("XX_MCHID"), "mch_id": os.getenv("XX_MCHID"),
"pay_key": os.getenv("XX_PAY_KEY"), "pay_key": os.getenv("XX_PAY_KEY"),
...@@ -28,19 +33,22 @@ pay_config_dict = { ...@@ -28,19 +33,22 @@ pay_config_dict = {
"xx": XX_PAY_CONFIG, "xx": XX_PAY_CONFIG,
} }
platform_config_list = ["", "sukang24h", ] platform_config_list = ["", "sukang24h", "xxzn"]
platform_config_dict = { platform_config_dict = {
"sukang24h": SK_CONFIG, "sukang24h": SK_CONFIG,
"xxzn": XXZN_CONFIG
} }
platform_appid_config_list = [ platform_appid_config_list = [
"", "",
SK_CONFIG["app_id"], # 苏康24H 平台序号 ==>1 SK_CONFIG["app_id"], # 苏康24H 平台序号 ==>1
XXZN_CONFIG["app_id"]
] ]
platform_appid_config_dict = { platform_appid_config_dict = {
"sukang24h": SK_CONFIG["app_id"], "sukang24h": SK_CONFIG["app_id"],
"xxzn": XXZN_CONFIG["app_id"]
} }
......
...@@ -6,12 +6,14 @@ author:Aeolus ...@@ -6,12 +6,14 @@ author:Aeolus
@file: hatch_portal.py @file: hatch_portal.py
""" """
import logging import logging
import time
from flask import Blueprint, request, jsonify, g from flask import Blueprint, request, jsonify, g
from models.base_model import db from models.base_model import db
from models.models import Machine, Production, Hatch, RentDetail from models.models import Machine, Production, Hatch, RentDetail
from utils.error_code import MACHINE_NOT_EXIST_ERROR, HATCH_NOT_EXIST_ERROR from utils.error_code import MACHINE_NOT_EXIST_ERROR, HATCH_NOT_EXIST_ERROR, MACHINE_NO_CREATE_ERROR, \
MACHINE_MAC_DUPLICATE_ERROR
from utils.my_response import BaseResponse from utils.my_response import BaseResponse
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -92,3 +94,28 @@ def run_get_machine_no(): ...@@ -92,3 +94,28 @@ def run_get_machine_no():
"command_time": machine.command_time, "type": machine.type}) "command_time": machine.command_time, "type": machine.type})
else: else:
return jsonify(MACHINE_NOT_EXIST_ERROR) return jsonify(MACHINE_NOT_EXIST_ERROR)
@machine_route.route('create_machine_no', methods=["post"])
def run_create_machine_no():
json_data = request.get_json()
mac = json_data["iMEI"]
hatch_number = json_data["slotCount"]
machine = Machine.query.filter_by(mac=mac).first()
if machine:
return jsonify(MACHINE_MAC_DUPLICATE_ERROR)
for i in range(3):
machine_no = int(time.time())
machine = Machine.query.filter_by(machine_no=machine_no).first()
if not machine:
break
return jsonify(MACHINE_NO_CREATE_ERROR)
machine_model = Machine()
machine_model.machine_no = machine_no
machine_model.mac = mac
machine_model.hatch_number = hatch_number
db.session.add(machine_model)
db.session.commit()
return BaseResponse(data={"machine_no": machine_no})
...@@ -124,7 +124,7 @@ def create_rent(): ...@@ -124,7 +124,7 @@ def create_rent():
db.session.add(rent) db.session.add(rent)
db.session.add(rent_detail) db.session.add(rent_detail)
db.session.commit() db.session.commit()
return BaseResponse() return BaseResponse(data={"out_trade_no": rent_no, "free_order": True})
total_fee = 0 total_fee = 0
open_hatchs = {} open_hatchs = {}
......
...@@ -13,4 +13,4 @@ app = create_app(os.getenv('RUN_ENV', 'prod')) ...@@ -13,4 +13,4 @@ app = create_app(os.getenv('RUN_ENV', 'prod'))
logger.info("run server") logger.info("run server")
if __name__ == '__main__': if __name__ == '__main__':
app.run('127.0.0.1', 8893, debug=False) app.run('127.0.0.1', 8893, debug=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment