Example #1
0
def bill():
    f = open("../conf/Current_login_account.txt", "r")  # 拿到当前登录的用户名字
    account_name = f.read()
    f.close()
    The_path = BASE_DIR + "/logger/" + account_name + ".log"
    f = open(The_path, "r")
    data = f.read()
    f.close()
    end1 = """
    ========================================================
    
    hello,
    Thank you for using the billing inquiry service,
    For bill inquiry, please enter "Y",
    To return to the main menu, please enter "Q"
    
    =========================================================
    """
    print(end1)
    USinput = input(">>>").strip()
    end2 = """
=============================================================
Here is your transaction bill:

"""
    if USinput == "Y":
        print(end2)
        print(data)
        end3 = """
=============================================================

Thank you for using the billing inquiry service,     
To return to the main menu, enter "T",
To exit, enter Q

=============================================================   
        """
        print(end3)
        choose = input(">>>").strip()
        if choose == "T":
            The_main_interface.Feature_selection()
        if choose == "Q":
            print(
                "Thank you for using ICBC,\nWe will make better optimization for you and wish you a happy life!"
            )
            exit()

    if USinput == "Q":
        The_main_interface.Feature_selection()

    elif USinput != "Y" and USinput != "Q":
        print("Your input is not compliant, please re-enter!")
        bill()
Example #2
0
def logged_in():
    global USaccount, USpassword
    USaccount = input("Please enter your account number:\n>>>")  #输入账号
    USpassword = input("Please enter your login password:\n>>>")  #密码
    f = open('../conf/Account information.txt')
    data = json.loads(f.read())
    if USaccount in data:
        if data[USaccount]["1"] == USpassword:
            f = open("../conf/logging status.txt", "w")
            logging_status = "logged in"
            f.write(logging_status)
            f.close()
            f = open("../conf/Current_login_account.txt", "w")
            f.write(USaccount)
            f.close()
            print("Login successful, jump to the previous screen for you..."
                  )  #登录成功,正在为你返回之前的界面……
            The_main_interface.Feature_selection()
        elif data[USaccount]["1"] != USpassword:
            print(
                "The account name or password is incorrect, please re-enter!")
            logged_in()

    elif USaccount not in data:
        print("The account name or password is incorrect, please re-enter!")
        logger()
Example #3
0
def deposit():  # 存钱函数
    global cash
    cash = input("How much would you like to deposit?")  # 存钱
    print("Please put in your cash...")
    select = input("Please enter Y after the banknote is finished."
                   "If you want to cancel, please press Q.\n>>>").strip(
                   )  # 放入钞票后输入Y,取消输入Q
    if select == "Y":  # 放钞完毕
        print("Just a moment, please. We are checking your bill...")  # 正在检测钞票
        loading()
        logger = Check_bank_card_statement.get_logger()
        logger.critical(
            "Deposit successfully!Your balance is %s $+%s $Amount" %
            (cash, Amount))
        print("\nDeposit successfully!Your balance is %s $+%s $Amount" %
              (cash, Amount))  # 存款成功,你的余额是
        Deposit_function()
    if select == "Q":
        print(
            "If you do not deposit money into your account,"
            "the default credit card limit is 10000.When you need to deposit,"
            " you can open the deposit function to operate."
        )  # 不存钱的话信用卡默认额度10000
        cash = 0
        Deposit_function()
        The_main_interface.Feature_selection()
    else:
        print("请输入指定信息!")
        deposit()
Example #4
0
def Deposit_function():
    if os.path.getsize("../conf/Account information.txt") != 0:  #如果文件不为空就打开文件
        f = open("../conf/Account information.txt", "r")  #把里面的信息取出来
        USinfo = json.loads(f.read())
        f.close()
        USinfo[USaccount] = {
            "0": name,
            "1": USpassword,
            "2": payment_code,
            "3": cash,
            "4": Amount
        }
        f = open("../conf/Account information.txt", "w")
        data = json.dumps(USinfo)
        f.write(data)  # 账户:0:名字,1:登录密码 2:支付密码 3:余额 4:额度
        f.close()
        print(
            "You have successfully registered, is jumping to the login screen for you..."
        )
        logged_in()
        The_main_interface.Feature_selection()
    elif os.path.getsize("../conf/Account information.txt") == 0:  #如果文件为空
        f = open("../conf/Account information.txt", "w")
        USinfo = {
            USaccount: {
                0: name,
                1: USpassword,
                2: payment_code,
                3: cash,
                4: Amount,
                5: "normal"
            }
        }
        data = json.dumps(USinfo)
        f.write(data)  # 账户:0:名字,1:登录密码 2:支付密码 3:余额 4:额度
        f.close()
        print(
            "You have successfully registered, is jumping to the login screen for you..."
        )
        logged_in()
        The_main_interface.Feature_selection()
