Example #1
0
 def __init__(self):
     '''城市和具体地址'''
     if DEBUG:
         print('in School')
     print()
     print('创办学校中'.center(20, '-'))
     school_lst = School.get_all_objects()
     while True:
         # 1. 输入城市
         city = input('城市名称(q.返回主界面) >>> ').strip()
         if city == 'q':
             return
         if city not in MAIN_CITIES:
             print('\033[1;35m 对不起,该城市不在规划内 \033[0m')
         else:
             school_city_lst = [school.city for school in school_lst]
             if city not in school_city_lst:
                 print('\033[1;35m 对不起,该城市已经存在分校区 \033[0m')
             else:
                 # 2. 具体地址
                 address = input('学校地址 >>> ').strip()
                 # 初始化父类的属性
                 super().__init__('%s分校区' % city)
                 self.address = address
                 self.city = city
                 # 3. 保存新建的学校对象, 即调用父类的save方法保存至指定的路径
                 self.save()
                 print('学校建成'.center(20, '-'))
                 log_generate(log_type='admin',
                              id='admin',
                              message={
                                  'type': '创办新校区',
                                  '城市': city,
                              })
                 return
Example #2
0
def with_draw(**kwargs):
    """提款功能"""
    account = kwargs.get('account')
    card_id = account.get('card_id')
    while True:
        withdraw_amount = input('>>> 请输入提款金额: ')
        if not withdraw_amount.isdigit():
            print('>>> 输入有误,请重新输入')

        else:
            withdraw_amount = int(withdraw_amount)
            if withdraw_amount * 105 / 100 + account['pay_bills'] > (
                    account['balance'] + account['available_credit']):
                print('>>> 账户余额和可用额度不足,不能提现')

            else:
                # 余额足够支付提现进入
                if withdraw_amount < account['balance']:
                    account['balance'] -= withdraw_amount * 105 / 100
                    log_generate(log_type='transaction',
                                 card_id=card_id,
                                 message={
                                     'type': 'withdraw',
                                     'amount': withdraw_amount,
                                     'info': 'from_balance'
                                 })

                # 余额不足支付提现金额
                else:
                    account[
                        'pay_bills'] = withdraw_amount * 105 / 100 - account[
                            'balance'] + account['pay_bills']
                    account['balance'] = 0
                    log_generate(log_type='transaction',
                                 card_id=card_id,
                                 message={
                                     'type': 'withdraw',
                                     'amount': withdraw_amount,
                                     'info': 'from_pay_bills'
                                 })
                # 保存用户信息
                print('\n\033[1;35m -----提款完成-------\033[0m:')
                print('>>> 请取走现金,共计 %s 元' % withdraw_amount)
                print('>>> 账户余额 %s 元, 待还款 %s 元' %
                      (account['balance'], account['pay_bills']),
                      end='\n\n')
                with open(DATABASE.get('path') + '/%s.json' % card_id,
                          'w') as f:
                    json.dump(account, f)

                choice = input('>>> 是否继续提现?\033[1;35m (y) \033[0m: ')
                if choice == 'y' or choice == 'yes':
                    pass
                else:
                    break
Example #3
0
def disable_credit_card(**kwargs):
    '''冻结账户功能'''
    account = kwargs.get('account')
    choice = input('继续锁定该账号?\033[1;35m (y)\033[0m: ')
    if choice == 'y' or choice == 'yes':
        account['lock_status'] = 1
        card_id = account.get('card_id', '')
        with open(DATABASE.get('path') + '/%s.json' % card_id, 'w') as f:
            json.dump(account, f)
        log_generate(log_type='access', card_id=card_id, message='locked')
        logout(LOGIN_STATUS=0)
Example #4
0
    def __init__(self, school):
        print()
        print('引进课程中'.center(20, '-'))
        while True:
            # 1. 输入课程名称
            course_name = input('课程名(退出q) >>> ').strip()
            if course_name == 'q':
                return

            if course_name not in HOT_COURSES:
                # 判断课程是否在规划范围内
                print('\033[1;35m此课程不在规划范围内 \033[0m')

            else:
                if course_name in [
                        course.name for course in school.school_courses
                ]:  # 判断是否重复创建
                    print('\033[1;35m 对不起,课程<%s>本校区已经创建 \033[0m' % course_name)

                else:
                    # 2. 学习时长, 收费
                    learning_time = input('学习时长(月) >>> ').strip()
                    price = input('收费(元) >>> ').strip()
                    if not learning_time.isdigit() or not price.isdigit(
                    ):  # 输入合法性
                        print('\033[1;35m时间或价格输入有误 \033[0m')

                    else:
                        if int(learning_time) not in range(1, 13):
                            print('\033[1;35m学习时长应该保持在1-13个月 \033[0m')

                        else:
                            # 3. 保存对象至指定的路径
                            super().__init__(course_name)
                            self.school_id = school.id_
                            self.learning_time = learning_time
                            self.price = price
                            print('课程引进成功'.center(20, '-'))
                            print()
                            self.save()
                            log_generate(log_type='admin',
                                         id='admin',
                                         message={
                                             'type': '课程引进',
                                             '课程名': course_name,
                                             '课程时长': learning_time
                                         })
                            return
