Esempio n. 1
0
 public function handle_request()
 {
     $apf = APF::get_instance();
     $request = $apf->get_request();
     $params = $request->get_parameters();
     $baseDomain = $apf->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $showUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/show";
     $win = Model_Goodbroker_Baseinfo::data_access()->filter('is_deem', 1)->filter('top_ten', 1)->limit(10)->find_all();
     $gbdao = new Bll_Goodbroker();
     $vcrres = $gbdao->getResourceDAO();
     $winids = '';
     foreach ($win as $row) {
         $winids .= $row->broker_id . ',';
     }
     $winids = substr($winids, 0, -1);
     $vcrarr = $vcrres->getVcr($winids);
     $varr = array();
     foreach ($vcrarr as $row) {
         $varr[$row['broker_id']] = $row['resource_url'];
     }
     $request->set_attribute('win', $win);
     $request->set_attribute('varr', $varr);
     $request->set_attribute('showUrl', $showUrl);
     return 'Goodbroker_Win';
 }
Esempio n. 2
0
 public function checkPrompt()
 {
     $apf = APF::get_instance();
     $arr['code'] = 0;
     $arr['exist'] = 0;
     $arr['time'] = 0;
     $deem = $apf->get_config('deem', 'common');
     $win = $apf->get_config('win', 'common');
     if (time() > strtotime($win)) {
         $arr['time'] = 2;
     } else {
         if (time() > strtotime($deem)) {
             $arr['time'] = 1;
         }
     }
     if ($this->isBrokerLogin()) {
         $request = $apf->get_request();
         $broker_id = $request->getBrokerId();
         $baseDomain = $apf->get_config('base_domain', 'common');
         $baseUri = defined('BASE_URI') ? BASE_URI : '';
         $show_url = "http://my.{$baseDomain}{$baseUri}/goodbroker/show" . '/' . $broker_id;
         $info_url = "http://my.{$baseDomain}{$baseUri}/goodbroker/join";
         $join_url = $info_url . '/' . $broker_id;
         $dao = new Bll_Goodbroker();
         //获取审核状态
         $verify = $dao->getIsVerify($broker_id);
         if (!empty($verify)) {
             $arr['exist'] = 1;
             if ($verify['prompt']) {
                 if ($verify['is_verify'] == 1) {
                     $arr['code'] = 1;
                     $arr['url'] = $show_url;
                 } elseif ($verify['is_verify'] == 2) {
                     $arr['code'] = 2;
                     $arr['url'] = $info_url;
                     $arr['id'] = $broker_id;
                     $arr['msg'] = $verify['reason'];
                 }
                 if (strpos($_SERVER['HTTP_REFERER'], 'goodbroker/index')) {
                     $dao->closePrompt($broker_id);
                 }
             } else {
                 if ($verify['is_verify'] == 1) {
                     $arr['isv'] = 1;
                     $arr['url'] = $show_url;
                 } else {
                     $arr['isv'] = 2;
                     $arr['url'] = $info_url;
                 }
             }
         } else {
             $arr['exist'] = 0;
         }
     }
     echo json_encode($arr);
     exit;
 }
Esempio n. 3
0
 public function handle_request()
 {
     $apf = APF::get_instance();
     $objRequest = $apf->get_request();
     $objResponse = $apf->get_response();
     $deem = $apf->get_config('deem', 'common');
     $vote_to_id = $objRequest->get_parameter('id');
     $guid = $objRequest->get_guid();
     $user_id = $objRequest->getUserId();
     $broker_id = $objRequest->getBrokerId();
     $client_ip = $objRequest->get_client_ip();
     $ajk = $objRequest->get_parameter('ajk');
     $md5 = md5(md5($vote_to_id . $guid) . 'chinagoodbroker');
     $arr = array();
     if ((strpos($_SERVER['HTTP_REFERER'], 'goodbroker/index') || strpos($_SERVER['HTTP_REFERER'], 'goodbroker/show')) && $ajk == $md5 && $guid && $_POST && time() < strtotime($deem)) {
         if ($vote_to_id == $broker_id) {
             $arr['msg1'] = '不能给自己投票哟,邀请好友来支持你吧~';
             $arr['msg2'] = '';
             $arr['msg3'] = '';
             $arr['code'] = '1';
         } else {
             $dao = new Bll_Goodbroker();
             $res = $dao->getVotelog()->getVotes($guid);
             if ($res >= 10) {
                 $arr['msg1'] = '对不起,不能再投啦~';
                 $arr['msg2'] = '您今天的投票数已超过10票,明天再来吧。';
                 $arr['code'] = '2';
             } else {
                 $res = $dao->getVotelog()->getVotes($guid, $vote_to_id);
                 if ($res >= 1) {
                     $arr['msg1'] = '对不起,不能再投啦~';
                     $arr['msg2'] = '您已经为该经纪人投过票了,明天再来吧。';
                     $arr['code'] = '3';
                 } else {
                     $res = $dao->getInfoDAO()->updateVotes($vote_to_id);
                     if ($res) {
                         $dao->getVotelog()->setVotes($user_id, $guid, $vote_to_id, $client_ip);
                         $arr['msg'] = '投票成功';
                         $arr['code'] = '4';
                     } else {
                         $arr['msg1'] = '投票失败';
                         $arr['code'] = '5';
                     }
                 }
             }
         }
     } else {
         $arr['msg1'] = '抱歉,暂时不能投票~';
         $arr['msg2'] = '';
         $arr['msg3'] = '';
         $arr['code'] = '1';
     }
     $objResponse->set_content_type('application/json');
     echo json_encode($arr);
     return false;
 }
