栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python基础——外卖管理系统和闭组会议总结

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python基础——外卖管理系统和闭组会议总结

外卖管理系统和闭组会议总结
  • 外卖管理系统
    • 用户、管理员、菜单
      • 菜单
      • 用户
        • 1.注册
        • 2.登录
        • 3.修改密码
        • 4.增加订单
        • 5.查找订单信息
        • 6.修改订单
        • 7.充值
        • 8.注销用户
      • 管理员
        • 1.修改用户密码
        • 2.增加订单信息
        • 3.查找订单信息
        • 4.删除订单信息
        • 5.修改订单信息
        • 6.注销用户
  • 闭组会议总结

外卖管理系统 用户、管理员、菜单 菜单
def main():
    option = input("用户请按1n管理员请按2n")
    if option == "1":
        menu1()
    if option == "2":
        menu2()
def menu1():
    global ID
    login = False
    while True:
        print(menu(login))
        try:
            choice = int(input("请输入:"))
            if choice in [0, 1, 2, 3, 4, 5, 6, 7, 8]:
                if choice == 0:
                    answer = input("您确定退出系统吗?y/n:")
                    if answer == "y":
                        print("感谢您的使用")
                        break
                if choice == 1:
                    register()
                elif choice == 2:
                    result = post()
                    login = result[0]
                    ID = result[1]
                if login:
                    if choice == 3:
                        modify_passwd(ID)
                    elif choice == 4:
                        insert(ID)
                    elif choice == 5:
                        search(ID)
                    elif choice == 6:
                        modify_num(ID)
                    elif choice == 7:
                        addmoney(ID)
                    elif choice == 8:
                        delete(ID)
            else:
                print("输入有误,请重新输入")
        except:
            print("输入有误,请重新输入")
def menu2():
    a = input("请输入管理员名称:")
    b = input("请输入密码:")
    if a == "kk" and b == "kkk":
        print("管理员登录成功")
    else:
        print("输入错误,请重新输入")
        return menu2()
    while True:
        print(menu_())
        choice = int(input("请输入:"))
        if choice in [0, 1, 2, 3, 4, 5, 6]:
            if choice == 0:
                answer = input("您确定退出系统吗?y/n:")
                if answer == "y":
                    print("感谢您的使用")
                    break
            if choice == 1:
                modify_passwd_()
            elif choice == 2:
                insert_()
            elif choice == 3:
                search_()
            elif choice == 4:
                delete_()
            elif choice == 5:
                modify_num2()
            elif choice == 6:
                delete2()
        else:
            print("输入有误")
def menu(login):
    if login:
        w = """
                  ====================================================外卖管理系统=====================================================
                  -------------------------------------------------功能选择-----------------------------------------------------------
                 tttt0.是否继续使用系统
                 tttt1.注册
                 tttt2.登录
                 tttt3.修改密码
                 tttt4.增加订单信息
                 tttt5.查找订单信息
                 tttt6.修改订单信息
                 tttt7.充值
                 tttt8.注销用户
                 --------------------------------------------------------------------------------------------------------------------
                 ====================================================================================================================
             """
        return w
    else:
        w = """
                    ====================================================外卖管理系统=====================================================
                    -------------------------------------------------功能选择-----------------------------------------------------------
                   tttt0.是否继续使用系统
                   tttt1.注册
                   tttt2.登录
                   --------------------------------------------------------------------------------------------------------------------
                   ====================================================================================================================
                   """
        return w
def menu_():
    ww = """
                  ====================================================外卖管理系统=====================================================
                  -------------------------------------------------功能选择-----------------------------------------------------------
                 tttt0.是否继续使用系统
                 tttt1.修改用户密码
                 tttt2.增加订单信息
                 tttt3.查找订单信息
                 tttt4.删除订单信息
                 tttt5.修改订单信息
                 tttt6.注销用户
                 --------------------------------------------------------------------------------------------------------------------
                 ====================================================================================================================
             """
    return ww

调用函数

if __name__ == '__main__':
    main()
用户 1.注册
def register():
    while True:
        ID = input("请输入用户名:")
        with open('users.txt', 'r', encoding='utf-8') as file_obj:
            fi = file_obj.readlines()
        u = False
        for item in fi:
            d = dict(eval(item))
            if d['ID'] == ID:
                u = True
                print("此用户名已被注册。请重新注册")
                break
        if u:
            continue
        password = input("请输入密码:")
        password_ = input("请确认密码:")
        if not ID or not password or not password_:
            print("用户名或密码不能为空")
            continue
        if password != password_:
            print("两次输入密码不一致,请重新输入")
            continue
        u = {"ID": ID, 'data': {'password': password, 'account': 0}}
        if password == password_:
            with open('users.txt', 'a+', encoding='utf-8') as file_obj:
                file_obj.write(str(u) + "n")
            print("注册成功,请确认登录")
            login = False
            return menu(login)