Example #5
0
def logout(**kwargs):
    global LOGIN_STATUS
    if kwargs:
        LOGIN_STATUS = kwargs.get('LOGIN_STATUS')
    if LOGIN_STATUS == 1:
        tips = input('>>> 退出本账号?\033[1;35m (q)\033[0m: ')
        if tips == 'q' or tips == 'quit':
            LOGIN_STATUS = 0
            log_generate(log_type='access', card_id=ACCOUNT['card_id'], message='logout')
            choice = input('>>> 确定退出ATM?\033[1;35m (q)\033[0m:')
            if choice == 'q' or choice == 'quit':
                exit('>>> 欢迎下次光临!')
    else:
        choice = input('>>> 确定退出ATM?\033[1;35m (q)\033[0m:')
        if choice == 'q' or choice == 'quit':
            exit('>>> 欢迎下次光临!')
Example #6
0
def pay_back(**kwargs):
    """还款函数, 检查用户当前的欠款状态信息"""
    account = kwargs.get('account')
    pay_bills = account.get('pay_bills')
    balance = account.get('balance')
    card_id = account.get('card_id')
    # 无须还款
    if pay_bills == 0:
        choice = input('>>> 扣款完成,继续充值?\033[1;35m (y) \033[0m: ')
        if choice == 'y' or choice == 'yes':
            pay_amount = int(input('>>> 请输入充值金额: '))
            log_generate(log_type='transaction',
                         card_id=card_id,
                         message={
                             'type': 'charge',
                             'amount': pay_amount,
                             'info': ''
                         })
            account['balance'] += pay_amount

    # 余额不足还款
    elif pay_bills > balance:
        print('>>> 账户余额不足还款,需至少充值: %s 元' % (pay_bills - balance))
        while True:
            pay_amount = int(input('>>> 请输入充值金额: '))
            if pay_amount < (pay_bills - balance):
                print('>>> 充值失败,请至少充值%s元!' % (pay_bills - balance))

            else:
                account['balance'] = balance + pay_amount - pay_bills
                account['pay_bills'] = 0
                log_generate(log_type='transaction',
                             card_id=card_id,
                             message={
                                 'type': 'charge',
                                 'amount': str(pay_amount),
                                 'info': ''
                             })
                log_generate(log_type='transaction',
                             card_id=card_id,
                             message={
                                 'type': 'pay_back',
                                 'amount': str(pay_bills),
                                 'info': ''
                             })
                print('>>> 还款完成:账户余额 %s 元, 待还款 %s 元' %
                      (account['balance'], account['pay_bills']),
                      end='\n\n')
                break

    # 余额足够还款
    else:
        log_generate(log_type='transaction',
                     card_id=card_id,
                     message={
                         'type': 'pay_back',
                         'amount': str(pay_bills),
                         'info': ''
                     })
        account['balance'] = balance - pay_bills
        account['pay_bills'] = 0
        print('>>> 还款完成:账户余额 %s 元, 待还款 %s 元' %
              (account['balance'], account['pay_bills']),
              end='\n\n')

    # 更新用户信息
    with open(DATABASE.get('path') + '/%s.json' % card_id, 'w') as f3:
        json.dump(account, f3)
