예제 #1
0
 public function getAreaCodesByParentId($p_parentId)
 {
     apf_require_class("ORM_AnjukeORM");
     $objORM = new ORM_AnjukeORM('ajk_commtype');
     $areaCodesList = $objORM->getList("ParentId = ?", array($p_parentId), true);
     return empty($areaCodesList) ? array() : $areaCodesList;
 }
예제 #2
0
 public function execute($input_parameters = NULL)
 {
     if (APF::get_instance()->is_debug_enabled()) {
         APF::get_instance()->debug(__CLASS__ . '[' . $this->pdo->config['dsn'] . '|' . $this->pdo->get_name() . ']' . "->execute: " . $this->queryString);
     }
     $logger = APF::get_instance()->get_logger();
     $logger->debug(__CLASS__, '[' . $this->pdo->get_name() . ']->execute: ', $this->queryString);
     APF::get_instance()->pf_benchmark_inc_begin('dbtime');
     $start = microtime(true);
     $ret = parent::execute($input_parameters);
     $end = microtime(true);
     APF::get_instance()->pf_benchmark_inc_end('dbtime');
     //add by hexin for record SQL execute time
     APF::get_instance()->pf_benchmark("sql_time", array($this->i => $end - $start));
     // 按照惯用格式记录sql执行时间和占用内存
     // added by htlv
     $tmp_time = $end - $start;
     $tmp_mem = memory_get_usage();
     apf_require_class('APF_Performance');
     APF::get_instance()->pf_benchmark("sql_time_af", array($this->i => array('sql' => $this->_sql, APF_Performance::MESSAGE_TIME => $tmp_time, APF_Performance::MESSAGE_MEMORY => $tmp_mem)));
     if (!$ret) {
         $error_info = parent::errorInfo();
         /**
          * remove duplicated error log
         $logger->error(__CLASS__, '['. $this->pdo->get_name() .']->execute: ', $this->queryString);
         $_error_info = preg_replace("#[\r\n \t]+#",' ',print_r($error_info,true));
         $logger->error(__CLASS__, '['. $this->pdo->get_name() .']->execute: ', $_error_info);
         */
         if (parent::errorCode() !== '00000') {
             throw new APF_Exception_SqlException($this->pdo->get_name() . ' | ' . $this->pdo->config['dsn'] . ' | ' . $this->queryString . ' | ' . join(' | ', $error_info), parent::errorCode());
         }
     }
     return $ret;
 }
예제 #3
0
 public function get_view()
 {
     $params = $this->get_params();
     $this->assign_data('menu', $params['menu']);
     $this->assign_data('index', $params['index']);
     //添加商业地产店铺城市列表
     $this->set_city_list();
     $this->assign_data('managespace_city_list', $this->managespace_city_list);
     $request = APF::get_instance()->get_request();
     $cityId = $request->getBrokerCityId();
     $this->assign_data('cityId', $cityId);
     $this->assign_data('isNewCommunityApplyCity', Bll_City::isNewCommunityApplyCity($cityId));
     //明星中介相关
     try {
         apf_require_class('Bll_Broker_StarIntermediary');
         $starBll = new Bll_Broker_StarIntermediary($cityId);
         $starIsOpen = $starBll->checkCityIfOpen();
         $brokerId = APF::get_instance()->get_request()->getBrokerId();
         $starInfo = $starBll->getBrokerNewestInfo($brokerId);
         if (empty($starInfo['broker'])) {
             $starIsOpen = 0;
         }
         $this->assign_data('starIsOpen', $starIsOpen);
     } catch (Exception $e) {
         //todo 不做任何处理,不展示明星中介内容
     }
     return "BrokerSideNav";
 }
예제 #4
0
 /**
  * @return APF_MQ_Stomp
  */
 public function load_stomp($name = "default")
 {
     $cfg = APF::get_instance()->get_config($name, 'mq');
     apf_require_class('APF_MQ_Stomp');
     $stomp = new APF_MQ_Stomp($cfg['uri']);
     return $stomp;
 }
