admin 发表于 2019-12-5 10:50:21

DZ 两次发送短消息太快,请稍候再发送 真正有效的解决方法

方法:在ucenter的基本设置里改。可以更改了更新缓存,前台没效果,但是数据库已经改了。原来他更新缓存没有更新到那个缓存,我直接到data下面的cache下面把settings.php改过来或者删除再更新缓存就可以成功了。只是ucenter和discuz结合之后出现的缓存问题,但是直接ucenter是不用这样子,settings.php也自动是最新的。
以下是一些资料:discuz 关于 发送失败,您当前超出了24小时内两人会话的上限
发布日期:2013年06月26日   来源:PHP1.CN   作者:毛毛   点击:169
实际上很多人遇到这个问题 但很快就能解决 因为这个设置是在 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函数中,通过
1$this->set_setting(‘privatepmthreadlimit‘,intval($privatepmthreadlimit));

将设置值更新到数据库中
1
2
3
4
functionset_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中,还不会影响论坛的操作。二、当论坛更新缓存时,程序会按照顺序执行各个函数,
1updatecache(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函数中取出设置的参数值,
1$settings=$this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd");

在updatedata函数中写入到uc_client/data/cache/settings.php文件中。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
functionupdatedata($cachefile=‘‘) {
      if($cachefile) {
             foreach((array)$this->map[$cachefile]as$modules) {
                  $s="<?php\r\n";
                  foreach((array)$modulesas$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->mapas$file=>$modules) {
                  $s="<?php\r\n";
                  foreach($modulesas$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文件中的值。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if($this->settings[‘pmsendregdays‘]) {
      if($user[‘regdate‘] >$this->time -$this->settings[‘pmsendregdays‘] * 86400) {
             returnPMSENDREGDAYS;
      }
}
if($this->settings[‘chatpmmemberlimit‘]) {
      if($type== 1 && ($countmsgto> ($this->settings[‘chatpmmemberlimit‘] - 1))) {
             returnCHATPMMEMBERLIMIT_ERROR;
      }
}
if($this->settings[‘pmfloodctrl‘]) {
      if(!$_ENV[‘pm‘]->ispminterval($this->user[‘uid‘],$this->settings[‘pmfloodctrl‘])) {
             returnPMFLOODCTRL_ERROR;
      }
}
if($this->settings[‘privatepmthreadlimit‘]) {
      if(!$_ENV[‘pm‘]->isprivatepmthreadlimit($this->user[‘uid‘],$this->settings[‘privatepmthreadlimit‘])) {
             returnPRIVATEPMTHREADLIMIT_ERROR;
      }
}
if($this->settings[‘chatpmthreadlimit‘]) {
      if(!$_ENV[‘pm‘]->ischatpmthreadlimit($this->user[‘uid‘],$this->settings[‘chatpmthreadlimit‘])) {
             returnCHATPMTHREADLIMIT_ERROR;
      }
}


这就是ucenter中进行短消息设置时,影响前台短消息发送的过程。
有种常见的问题是,其他操作都没有问题,就是uc_client\data\cache目录权限不对,造成设置的缓存不能更新,导致会员发送短消息时出现各种问题。

页: [1]
查看完整版本: DZ 两次发送短消息太快,请稍候再发送 真正有效的解决方法