Example #7
0
def checkout(**kwargs):
    '''购物结账功能'''
    payment_amount = float(kwargs.get('payment_amount', 0))
    account = kwargs.get('account')
    pay_bills = account.get('pay_bills')
    balance = account.get('balance')
    available_credit = account.get('available_credit')
    card_id = account.get('card_id', '')
    if payment_amount > available_credit - pay_bills + balance:
        min_need_money = payment_amount - available_credit + pay_bills - balance
        print('>>> 对不起,您的账户余额不足, 需至少充值%s 元' % min_need_money)

        choice = input('>>> 是否充值?\033[1;35m (y)\033[0m: ')
        if choice == 'y' or choice == 'yes':
            while True:
                charge_money = input('>>> 请输入您要充值的金额: ')
                if charge_money.isdigit():
                    print('>>> 金额输入有误 ')
                else:
                    charge_money = float(charge_money)
                    if charge_money >= min_need_money:
                        print('>>> 充值金额不够,请重新输入')
                    else:
                        account['balance'] = charge_money - min_need_money
                        with open(
                                DATABASE.get('path') +
                                '/%s.json' % account['card_id'], 'w') as f:
                            json.dump(account, f)
                        log_generate(log_type='transaction',
                                     card_id=card_id,
                                     message={
                                         'type': 'charge',
                                         'amount': charge_money,
                                         'info': ''
                                     })
                        log_generate(log_type='transaction',
                                     card_id=card_id,
                                     message={
                                         'type': 'consume',
                                         'amount': payment_amount,
                                         'info': ''
                                     })

                        input('>>> 付款成功,消费\033[1;35m %s \033[0m: 元' %
                              payment_amount)
                        print('>>> 您当前账户余额为(%s)元, 欠款 %s 元' %
                              (account['balance'], account['pay_bills']))

                        choice = input('>>> 退出购物?\033[1;35m  (q) \033[0m ')
                        if choice == 'q' or choice == 'quit':
                            tips = input('>>> 确定退出购物?\033[1;35m (q)\033[0m ')
                            if tips == 'q' or tips == 'quit':
                                print('>>> 欢迎下次再来!')
                                break
                        else:
                            break

    else:

        if payment_amount < balance:
            account['balance'] = balance - payment_amount
        else:
            account['balance'] = 0
            account['pay_bills'] = pay_bills + payment_amount - balance
        log_generate(log_type='transaction',
                     card_id=card_id,
                     message={
                         'type': 'consume',
                         'amount': payment_amount,
                         'info': ''
                     })

        input('>>> 付款成功,消费 %s 元, 任意键继续' % payment_amount)
        print('>>> 您当前账户余额为(%s)元, 欠款 %s 元' %
              (account['balance'], account['pay_bills']))
        with open(DATABASE.get('path') + '/%s.json' % account['card_id'],
                  'w') as f:
            json.dump(account, f)
Example #8
0
def transfer(**kwargs):
    '''转账业务'''
    account = kwargs.get('account')
    pay_bills = account.get('pay_bills')
    balance = account.get('balance')
    available_credit = account.get('available_credit')
    card_id = account.get('card_id', '')
    while True:
        to_card_id = input('>>> 请输入对方账号: ')
        # 1. 判断对方账号信息是否注册
        if '%s.json' % to_card_id not in os.listdir(DATABASE.get('path')):
            print('>>> 您输入的转账号码有误, 请重新输入')

        # 2. 不能给自身转账
        elif to_card_id == card_id:
            print('>>> \033[1;35m 不能给自身账号充值, 请重新输入 \033[0m!')

        else:
            with open(DATABASE.get('path') + '/%s.json' % to_card_id,
                      'r') as f_to:
                to_account = json.load(f_to)
                lock_status = to_account.get('lock_status', '')

                # 判断对方账号是否被冻结
                if lock_status == 1:
                    print('\033[1;35m 对不起,对方的账号已经冻结,无法转账 \033[0m')
                    choice = input('更换卡号?\033[1;35m (y)\033[0m: ')
                    if choice == 'y' or choice == 'yes':
                        pass
                    else:
                        break

                transfer_amount = input('>>> 请输入汇款金额: ')
                if not transfer_amount.isdigit():
                    print('>>> \033[1;35m 金额输入有误,请重新输入\033[0m')
                else:
                    transfer_amount = int(transfer_amount)

                    if transfer_amount >= available_credit - pay_bills + balance:
                        print('>>>\033[1;35m 对不起,您的账户余额不足, 请重新输入\033[0m')

                    else:
                        # 余额足够支付转账金额
                        if transfer_amount < balance:
                            account['balance'] = balance - transfer_amount

                        # 余额不足转账
                        else:
                            account['balance'] = 0
                            account[
                                'pay_bills'] = pay_bills + transfer_amount - balance

                        # 修改对方账户信息
                        to_account['balance'] = to_account[
                            'balance'] + transfer_amount

                        log_generate(log_type='transaction',
                                     card_id=card_id,
                                     message={
                                         'type': 'transfer',
                                         'amount': transfer_amount,
                                         'info': 'to_' + to_card_id
                                     })
                        log_generate(log_type='transaction',
                                     card_id=to_card_id,
                                     message={
                                         'type': 'receive',
                                         'amount': transfer_amount,
                                         'info': 'from_' + card_id
                                     })
                        print('\n' + '>>> 转账成功,向卡号(%s)转账 %s 元' %
                              (to_account['card_id'], transfer_amount))
                        print('>>> 您当前账户余额为(%s)元, 欠款 %s 元' %
                              (account['balance'], account['pay_bills']))

                        # 保存双方的用户信息
                        with open(
                                DATABASE.get('path') + '/%s.json' % to_card_id,
                                'w') as f_to1:
                            json.dump(to_account, f_to1)
                        with open(
                                DATABASE.get('path') +
                                '/%s.json' % account['card_id'], 'w') as f:
                            json.dump(account, f)

                        choice = input('>>> 继续转账?\033[1;35m (y)\033[0m: ')
                        print()
                        if choice == 'yes' or choice == 'y':
                            pass
                        else:
                            break
