def get_data(): now_users = db_util2.get_pxc_users() db_util2.set_users(now_users) app_version = db_util2.get_download_apk_info() data = db_util2.get_data() data['app_version'] = app_version['info']['serverVersion'] print(data) return jsonify(data)
def download_file(filename): # 需要知道2个参数, 第1个参数是本地目录的path, 第2个参数是文件名(带扩展名) print("进入接口") directory = r'/var/www/apk' data = db_util2.get_download_apk_info() print(data) serverVersion = data['info']['serverVersion'] new_fileName = filename + serverVersion + r'.apk' print(new_fileName) # 新增下载次数 web_data = db_util2.get_data() nowDownloads = web_data['downloads'] db_util2.set_downloads(int(nowDownloads) + 1) return send_from_directory(directory, new_fileName, as_attachment=True)
def download_apk_info(): data = db_util2.get_download_apk_info() return jsonify(data)