from django.shortcuts import render
from django.views.decorators.http import require_http_methods

from DCbackend.utils.common import fail
from backend.Service.AdminService import AdminService


# Create your views here.

def index(request):
    return fail("接口地址，请勿直接访问")


# 用户登录
@require_http_methods(['POST'])
def login(request):
    return AdminService.login(request)

@require_http_methods(['POST'])
def login1(request):
    return AdminService.login1(request)
# 用户登录
@require_http_methods(['POST'])
def logout(request):
    return AdminService.logout(request)


# 用户登录
@require_http_methods(['POST'])
def currentUser(request):
    return AdminService.getAdminByToken(request)


# 用户登录
@require_http_methods(['POST'])
def getUserInfo(request):
    return AdminService.getAdminInfo(request)


# 创建用户
@require_http_methods(['POST'])
def create(request):
    return AdminService.create(request)


# 搜索列表
@require_http_methods(['POST'])
def search(request):
    return AdminService.search(request)


# 搜索列表
@require_http_methods(['POST'])
def update(request):
    return AdminService.update(request)

# 搜索列表
@require_http_methods(['POST'])
def updateProfile(request):
    return AdminService.updateProfile(request)


# 搜索列表
@require_http_methods(['POST'])
def changePassword(request):
    return AdminService.changePassword(request)

@require_http_methods(['POST'])
def delete(request):
    return AdminService.delete(request)
