PHPIN.NET

 找回密码
 立即注册
查看: 6103|回复: 0

[Discuz!技巧] 解决Discuz X整合其他系统后同步问题

[复制链接]

469

主题

31

回帖

5497

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
5497
发表于 2014-11-22 00:57:42 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
解决Discuz X整合其他系统后同步问题

本文关键字词:同步登陆,同步注册,同步注销,discuz

有很多程序整合discuz后,UC中显示通信成功,在整合端登陆注销,DX也会跟随同步登陆注销
但是反过来在DX中登陆注销,整合端反而不会跟随同步登陆注销。实在是很恶心!!!
后查询发现,原来是dx登陆注册的时候没有返回给UC状态。
所以暂时解决方案如下:
DX的client.php文件中(默认在uc_client目录下):
找到310行左右


  1. function uc_user_synlogin($uid) {
  2.         $uid = intval($uid);
  3.         if(@include UC_ROOT.'./data/cache/apps.php') {
  4.                 if(count($_CACHE['apps']) > 1) {
  5.                         $return = uc_api_post('user', 'synlogin', array('uid'=>$uid));
  6.                 } else {
  7.                         $return = '';
  8.                 }
  9.         }
  10.         return $return;
  11. }

  12. function uc_user_synlogout() {
  13.         if(@include UC_ROOT.'./data/cache/apps.php') {
  14.                 if(count($_CACHE['apps']) > 1) {
  15.                         $return = uc_api_post('user', 'synlogout', array());
  16.                 } else {
  17.                         $return = '';
  18.                 }
  19.         }
  20.         return $return;
  21. }
复制代码



修改为:
  1. function uc_user_synlogin($uid) {
  2.         $uid = intval($uid);
  3.         if(@include UC_ROOT.'./data/cache/apps.php') {
  4.                 if(count($_CACHE['apps']) > 1) {
  5.                         $return = uc_api_post('user', 'synlogin', array('uid'=>$uid));
  6.                 } else {
  7.                         $return = uc_api_post('user', 'synlogin', array('uid'=>$uid));
  8.                 }
  9.         }
  10.         return $return;
  11. }

  12. function uc_user_synlogout() {
  13.         if(@include UC_ROOT.'./data/cache/apps.php') {
  14.                 if(count($_CACHE['apps']) > 1) {
  15.                         $return = uc_api_post('user', 'synlogout', array());
  16.                 } else {
  17.                         $return = uc_api_post('user', 'synlogout', array());
  18.                 }
  19.         }
  20.         return $return;
  21. }
复制代码



这样即可实现双向同步登陆注销了。具体有什么后遗症没具体测试,有心的同学可以测试测试。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|PHPIN.NET ( 冀ICP备12000898号-14 )|网站地图

GMT+8, 2024-3-28 18:19

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表