# -*- encoding: utf-8 -*-
# -----------------------------------------------------------------------------
# @File Name  : fund.py
# @Time       : 2021/1/14 下午5:31
# @Author     : X. Peng
# @Email      : acepengxiong@163.com
# @Software   : PyCharm
# -----------------------------------------------------------------------------
import datetime
import time
import uuid

import oss2
from flask_restful import Resource, reqparse
from flask import request, render_template
from flask import make_response
from app.api.engine import pdf_folder, redis

class FundEvaluation(Resource):
    def __init__(self):
        """."""
        token = request.headers.get('Authorization', '')
        token = 's:sid:' + token.split(' ')[1]
        ifa_id = redis.get(token)
        if not ifa_id:
            return {"code": '9005', "message": "请登录", "attributes": []}
        self.ifa_id = ifa_id.decode().replace('\'', '')
        self.parser = reqparse.RequestParser()

    def get(self):
        """"""
        self.parser.add_argument('fund_id', type=str, required=True, help='基金id不能为空')
        args = self.parser.parse_args()
        args['ifa_id'] = self.ifa_id
        data = get_fund_evaluation(args)
        resp = {
            "statusCode": "0000",
            "message": "成功",
            "attributes": data
        }
        return resp
