当前位置: 首页>>代码示例>>PHP>>正文


PHP UserApi::addSyncData方法代码示例

本文整理汇总了PHP中User\Api\UserApi::addSyncData方法的典型用法代码示例。如果您正苦于以下问题:PHP UserApi::addSyncData方法的具体用法?PHP UserApi::addSyncData怎么用?PHP UserApi::addSyncData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User\Api\UserApi的用法示例。


在下文中一共展示了UserApi::addSyncData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unbind

 protected function unbind($syncData = null)
 {
     //$this->checkIsBind($syncData);
     $access_token = session('SYNCLOGIN_ACCESS_TOKEN');
     $openid = session('SYNCLOGIN_OPENID');
     $type = session('SYNCLOGIN_TYPE');
     $token = session('SYNCLOGIN_TOKEN');
     $user_info = D('Addons://SyncLogin/Info')->{$type}($token);
     $syncData === null && ($syncData = D('sync_login')->where(array('type_uid' => $openid, 'type' => $type))->find());
     if ($syncData) {
         $uid = $syncData['uid'];
         $user = UCenterMember()->where(array('id' => $syncData['uid']))->find();
         if (empty($user)) {
             $this->clearSyncLoginSession();
             //用户已经不存在,删除绑定记录
             D('sync_login')->where(array('type_uid' => $openid, 'type' => $type))->delete();
             return redirect(homeUrl());
         } else {
             //已经绑定过,执行登录操作,设置token
             if (!$syncData['oauth_token'] || $syncData['oauth_token'] != $access_token) {
                 $data = array();
                 $data['id'] = $syncData['id'];
                 $data['oauth_token'] = $access_token;
                 $data['oauth_token_secret'] = $openid;
                 D('sync_login')->save($data);
             }
         }
     } else {
         $Api = new UserApi();
         //usercenter表新增数据
         $uid = $Api->addSyncData();
         //member表新增数据
         D('Common/Member')->addSyncData($uid, $user_info);
         // 记录数据到sync_login表中
         $this->addSyncLoginData($uid, $access_token, $openid, $type, $openid);
         //保存头像
         $this->saveAvatar($user_info['head'], $openid, $uid, $type);
         $config = D('Config')->where(array('name' => 'USER_REG_WEIBO_CONTENT'))->find();
         $reg_weibo = $config['value'];
         //用户注册的微博内容
         if ($reg_weibo != '' && $config) {
             //为空不发微博
             D('Weibo/Weibo')->addWeibo($uid, $reg_weibo);
         }
     }
     $this->loginWithoutpwd($uid);
 }
开发者ID:admpub,项目名称:OpenCenter,代码行数:47,代码来源:BaseController.class.php

示例2: unbind

 public function unbind()
 {
     $this->checkIsBind();
     $access_token = session('SYNCLOGIN_ACCESS_TOKEN');
     $openid = session('SYNCLOGIN_OPENID');
     $type = session('SYNCLOGIN_TYPE');
     $token = session('SYNCLOGIN_TOKEN');
     $user_info = D('Addons://SyncLogin/Info')->{$type}($token);
     if ($info1 = D('sync_login')->where("`type_uid`='" . $openid . "' AND type='" . $type . "'")->find()) {
         $user = UCenterMember()->where("id=" . $info1['uid'])->find();
         if (empty($user)) {
             D('sync_login')->where("type_uid=" . $openid . " AND type='" . $type . "'")->delete();
             //已经绑定过,执行登录操作,设置token
         } else {
             if ($info1['oauth_token'] == '') {
                 $syncdata['id'] = $info1['id'];
                 $syncdata['oauth_token'] = $access_token;
                 $syncdata['oauth_token_secret'] = $openid;
                 D('sync_login')->save($syncdata);
             }
             $uid = $info1['uid'];
         }
     } else {
         $Api = new UserApi();
         //usercenter表新增数据
         $uid = $Api->addSyncData();
         //member表新增数据
         D('Home/Member')->addSyncData($uid, $user_info);
         // 记录数据到sync_login表中
         $this->addSyncLoginData($uid, $access_token, $openid, $type, $openid);
         //保存头像
         $this->saveAvatar($user_info['head'], $openid, $uid, $type);
         $config = D('Config')->where(array('name' => 'USER_REG_WEIBO_CONTENT'))->find();
         $reg_weibo = $config['value'];
         //用户注册的微博内容
         if ($reg_weibo != '' && $config) {
             //为空不发微博
             //                D('Weibo/Weibo')->addWeibo($uid, $reg_weibo);
         }
     }
     $this->loginWithoutpwd($uid);
 }
开发者ID:fishling,项目名称:chatPro,代码行数:42,代码来源:BaseController.class.php

示例3: unbind

 public function unbind()
 {
     $this->checkIsBind();
     $access_token = session('SYNCLOGIN_ACCESS_TOKEN');
     $openid = session('SYNCLOGIN_OPENID');
     $type = session('SYNCLOGIN_TYPE');
     $token = session('SYNCLOGIN_TOKEN');
     $user_info = D('Addons://SyncLogin/Info')->{$type}($token);
     if ($info1 = D('sync_login')->where("`type_uid`='" . $openid . "' AND type='" . $type . "'")->find()) {
         $user = D('UcenterMember')->where("id=" . $info1['uid'])->find();
         if (empty($user)) {
             D('sync_login')->where("type_uid=" . $openid . " AND type='" . $type . "'")->delete();
             //已经绑定过,执行登录操作,设置token
         } else {
             if ($info1['oauth_token'] == '') {
                 $syncdata['id'] = $info1['id'];
                 $syncdata['oauth_token'] = $access_token;
                 $syncdata['oauth_token_secret'] = $openid;
                 D('sync_login')->save($syncdata);
             }
             $uid = $info1['uid'];
         }
     } else {
         $Api = new UserApi();
         //usercenter表新增数据
         $uid = $Api->addSyncData();
         //member表新增数据
         D('Home/Member')->addSyncData($uid, $user_info);
         // 记录数据到sync_login表中
         $this->addSyncLoginData($uid, $access_token, $openid, $type, $openid);
         //保存头像
         $this->saveAvatar($user_info['head'], $openid, $uid, $type);
     }
     $this->loginWithoutpwd($uid);
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:35,代码来源:BaseController.class.php


注:本文中的User\Api\UserApi::addSyncData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。