代码拉取完成,页面将自动刷新
同步操作将从 医学联盟/医学区块链 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# encoding: utf-8
import json
from flask import Flask, request, jsonify
from flasgger import Swagger
from flask_cors import *
import time
from client_config import client_config
from ficsobcos_main import fiscobcos_deploy, fiscobcos_upload, fiscobcos_download
from encrypt_de import passWord
app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
app.config['JSONIFY_MIMETYPE'] = "application/json;charset=utf-8"
CORS(app, suppors_credentials=True, resources={r'/*'}) # 设置跨域
swagger = Swagger(app)
app = Flask(__name__)
@app.route('/api/p/medical/blockchain/deploy', methods=['GET'])
def deploy():
deploy_result = fiscobcos_deploy()
return jsonify(deploy_result)
@app.route('/api/p/medical/blockchain/upload', methods=['POST', 'OPTIONS'])
@cross_origin(supports_credentials=True)
def upload_page():
data = request.data.decode('utf-8')
data = json.loads(data)
upload_result = fiscobcos_upload(client_config.contract_address,
[str(data["file_data"]), data["file_hash"].encode(), str(int(time.time())),
data["file_pubkey"],
data["file_sign"]])
return jsonify(upload_result)
@app.route('/api/p/medical/blockchain/download', methods=['POST', 'OPTIONS'])
@cross_origin(supports_credentials=True)
def download_page():
data = request.data.decode('utf-8')
data = json.loads(data)
download_result = fiscobcos_download(client_config.contract_address,
[data["file_hash"].encode()])
return jsonify(download_result)
@app.route('/api/p/medical/blockchain/crate', methods=['POST', 'OPTIONS'])
@cross_origin(supports_credentials=True)
def crate():
data = request.data.decode('utf-8')
data = json.loads(data)
result = passWord().get_key(data["key"])
return jsonify(result)
@app.route('/api/p/medical/blockchain/sign', methods=['POST', 'OPTIONS'])
@cross_origin(supports_credentials=True)
def sign_():
data = request.data.decode('utf-8')
data = json.loads(data)
result = passWord().message_sign(data["text"], data["prvkey"])
return jsonify(result)
@app.route('/api/p/medical/blockchain/verify', methods=['POST', 'OPTIONS'])
@cross_origin(supports_credentials=True)
def verify():
data = request.data.decode('utf-8')
data = json.loads(data)
result = passWord().verifity(data["text"], data["sign"], data["address"])
return jsonify(result)
@app.route('/api/p/medical/blockchain/hash', methods=['POST', 'OPTIONS'])
@cross_origin(supports_credentials=True)
def data_hash():
data = request.data.decode('utf-8')
data = json.loads(data)
result = passWord().message_hash(data["text"])
return jsonify(result)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=client_config.config_port)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。