예제 #5
0
파일: Xhprof.php 프로젝트: emilymwang8/cms
 public function insert_xprof()
 {
     apf_require_class('Aifang_Core_Bll_Tools_Xhprof');
     $bll = new Aifang_Core_Bll_Tools_Xhprof();
     $data = array('namespace' => $this->namespace, 'xhprof_data' => $this->xhprof_data);
     return $bll->insert_xhporf($data);
 }
예제 #6
0
 /**
  * 检查手机是否被用户使用
  * @param $mobile 手机号
  * @return bool true已被占用 false 没有被占用
  */
 public static function checkUserMobile($params)
 {
     $userAPIDomain = APF::get_instance()->get_config("user_api_url");
     $url = $userAPIDomain . "/memberapi/m";
     $postData = array("act" => "check_user_phone", "phone" => $params['mobile']);
     $postData = http_build_query($postData);
     //curl 获取结果
     apf_require_class("APF_Http_Client_Curl");
     $curl_client = new APF_Http_Client_Curl('post');
     //创建http客户端实例
     $curl_client->set_url($url);
     //设置URL
     $curl_client->set_attribute(CURLOPT_POSTFIELDS, $postData);
     $curl_client->set_attribute(CURLOPT_HTTPHEADER, array());
     $curl_client->set_attribute(CURLOPT_POST, 1);
     $curl_client->execute();
     $res = $curl_client->get_response_text();
     //从romar的http接口中获取推荐的数据
     if (isset($res)) {
         $res = json_decode($res);
     }
     if ($res->status == 'ok' && $res->result > 0) {
         return true;
     } else {
         return false;
     }
 }
예제 #7
0
파일: List.php 프로젝트: emilymwang8/cms
 public function handle_request_internel()
 {
     apf_require_class('Bll_App_Appparams');
     $params = $this->request->get_parameters();
     $page = isset($params['page']) ? (int) $params['page'] : 1;
     $page_size = 20;
     $offset = ($page - 1) * $page_size;
     $where = '';
     $kw = strip_tags($params['kw']);
     if ($kw) {
         $where = "cache_k like '%" . $kw . "%'";
     }
     $order = 'display_order asc,id desc';
     //分页的链接
     $prev = $page === 1 ? 1 : $page - 1;
     $next = $page + 1;
     $prev_uri = '/user/appsetting/?kw=' . $kw . '&page=' . $prev;
     $next_uri = '/user/appsetting/?kw=' . $kw . '&page=' . $next;
     $prev_url = PageHelper::gen_url($prev_uri);
     $next_url = PageHelper::gen_url($next_uri);
     $list = Bll_App_Appparams::get_instance()->fetchAll('*', $where, $order, $offset, $page_size);
     if ($list && is_array($list)) {
         $app_type = $this->get_config('app', 'app');
         foreach ($list as $k => $v) {
             $list[$k]['app_type'] = $app_type[$v['app']];
             $list[$k]['update_time'] = date('Y-m-d H:i:s', $v['updated']);
             $list[$k]['edit_url'] = '/user/appsetting/edit?id=' . $v['id'];
         }
     }
     $this->request->set_attribute('kw', $kw);
     $this->request->set_attribute('list_data', $list);
     $this->request->set_attribute('prev_url', $prev_url);
     $this->request->set_attribute('next_url', $next_url);
     return 'Appsetting_List';
 }
예제 #8
0
 public function getCommMapCorrectTrackList($userid, $opentime, $start, $limit)
 {
     apf_require_class("ORM_AnjukeORM");
     $orm = new ORM_AnjukeORM('log_modify_commmap');
     $rst = $orm->getList('UserId=? and PostTime > ? order by PostTime desc limit ' . $start . ',' . $limit, array($userid, $opentime), true);
     return empty($rst) ? array() : $rst;
 }
