实际上很多人遇到这个问题 但很快就能解决 因为这个设置是在 ucenter 基本设置中 设置的 只需要将 25设置成0 或者设置成你想要的数量即可。可有的时候遇到 权限混乱的 服务器 真心就尴尬了
如果出现了 已经将24小时 发送限制取消了 还是无法正常发送 请查看
uc_client/data/cache/settings.php 文件
整体上来说 这个的排查很漫长 这里提供下 整体的 实现逻辑,转自disucz开发人员 专贴:
一、在ucenter中进行短消息的相关设置,每一项设置都会对应一个变量,
发短消息最少注册天数(pmsendregdays )
同一用户在24小时内允许发起两人会话的最大数(privatepmthreadlimit )
同一用户在24小时内允许发起群聊会话的最大数(chatpmthreadlimit )
参与同一群聊会话的最大用户数(chatpmmemberlimit )
发短消息灌水预防(pmfloodctrl )
启用短消息中心(pmcenter )
开启发送短消息验证码(sendpmseccode )
在uc_server\control\admin\setting.php文件的onls函数中,通过
$this->set_setting('privatepmthreadlimit', intval($privatepmthreadlimit));
将设置值更新到数据库中
function set_setting($k, $v, $encode = FALSE) { $v = is_array($v) || $encode ? addslashes(serialize($v)) : $v; $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."settings SET k='$k', v='$v'"); }
可见,这些设置提交后,只会保存到ucenter的设置表settings中,还不会影响论坛的操作。
二、当论坛更新缓存时,程序会按照顺序执行各个函数,
updatecache(function_cache.php) -> build_cache_setting(cache_setting.php)-> uc_app_ls(client.php)-> init_cache(base.php)-> cache(base.php)-> updatedata(cache.php)-> _get_settings(cache.php)-> get_setting(base.php)
在get_setting函数中取出设置的参数值,
$settings = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd");
在updatedata函数中写入到uc_client/data/cache/settings.php文件中。
function updatedata($cachefile = '') { if($cachefile) { foreach((array)$this->map[$cachefile] as $modules) { $s = "<?php\r\n"; foreach((array)$modules as $m) { $method = "_get_$m"; $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n"; } $s .= "\r\n?>"; @file_put_contents(UC_DATADIR."./cache/$cachefile.php", $s); } } else { foreach((array)$this->map as $file => $modules) { $s = "<?php\r\n"; foreach($modules as $m) { $method = "_get_$m"; $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n"; } $s .= "\r\n?>"; @file_put_contents(UC_DATADIR."./cache/$file.php", $s); } } }
三、当会员发送短消息的时候,在uc_client\control\pm.php文件的 onsendpm 函数中,所使用的$this->settings[‘pmsendregdays’] 等,就是uc_client/data/cache/settings.php文件中的值。
if($this->settings['pmsendregdays']) { if($user['regdate'] > $this->time - $this->settings['pmsendregdays'] * 86400) { return PMSENDREGDAYS; } } if($this->settings['chatpmmemberlimit']) { if($type == 1 && ($countmsgto > ($this->settings['chatpmmemberlimit'] - 1))) { return CHATPMMEMBERLIMIT_ERROR; } } if($this->settings['pmfloodctrl']) { if(!$_ENV['pm']->ispminterval($this->user['uid'], $this->settings['pmfloodctrl'])) { return PMFLOODCTRL_ERROR; } } if($this->settings['privatepmthreadlimit']) { if(!$_ENV['pm']->isprivatepmthreadlimit($this->user['uid'], $this->settings['privatepmthreadlimit'])) { return PRIVATEPMTHREADLIMIT_ERROR; } } if($this->settings['chatpmthreadlimit']) { if(!$_ENV['pm']->ischatpmthreadlimit($this->user['uid'], $this->settings['chatpmthreadlimit'])) { return CHATPMTHREADLIMIT_ERROR; } }
这就是ucenter中进行短消息设置时,影响前台短消息发送的过程。
有种常见的问题是,其他操作都没有问题,就是uc_client\data\cache目录权限不对,造成设置的缓存不能更新,导致会员发送短消息时出现各种问题。