#!/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="登陆失败"))