예제 #9
0
 /**
  * Returns new instance of pdo
  *
  * @param string $name
  * @return APF_DB_PDO
  */
 public function load_pdo($name = "default")
 {
     //var_dump($name);die();
     $apf = APF::get_instance();
     if ($apf->is_debug_enabled()) {
         $apf->benchmark_begin(__CLASS__ . ": open pdo '{$name}'");
     }
     $dbcfg = APF::get_instance()->get_config($name, "database");
     //var_dump($dbcfg);die();
     apf_require_class($this->pdo_class);
     //die();
     //var_dump($pdo);die();
     $pdo = new $this->pdo_class($dbcfg['dsn'], @$dbcfg['username'], @$dbcfg['password'], isset($dbcfg['driver_options']) ? $dbcfg['driver_options'] : array());
     //var_dump($pdo);die();
     $pdo->set_name($name);
     if (isset($dbcfg['default_fetch_mode'])) {
         $pdo->set_default_fetch_mode($dbcfg['default_fetch_mode']);
     }
     if (isset($dbcfg['init_statements'])) {
         foreach ($dbcfg['init_statements'] as $sql) {
             $pdo->exec($sql);
         }
     }
     if ($apf->is_debug_enabled()) {
         $apf->benchmark_end(__CLASS__ . ": open pdo '{$name}'");
     }
     return $pdo;
 }
예제 #10
0
 public function post($url, array $param, $ifJson = true)
 {
     $baseHost = $this->host;
     $postUrl = "http://" . $baseHost . "/" . $url;
     if ($ifJson) {
         $postData = json_encode($param);
     } else {
         $postData = http_build_query($param);
     }
     //curl 获取结果
     apf_require_class("APF_Http_Client_Curl");
     $curl_client = new APF_Http_Client_Curl('post');
     //创建http客户端实例
     $curl_client->set_url($postUrl);
     //设置URL
     $curl_client->set_attribute(CURLOPT_POST, 1);
     $curl_client->set_attribute(CURLOPT_POSTFIELDS, $postData);
     $curl_client->execute();
     $res = $curl_client->get_response_text();
     //从romar的http接口中获取推荐的数据
     unset($curl_client);
     if (isset($res)) {
         $res = json_decode($res);
         return $res;
     } else {
         return false;
     }
 }
예제 #11
0
 public function insert()
 {
     apf_require_class('Model_PersonalGalleryAI');
     $da = Model_PersonalGalleryAI::data_access();
     $da->set_field(Model_PersonalGalleryAI::STUB, 'a')->replace();
     $this->id = $da->connection->lastInsertId();
     return parent::insert();
 }
예제 #12
0
파일: Action.php 프로젝트: emilymwang8/ibug
 public static function get_action($action)
 {
     $class_name = $action;
     //'Ticket_Action'.$action;//先将action全部小写,然后首字母大写,得到对应的action类.
     apf_require_class($class_name);
     $ticket_action = new $class_name();
     return $ticket_action;
 }
예제 #13
0
 public function updateData($id, $data)
 {
     if (intval($id) > 0) {
         apf_require_class('DAO_My_Broker_Introduction');
         $dao = new DAO_My_Broker_Introduction();
         $result = $dao->updateIntroduction($id, $data);
         return $result;
     }
 }
예제 #14
0
 public function insertData($data)
 {
     if (intval($data['BrokerId']) > 0) {
         apf_require_class('DAO_Broker_Suggestion');
         $dao = new DAO_Broker_Suggestion();
         $result = $dao->addSuggestion($data);
         return $result;
     }
 }
예제 #15
0
 public function updateData($data)
 {
     if (intval($data['Id']) > 0) {
         apf_require_class('DAO_Broker_Suggestion');
         $dao = new DAO_Broker_Suggestion();
         $result = $dao->updateSuggestion($data['Id'], $data);
         print_r($result);
     }
 }
