Ejemplo n.º 1
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     if (method_exists($this, "_init")) {
         $this->_init();
     }
 }
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $this->getConfig();
     $this->alipay_config = $this->getAlipayConfig();
     //引入支付官方sdk
     vendor('alipay_submit', APP_PATH . 'Api/Vendor/InternationalAlipay/', '.class.php');
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     if (isset($_GET['labId'])) {
         $this->labModel = new LabModel($_GET['labId']);
     }
     $this->map = ['id' => '_id'];
 }
Ejemplo n.º 4
0
 function __construct()
 {
     parent::__construct();
     if (isset($_GET['labId'])) {
         $this->model = new LabModel($_GET['labId']);
     } else {
         $this->ajaxReturn($this->error('未给出实验室ID'));
     }
 }
 public function __construct()
 {
     parent::__construct();
     //		$oauth = new ThinkOAuth2();
     //		$ac = I('request.access_token');
     //		if(empty($ac)) $this->response(array('info'=> C('errorcode.2001'), 'code'=>2001) , 'json');
     //		$access_token = $oauth->getAccessToken($ac);
     //		if(empty($access_token)) $this->response(array('info'=>C('errorcode.2002') , 'code'=>2002) , 'json');
     //		if( time()-$access_token['expires'] < 0 ) $this->response(array('info'=>C('errorcode.2003') , 'code'=>2003) , 'json');
 }
 public function __construct()
 {
     parent::__construct();
     $client_id = C('CLIENT_ID');
     $client_secret = C('CLIENT_SECRET');
     $config = array('client_id' => $client_id, 'client_secret' => $client_secret, 'site_url' => C("SITE_URL"));
     $client = new OAuth2ClientService($config);
     $access_token = $client->getAccessToken();
     if ($access_token['status']) {
         $this->assign("access_token", $access_token['info']);
     }
     $this->assign("error", $access_token);
 }
 public function __construct()
 {
     parent::__construct();
     $oauth = new ThinkOAuth2();
     $ac = I('request.access_token');
     if (empty($ac)) {
         $this->response(array('info' => '未传入access_token', 'code' => 8001), 'json');
     }
     $access_token = $oauth->getAccessToken($ac);
     if (empty($access_token)) {
         $this->response(array('info' => 'access_token错误', 'code' => 8002), 'json');
     }
 }
 public function __construct()
 {
     //加载错误代码配置
     L(include APP_PATH . 'Api/Conf/error_code.php');
     parent::__construct();
     if (MODULE_NAME == 'ApiBase') {
         $this->sendHttpStatus(404);
         exit;
     }
     //var_dump($_GET);
     $this->_type = 'html';
     //获取token
     if ($this->is_check_token) {
         $this->check_token();
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->_model = new \Think\Model();
     $this->user = new \Home\Model\UserModel();
 }
 /**
  * 魔术方法
  *
  * @param
  *        	method 方法名
  * @param
  *        	args 参数
  *        	
  */
 public function __call($method, $args)
 {
     if (0 === strcasecmp($method, 'Callback')) {
         $this->_before_run();
         if (0 == strcmp($this->_method, 'get')) {
             $this->login(I('param.state'), I('param.code'));
         }
         redirect('/Home/ErrorMessage.html?errcode=0');
     } else {
         parent::__call($method, $args);
     }
 }
Ejemplo n.º 11
0
 protected function response($data, $model = null, $is_table = false)
 {
     /*
      * 格式化数据
      * **/
     if ($model) {
         $data = Schema::data_format($data, $model, $is_table);
     }
     return parent::response($data, 'json');
 }
 /**
  * 重载数据编码。
  * @param  mixed  $data  数据
  * @param  string $type  数据格式
  * @return string        格式化化后的字符串
  */
 protected function encodeData($data, $type = '')
 {
     if (APP_DEBUG) {
         trace('重载数据编码encodeData...');
     }
     if (empty($data)) {
         return '';
     }
     if ('json' == $type) {
         //设置内容类型
         $this->setContentType($type);
         //设置数据
         return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
     } else {
         return parent::encodeData($data, $type);
     }
 }
 /**
  * 构造函数
  */
 public function __construct()
 {
     parent::__construct();
     $this->getConfig();
     $this->alipay_config = $this->getAlipayConfig();
 }