Esempio n. 4
0
 public function handle_request()
 {
     $apf = APF::get_instance();
     $request = $apf->get_request();
     $params = $request->get_parameters();
     $baseDomain = $apf->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $indexUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/index";
     $showUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/show";
     $guid = $request->get_guid();
     $per = 16;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     $daBaseinfo = Model_Goodbroker_Baseinfo::data_access()->filter('is_verify', 1);
     $daTotal = clone $daBaseinfo;
     if (time() < strtotime(date('2014-03-24'))) {
         $sort = isset($params['s']) ? $params['s'] : 'n';
     } else {
         $sort = isset($params['s']) ? $params['s'] : 'h';
     }
     if ($sort == 'n') {
         $Baseinfo = $daBaseinfo->limit($per)->offset(($page - 1) * $per)->sort('create_time', 'DESC')->find_all();
     } else {
         $Baseinfo = $daBaseinfo->limit($per)->offset(($page - 1) * $per)->sort('votes', 'DESC')->find_all();
     }
     $bllgoodbroker = new Bll_Goodbroker();
     $votelog = $bllgoodbroker->getVotelog();
     $brokers = '';
     $votes = array();
     if (!empty($Baseinfo)) {
         foreach ($Baseinfo as $row) {
             $brokers .= intval($row->broker_id) . ',';
         }
         $brokers = substr($brokers, 0, -1);
         $isvotes = $votelog->getVotesByUser($guid, $brokers);
         foreach ($isvotes as $row) {
             $votes[$row['broker_id']]['id'] = $row['id'];
         }
     }
     $total = $daTotal->count();
     $pager = Util_MultiPager::multiPage($params, '', $total, $per, 5, $indexUrl);
     $request->set_attribute('page', $page);
     $request->set_attribute('pager', $pager);
     $request->set_attribute('showPager', $total > $per);
     $request->set_attribute('showUrl', $showUrl);
     $request->set_attribute('indexUrl', $indexUrl);
     $request->set_attribute('baseinfo', $Baseinfo);
     $request->set_attribute('votes', $votes);
     $request->set_attribute('sort', $sort);
     return 'Goodbroker_Index';
 }
Esempio n. 5
0
 public function handle_request()
 {
     $id = 0;
     if (preg_match("/show\\/(\\d+)/", $_SERVER["REQUEST_URI"], $matches)) {
         if ($matches[1] && is_numeric($matches[1])) {
             $id = $matches[1];
         }
     }
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     $u = $params['u'];
     $guid = $request->get_guid();
     $broker_id = $request->getBrokerId();
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $homeUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/index";
     $deemUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/deem";
     $winUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/win";
     $dao = new Bll_Goodbroker();
     if ($u == 'c') {
         $info = $dao->getBrokerInfo($id);
     } else {
         $info = $dao->getBrokerInfo($id, 1);
         $vcr = '';
         if ($info['resource']) {
             foreach ($info['resource'] as $res) {
                 if ($res['resource_type'] == 2) {
                     $vcr = $res['resource_url'];
                     break;
                 }
             }
         }
     }
     if ($info === false) {
         $this->redirect($homeUrl);
     }
     if (time() < strtotime('2014-04-11')) {
         //检查是否已投票
         $isvote = Model_Goodbroker_Votelog::data_access()->filter('user_guid', $guid)->filter('vote_date', strtotime(date('Y-m-d')))->filter('broker_id', $id)->count();
         $request->set_attribute('isvote', $isvote);
     }
     $request->set_attribute('info', $info);
     $request->set_attribute('vcr', $vcr);
     $request->set_attribute('homeurl', $homeUrl);
     $request->set_attribute('deemurl', $deemUrl);
     $request->set_attribute('winurl', $winUrl);
     $request->set_attribute('isbroker', $broker_id == $id);
     return 'Goodbroker_Show';
 }