예제 #16
0
파일: Add.php 프로젝트: emilymwang8/cms
 /**
  * 处理提交保存
  */
 private function handle_form($params)
 {
     apf_require_class('Bll_App_Appparams');
     $config_sercet = $this->get_config('sercet', 'app');
     $flag = false;
     $message = '';
     $return_url = 'http://' . $_SERVER['HTTP_HOST'] . '/user/appsetting/add';
     $data = array();
     if ($config_sercet != $params['sercet']) {
         $message = '口令不正确!请核对';
     } else {
         if (empty($params['cache_k']) || empty($params['note']) || !in_array($params['app'], array(1, 2, 3))) {
             $message = '输入参数不完整';
         } else {
             $cache_k = $params['cache_k'];
             $result = Bll_App_Appparams::get_instance()->getCount("cache_k = '" . $cache_k . "'");
             if ($result) {
                 $message = '已经存在该设置项';
             } else {
                 if (preg_match("/^\\w+\$/", $params['cache_k'])) {
                     $flag = true;
                     $data['cache_k'] = $params['cache_k'];
                     $data['display_order'] = $params['display_order'];
                     $data['cache_v'] = $params['cache_v'];
                     $data['app'] = (int) $params['app'];
                     $data['note'] = $params['note'];
                 } else {
                     $message = '数据格式错误';
                 }
             }
         }
     }
     if ($flag) {
         //$id = Bll_App_Appparams::get_instance()->add($data);
         $url = 'http://' . $_SERVER['HTTP_HOST'] . '/user/appsetting/list';
         apf_require_class('Tools_Curl');
         $curl = new Tools_Curl();
         $save_setting_url = $this->get_config('save_setting_url', 'app');
         $post_data = array('cache_k' => $data['cache_k'], 'cache_v' => $data['cache_v'], 'app' => $data['app'], 'note' => $data['note'], 'display_order' => $data['display_order']);
         $curl_result = $curl->post($save_setting_url, $post_data);
         $response_data = json_decode($curl_result, true);
         if (isset($response_data['status']) && $response_data['status'] == 'ok') {
             $this->response->redirect($url);
             exit;
         } else {
             echo '远程API接口无法响应,添加失败<br>';
             echo '<a href="' . $return_url . '">点击返回</a>';
             exit;
         }
     } else {
         echo $message;
         echo '<br>';
         echo '<a href="' . $return_url . '">返回</a>';
         exit;
     }
 }
예제 #17
0
 /**
  * @return APF_Cache_Filecache
  */
 public function load_filecache()
 {
     apf_require_class($this->filecache_class);
     $filecache = new $this->filecache_class();
     $cache_dir = @APF::get_instance()->get_config("cache_dir", "cache");
     if ($cache_dir) {
         $filecache->set_cache_dir($cache_dir);
     }
     return $filecache;
 }