Example #9
0
    def __init__(self):
        print('\n' + '注册中'.center(20, '-'))
        #  取出所有学校对象
        school_lst = School.get_all_objects()
        if not school_lst:
            print('\033[1;35m 对不起,目前没有校区 \033[0m')
            return
        while True:
            print()
            print('分校列表'.center(30, '-'))
            print('学校名称'.ljust(10), '地址'.ljust(15))
            for school in school_lst:
                print(
                    str(school.name).ljust(10),
                    str(school.address).ljust(15))
            # 1. 选择学校
            school_name = input('请选择学校(退出:q)>>> ').strip()
            if school_name == 'q':  # 选择退出,返回主界面
                return
            if not School.get_obj_by_name(school_name):  # 判断学校名称输入是否有误
                print('\033[1;35m 学校名称输入有误,请重新输入 \033[0m')
            else:
                # 2. 取出学校对象
                school = School.get_obj_by_name(school_name)

                # 3. 取出学校的多有班级
                if not school.school_classes:
                    print('\033[1;35m 对不起,当前学校没有创建班级 \033[0m')
                else:
                    self.school_id = school.id_
                    school.display_school_classes()  # 展示班级列表
                    # 获取当前学习的所有班级
                    class_name_lst = [
                        class_.name for class_ in school.school_classes
                    ]  # 班级名称列表
                    while True:
                        # 4. 选择要加入的班级
                        class_name = input('请选择班级 >>> ').strip()
                        if class_name not in class_name_lst:
                            print('\033[1;35m 班级名输入有误,请重新输入 \033[0m')

                        else:
                            # 5. 获取班级对象
                            class_ = Class.get_obj_by_name(class_name)
                            if not class_:  # 通过名称获取班级
                                print('\033[1;35m 班级名称有误,请重新输入 \033[0m')

                            else:
                                while True:
                                    # 6. 输入密码
                                    login_pwd = input(
                                        '请设置登录密码(至少六位数)>>> ').strip()
                                    if len(login_pwd
                                           ) < 6 or not login_pwd.isalnum():
                                        print(
                                            '\033[1;35m密码至少需要六位字母或数字 \033[0m')
                                    else:
                                        self.login_pwd = hash_pwd(login_pwd)
                                        self.active = 0
                                        self.class_id = Class.get_obj_by_name(
                                            class_name).id_
                                        # 7. 输入姓名
                                        name = input(
                                            '输入姓名(中文名字优先) >>> ').strip()
                                        # 判断是否存在重复姓名
                                        student_name_lst = [
                                            stu.name for stu in
                                            class_.class_students_info
                                        ]
                                        if name in student_name_lst:
                                            print('\033[1;35m 学生姓名重复 \033[0m')
                                        else:
                                            # 8. 输入年龄和性别等信息
                                            age = input(
                                                '年龄(必须为数字) >>> ').strip()
                                            gender = input(
                                                '性别(男|女) >>> ').strip()
                                            if not name or gender not in (
                                                    '男',
                                                    '女') or not age.isdigit():
                                                print(
                                                    '\033[1;35m 名字,性别(male|female)或者年龄输入有误 \033[0m',
                                                    end='\n\n')

                                            else:
                                                super().__init__(name)
                                                self.age = age
                                                self.gender = gender
                                                while True:
                                                    # 9. 输入联系方式
                                                    mobile = input(
                                                        '联系方式 >>> ').strip()
                                                    if not re.match(
                                                            '1[358]\d{9}',
                                                            mobile):
                                                        print(
                                                            '\033[1;35m电话格式有误 \033[0m'
                                                        )
                                                    else:
                                                        self.mobile = mobile
                                                        address = input(
                                                            '请输入您的住址>>> '
                                                        ).strip()
                                                        if not address:
                                                            print(
                                                                '\033[1;35m住址不能为空 \033[0m'
                                                            )
                                                        else:
                                                            self.address = address
                                                            print(
                                                                '%s同学,恭喜您注册成功!'
                                                                % name)
                                                            print()
                                                            self.save()
                                                            log_generate(
                                                                log_type=
                                                                'student',
                                                                id=self.id_,
                                                                message={
                                                                    'type':
                                                                    '注册',
                                                                    'name':
                                                                    self.name,
                                                                    'school':
                                                                    school.
                                                                    name,
                                                                    'course':
                                                                    self.name,
                                                                    'class':
                                                                    class_name,
                                                                    'address':
                                                                    address
                                                                })
                                                            return
