first commit
This commit is contained in:
123
glapp.py
Normal file
123
glapp.py
Normal file
@ -0,0 +1,123 @@
|
||||
from flask import Flask, request, redirect, abort, session
|
||||
from utils import *
|
||||
import os, _thread, urllib
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = os.urandom(24)
|
||||
|
||||
|
||||
|
||||
@app.route('/queryUserId', methods=['GET'])
|
||||
def queryUserId():
|
||||
# 获取支付明细
|
||||
try:
|
||||
code = request.args.get('code')
|
||||
data = query_wx_userid(code)
|
||||
if len(data) <= 11:
|
||||
res = query_wx_fj_info(data)
|
||||
data = res
|
||||
print(f'http://web.jiyuankeshang.com/?user={data}')
|
||||
return redirect(f'http://web.jiyuankeshang.com/?user={data}')
|
||||
except Exception as e:
|
||||
return {}
|
||||
|
||||
|
||||
@app.route('/queryUser', methods=['GET'])
|
||||
def queryUserApi():
|
||||
# 获取支付明细
|
||||
try:
|
||||
id = request.args.get('user')
|
||||
data = queryUser(id)
|
||||
return data
|
||||
except Exception as e:
|
||||
return {}
|
||||
|
||||
|
||||
@app.route('/getPaymentDetails', methods=['GET'])
|
||||
def getPaymentDetails():
|
||||
try:
|
||||
id = request.args.get('user','')
|
||||
|
||||
id = id.replace(" ", "")
|
||||
|
||||
if not id:
|
||||
return {}
|
||||
data = query_pay_details(id)
|
||||
return data
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
@app.route('/test', methods=['POST'])
|
||||
def test():
|
||||
# 新增未收付明细 {"pay_amount": 20000, "id": "18515367096"}
|
||||
try:
|
||||
data = request.data.decode("utf-8")
|
||||
print(data)
|
||||
return {}
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
|
||||
@app.route('/addUnPayment', methods=['POST'])
|
||||
def addUnPayment():
|
||||
# 新增未收付明细 {"pay_amount": 20000, "id": "18515367096"}
|
||||
try:
|
||||
data = request.data.decode("utf-8")
|
||||
data = data.replace("null", "None")
|
||||
data = eval(data)
|
||||
data = data['data']
|
||||
print("开始========", data)
|
||||
if data['shifoudikou'] != "是":
|
||||
return {data}
|
||||
res = filter_jdy_ht(data['sijishenfenzhenghao'])
|
||||
data1 = {"pay_amount": 0, "id": data['sijishenfenzhenghao'],
|
||||
"fs": data['fs'], "jg": data['company_jc'], "name": data['sijixingming'],
|
||||
"fsfz": data['fs_p'],"shfid": data['shfid'],
|
||||
"hphm": data['license_plate']}
|
||||
print(data1)
|
||||
_thread.start_new_thread(add_payment, (data1, 1))
|
||||
|
||||
return data
|
||||
except Exception as e:
|
||||
print("addUnPayment",e, res)
|
||||
return {}
|
||||
|
||||
|
||||
@app.route('/addPayment', methods=['POST'])
|
||||
def addPayment():
|
||||
# 新增充值明细 {"pay_amount": 20000, "id": "18515367096"}
|
||||
try:
|
||||
data = request.data.decode("utf-8")
|
||||
print(data)
|
||||
data = data.replace("null", "None")
|
||||
data = eval(data)
|
||||
data = data['data']
|
||||
# res = filter_jdy_ht(data['id_card'])
|
||||
if not data['price']:
|
||||
data['price'] = 0
|
||||
# if not res:
|
||||
# # 合同表单未有数据
|
||||
fsfz = data['fsfz']['dept_no'] if data['fsfz'] else ""
|
||||
_thread.start_new_thread(add_payment, ({"pay_amount": data['price'], "id": data['id_card'],
|
||||
"fs": data['fs'], "jg": data['jg'], "name": data['name'],
|
||||
"fsfz": fsfz, "hphm": data['hphm']}, 1))
|
||||
# else:
|
||||
# _thread.start_new_thread(add_payment, ({"pay_amount": data['price'], "id": data['id_card'],
|
||||
# "fs": res[1], "jg": res[0], "name": res[4],
|
||||
# "fsfz": res[6],"shfid": res[7],
|
||||
# "hphm": res[5]}, 1))
|
||||
return {}
|
||||
except Exception as e:
|
||||
print("addPayment",e, data)
|
||||
return {}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host="0.0.0.0", port=3007, processes=True)
|
||||
Reference in New Issue
Block a user