Exemplo n.º 1
0
 def post(self):
     body = request.get_json()
     action = body.get('action')
     data = body.get('data')
     if action == 'user_check':
         return flask_utils.res_s(action=action, data=self.c_user)
     elif action == 'action_data':
         return flask_utils.res_s(action=action, data=data)
     else:
         return flask_utils.res_f('res no action')
Exemplo n.º 2
0
 def post(self):
     body = request.get_json()
     action = body.get('action')
     data = body.get('data')
     if action == 'list_file':
         rst = file_manager.list_my_file(data.get('user_name'))
         return flask_utils.res_s(action=action, data=rst)
     else:
         return flask_utils.res_f('FileResource no action')
def upload_file():
    up_list = list()
    user_name = None
    token = request.headers.get("access-token")
    rst = jwt_utils.token_decode(token)
    if rst.get('code') == 0:
        try:
            user_name = rst.get('data').get('user_name')
        except Exception as e:
            print(e)
        # # 用户鉴权
        # payload = rst.get('data')
        # c_user = {
        #     'user_name': payload.get('user_name'),
        #     'nick_name': payload.get('nick_name'),
        #     'role': payload.get('role'),
        #     'login_time': payload.get('login_time')
        # }
    if user_name and request.method == 'POST' and 'media' in request.files:
        file_list = request.files.getlist('media')
        up_list = file_manager.upload_files(file_list, user_name)
    if up_list:
        return flask_utils.res_s(action='upload_file', data=up_list)
    return flask_utils.res_f(action='upload_file')
Exemplo n.º 4
0
 def get(self):
     return flask_utils.res_s('Hello flask')
Exemplo n.º 5
0
 def get(self):
     return flask_utils.res_s('Hello SI AUTH', data=None)