|
@@ -22,6 +22,35 @@ class Base
|
|
|
$this->save = new Save(false, 'cookie');
|
|
|
}
|
|
|
|
|
|
+ # 合并用户
|
|
|
+ protected function combine($uid, $unionid, $col = 'unionid')
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ $user_wechat = Dever::load('passport/wechat-state', array($col => $unionid));
|
|
|
+ if ($user_wechat) {
|
|
|
+ # 合并去
|
|
|
+ $cur = $uid;//1 1,2
|
|
|
+ $drop = array();
|
|
|
+ foreach ($user_wechat as $k => $v) {
|
|
|
+ if ($v['uid'] < $cur) {
|
|
|
+ $drop[$cur] = $cur;
|
|
|
+ $cur = $v['uid'];
|
|
|
+ } elseif ($v['uid'] > $cur) {
|
|
|
+ $drop[$v['uid']] = $v['uid'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($drop) {
|
|
|
+ foreach ($drop as $k => $v) {
|
|
|
+ Dever::load('passport/user-update', array('set_state' => 2, 'where_id' => $v));
|
|
|
+ }
|
|
|
+ $combine = Dever::project('combine');
|
|
|
+ if ($combine) {
|
|
|
+ Dever::load('combine/lib/core')->handle($cur, $drop);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 检测用户有效性
|
|
|
*
|