ssss
This commit is contained in:
@@ -150,25 +150,17 @@ def loginmiya():
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
return jsonify(resp)
|
return jsonify(resp)
|
||||||
|
|
||||||
@route_api.route("/member/ruilaizi",methods = [ "GET","POST" ])
|
@route_api.route("/member/ruilaizi",methods = [ "GET" ])
|
||||||
def ruilaizi():
|
def ruilaizi():
|
||||||
# resp = {'code': 200, 'msg': 'r操作成功~', 'data': {}}
|
# version = request.args.get('version', type=str) # 获取要下载的版本号
|
||||||
# req = request.values
|
package_path = f'/static/app-release.apk' # 假设更新包存放在 /path/to/update/package 目录下
|
||||||
# app.logger.info(req)
|
if os.path.exists(package_path): # 如果更新包存在
|
||||||
# # 文件路径 1.txt为测试文件 在项目的static/file目录下
|
return send_from_directory(directory='/static', filename=f'app-release.apk', as_attachment=True)
|
||||||
# # 获取文件的路径和文件名
|
else: # 如果更新包不存在
|
||||||
# filepath = os.path.join('static/app-release.apk')
|
return jsonify({
|
||||||
# try:
|
'code': 404,
|
||||||
# # 尝试打开文件并发送
|
'msg': '找不到指定版本的安装包'
|
||||||
# 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)
|
|
||||||
|
|
||||||
@route_api.route("/member/ruilaizitest",methods = [ "GET","POST" ])
|
@route_api.route("/member/ruilaizitest",methods = [ "GET","POST" ])
|
||||||
def ruilaizitest():
|
def ruilaizitest():
|
||||||
|
|||||||
Reference in New Issue
Block a user