Ejemplo n.º 1
0
 public function handle_request_internal()
 {
     $apf = APF::get_instance();
     $response = $apf->get_response();
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     //加密公钥
     $member_key = $apf->get_config("member_key");
     //加密字符串
     $key = $params['key'];
     //用户ID
     $uid = $params['uid'];
     //用户NAME
     $username = $params['name'];
     //用户类型
     $usertype = $params['utype'];
     //$response->set_cookie("uid",$uid);
     $response->set_cookie("usertype", $usertype);
     //成功跳转页面
     $location = base64_decode(urldecode($params['location']));
     if (strpos($location, chr(13))) {
         $location = substr($location, 0, strpos($location, chr(13)));
     }
     if (strpos($location, '?') !== false) {
         $location .= '&_r=' . mt_rand(0, time());
     } else {
         $location .= '?_r=' . mt_rand(0, time());
     }
     //用户登录时间
     $time = $params['time'];
     //key的过期时间
     $keytime = $params['keytime'];
     //是否来自经纪人登陆
     $frombroker = $params['frombroker'];
     $errmsg = htmlspecialchars(urldecode($params['errmsg']));
     //错误代码
     $error = $params['error'];
     //来源
     $sid = @APF::get_instance()->get_request()->get_parameter("sid");
     //登陆成功
     if ($uid && Bll_Security_Member::check_key($key, $uid, $username, $member_key, $time, $keytime)) {
         $user = Model_Broker_Member::getAjkMembersByUserId($uid);
         if ($user->userType > 1) {
             $broker = Model_Broker_AjkBrokerExtend::getBrokerInfoByUserId($user->userId);
         }
         if ($user) {
             header("P3P: CP=CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR");
             $brokerid = 0;
             $cookietime = 86400 * 365;
             $ucity = APF::get_instance()->get_request()->getCityId();
             if ($user->userType == 2) {
                 // 自动创建三网支付中心账号
                 /*$bll_account = new BLL_Acenter_AccountUser();
                   $bll_account->create_three_account_must($uid);*/
                 if (intval($broker->checkState) == 2) {
                     // 被业务经理关闭的帐号
                     $errorMess = Const_Verify::CLOSE_ERROR;
                 }
                 if (intval($broker->accountType) == 10000) {
                     // 被业务经理冻结帐号
                     $errorMess = Const_Verify::FREEZE_ERROR;
                 }
                 if ($broker->isLogin == 0 && $broker->punish == 2) {
                     //黑名单经纪人不管是免费的还是续费的,立即关闭。
                     $errorMess = Const_Verify::BLACK_ERROR;
                 }
                 if ($errorMess) {
                     $backurl = strpos($location, '?') ? $location . '&errorMess=' . $errorMess : $location . '?errmsg=' . $errorMess;
                     Uri_Http::redirect_header($backurl, 302);
                     return;
                 }
                 $ucity = @$broker->cityId;
                 $brokerid = @$broker->brokerId;
                 $cookietime = 0;
                 $userTypeNew = Const_Verify::BROKER_USER;
             } else {
                 //查询是用户是否门店
                 $AgcyInfo = Model_Broker_AgcyAccount::getAgcyByUserId($user->userId);
                 if (is_array($AgcyInfo) && count($AgcyInfo)) {
                     $userTypeNew = Const_Verify::COMPANY_USER;
                 } else {
                     $userTypeNew = Const_Verify::COMMON_USER;
                 }
             }
             $userid = $user->userId;
             $username = $user->userName;
             $usertype = $user->userType;
             $fuid = $user->fuid;
             $emailpass = 1;
             if ($brokerid > 0) {
                 Model_Log_BrokerLogin::insertLoginLog(date('Ym'), $brokerid);
             }
             $anjuke_secques = APF::get_instance()->get_config("AnjukeSecques");
             $this->setLoginDataCookie($userid, $username, $usertype, $emailpass, $anjuke_secques, 0, $fuid, $ucity, $brokerid, $cookietime, $afutype = 0, $sid, $userTypeNew);
             $this->setLastLoinUserName($username, 86400 * 365);
         }
         //跳转用户原访问页面
         if (!$params['no_redirect']) {
             Uri_Http::redirect_header($location, 302);
         }
     } else {
         //登陆失败
         $backurl = strpos($location, '?') ? $location . '&errorMess=' . $errmsg . '&errorCode=' . $error : $location . '?errorMess=' . $errmsg . '&errorCode=' . $error;
         Uri_Http::redirect_header($backurl, 302);
         return;
     }
 }
Ejemplo n.º 2
0
 /**
  * author hukan
  * 根据UserId获取经纪人的信息
  */
 public static function getBrokerInfoByUserId($userId)
 {
     if ($userId) {
         return Model_Broker_AjkBrokerExtend::getBrokerInfoByUserId($userId);
     } else {
         return array();
     }
 }
Ejemplo n.º 3
0
 public function handle_request()
 {
     //监控fyk_push_props表 如果有新增记录 生成推送信息推送
     $props = $this->getPushedRecommendProps();
     if (empty($props)) {
         // 更新游标
         $id = array_pop($props);
         if (!empty($id)) {
             $this->cursor['id'] = $id->id;
             $this->setFlag($this->cursor);
         }
         return;
     }
     $propIds = array();
     foreach ($props as $prop) {
         $propIds[] = $prop->propId;
     }
     //房源库房源信息
     $commIds = array();
     $keyPropInfos = array();
     $propInfos = Model_Fyk_PropLibrary::getDataById($propIds);
     if (empty($propInfos)) {
         // 更新游标
         $id = array_pop($props);
         $this->cursor['id'] = $id->id;
         $this->setFlag($this->cursor);
         return;
     }
     foreach ($propInfos as $propInfo) {
         $commIds[] = $propInfo['commId'];
         $keyPropInfos[$propInfo['id']] = $propInfo;
         // 房源id 为key 房源信息
     }
     //批量小区信息
     $commInfos = $this->getCommInfo($commIds);
     //小区id 为key  小区坐标
     foreach ($props as $prop) {
         $userId = $prop->userId;
         $brokerInfo = Model_Broker_AjkBrokerExtend::getBrokerInfoByUserId($userId);
         if (empty($brokerInfo)) {
             //更新游标
             $this->cursor['id'] = $prop->id;
             $this->setFlag($this->cursor);
             continue;
         }
         $brokerId = $brokerInfo->brokerId;
         //获取房源小区
         $commId = $keyPropInfos[$prop->propId]['commId'];
         if (empty($commId)) {
             //更新游标
             $this->cursor['id'] = $prop->id;
             $this->setFlag($this->cursor);
             continue;
         }
         $msg = $commInfos[$commId]['commName'] . '出现新房源';
         /** 消息推送 */
         $result = $this->push($brokerId, $msg);
         //更新游标
         $this->cursor['id'] = $prop->id;
         $this->setFlag($this->cursor);
     }
 }