2.登录
def post():
    while True:
        ID = input("请输入用户名:")
        password = input("请输入密码:")
        with open("users.txt", "r", encoding="utf-8") as fp:
            m = fp.readlines()
            try:
                for i in m:
                    f = dict(eval(i))
                    if ID == f['ID'] and password == f['data']['password']:
                        print("登录成功")
                        global name
                        name = ID
                        return True, name
                print('用户名或者密码错误,请确认用户名及密码无误后重新尝试,请重新输入')
                c = input("    1.重新登录n    2.注册账户n")
                if c == '1':
                    pass
                elif c == "2":
                    register()
                    return False
                else:
                    print('输入错误')
            except:
                print("该用户不存在,请重新输入")

3.修改密码
def modify_passwd(ID):
    lst = []
    with open("users.txt", "r", encoding="utf-8") as file:
        k = file.readlines()
        for i in k:
            lst.append(dict(eval(i)))
    while True:
        password_new = input("请输入您的新密码:")
        password_new_ = input("请确认您的新密码:")
        if password_new == password_new_:
            break
        else:
            print("两次密码不一样")
    for user in lst:
        if user["ID"] == ID:
            user['data']['password'] = password_new
    with open("users.txt", "w+", encoding="utf-8") as file:
        for i in lst:
            file.write(str(i) + "n")
    print("修改成功")
4.增加订单
import random
def insert(ID):
    while True:
        with open('nums.txt', 'r', encoding='utf-8') as file_obj:
            fi = file_obj.readlines()

        for item in fi:
            d = dict(eval(item))
            if d['ID'] == ID:

                print("此用户名订单已存在。")
                return

        num = random.randint(0, 99999)
        tel = str(input("请输入手机号码:"))
        address = str(input("请输入收货地址:"))
        m = {"ID": ID, 'data': {'num': num, 'tel': tel, 'address': address}}
        print("成功添加信息")
        with open('nums.txt', 'a+', encoding='utf-8') as file_obj:
            file_obj.write(str(m) + "n")
            return menu_()

5.查找订单信息
def search(ID):
    while True:
        x = 0
        with open("users.txt", "r", encoding="utf-8") as fp:
            m = fp.readlines()
            for i in m:
                f = dict(eval(i))
                if ID == f['ID']:
                    a = f['ID']
                    b = f['data']['account']
                    x = 0
                    break
                else:
                    x += 1
            if x != 0:
                print("未找到该用户,请重新输入")
                break

            y = 0
            with open("nums.txt", "r", encoding="utf-8") as fo:
                h = fo.readlines()
                for g in h:
                    q = dict(eval(g))
                    if ID == q['ID']:
                        c = q['data']['num']
                        d = q['data']['tel']
                        e = q['data']['address']
                        print(f"用户名:{a},账户:{b}元,订单号:{c},电话:{d},收货地址:{e}")
                        y = 0
                        return
                    else:
                        y += 1

                if y != 0:
                    print("未找到该用户的订单信息,请重新输入")
                    break

6.修改订单
def modify_num(ID):
    while True:
        with open("nums.txt", "r", encoding="utf-8") as file:
            a = 0
            lst3 = []
            uu = file.readlines()
            for yy in uu:
                n = dict(eval(yy))
                lst3.append(n)
                if n['ID'] == ID:
                    a = 0
                    break
                else:
                    a += 1
            if a != 0:
                print("没有找到该用户的订单信息,请重新输入")

                return
            cc = input("请选择:n1.修改手机号n2.修改收货地址n3.退出修改n")
            if cc == "1":
                while True:
                    tel_new = input("请输入新的手机号:")
                    tel_new_ = input("请确认新的手机号:")
                    if tel_new == tel_new_:
                        break
                    else:
                        print("两次手机号输入不一致,请重新输入")
                for user in lst3:
                    if user["ID"] == name:
                        user['data']['tel'] = tel_new
                with open("nums.txt", "w+", encoding="utf-8") as file:
                    for uu in lst3:
                        file.write(str(uu) + "n")
                print("手机号修改成功")
            if cc == "2":
                while True:
                    tel_new = input("请输入新的收货地址:")
                    tel_new_ = input("请确认新的收货地址:")
                    if tel_new == tel_new_:
                        break
                    else:
                        print("两次收货地址输入不一致,请重新输入")
                for user in lst3:
                    if user["ID"] == name:
                        user['data']['tel'] = tel_new
                with open("nums.txt", "w+", encoding="utf-8") as file:
                    for uu in lst3:
                        file.write(str(uu) + "n")
                print("收货地址修改成功")
            if cc == "3":
                login = False
                return login

