def GetHealth_api(): mongo = PyMongo(app) datatype = request.args.get('type', 0) duration = request.args.get('duration') time = request.args.get('time', 0) day = int(time.split('/',2)[1]) month = int(time.split('/',2)[0]) if current_user.is_active: user = current_user.id person = mongo.db.Select_People.find({'username': user})[0]['person'] health = Health(person) #處理天 if duration != 'false': x_time,y_data = health.Day(datatype,day,month) #處理週 else: x_time,y_data = health.Week(datatype) return jsonify(x_time,y_data)