python3 - emulate ATM_shopping

1. readme

1. Function description
Environment: python3
Function: Simulate functions such as bank ATM and shopping mall!
Purpose: study
Note: If you develop and run under Windows and then port to Linux, you need to delete the cache directory (__pycache__) in each directory.
Second, the directory structure
atm_shopping
|-- bank#ATM program
| |-- bin# program entry
| | |-- atm_bank.py#ATM backend
|   |   |-- atm.py#ATM
|   |   `-- __init__.py
| |-- func# function function
|   |   |-- function.py
|   |   |-- function.pyc
|   |   |-- __init__.py
|   |   |-- __init__.pyc
|   |   |-- logger.py
|   |   `-- logger.pyc
|   |-- __init__.py
|   |-- __init__.pyc
| |-- log user log
|   |   `-- __init__.py
| |-- user_data#User account information
| | |-- 123.pkl
|   |   `-- __init__.py
| `-- user_login#ATM login authentication
|       |-- __init__.py
|       |-- __init__.pyc
|       |-- login.py
|       `-- login.pyc
|-- __init__.py
`-- shopping# shopping program
    |-- bin#Program entry
    | |-- goods_put_or_off.py#goods on and off the shelf
    |   |-- __init__.py
    | |-- shopping.py#shopping
    | `-- user_set.py#Account settings
    |-- func
    | |-- function.py#Function function
    |   `-- __init__.py
    |-- goods#
    | |-- goods.pkl#goods
    |   `-- __init__.py
    |-- __init__.py
    |-- log
    |   |-- __init__.py
    | `-- shopping_log.txt# Shopping log
    `-- user_login
        |-- login.py#Shopping login authentication
        |-- user_create.py
        |-- user_info_all.bak
        |-- user_info_all.dat
        `-- user_info_all.dir

3. Use cases
1), bank account opening
C:\Python36\python3.exe F:/PyCharm/script/atm_shopping/bank/bin/atm_bank.py

        1: Open an account
        2: Unlock or freeze the account
        3: Exit
        
Please select: 1
----Begin to open an account, please enter as prompted---
Please enter the account number: 123456
Please enter your name: Azalea
Please enter the ID number: 332226199202011020
Please enter the amount: 10000
Please enter the account status, the default is unlock, (Enter):
Please enter the password: 123456
Successful account opening: name [Azalea], account number [123456], quota [10000]

        1: Open an account
        2: Unlock or freeze the account
        3: Exit
        
Please select: 3

Process finished with exit code 0
2), ATM login
C:\Python36\python3.exe F:/PyCharm/script/atm_shopping/bank/bin/atm.py
---Login Authentication---
Please enter the account number: 123456
{'account': '123456', 'password': '123456', 'time': 3, 'money': 10000, 'name': '映山红', 'identified': '332226199202011020',

'status': 'unlock', 'edu': 10000}
Please enter the password: 123456
Welcome to log in

1: Inquiry 2: Withdrawal
3: Transfer 4: Repayment
5: Change password 6: Exit

please choose:
3) Shopping mall user creation
C:\Python36\python3.exe F:/PyCharm/script/atm_shopping/shopping/bin/user_set.py

        1: Create a user
        2: delete user
        3: Reset password
        4: Reset the lock state
        5: View user information
        6: Exit
        
Please select: 1
Please enter username (exit: exit): 12345
Please enter the password: 12345
Please enter your username (exit: exit): exit
4), the product is on the shelf
C:\Python36\python3.exe F:/PyCharm/script/atm_shopping/shopping/bin/goods_put_or_off.py
--Commodity on the shelf--
Please enter the product name (exit: exit): Durian
Please enter product price: 60
Please enter the product name (exit: exit): apple
Please enter product price: 15
Please enter the product name (exit: exit): exit
5), shopping
C:\Python36\python3.exe F:/PyCharm/script/atm_shopping/shopping/bin/shopping.py
Please enter username: 123456
The username does not exist. Please enter again
Please enter username: 12345
Please enter the password: 12345
Welcome to log in
No. Name Price
-------------------
1 Durian 60
2 apples 15
please choose:
    1: Shopping
    2: Return the product
    3: Payment
    4: Shopping List
    5: Exit
Please select: 1
Please select the item number to purchase: 1
You have selected: Durian Price: 60
No. Name Price
-------------------
1 Durian 60
2 apples 15
please choose:
    1: Shopping
    2: Return the product
    3: Payment
    4: Shopping List
    5: Exit
Please select: 1
Please select the item number to purchase: 2
You have chosen: Apple Price is: 15
No. Name Price
-------------------
1 Durian 60
2 apples 15
please choose:
    1: Shopping
    2: Return the product
    3: Payment
    4: Shopping List
    5: Exit
Please select: 4
Purchased item list:
No. Name Price
-------------------
1 Durian 60
2 apples 15
No. Name Price
-------------------
1 Durian 60
2 apples 15
please choose:
    1: Shopping
    2: Return the product
    3: Payment
    4: Shopping List
    5: Exit
Please select: 3
--Bank card account login--
Please enter the account number: 123
Please enter the password: 123
Welcome to log in
Payables:[75]
Please enter the account number of the transferee: 123456
Please enter the transfer amount: 75
Successfully transferred [75] yuan to the account [123456]!
successful payment
No. Name Price
-------------------
1 Durian 60
2 apples 15
please choose:
    1: Shopping
    2: Return the product
    3: Payment
    4: Shopping List
    5: Exit
Please select: 5
welcome next visit

Process finished with exit code 0
6), log view
F:\PyCharm\script\atm_shopping\bank\log\atm_log.txt

2018-05-03 16:52:51 user: root process_id:14244 modual:logger.py line:19 level:INFO message: Successful account opening: Name[Azalea], Account[123456], Quota[10000]
2018-05-03 16:54:11 user: root process_id:13460 modual:logger.py line:19 level:INFO message:Bank card account [123456] Login successful
2018-05-03 16:54:19 user: root process_id:13460 modual:logger.py line:19 level:INFO message:user[123456] query
2018-05-03 17:01:59 user: root process_id:6444 modual:logger.py line:19 level:INFO message:Bank card account [123] Login successful
2018-05-03 17:02:11 user: root process_id:6444 modual:logger.py line:19 level:INFO message:Account[123] transferred to account[123456][75]yuan
2018-05-03 17:02:11 user: root process_id:6444 modual:logger.py line:19 level:INFO message:Account [123456] received account [123] transfer [75] yuan
2018-05-03 17:02:15 user: root process_id:6444 modual:logger.py line:19 level:INFO message: Account [123] exited successfully

F:\PyCharm\script\atm_shopping\shopping\log\shopping_log.txt
User: 12345 Product: Durian Price: 60 Time: 2018-05-03 17:02:11
User: 12345 Product: Apple Price: 15 Time: 2018-05-03 17:02:11

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325332671&siteId=291194637