chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\worker\enum;
// ==================== 第一层:协议帧类型(传输层) ====================
enum MsgFrame: string {
/**
* 聊天内容 文本 图片 视频 语音 文件
*/
case PING = 'ping'; // 心跳帧(客户端定时发送,服务端回复PONG)
case PONG = 'pong';
/**
* 聊天内容 文本 图片 视频 语音 文件
*/
case CHAT = 'chat';
/**
* 系统消息 心跳 认证 错误
*/
case SYSTEM = 'sys';
/**
* 关系消息 加好友 同意加好友 拒绝加好友 加群组 同意加入 拒绝加入
*/
case RELATION = 'rel';
/**
* 状态消息 正在输入 送达 未读 已读 撤回
*/
case STATUS = 'state'; // 连接控制(心跳/认证/状态)
case ERROR = 'err'; // 协议错误(独立错误帧)
}
// [
// 'id' => 'msg_1234567890abcdef', // 唯一IDUUID / 雪花ID,服务端可生成)
// 'from' => 'user_001', // 消息发送者 UID
// 'to' => 'user_002', // 接收者 UID(单聊) 或 to_gid: "group_001"(群聊)
// 'totype' => 'member', // 接收目标类型:user(私聊) / group(群聊)
// 'type' => 'text', // 消息类型:text / image / voice / video / file / system / notification / typing / read / revoke
// 'action' => 'chat.send', // 【可选】业务动作,用于服务端路由(如 chat.send, system.notify, typing.start
// 'content' => 'Hello world!', // 消息正文内容(文本消息直接是字符串,其他类型可能是 URL 或结构化数据)
// 'extra' => [ // 【可选】扩展字段,根据 type 不同而不同
// 'image_url' => 'https://xxx.com/img.jpg',
// 'image_width' => 800,
// 'image_height' => 600,
// 'voice_url' => 'https://xxx.com/voice.amr',
// 'voice_duration' => 3,
// 'file_name' => 'doc.pdf',
// 'file_size' => 102400,
// 'reply_to_msg_id' => 'msg_0987654321', // 引用回复的消息ID
// 'mention_uids' => ['user_003', 'user_004'] // @了哪些人
// ],
// 'timestamp' => 1700000000123, // 消息发送时间(毫秒级 UNIX 时间戳,推荐)
// 'status' => 'sent', // 消息状态:sending / sent / delivered / read / failed
// 'encipher' => true, // 是否经过 AES 加密(可选字段,用于标识)
// 'revoked' => false // 是否被撤回
// ];
+42
View File
@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\worker\enum;
// ==================== 第三层:具体消息子类型(MsgSubType ====================
enum MsgType: string {
// -------------------- CHAT 类消息 --------------------
case TEXT = 'text';
case IMAGE = 'image';
case VOICE = 'voice';
case VIDEO = 'video'; // 修正大小写
case FILE = 'file';
// -------------------- RELATION 类消息 --------------------
case FRIEND_REQUEST = 'friend_request'; // 好友申请
case FRIEND_AGREE = 'friend_agree'; // 同意添加
case FRIEND_REFUSE = 'friend_refuse'; // 拒绝添加
case GROUP_INVITE = 'group_invite'; // 群邀请
case GROUP_JOIN = 'group_join'; // 主动加群
// -------------------- SYSTEM 系统类 类专属 --------------------
case HEARTBEAT = 'heartbeat';
case AUTH = 'auth';
case Notice = 'notice';
case ERROR = 'error';
// -------------------- STATUS 状态 类专属 --------------------
case TYPING = 'typing'; // 正在输入(实时状态,不存库)
case DELIVERED = 'delivered'; // 送达回执(服务端→发送方)
case RECEIVED = 'received'; // 接收回执(接收方→服务端)
case READ = 'read';
case REVOKED = 'revoked';
}
+19
View File
@@ -0,0 +1,19 @@
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\wxchat\worker\enum;
// ==================== 聊天目标 ====================
enum Target: string {
case USER = 'single';
case GROUP = 'group';
case ROOM = 'room';
case SYSTEM = 'system';
}