• today


    toy_uploader

     if friend_type == "toy":
            filename = get_xxtx(to_user, from_user, "xxtx")
       RET["CODE"] = 0
        RET["MSG"] = "上传成功"
        RET["DATA"] = {
            "code":0,
            "filename": filename,
            "friend_type": "toy"
        }
            
    

    redis_chat

    def get_redis_toy(to_user, from_user):
        to_user_json = RDB.get(to_user)
        if to_user_json:
            to_user_dict = json.loads(to_user_json)
            count = to_user_dict.pop(from_user, 0)
            if count == 0:
                for k, v in to_user_dict.items():
                    if v:
                        from_user = k
                        count = v
    
            to_user_dict[from_user] = 0
    
            to_user_json = json.dumps(to_user_dict)
        else:
            to_user_json = json.dumps({from_user: 0})
            count = 0
    
        RDB.set(to_user, to_user_json)
    
        return count,from_user
    

    utils

    def get_xxtx(to_user,from_user,tx_type=None):
        friend_remark = "未知用户"
        toy_info = MDB.Toys.find_one({"_id": ObjectId(to_user)})
        toy_friend_list = toy_info.get("friend_list")
        for friend in toy_friend_list:
            if friend.get("friend_id") == from_user:
                friend_remark = friend.get("friend_remark")
                friend_type = friend.get("friend_type")
    
        if tx_type == "xxtx":
            wenjianming = text2audio(f"你有来自{friend_remark}的消息")
            return wenjianming
        else:
            wenjianming = text2audio(f"以下是来自{friend_remark}的消息")
            return wenjianming,friend_type
    
    
  • 相关阅读:
    C# 系统应用之通过注册表获取USB使用记录(一)
    web项目测试方法总结
    C#面向对象编程实例-猜拳游戏
    c#基础这些你都看过吗?(一)-----仅供初学者使用
    .NET事件监听机制的局限与扩展
    SQL代码
    泛型接口委托
    存储过程
    小操作
    DataGridView
  • 原文地址:https://www.cnblogs.com/Doner/p/11251725.html
Copyright © 2020-2023  润新知