예제 #18
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $broker = self::$BrokerInfo;
     $brokerIdentity = Bll_BrokerBaseBll::get_instance()->get_broker_identity_info_v2($broker['BaseInfo']['brokerId']);
     if (empty($broker['BaseInfo']) || empty($brokerIdentity)) {
         apf_require_class("Uri_Http");
         //Uri_Http::redirect_header("/user/broker/new/brokerinfo/");
         Uri_Http::redirect_header("/ajkbroker/broker/modify/brokerinfo/");
     }
     $broker['UsrCardState'] = $brokerIdentity['IdentityInfo']['usrCardState'];
     $broker['UsrPhotoTmpState'] = $brokerIdentity['IdentityInfo']['userPhotoTmpState'];
     $broker['UsrPhotoState'] = $brokerIdentity['IdentityInfo']['userPhotoState'];
     $broker['BnsCardState'] = $brokerIdentity['IdentityInfo']['bnsCardState'];
     $broker['CheckState'] = $brokerIdentity['IdentityInfo']['checkState'];
     //        $area = $this->getBlockName(substr($broker['BaseInfo']['areaCode'], 4, 4));
     //        $block = $this->getBlockName(substr($broker['BaseInfo']['areaCode'], 8, 4));
     $area = Bll_Commtype_Api::getInfoByTypeCodeV2(substr($broker['BaseInfo']['areaCode'], 0, 8));
     $block = Bll_Commtype_Api::getInfoByTypeCodeV2($broker['BaseInfo']['areaCode']);
     $broker['CityName'] = $this->getCityName($broker['BaseInfo']['cityId']);
     $broker['AreaName'] = $area['typeName'];
     $broker['BlockName'] = $block['typeName'];
     //获得最后提交资料
     $lastupdata = Bll_BrokerBaseBll::get_instance()->getLastPostFile($broker['BaseInfo']['brokerId']);
     $brokerCheckInfoBll = new Bll_Broker_BrokerCheckInfo();
     //获取经纪人最近一次头像或名片审核不通过的原因记录
     if ($broker['UsrPhotoState'] == 2) {
         $brokerTheLastCheck = $brokerCheckInfoBll->getBrokerTheLastCheckInfo($broker['BaseInfo']['brokerId'], 1);
         $faceLastCheckInfo = $brokerTheLastCheck['content'];
     } else {
         $faceLastCheckInfo = $brokerCheckInfoBll->getNoPassExp($broker['BaseInfo']['brokerId'], 1);
         //1图像
     }
     $brokerTheLastCheckInfo = $brokerCheckInfoBll->getBrokerTheLastCheckInfo($broker['BaseInfo']['brokerId'], 2);
     //名片
     $mingpianLastCheckInfo = $brokerCheckInfoBll->getNoPassExp($broker['BaseInfo']['brokerId'], 3);
     //名片
     $idCardLastCheckInfo = $brokerCheckInfoBll->getNoPassExp($broker['BrokerId'], 2);
     //电话锁定状态
     $phoneLockInfo = $brokerCheckInfoBll->getLockStatus($broker['BaseInfo']['brokerId']);
     if ($phoneLockInfo['company_id'] == $broker['BaseInfo']['companyId'] && $phoneLockInfo['status'] == 1) {
         $phoneLockStatus = 1;
     } else {
         $phoneLockStatus = 0;
     }
     $request->set_attribute('broker', $broker);
     $request->set_attribute('lastupdata', $lastupdata);
     $request->set_attribute('faceLastCheckInfo', $faceLastCheckInfo);
     $request->set_attribute('mingpianLastCheckInfo', $mingpianLastCheckInfo);
     $request->set_attribute('phoneLockStatus', $phoneLockStatus);
     $request->set_attribute('idCardLastCheckInfo', $idCardLastCheckInfo);
     $request->set_attribute('brokerTheLastCheckInfo', $brokerTheLastCheckInfo);
     return 'Broker_BrokerInfo';
 }
예제 #19
0
파일: Status.php 프로젝트: emilymwang8/ibug
 public static function get_status($ticket)
 {
     $status_str = $ticket->status;
     $status_str = strtolower($status_str);
     $status_str = ucfirst($status_str);
     $class_name = 'Ticket_Status' . $status_str;
     //先将status_str全部小写,然后将首字母大写,得到对应的状态类.
     apf_require_class($class_name);
     $ticket_status = new $class_name($ticket->id);
     return $ticket_status;
 }
예제 #20
0
 protected function set_guid()
 {
     $strGuid = APF::get_instance()->get_request()->get_cookie("aQQ_ajkguid");
     if (empty($strGuid) || strlen($strGuid) != 36) {
         apf_require_class("Util_Guid");
         $CGuid = new Util_Guid();
         $strGuid = $CGuid->toString();
         APF::get_instance()->get_response()->set_cookie('aQQ_ajkguid', $strGuid, 3600 * 24 * 365);
         unset($CGuid);
     }
     APF::get_instance()->get_request()->set_guid($strGuid);
 }