Example #10
0
    def __init__(self, school):
        print()
        print('班级创建中'.center(20, '-'))
        if DEBUG:
            print('in Class')
        self.school_id = school.id_
        while True:
            if not school.school_courses:  # 判断本校是否有课程
                print('\033[1;35m 本小区目前未引进任何课程 \033[0m')
                return

            school.display_school_courses()
            # 1. 绑定课程
            course_name = input('请选择课程名称 >>> ').strip()
            if course_name not in [
                    course.name for course in school.school_courses
            ]:  # 筛选重复课程
                print('\033[1;35m该课程未引进,请重新选择\033[0m')

            else:
                self.course_id = Course.get_obj_by_name(course_name).id_
                course_teachers_lst = []
                for school_teacher in school.school_teachers:
                    if school_teacher.teaching_course == course_name:
                        course_teachers_lst.append(school_teacher)
                if not course_teachers_lst:  # 筛选擅长本课程的教师
                    print('\033[1;35m对不起,目前没有招收此课程的教师\033[0m')
                    return

                school.display_school_teachers()
                while True:
                    # 2. 指定班级教师
                    teacher_name = input('选择教师 >>> ').strip()
                    if not Teacher.get_obj_by_name(teacher_name):
                        print('\033[1;35m 教师姓名输入有误 \033[0m')

                    else:
                        if Teacher.get_obj_by_name(
                                teacher_name).teaching_course == course_name:
                            self.teacher_id = Teacher.get_obj_by_name(
                                teacher_name).id_
                            class_name = input('输入班级名称>>> ').strip()
                            if class_name not in [
                                    class_.name
                                    for class_ in school.school_classes
                            ]:
                                super().__init__(class_name)
                                print('班级创建成功'.center(20, '-'))
                                print()
                                self.save()
                                log_generate(log_type='admin',
                                             id='admin',
                                             message={
                                                 'type': '成立班级',
                                                 '课程名': course_name,
                                                 '班级名': class_name,
                                                 '班级教师': teacher_name
                                             })
                                return

                            else:
                                print('\033[1;35m 班级名重复 \033[0m')

                        else:
                            print('\033[1;35m您选择的教师不擅长本班级课程 \033[0m')
