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

 

 

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])) { $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(); $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)"); $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‘");

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。