예제 #21
0
파일: Factory.php 프로젝트: uedcw/webstory
 /**
  * 创建DFS实例. 根据name,从配置文件获取信息创建实例.
  *
  * @param string $name
  * @return APF_DB_PDO
  */
 protected function create_dfs($name)
 {
     $apf = APF::get_instance();
     $config = $apf->get_config($name, self::CONFIG_F_DFS);
     if (!isset($config[self::CONFIG_N_CLASS])) {
         throw new Exception("class not provided for dfs::{$name}");
     }
     $class = $config[self::CONFIG_N_CLASS];
     apf_require_class($class);
     $dfs = new $class();
     $dfs->init($config);
     return $dfs;
 }
예제 #22
0
 /**
  * @param $id
  * @return array|mixed|null
  */
 public static function get_property_type_info($id)
 {
     apf_require_class('Model_Property_Type');
     $da = Model_Jinpu_PropertyType::data_access();
     $property_type_info = null;
     try {
         $property_type_info = $da->find_by_pk($id);
         unset($da);
     } catch (Exception $e) {
         $property_type_info->name = null;
     }
     return $property_type_info;
 }
예제 #23
0
파일: PDO.php 프로젝트: emilymwang8/cms
 public function __construct($dsn, $username = "", $password = "", $driver_options = array())
 {
     if (!self::$pdo_statement_class) {
         self::$pdo_statement_class = APF::get_instance()->get_config('pdo_statement_class', 'database');
         if (!self::$pdo_statement_class) {
             self::$pdo_statement_class = 'APF_DB_PDOStatement';
         }
         apf_require_class(self::$pdo_statement_class);
     }
     parent::__construct($dsn, $username, $password, $driver_options);
     $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array(self::$pdo_statement_class, array($this)));
     $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
     $this->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
 }
예제 #24
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $brokerId = $request->getBrokerId();
     $userId = $request->getUserId();
     $params = $request->get_parameters();
     $BrokerServiceObj = new Bll_Service_Broker();
     $sq1 = $BrokerServiceObj->getBasicInfo(array('brokerId' => $brokerId));
     $replies1 = $BrokerServiceObj->aps_wait_for_replies();
     if (empty($replies1)) {
         apf_require_class("Uri_Http");
         Uri_Http::redirect_header('/user/broker/new/brokeremail?type=modify');
     }
     $oldEmail = $replies1[$sq1]['data']['email'];
     $flag = 0;
     if ($request->is_post_method()) {
         $password = Bll_Broker_User::getPasswordByUserId($userId);
         if (base64_encode(md5($params['password'])) == $password) {
             $userIdByEmail = Bll_Broker_User::getUserIdByEmail($params['email']);
             if (empty($userIdByEmail)) {
                 try {
                     //可以更改邮箱
                     $apsParams = array('brokerId' => $brokerId, 'email' => trim($params['email']));
                     $sq2 = $BrokerServiceObj->setBasicInfo($apsParams);
                     $replies2 = $BrokerServiceObj->aps_wait_for_replies();
                     $flag = $replies2[$sq2]['status'] == 'ok' ? Broker_EditEmailController::EDIT_SUCCESS : Broker_EditEmailController::EDIT_ERROR;
                 } catch (Exception $e) {
                     $flag = Broker_EditEmailController::EDIT_ERROR;
                 }
             } else {
                 //邮箱已经存在
                 //$flag = $userIdByEmail == $userId ? Broker_EditEmailController::EDIT_ERROR : Broker_EditEmailController::EMAIL_IS_EXIST;
                 $flag = Broker_EditEmailController::EMAIL_IS_EXIST;
             }
         } else {
             if (empty($params['password'])) {
                 $flag = Broker_EditEmailController::PASSWORD_EMPTY;
             } else {
                 $flag = Broker_EditEmailController::PASSWORD_ERROR;
             }
         }
         $request->set_attribute("newEmail", $params['email']);
         $request->set_attribute("url", $this->getURL('my', '/ajkbroker/broker/brokerinfo'));
     }
     $request->set_attribute("flag", $flag);
     $request->set_attribute("oldEmail", $oldEmail);
     return "Broker_EditEmail";
 }