7.充值
def addmoney(ID):
    lst2 = []
    kk = int(input("请输入要充值的金额:"))
    with open("users.txt", "r", encoding="utf-8") as file:
        kkk = file.readlines()
        for ii in kkk:
            lst2.append(dict(eval(ii)))
    for user in lst2:
        if user["ID"] == name:
            a = int(user['data']['account'])
            a += kk
            user['data']['account'] = a
    with open("users.txt", "w+", encoding="utf-8") as file:
        for ii in lst2:
            file.write(str(ii) + "n")
    print("充值成功")
8.注销用户
def delete(ID):
    while True:
        with open("users.txt", 'r', encoding='utf-8') as fr:
            user_old = fr.readlines()
            user_new = []
            for item in user_old:
                d = dict(eval(item))
                if ID == d['ID']:
                    break
                else:
                    user_new.append(d)
            with open("users.txt", 'w+', encoding='utf-8') as fra:
                for item in user_new:
                    fra.write(str(item) + 'n')
            break
    while True:
        with open("nums.txt", 'r', encoding='utf-8') as frb:
            user_old = frb.readlines()
            user_new = []
            for item in user_old:
                d = dict(eval(item))
                if ID == d['ID']:
                    break
                else:
                    user_new.append(d)
            with open("nums.txt", 'w+', encoding='utf-8') as frb:
                for item in user_new:
                    print(f"ID为{ID}的用户信息已经删除!")
                    frb.write(str(item) + 'n')
            break
管理员 1.修改用户密码
def modify_passwd_():
    a = 0
    pp = input("请输入要修改信息的用户名:")
    lst1 = []
    with open("users.txt", "r", encoding="utf-8") as file:
        ki = file.readlines()
        for i in ki:
            bb = dict(eval(i))
            lst1.append(bb)
        for j in lst1:
            if j['ID'] == pp:
                a = 0
                break
            else:
                a += 1
        if a == 0:
            while True:
                password_new = input("请输入新密码:")
                password_new_ = input("请确认新密码:")
                if password_new == password_new_:
                    break
                else:
                    print("两次密码不一样")
        else:
            print("未查找到该用户,请重新输入")
            return modify_passwd_()
        for users in lst1:
            if users["ID"] == pp:
                users['data']['password'] = password_new
                with open("users.txt", "w+", encoding="utf-8") as file:
                    for i in lst1:
                        file.write(str(i) + "n")
                print("修改成功")
2.增加订单信息
def insert_():
    while True:
        ID = input("请输入用户名:")
        t = 0
        with open('users.txt', 'r', encoding='utf-8') as file_obj:
            fi = file_obj.readlines()
        for item in fi:
            d = dict(eval(item))
            if d['ID'] == ID:
                t = 0
                break
            else:
                t += 1
        if t != 0:
            print("此用户名未注册,请先注册")
            return

        num = random.randint(1,10000)
        tel = str(input("请输入手机号码:"))
        address = str(input("请输入收货地址:"))
        mn = {"ID": ID, 'data': {'num': num, 'tel': tel, 'address': address}}
        print("成功添加信息")
        with open('nums.txt', 'a+', encoding='utf-8') as file_obj:
            file_obj.write(str(mn) + "n")
            return menu_()
3.查找订单信息
def search_():
    while True:
        ID = input("请输入用户名:")
        x = 0
        with open("users.txt", "r", encoding="utf-8") as fp:
            m = fp.readlines()
            for i in m:
                f = dict(eval(i))
                if ID == f['ID']:
                    a = f['ID']
                    b = f['data']['account']
                    x = 0
                    break
                else:
                    x += 1
            if x != 0:
                print("未找到该用户,请进行注册")
                break

            y = 0
            with open("nums.txt", "r", encoding="utf-8") as fo:
                h = fo.readlines()
                for g in h:
                    q = dict(eval(g))
                    if ID == q['ID']:
                        c = q['data']['num']
                        d = q['data']['tel']
                        e = q['data']['address']
                        print(f"用户名:{a},账户:{b}元,订单号:{c},电话:{d},收货地址:{e}")
                        y = 0
                        return
                    else:
                        y += 1

                if y != 0:
                    print("未找到该用户的订单信息,请重新输入")
                    break
4.删除订单信息
def delete_():
    while True:
        ID = input("请输入要删除订单信息的用户名:")
        t = 0
        with open("nums.txt", 'r', encoding='utf-8') as fr:
            user_old_ = fr.readlines()
            for items in user_old_:
                d = dict(eval(items))
                if ID == d['ID']:
                    t = 0
                    break
                else:
                    t += 1
            if t != 0:
                print("未找到该用户,请重新输入")
                break
            user_new = []
            for items in user_old_:
                d = dict(eval(items))
                if ID == d['ID']:
                    print(f"ID为{ID}的用户信息已经删除!")
                    continue
                else:
                    user_new.append(d)
            with open("nums.txt", 'w+', encoding='utf-8') as frs:
                for item in user_new:
                    frs.write(str(item) + 'n')
            break