Esempio n. 6
0
 public function handle_request()
 {
     $CurrentUrl = APF::get_instance()->get_request()->get_current_url();
     if (!$this->isBrokerLogin()) {
         APF::get_instance()->get_response()->redirect(Uri_MemberUrl::login_url($CurrentUrl));
         exit;
     }
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $indexUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/index";
     $joinUrl = "http://my.{$baseDomain}{$baseUri}/goodbroker/join";
     $flag = '';
     if (preg_match("/join\\/(\\d+)/", $_SERVER["REQUEST_URI"], $matches)) {
         if ($matches[1] && is_numeric($matches[1])) {
             $flag = $matches[1];
         }
     }
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     $request->set_attribute('indexUrl', $indexUrl);
     $broker_id = $request->getBrokerId();
     //$broker_id = 100100;
     $user_id = $request->getUserId();
     $dao = new Bll_Goodbroker();
     //获取审核状态
     $verify = $dao->getIsVerify($broker_id);
     $is_verify = $verify === false ? $verify : $verify['is_verify'];
     $realname = $dao->getBrokername($broker_id);
     $info['realname'] = $realname;
     $request->set_attribute('realname', $realname);
     if ($is_verify === '0') {
         //报名未审核
         $request->set_attribute('code', '3');
         return 'Goodbroker_Info';
     } elseif ($is_verify == 1) {
         //审核通过
         $show_url = "http://my.{$baseDomain}{$baseUri}/goodbroker/show";
         $show_url .= '/' . $broker_id;
         $request->set_attribute('url', $show_url);
         $request->set_attribute('code', '1');
         return 'Goodbroker_Info';
     } elseif ($is_verify == 2 && $flag == '') {
         //审核不通过
         $show_url = "http://my.{$baseDomain}{$baseUri}/goodbroker/join";
         $show_url .= "/" . $broker_id;
         $request->set_attribute('reason', $verify['reason']);
         $request->set_attribute('url', $show_url);
         $request->set_attribute('code', '2');
         return 'Goodbroker_Info';
     }
     if ($is_verify == 2 && $flag == $broker_id) {
         //审核不通过重新修改资料
         $info = $dao->getBrokerInfo($broker_id);
         $request->set_attribute('info', $info);
     }
     $info['photo'] = strlen($params['default_photo']) == 32 ? $params['default_photo'] : $params['photoes'][0];
     if ($params['slogan'] && $params['story'] && $params['photoes']) {
         if (strlen($params['slogan']) > 100) {
             $error['slogan'] = '参赛口号限20字以内';
         } else {
             $info['slogan'] = htmlentities($params['slogan'], ENT_QUOTES | ENT_IGNORE, "UTF-8");
         }
         if (strlen($params['story']) > 2000) {
             $error['story'] = '个人故事限500字以内';
         } else {
             $info['story'] = htmlentities($params['story'], ENT_QUOTES | ENT_IGNORE, "UTF-8");
         }
         $photoes = $params['photoes'];
         if (count($photoes) < 3 || count($photoes) > 8) {
             $error['story'] = '照片数最少3张最多8张 ';
         }
         if (isset($error) && !empty($error)) {
             $request->set_attribute('error', $error);
         } else {
             $base = Bll_BrokerInfoApp::get_goodbroker_info($broker_id);
             $info['city_id'] = $base['city_id'];
             $info['phone'] = $base['phone'];
             $info['company_name'] = $base['company'];
             $info['store_name'] = $base['store'];
             //获取经纪人的注册时间以及在售房源数
             $info['register_time'] = $dao->getBrokerRegtime($user_id);
             $info['on_sale'] = Bll_Goodbroker::getSpreadProCount($broker_id, $base['city_id']);
             $dao->addBrokerInfo($broker_id, $info, $photoes);
             $request->set_attribute('code', '3');
             $this->redirect($joinUrl);
             //return 'Goodbroker_Info';
         }
     }
     return 'Goodbroker_Join';
 }