예제 #25
0
 public function get_inline_styles()
 {
     $url = $this->get_boundable_styles_url();
     $key = "css-" . md5($url);
     apf_require_class('APF_Cache_Factory');
     $mem = APF_Cache_Factory::get_instance()->get_memcache();
     $css = $mem->get($key);
     if ($css) {
         return $css;
     }
     apf_require_class('APF_Http_Client_Factory');
     $c = APF_Http_Client_Factory::get_instance()->get_curl();
     $c->set_url($url);
     $c->execute();
     $css = $c->get_response_text();
     $mem->set($key, $css, 0, 0);
     return $css;
 }
예제 #26
0
 public function before()
 {
     $params = APF::get_instance()->get_request()->get_parameters();
     if ($params['doc'] == 1) {
         return self::STEP_CONTINUE;
     }
     $request_uri = isset($_SERVER['ORGINAL_REQUEST_URI']) ? $_SERVER['ORGINAL_REQUEST_URI'] : $_SERVER['REQUEST_URI'];
     $pos = strpos($request_uri, '?');
     if ($pos !== false) {
         $request_uri = str_replace("/mobile-ajk-broker", '', substr($request_uri, 0, $pos));
     } else {
         $request_uri = str_replace("/mobile-ajk-broker", '', $request_uri);
     }
     $app_key = $_SERVER['HTTP_KEY'];
     $shared_keys = APF::get_instance()->get_config('signature', 'mobile_api');
     $shared_key = $shared_keys[$app_key];
     $request_body = file_get_contents('php://input');
     // 先尝试使用新的方法验证签名
     $debug_nocheck_flag = APF::get_instance()->get_config('debug_nocheck_flag');
     $sig = $this->signature($request_uri, $_GET, $_POST, $request_body, $shared_key);
     //echo "<pre>";print_r($sig);exit;
     if ($sig == $_SERVER['HTTP_SIG'] || isset($params["is_nocheck"]) && $params["is_nocheck"] == 1 || $debug_nocheck_flag) {
         return self::STEP_CONTINUE;
     } else {
         apf_require_class('Util_Nlog_NLogger');
         $logger = Util_Nlog_NLogger::get_instance();
         $log_force = APF::get_instance()->get_config('log_force', 'nlogger');
         $data['HTTP_KEY'] = $app_key;
         $data['HTTP_SIG'] = $_SERVER['HTTP_SIG'];
         $data['sig_finalstr'] = $this->_sig_finalstr;
         $data['sig'] = $sig;
         $data['request_uri'] = $request_uri;
         $data['REQUEST_GET'] = $_GET;
         $data['REQUEST_POST'] = $_POST;
         $data['request_body'] = $request_body;
         $key = 'signatrue_' . date("Y-m-d H:i:s");
         $str = json_encode(array($key => $data));
         $logger->log('apierror', $str, $log_force);
     }
     echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_SIG_INVALID));
     return self::STEP_EXIT;
 }
예제 #27
0
 /**
  * 检查手机是否被用户使用
  *
  * @param $mobile 手机号
  * @return bool true已被占用 false 没有被占用
  */
 public function checkUserMobile($mobile)
 {
     $userAPIDomain = APF::get_instance()->get_config("user_api_url");
     $url = $userAPIDomain . "/memberapi/m";
     $postData = array("act" => "check_user_phone", "phone" => $mobile);
     //curl 获取结果
     apf_require_class("APF_Http_Client_Curl");
     $curl_client = new APF_Http_Client_Curl('post');
     //创建http客户端实例
     $curl_client->set_url($url);
     //设置URL
     $curl_client->set_attribute(CURLOPT_POSTFIELDS, $postData);
     $curl_client->execute();
     $res = $curl_client->get_response_text();
     //从romar的http接口中获取推荐的数据
     if (isset($res)) {
         $res = json_decode($res);
     }
     return $res;
 }