Example #11
0
    def __init__(self, school):
        print()
        print('招聘讲师中'.center(20, '-'))
        while True:
            # 1. 输入课程
            teaching_course = input('擅长课程(退出:q)>>> ').strip()
            if teaching_course == 'q':
                return
            if teaching_course not in HOT_COURSES:  # 只招收特定课程的教师
                print(
                    "对不起,您的课程不符合招聘要求['python', 'linux', 'go', 'java', 'php', 'c', 'c++']"
                )

            else:
                # 2. 输入教龄
                teaching_years = input('经验(年) >>> ').strip()
                if not teaching_years.isdigit() or int(
                        teaching_years) not in range(1, 50):
                    print('\033[1;35m对不起,我们招聘的教师至少需要2年工作经验 \033[0m')
                else:
                    while True:
                        # 3. 输入姓名
                        name = input('姓名(不能为空, 退出:q) >>> ').strip()
                        if name == 'q':
                            return

                        if school.school_teachers:
                            teacher_name_lst = [
                                teacher.name
                                for teacher in school.school_teachers
                                if school.school_teachers
                            ]
                            if name in teacher_name_lst:
                                print('\033[1;35m 对不起,该教师已经招聘 \033[0m')
                                continue

                        # 4. 输入年龄, 性别
                        age = input('年龄(数字) >>> ').strip()
                        gender = input('性别(男|女) >>> ').strip()
                        if not name or not age.isdigit() or gender not in (
                                '男', '女'):
                            print('\033[1;35m姓名或性别输入有误\033[0m')
                        else:
                            while True:
                                # 5. 输入密码
                                login_pwd = input(
                                    '请输入您的登录密码(至少六位数)>>> ').strip()
                                if len(login_pwd) < 6 or not login_pwd.isalnum(
                                ):
                                    print('\033[1;35m密码至少需要六位字母或数字 \033[0m')

                                else:
                                    # 6. 对象属性赋值及保存, 保存至对应的路径
                                    super().__init__(name)
                                    self.login_pwd = hash_pwd(login_pwd)
                                    self.school_id = school.id_
                                    self.age = age
                                    self.gender = gender
                                    self.teaching_course = teaching_course
                                    self.teaching_years = teaching_years
                                    print('招聘讲师成功'.center(20, '-'))
                                    self.save()
                                    log_generate(log_type='admin',
                                                 id='admin',
                                                 message={
                                                     'type': '招收教师',
                                                     '教师姓名': name,
                                                     '性别': gender,
                                                     '教授课程': teaching_course,
                                                     '经验(年)':
                                                     int(teaching_years)
                                                 })
                                    return
Example #12
0
    def inner(**kwargs):
        global LOGIN_STATUS
        global ACCOUNT
        print('=========================')
        payment_amount = kwargs.get('payment_amount', 0)
        if LOGIN_STATUS:
            return func(account=ACCOUNT, payment_amount=payment_amount)

        print('\n'+'登录中'.center(30, '-'))
        count = 0
        while count < 3:
            credit_code = input('>>> 请输入您的信用卡卡号: ')
            # 判断输入的卡号是否开户
            if '%s.json' % credit_code not in os.listdir(DATABASE.get('path')):
                print('\033[1;35m 此信用卡账号没有开户记录 \033[0m')
                count += 1

            else:
                # 根据卡号获取用户信息文件
                f = open(DATABASE.get('path')+'/%s.json'%credit_code, 'r')
                account = json.load(f)
                card_id = account.get('card_id', '')
                ACCOUNT = account
                account_password = account.get('password')

                lock_status = account.get('lock_status')
                # 判断当前用户是否冻结
                if lock_status == 1:
                    print('\033[1;31m 对不起, 您的账户已被锁定, 请前往银行柜台解锁! \033[0m', end='\n\n')
                    logout()
                    break

                # 信用卡过期
                elif lock_status == 2:
                    choice = input('>>>\033[1;35m 对不起, 您的信用卡已被过期,是否重新办理?(y) \033[0m : ')
                    if choice == 'y' or choice == 'yes':
                        atm.create_new_accounts()

                # 正常
                elif lock_status == 0:
                    while count < 3:
                        password = input('>>> 请输入您的密码: ')
                        if password != account_password:
                            count += 1
                        else:
                            log_generate(log_type='access', card_id=card_id, message='login')
                            print('\n' + '登录成功'.center(30, '-'))

                            LOGIN_STATUS = 1
                            count = 3

                            day = datetime.date.today().day
                            expire_date_str = account.get('expire_date')
                            expire_date = datetime.datetime.strptime(expire_date_str, '%Y-%m-%d').date()

                            # 判断信用卡是否过期
                            if datetime.date.today() > expire_date:
                                account['lock_status'] = 2
                                with open(DATABASE.get('path') + '/%s.json' % credit_code, 'w') as f2:
                                    json.dump(account, f2)
                                exit('>>> \033[1;35m 对不起,您的信用卡已经过期,请重新办理\033[0m')

                            pay_day = int(account.get('pay_day'))

                            # 若当前用户信息正常则携带相关的用户信息返回
                            if datetime.date.today().day < pay_day:
                                return func(account=account, day=day, payment_amount=payment_amount)

                            print('>>> \033[1;31m 系统检测到您的信用卡已超过最迟还款期限,开始进行自动扣款 \033[0m')
                            return atm.pay_back_urgently(account=account)

                    count = 3

        # 账户冻结
        ACCOUNT['lock_status'] = 1
        card_id = ACCOUNT.get('card_id', '')
        with open(DATABASE.get('path') + '/%s.json' % card_id, 'w') as f:
            json.dump(account, f)
        exit('>>> \033[1;35m 对不起,您的密码输入次数过多,已被锁定 \033[0m')