This commit is contained in:
2023-11-23 00:07:03 +08:00
parent baacb8cb3c
commit 31dc2e47fb

View File

@@ -150,25 +150,17 @@ def loginmiya():
db.session.commit()
return jsonify(resp)
@route_api.route("/member/ruilaizi",methods = [ "GET","POST" ])
@route_api.route("/member/ruilaizi",methods = [ "GET" ])
def ruilaizi():
# resp = {'code': 200, 'msg': 'r操作成功~', 'data': {}}
# req = request.values
# app.logger.info(req)
# # 文件路径 1.txt为测试文件 在项目的static/file目录下
# # 获取文件的路径和文件名
# filepath = os.path.join('static/app-release.apk')
# try:
# # 尝试打开文件并发送
# return send_file(filepath, as_attachment=True)
# except PermissionError:
# return '文件权限错误,无法访问', 403
# except Exception as e:
# return '发生错误', 500
#
# return jsonify(resp)
file_path = 'static/app-release.apk'
return send_file(file_path, as_attachment=True)
# version = request.args.get('version', type=str) # 获取要下载的版本号
package_path = f'/static/app-release.apk' # 假设更新包存放在 /path/to/update/package 目录下
if os.path.exists(package_path): # 如果更新包存在
return send_from_directory(directory='/static', filename=f'app-release.apk', as_attachment=True)
else: # 如果更新包不存在
return jsonify({
'code': 404,
'msg': '找不到指定版本的安装包'
})
@route_api.route("/member/ruilaizitest",methods = [ "GET","POST" ])
def ruilaizitest():