예제 #28
0
 public function handle_request_internal()
 {
     if (!$this->ip_check()) {
         return Util_MobileAPI::error_tmp('ip_invalid', $this->error_map('ip_invalid'));
     }
     if (!isset($this->_params['user_id'])) {
         return Util_MobileAPI::error_tmp('user_id_miss', $this->error_map('user_id_miss'));
     }
     if (!$this->check_msg_code($this->_params['msg_code'])) {
         return Util_MobileAPI::error_tmp('msg_code_invalid', $this->error_map('msg_code_invalid'));
     }
     $user_id = $this->_params['user_id'];
     $msg_code = $this->_params['msg_code'];
     $addon = $this->_params['addon'] ?: '';
     $from = $this->_params['from'] ?: '';
     $msg = $this->gen_msg($user_id, $msg_code, $addon, $from);
     $redis = $this->get_redis();
     try {
         //添加逻辑判断待发送信息的经纪人是否开通微聊
         $activeBorker = Model_Mobile_BrokerChatInfo::getActiveBroker($user_id, array('chatId'));
         if (empty($activeBorker)) {
             $redis->lPush($this->queue_name, $msg);
         } else {
             //添加发送公众号信息逻辑
             //发送公众号信息
             if ($activeBorker['chatId']) {
                 $msg_map = APF::get_instance()->get_config('msg_conf', 'mobile_api');
                 $text = $msg_map[$msg_code];
                 if ($msg_code === 'BROKER_PLAN_LIMIT') {
                     //定价计划限额到达需要特殊处理。
                     $text = $addon . $text;
                 }
                 apf_require_class('Bll_Chat');
                 $result = Bll_Chat::sendPublicMsg($activeBorker['chatId'], $text);
             }
         }
     } catch (RedisException $e) {
         return Util_MobileAPI::error_tmp('push_failed', $e->getMessage());
     }
     return array('status' => 'ok', 'data' => '操作成功');
 }
예제 #29
0
<?php

apf_require_class('Bll_TicketBiz');
apf_require_class('Bll_ReportDayOnlineBiz');
apf_require_class('Bll_DdCommonBiz');
$departments = Bll_DdCommonBiz::get_instance()->get_departments_new();
foreach ($departments as $depart) {
    $tickets = Bll_TicketBiz::get_instance()->get_count_online_bugs($depart->id);
    if ($tickets) {
        $count = count($tickets);
    } else {
        $count = 0;
    }
    $day = date("Y-m-d");
    $current_time = date("Y-m-d H:i:s");
    $input_arr = array('day' => $day, 'department' => $depart->value, 'type_key' => 'all', 'type_value' => '0', 'count' => $count, 'created_at' => $current_time);
    $count_id = Bll_ReportDayOnlineBiz::get_instance()->insert_count_data($input_arr);
}
echo date('c ') . " Count day online bugs ok \n";
예제 #30
0
파일: NoAuth.php 프로젝트: emilymwang8/ibug
<?php

apf_require_class('Util_AuthorCrypt');
class NoAuthInterceptor extends APF_Interceptor
{
    public function before()
    {
        $ret = parent::before();
        $request = APF::get_instance()->get_request();
        $cookiename = APF::get_instance()->get_config('AuthCookieName');
        $cookie = @$request->get_cookie($cookiename);
        // 为flash上传做的改动
        if (empty($cookie)) {
            $cookie = $request->get_parameter($cookiename);
        }
        $is_myself = self::is_auth($cookie);
        if (!$is_myself) {
            $request->set_user_id(0);
            $request->set_username('none');
        }
        if ($ret != self::STEP_CONTINUE) {
            return $ret;
        }
        return self::STEP_CONTINUE;
    }
    public static function is_auth($cookie)
    {
        $request = APF::get_instance()->get_request();
        if ($cookie) {
            $is_flash = @$request->get_parameter("is_flash");
            if ($is_flash) {