5.修改订单信息
def modify_num2():
    while True:
        ID = input("请输入要修改信息的用户名:")
        t = 0
        lst4 = []
        with open("nums.txt", "r", encoding="utf-8") as file:
            uu = file.readlines()
            for yy in uu:
                h = dict(eval(yy))
                lst4.append(h)
                if ID == h['ID']:
                    t = 0
                    break
                else:
                    t += 1
            if t != 0:
                print("未找到该用户的订单信息,请重新输入")
                break
            else:
                cc = input("请选择:n1.修改手机号n2.修改收货地址n")
            if cc == "1":
                while True:
                    tel_new = input("请输入新的手机号:")
                    tel_new_ = input("请确认新的手机号:")
                    if tel_new == tel_new_:
                        break
                    else:
                        print("两次手机号输入不一致,请重新输入")
                for user in lst4:
                    if user["ID"] == ID:
                        user['data']['tel'] = tel_new
                with open("nums.txt", "w+", encoding="utf-8") as file:
                    for uu in lst4:
                        file.write(str(uu) + "n")
                print("手机号修改成功")
                break
            if cc == "2":
                while True:
                    tel_new = input("请输入新的收货地址:")
                    tel_new_ = input("请确认新的收货地址:")
                    if tel_new == tel_new_:
                        break
                    else:
                        print("两次收货地址输入不一致,请重新输入")
                for user in lst4:
                    if user["ID"] == ID:
                        user['data']['tel'] = tel_new
                with open("nums.txt", "w+", encoding="utf-8") as file:
                    for uu in lst4:
                        file.write(str(uu) + "n")
                print("收货地址修改成功")
                break
6.注销用户
def delete2():
    while True:
        ID = input("请输入想要删除的用户:")
        t = 0
        with open("users.txt", 'r', encoding='utf-8') as fr:
            user_old_ = fr.readlines()
            for items in user_old_:
                d = dict(eval(items))
                if ID == d['ID']:
                    t = 0
                    break
                else:
                    t += 1
            if t != 0:
                print("未找到该用户,请重新输入")
                continue
            user_new = []
        for items in user_old_:
            d = dict(eval(items))
            if ID == d['ID']:
                print(f"ID为{ID}的用户信息已经删除!")
                continue
            else:
                user_new.append(d)
        with open("users.txt", 'w+', encoding='utf-8') as frs:
            for item in user_new:
                frs.write(str(item) + 'n')
        break
    while True:
        with open("nums.txt", 'r', encoding='utf-8') as frb:
            user_old = frb.readlines()
            user_new = []
            for item in user_old:
                d = dict(eval(item))
                if ID == d['ID']:
                    break
                else:
                    user_new.append(d)
            with open("nums.txt", 'w+', encoding='utf-8') as frb:
                for item in user_new:
                    frb.write(str(item) + 'n')
            print(f"ID为{ID}的订单信息已经删除!")
            break
闭组会议总结

今天下午小组举行了闭组会议。先是由两位优秀的正在实习的学姐讲述了她们的实习经历,然后是大家的提问环节,最后是每个方向的负责人总结上学期的学习情况。
通过认真听两位学姐分享自己的实习经历,我受益匪浅。因为无论我们将来是选择考研还是就业,到最后都会去找工作的。两位学姐都提出我们要从大一开始练习算法题,力扣的每日一题就是不错的选择。学姐的建议是先独立思考半个小时,如果半个小时后还没有思路,就可以查看题解。通过对题解的认真研究,学会一道题的多种解法。
我们学校的知名度不够,既不是985、211,也不是“双一流”,因此我们更要提升自己的能力,才能在以后的求职中脱颖而出。在求职过程中,要多投简历,“海投”。在我们投简历时,要在简历中突出自己的能力和自己的成果。这就需要我们平时在小组多做项目,才不至于在以后让自己的简历是一片空白。而且多做项目能让我们复习巩固前一阶段所学知识。不过项目看的不止是数量,更重要的是它的质量。学姐还说到要早日去找实习工作,以便自己能够学到更多东西,积累经验。我们的博客也要坚持写,这在以后都是加分项。
想要学好我们这个专业,高数也是必不可少的。
在各个方向负责人总结时,学长说道,我们的成果并不明显。我觉得这是因为我们还没有找到属于自己的方向,找到自己的方向是非常重要的。“如果没有目标地前进,那么任何方向的风都是逆风。”
虽然小组闭组后,对我们的学习时间要求的没有那么严格了,但是我们也要抓紧学习,复习考试科目,不能松懈自己的学习。期待能够成为更好的自己。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/655897.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号