• discuz 消息数据表说明


    PM.so

    消息列表

    CREATE TABLE `pre_ucenter_pm_lists` (
    `plid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '消息自增ID',
    `authorid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '发送者Uid',
    `pmtype` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '消息类型 1 普通 两人聊天',
    `subject` varchar(80) NOT NULL,
    `members` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '多少人聊天',
    `min_max` varchar(17) NOT NULL COMMENT '用户Uid组合,min_max,pmtype=2时为空',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    `lastmessage` text NOT NULL COMMENT '最近的消息内容',
    PRIMARY KEY (`plid`),
    KEY `pmtype` (`pmtype`),
    KEY `min_max` (`min_max`),
    KEY `authorid` (`authorid`,`dateline`)
    ) ENGINE=MyISAM DEFAULT CHARSET=gbk

    获取消息内容pmid

    CREATE TABLE `pre_ucenter_pm_indexes` (
    `pmid` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
    `plid` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '消息ID',
    PRIMARY KEY (`pmid`),
    KEY `plid` (`plid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=gbk

     消息内容表

    CREATE TABLE `pre_ucenter_pm_messages_0` (
    `pmid` mediumint(8) unsigned NOT NULL DEFAULT '0',
    `plid` mediumint(8) unsigned NOT NULL DEFAULT '0',
    `authorid` mediumint(8) unsigned NOT NULL DEFAULT '0',
    `message` text NOT NULL,
    `delstatus` tinyint(1) unsigned NOT NULL DEFAULT '0',
    `dateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`pmid`),
    KEY `plid` (`plid`,`delstatus`,`dateline`),
    KEY `dateline` (`plid`,`dateline`)
    ) ENGINE=MyISAM DEFAULT CHARSET=gbk

    用户消息统计表 

    CREATE TABLE `pre_ucenter_pm_members` (
    `plid` mediumint(8) unsigned NOT NULL DEFAULT '0',
    `uid` mediumint(8) unsigned NOT NULL DEFAULT '0',
    `isnew` tinyint(1) unsigned NOT NULL DEFAULT '0',
    `pmnum` int(10) unsigned NOT NULL DEFAULT '0',
    `lastupdate` int(10) unsigned NOT NULL DEFAULT '0',
    `lastdateline` int(10) unsigned NOT NULL DEFAULT '0',
    PRIMARY KEY (`plid`,`uid`),
    KEY `isnew` (`isnew`),
    KEY `lastdateline` (`uid`,`lastdateline`),
    KEY `lastupdate` (`uid`,`lastupdate`)
    ) ENGINE=MyISAM DEFAULT CHARSET=gbk

     用新消息的用户列表

    CREATE TABLE `pre_ucenter_newpm` (
    `uid` mediumint(8) unsigned NOT NULL,
    PRIMARY KEY (`uid`)
    ) ENGINE=MyISAM DEFAULT CHARSET=gbk

    http://9night.kimiss.com/home.php?mod=spacecp&ac=pm   私人消息

    发消息   pre_ucenter_pm_lists.pmtype   普通1, 群聊2

    sendpm(implode(',', $newusers), $subject, $message, '', 0, 1, $type);

    function sendpm($toid, $subject, $message, $fromid = '', $replypmid = 0, $isusername = 0, $type = 0) {
        global $_G;
        if($fromid === '') {
            $fromid = $_G['uid'];
        }
        loaducenter();
        return uc_pm_send($fromid, $toid, $subject, $message, 1, $replypmid, $isusername, $type);
    }
    function uc_pm_send($fromuid, $msgto, $subject, $message, $instantly = 1, $replypmid = 0, $isusername = 0, $type = 0) {
        if($instantly) {
            $replypmid = @is_numeric($replypmid) ? $replypmid : 0;
            return call_user_func(UC_API_FUNC, 'pm', 'sendpm', array('fromuid'=>$fromuid, 'msgto'=>$msgto, 'subject'=>$subject, 'message'=>$message, 'replypmid'=>$replypmid, 'isusername'=>$isusername, 'type' => $type));
        } else {
            $fromuid = intval($fromuid);
            $subject = rawurlencode($subject);
            $msgto = rawurlencode($msgto);
            $message = rawurlencode($message);
            $replypmid = @is_numeric($replypmid) ? $replypmid : 0;
            $replyadd = $replypmid ? "&pmid=$replypmid&do=reply" : '';
            $apiurl = uc_api_url('pm_client', 'send', "uid=$fromuid", "&msgto=$msgto&subject=$subject&message=$message$replyadd");
            @header("Expires: 0");
            @header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE);
            @header("Pragma: no-cache");
            @header("location: ".$apiurl);
        }
    }

     发送消息     pre_ucenter_pm_lists.pmtype = 1

    // 之前有一方发送过消息
    if
    (!isset($existplid[$value])) {
                // 记录两个人一个消息关系,唯一,2个人,不属于群聊
    $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_lists(authorid, pmtype, subject, members, min_max, dateline, lastmessage) VALUES('$fromuid', '1', '$subject', 2, '$value', '".$this->base->time."', '$lastmessage')"); $plid = $this->db->insert_id(); // 两人消息标识, 所有两个的消息都有此Plid存在 $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_indexes(plid) VALUES('$plid')"); $pmid = $this->db->insert_id(); // 消息内容ID
                // 根据plid获取消息内容表名,记录消息内容
    $this->db->query("INSERT INTO ".UC_DBTABLEPRE.$this->getposttablename($plid)."(pmid, plid, authorid, message, dateline, delstatus) VALUES('$pmid', '$plid', '$fromuid', '$message', '".$this->base->time."', 0)");
                // 更新用户(和某个用户的)消息记录数
    $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_members(plid, uid, isnew, pmnum, lastupdate, lastdateline) VALUES('$plid', '$key', '1', '1', '0', '".$this->base->time."')"); $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_members(plid, uid, isnew, pmnum, lastupdate, lastdateline) VALUES('$plid', '$fromuid', '0', '1', '".$this->base->time."', '".$this->base->time."')"); } else { $plid = $existplid[$value]; $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_indexes(plid) VALUES('$plid')"); $pmid = $this->db->insert_id(); $this->db->query("INSERT INTO ".UC_DBTABLEPRE.$this->getposttablename($plid)."(pmid, plid, authorid, message, dateline, delstatus) VALUES('$pmid', '$plid', '$fromuid', '$message', '".$this->base->time."', 0)"); $result = $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_members(plid, uid, isnew, pmnum, lastupdate, lastdateline) VALUES('$plid', '$key', '1', '1', '0', '".$this->base->time."')", 'SILENT'); if(!$result) { $this->db->query("UPDATE ".UC_DBTABLEPRE."pm_members SET isnew=1, pmnum=pmnum+1, lastdateline='".$this->base->time."' WHERE plid='$plid' AND uid='$key'"); } $result = $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_members(plid, uid, isnew, pmnum, lastupdate, lastdateline) VALUES('$plid', '$fromuid', '0', '1', '".$this->base->time."', '".$this->base->time."')", 'SILENT'); if(!$result) { $this->db->query("UPDATE ".UC_DBTABLEPRE."pm_members SET isnew=0, pmnum=pmnum+1, lastupdate='".$this->base->time."', lastdateline='".$this->base->time."' WHERE plid='$plid' AND uid='$fromuid'"); } $this->db->query("UPDATE ".UC_DBTABLEPRE."pm_lists SET lastmessage='$lastmessage' WHERE plid='$plid'"); }

    回复消息       pre_ucenter_pm_lists.pmtype = 1

    $lastmessage = array('lastauthorid' => $fromuid, 'lastauthor' => $fromusername, 'lastsummary' => $lastsummary);
                $lastmessage = addslashes(serialize($lastmessage));
                $result = $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_members(plid, uid, isnew, pmnum, lastupdate, lastdateline) VALUES('$plid', '$touid', '1', '1', '0', '".$this->base->time."')", 'SILENT');
                if(!$result) {
                    $this->db->query("UPDATE ".UC_DBTABLEPRE."pm_members SET isnew=1, pmnum=pmnum+1, lastdateline='".$this->base->time."' WHERE plid='$plid' AND uid='$touid'");
                }
                $this->db->query("UPDATE ".UC_DBTABLEPRE."pm_members SET isnew=0, pmnum=pmnum+1, lastupdate='".$this->base->time."', lastdateline='".$this->base->time."' WHERE plid='$plid' AND uid='$fromuid'");

    公共蜜邮

    pre_common_grouppm  存储蜜邮内容 

    pre_common_member_grouppm 用户公共蜜邮数据表

  • 相关阅读:
    Java中的面向对象以及java的基本特性
    Redis数据结构(三):双向链表和压缩链表
    java对象晋升的四种情况
    Redis数据结构(一):对外数据类型和底层数据结构
    InnoDB中的的聚合函数count(?)哪个效率高?
    群智能算法标准测试函数集
    运行vue项目时报错“ValidationError: Progress Plugin Invalid Options”
    uswipeaction 宽度计算的延迟导致组件加载时内部样式错误
    地址智能识别相关插件
    js滑动验证
  • 原文地址:https://www.cnblogs.com/bandbandme/p/4137909.html
Copyright © 2020-2023  润新知