You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
694 B

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/07/19 16:34:34
'''
from flask import jsonify, request, session
from common.utils import Utils
from . import user_router
from db_logic.user import BllUser
@user_router.router("/login", methods=["POST"])
def user_login():
user_name = request.values.get("user_name")
user_pwd = request.values.get('password')
user_obj = BllUser.login(user_name, user_pwd)
if user_obj:
session['user_id'] = user_obj.user_id
session['customer_id'] = user_obj.customer_id
return jsonify(Utils.true_return(msg="登陆成功"))
else:
return jsonify(Utils.false_return(status=201, msg="登陆失败"))