消息中心还是好多问题啊?啥时候能解决吖
待回答本地单机环境和内网环境都做了测试
1、发了公告后,前台铃铛上有个红点,点了之后啥消息都没有,只能进消息中心才能看到
2、消息中心显示不出消息内容,只显示Array
翻了下以前的提问,从2.1.0版本就开始有这些问题,现在都3.3.1了,还是没有解决……关键是官方社区竟然全部都正常
在Application/Common/Model/MessageModel.class.php中的353行左右找到
private function _initUserMessageSession($uids, $type)
然后将
private function _initUserMessageSession($uids, $type)
{
$messageTypeModel = M('MessageType');
$map['uid'] = array('in', $uids);
$map['type'] = $type;
$already_uids = $messageTypeModel->where($map)->field('uid')->select();
$already_uids = array_column($already_uids, 'uid');
$need_uids = array_diff($uids, $already_uids);
$dataList = array();
foreach ($need_uids as $val) {
S('MY_MESSAGE_SESSION_' . $val, null);
$dataList[] = array('uid' => $val, 'type' => $type, 'status' => 1);
}
unset($val);
if (count($dataList)) {
$messageTypeModel->addAll($dataList);
}
return true;
}改为
private function _initUserMessageSession($uids, $type)
{
$messageTypeModel = M('MessageType');
$map['uid'] = array('in', $uids);
$map['type'] = $type;
$already_uids = $messageTypeModel->where($map)->field('uid')->select();
$already_uids = array_column($already_uids, 'uid');
if($already_uids == null)
$already_uids = array();
$need_uids = array_diff($uids, $already_uids);
$dataList = array();
foreach ($need_uids as $val) {
S('MY_MESSAGE_SESSION_' . $val, null);
$dataList[] = array('uid' => $val, 'type' => $type, 'status' => 1);
}
unset($val);
if (count($dataList)) {
$messageTypeModel->addAll($dataList);
}
return true;
}请登录后回答