finish close #1

This commit is contained in:
RainSun 2019-12-08 22:40:05 +08:00
parent 83219d749f
commit 7f011acf06
5 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1 @@
var data = [{ "_id" : {"$oid": "5de3cc411e83c77332ded8a5"}, "username" : "小例子~欢迎测试~", "node" : "绝对不能删除这个东西", "wxcode" : "wxp://f2f0WvGwL7XfIB-3LU3S6bzSF9yZpiZCeMKP", "alcode" : "https://qr.alipay.com/fkx096505kpwu1n71l6pw4a", "qqcode" : "https://i.qianbao.qq.com/wallet/sqrcode.htm?m=tenpay&f=wallet&a=1&ac=CAEQkpzIoQQY14z17gU%3D_xxx_sign&u=1144131090&n=Rain+Sun", "openId" : "otxHM4icvFkfMcaqxTH1zSNKhKVs", "timeout" : "1606314047962", "create_time" : 1575210049 }]

View File

@ -0,0 +1 @@
var data = [{ "_id" : {"$oid": "5de7be0bb553c0e257aaed87"}, "username" : "义卖", "node" : "", "wxcode" : "wxp://f2f0iCNCl9-RLi3FPcMTfJd1oDHAa6W9sQmL", "alcode" : "https://qr.alipay.com/fkx07547sutepd2xxujd61f", "qqcode" : "", "openId" : "otxHM4mV1Z6QGfMEfouhiEHId1x4", "timeout" : "1578060556451", "create_time" : 1575468555 }]

View File

@ -0,0 +1 @@
var data = [{ "_id" : {"$oid": "5dec451fa0e4c53d2e1b0c17"}, "username" : "五金百货姚", "node" : "", "wxcode" : "wxp://f2f0lRtAjngRMk6kIBQoyox3g6mDiwnv1Vu3", "alcode" : "https://qr.alipay.com/fkx05073v5qnwtjbim8w17d", "qqcode" : "", "openId" : "otxHM4rQbf_KgadoZ4mclq2F6t2o", "timeout" : "1606869279009", "create_time" : 1575765279 }]

View File

@ -4,6 +4,7 @@ from pay import checkNotify, createOrderParams
import re
import json
import time
import os
# 主函数
@ -56,7 +57,17 @@ def delQR(request):
codeId = str(request.form['id'])
if(len(codeId) == 24): # 长度校验
if(codeId.isalnum()): # 内容校验
return delCode(codeId) # 返回code信息
res = delCode(codeId) # 返回code信息
if res:
path = '{0}{1}.js'.format('/data/qrcode/data/', codeId)
print(path)
if os.path.exists(path):
os.remove(path)
return res
else:
return res
else:
return False
else:
return False
else:
@ -72,7 +83,16 @@ def addQR(request):
if checked:
res = insertCode(checked)
if res:
return {'errcode': 200, 'id': res}
res = json.loads(res) # res是str 转成json
res = res['$oid'] # 取到里边的id
data = findCode(res) # 获取到所有的信息
try: # 将信息写入文件
f = open('{0}{1}.js'.format('/data/qrcode/data/', res),'w',encoding="utf-8")
f.write('{0}{1}'.format('var data = ',data))
f.close()
except IOError:
return False
return {'errcode': 200, 'id': res, 'data':data}
else:
return False
else:

BIN
backEnd/qr/img/bg6.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB