// +---------------------------------------------------------------------- namespace ywxapp\model; /** * 聊天 */ class Chat extends BaseModel { // 设置表名(think-orm 4.0:name 不带前缀,自动拼 wxapp_) protected $name = 'chat'; protected $schema = [ 'id' => 'int', 'from_uid' => 'int', 'to_uid' => 'int', 'type' => 'int', 'content' => 'string', 'create_at' => 'int', 'update_at' => 'int', ]; } // CREATE TABLE `chat_users` ( // `id` int(11) NOT NULL AUTO_INCREMENT, // `username` varchar(50) NOT NULL, // `password` varchar(255) NOT NULL, // `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, // PRIMARY KEY (`id`) // ); // CREATE TABLE `chat_messages` ( // `id` int(11) NOT NULL AUTO_INCREMENT, // `from_user_id` int(11) NOT NULL, // `to_user_id` int(11) NOT NULL, // `message` text NOT NULL, // `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP, // PRIMARY KEY (`id`) // );