コード例 #1
0
ファイル: RESTful.php プロジェクト: qichilu/bnx-member
 public function display($data = [])
 {
     ($viewMode = $this->_view_mode) || ($viewMode = Config::get('project', ['view_mode' => 'Json'])['view_mode']);
     http_response_code($this->respCode);
     $view = VFactory::getInstance($viewMode);
     $view->render($data);
 }
コード例 #2
0
ファイル: ControllerBase.php プロジェクト: qichilu/bnx-member
 function checkSign()
 {
     //        $token = \apache_request_headers()['token'];
     $headers = apache_request_headers();
     //        if(isset($headers['token']) && $)
     return isset($headers['Token']) && $headers['Token'] == Config::get('express')['server_token'];
 }
コード例 #3
0
ファイル: RFramework.php プロジェクト: qichilu/bnx-member
 /**
  * 运行时
  * @param $rootPath
  */
 public static function run($rootPath = '')
 {
     self::$rFramePath = \dirname(__DIR__) . DIRECTORY_SEPARATOR;
     self::setRootPath($rootPath);
     //        echo self::$rootPath;
     //        echo 'config path:', $configPath, "<br>";
     //注册autoLoad函数
     \spl_autoload_register(__CLASS__ . '::autoLoader');
     Config::load(self::getConfigPath());
     $timeZone = Config::get('time_zone', 'Asia/Shanghai');
     \date_default_timezone_set($timeZone);
     $serverMode = Config::get('server_mode');
     //        var_dump($serverMode);
     Factory::getInstance($serverMode)->run();
     //        $control = new \Controller\MainController();
     //        $control->mainGet();
 }
コード例 #4
0
 public function mainPut()
 {
     $post_id = $type = '';
     parse_str($this->_params[0]);
     //        var_dump($this->checkSign());
     if (!$post_id || !$type || !$this->checkSign()) {
         return $this->getError(Error::ERROR_PARAMS);
     }
     $express = new ExpressFree(Config::get('express')['free_secret']);
     $typeArr = $express->getTypeInfo($type);
     if (!$typeArr) {
         return $this->getError(Error::ERROR_POST_NOT_SUPPORT);
     }
     $key = $typeArr['type'] . '_' . $post_id;
     $res = $express->query($type, $post_id);
     $this->cache->putCache($key, $res, $this->cache_type);
     return ['status' => 0, 'message' => 'ok'];
 }