"""
@autor:Yue
@date::15:49
@file:callback_test.py
@project:autoInterface

"""
import os,json,time,sys
from blueprints.tools.deals import  dealSha1
aa=os.path.abspath(__file__)
sys.path.append(os.path.dirname(os.path.dirname(aa)))
from flask import render_template,current_app,Blueprint,request,url_for,redirect,jsonify
try:
    from blueprints.exec import runexec
except:
    from blueprints.exec import runexec
from blueprints.tools.dealScene import dealScene
from blueprints.tools import deals

callback_test=Blueprint('callbackfunc',__name__)

@callback_test.route('/out-custom_link_batch',methods=['post'])
def hetongcallback():
    userId=request.json.get('userId')
    templateId = request.json.get('contract')[0].get('templateId')
    t={'userid':userId,'templateid':1,'msg':'return test flask out-custom_link_batch callback_test','code':'0'}
    return jsonify(t)


@callback_test.route('/out-custom_link',methods=['post'])
def hetongcallback1():
    userId=request.json.get('userId')
    templateId = request.json.get('contract')[0].get('templateId')
    t={'userid':userId,'templateid':1,'msg':'return test flask out-custom_link','code':'0'}
    return jsonify(t)


@callback_test.route('/api/v1/unified',methods=['post'])
def mock_shangbao():
    body={
  "version":"1.0",
  "instCode":"2",
  "operation":"preApply",
  "sign":""
}
    afterBody=dealSha1(body)
    resp={
    "code": 0,
    "message": "OK",
    "data": {
        "seqNo": "ba6a36d1-a34a-4588-811e-aa25394417a8"
    }
}
    return jsonify(resp)