Example #5
0
def Input_selection():
    select = input(
        "Thank you for using the Query Balance feature."
        "Press T to return to the main menu, press Q to exit\n>>>").strip()
    if select == "T":
        The_main_interface.Feature_selection()

    if select == "Q":
        exit(
            "Thank you for using ICBC,"
            "We will make better optimization for you and wish you a happy life!"
        )
    elif select != "Q" and select != "T":
        print("Your input is not recognized, please re-enter!")
        Input_selection()
Example #6
0
def Shopping():
    end1 = """
=========================================================== 
   
Welcome to shopping mall function,
We offer you the following kinds of goods:
1.Fresh fruit(水果生鲜)
2.Intelligent technology products(科技产品)
3.snacks(零食)
……More varieties are being added……

For more information,
please enter the number before the product category.
To return to the main menu, enter T,
To exit the program, enter Q.
===========================================================  
    """
    f = open("../conf/list.py", "r", encoding="utf-8")
    global data
    data = eval(f.read())
    f.close()

    print(end1)
    global choose
    choose = input(">>>")

    if choose == "1":
        data = data["1"]
        style()

    if choose == "2":
        data = data["2"]
        style()
    if choose == "3":
        data = data["3"]
        style()

    if choose == "T":
        The_main_interface.Feature_selection()

    if choose == "Q":
        exit(
            "Thank you for using ICBC,\nWe will make better optimization for you and wish you a happy life!"
        )

    elif choose != "1" and choose != "2" and choose != "3":
        print("Please enter the corresponding serial number!")
        Shopping()
Example #7
0
def deposit():
    f = open("../conf/Current_login_account.txt", "r")
    account_number = f.read()
    f.close()
    f = open('../conf/Account information.txt',"r")
    data = json.loads(f.read())
    f.close()
    name = data[account_number]["0"]
    Balance = data[account_number]["3"]
    Credit_card_limit = data[account_number]["4"]
    Formatted_query_balance = """
        ========================================================

        Hello,%s,
        Your balance is:%s
        Your credit card limit is:%s

        ========================================================
        """ % (name, Balance, Credit_card_limit)
    print(Formatted_query_balance)
    select=input("Do you want to deposit? Confirm, press Y, cancel, press Q\n>>>").strip()
    if select=="Y":
        Save_money=input("How much would you like to deposit?\n>>>").strip()
        if Save_money.isdigit()==True:
            print("Please put in your cash...") #请放入现金
            select = input("Please enter Y after the banknote is finished.\n>>>").strip()  # 放入钞票后输入Y,取消输入Q
            if select == "Y":  # 放钞完毕
                print("Just a moment, please. We are checking your bill...")  # 正在检测钞票
                loading()
                Balance=int(Balance)
                Save_money=int(Save_money)
                Balance=Balance+Save_money
                f = open("../conf/Account information.txt", "r")
                USinfo = json.loads(f.read())
                f.close()
                f = open("../conf/Account information.txt", "w")
                USinfo[account_number]["3"] = Balance
                data = json.dumps(USinfo)
                f.write(data)
                f.close()
                logger = Check_bank_card_statement.get_logger()
                logger.critical("\nDeposit successfully!Your balance is %s + %s Amount"% (Balance, Credit_card_limit))  # 存款成功,你的余额是")
                print("\nDeposit successfully!Your balance is %s + %s Amount"% (Balance, Credit_card_limit))  # 存款成功,你的余额是
                select=input("Press Y to return to the main menu, or press Q to exit the program.\n>>>").strip()
                if select=="Y":
                    The_main_interface.Feature_selection()
                if select=="Q":
                    exit("Thank you for using ICBC,"
                        "We will make better optimization for you and wish you a happy life!")
                elif select != "Y" and select != "Q" :
                    print("Your input is not compliant, please operate again!")
                    deposit()

            elif select !="Y":
                print("Your input is not compliant, please operate again!")
                deposit()


        elif Save_money.isdigit()==False:
            print("You can only enter a numeric amount!")
            deposit()

    if select=="Q":
            print("Your operation has been canceled and is jumping for you, please wait...")
            The_main_interface.Feature_selection

    elif select!="Q" and select!="Y":
        print("Your input is not compliant, please re-enter!")
        deposit()
