public static function bindingAccount($uid, $username, $arrSaveinfo) { $returnValue = FALSE; $strSql = "select count(id) from " . TABLEPRE . "witkey_member_oauth\n\t\t\t\twhere source ='" . $arrSaveinfo['type'] . "' and oauth_id='{$arrSaveinfo['account']}' and uid=" . $uid; $isBind = db_factory::get_count($strSql); if (!$isBind) { $objMemberOauth = new Keke_witkey_member_oauth_class(); $objMemberOauth->setAccount($arrSaveinfo['nickname']); $objMemberOauth->setOauth_id($arrSaveinfo['account']); $objMemberOauth->setSource($arrSaveinfo['type']); $objMemberOauth->setUid($uid); $objMemberOauth->setUsername($username); $objMemberOauth->setOn_time(time()); $intRes = $objMemberOauth->create_keke_witkey_member_oauth(); unset($objMemberOauth); $intRes and $returnValue = TRUE or $returnValue = FALSE; } return $returnValue; }
public static function register_binding($oauth_user_info, $user_info, $type) { global $_lang, $nick, $taobao_user_id; $csql = "select count(*) as c from %switkey_member_oauth where source='%s' and oauth_id ='%s'"; $c = db_factory::get_one(sprintf($csql, TABLEPRE, $type, $oauth_user_info['account'])); if (intval($c['c']) == 0) { $oauth_obj = new Keke_witkey_member_oauth_class(); if (!$oauth_user_info['name']) { $oauth_user_info['name'] = $nick; } if (!$oauth_user_info['account']) { $oauth_user_info['account'] = $taobao_user_id; } $oauth_obj->setAccount($oauth_user_info['name']); $oauth_obj->setOauth_id($oauth_user_info['account']); $oauth_obj->setSource($type); $oauth_obj->setUid($user_info['uid']); $oauth_obj->setUsername($user_info['username']); $oauth_obj->setOn_time(time()); $oauth_obj->create_keke_witkey_member_oauth() or $this->show_msg($_lang['bind_fail'], 2); } else { $this->show_msg($_lang['this_user_has_bind'], 7); } return true; }