• 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
    
    
  • 相关阅读:
    安装 android sdk 时,dl.google.com 连不上各种尝试
    解决android SDK 安装过程中 packages 列表为空的问题
    Java 集合 -- Deque
    Java 集合 -- Queue
    Java 集合 -- Set
    Java 集合 -- Map
    Java 集合 -- List
    Java 语言进阶 -- 线程
    Java 语言基础知识
    Java 网络编程基础 -- TCP 编程
  • 原文地址:https://www.cnblogs.com/Doner/p/11251725.html
Copyright © 2020-2023  润新知