Example #8
0
def transfer():
    print("Welcome to use the ICBC transfer function.")
    select = input(
        "To transfer the input Y,\nreturn to the main menu and enter Q!\n>>>"
    ).strip()
    if select == "Y":
        USaccount = input("Please enter your account number:\n>>>")  #账号
        payment_code = input(
            "Please enter your payment password:\n>>>")  # 支付密码
        f = open('../conf/Current_login_account.txt')
        data = f.read()
        f.close()
        if USaccount == data:  #判断登录账号和输入的账号是否一致
            f = open("../conf/Account information.txt", "r")  # 把里面的信息取出来
            USinfo = json.loads(f.read())
            f.close()
            if USinfo[USaccount]["2"] == payment_code:  #判断账号和支付密码是否对应
                global Account_to_transfer
                Account_to_transfer = input(
                    "Please enter the account you want to transfer:").strip(
                    )  #要转钱的账号
                difference = int(
                    input(
                        "Please enter the money you want to transfer to the other party:"
                    ).strip())  #要转多少钱
                Account_Balance = int(USinfo[USaccount]["3"])
                if Account_Balance >= difference:  #判断账户上钱够不够 (账户余额大于等于你要转的钱)
                    print(
                        "Account:%s,\nDo you want to transfer money to:%s,\n%s RMB?\n"
                        % (USaccount, Account_to_transfer, difference))
                    select = input(
                        "If you confirm, please enter Y, cancel please enter Q\n>>>"
                    ).strip()
                    if select == "Y":  #如果确定:判断账号是否存在!如果存在,就扣钱!给对方加钱!
                        if Account_to_transfer in USinfo.keys():  #如果对方的账号存在:
                            Account_Balance = Account_Balance - difference  #你账户的余额减去你要转的钱=你现在的余额
                            OTHAccount_Balance = int(
                                USinfo[Account_to_transfer]["3"])  #要转账账号的余额
                            OTHAccount_Balance = OTHAccount_Balance + difference  #你朋友的账户余额=她原本的余额+你转给她的钱
                            USinfo[USaccount]["3"] = Account_Balance  #修改你账号的余额
                            USinfo[Account_to_transfer][
                                "3"] = OTHAccount_Balance  #修改你朋友账号的余额
                            f = open("../conf/Account information.txt",
                                     "w")  # 把里面的信息取出来
                            USinfo = json.dumps(USinfo)
                            f.write(USinfo)
                            f.close()
                            loading()
                            logger = Check_bank_card_statement.get_logger()
                            logger.critical(
                                "The transfer to:%s was successful.Operating transfer amount:%s,Your current balance is:%s Yuan."
                                % (Account_to_transfer, difference,
                                   Account_Balance))
                            print(
                                "\nThe transfer was successful.money will arrive soon!"
                            )
                            transfer()
                        elif Account_to_transfer not in USinfo.keys():
                            print(
                                "The account you want to transfer does not exist,\n please check it before proceeding!"
                            )
                            transfer()

                    if select == "Q":  #取消转账
                        print(
                            "I have cancelled the transfer operation for you and returned to the main menu,\n thank you for your use!"
                        )
                        transfer()
                if Account_Balance < difference:  # 账户余额小于你要转的钱
                    print("Insufficient balance, please re-operate!")
                    transfer()

            elif USinfo[USaccount]["2"] != payment_code:  #支付密码错误
                print(
                    "The payment password is incorrect, please re-enter!\nPlease note: you need to enter the payment password instead of the login password!"
                )
                transfer()
        elif USaccount != data:
            print(
                "The account you entered does not match the account you are logged in to, please re-enter!"
            )
            transfer()

    if select == "Q":
        print("Jumping interface for you, please wait...")
        The_main_interface.Feature_selection()

    elif select != "Q" and select != "Y":
        print("Please enter the standard options!")
        transfer()
Example #9
0
#_author:无言宝宝
#date:  2019/8/5

import os
import sys

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from mudule import The_main_interface

The_main_interface.Feature_selection()