示例#1
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';
 }
示例#2
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';
 }