コード例 #1
0
ファイル: IndexController.php プロジェクト: fanqimeng/4tweb
 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     $charset = 'utf-8';
     $_windidkey = $this->getInput('windidkey', 'get');
     $_time = (int) $this->getInput('time', 'get');
     $_clientid = (int) $this->getInput('clientid', 'get');
     if (!$_time || !$_clientid) {
         $this->output(WindidError::FAIL);
     }
     $clent = $this->_getAppDs()->getApp($_clientid);
     if (!$clent) {
         $this->output(WindidError::FAIL);
     }
     if (WindidUtility::appKey($clent['id'], $_time, $clent['secretkey']) != $_windidkey) {
         $this->output(WindidError::FAIL);
     }
     $time = Windid::getTime();
     if ($time - $_time > 120) {
         $this->output(WindidError::TIMEOUT);
     }
     $charset = $clent['charset'] == 1 ? 'utf8' : 'gbk';
     $baseUrl = Wind::getApp()->getRequest()->getBaseUrl(true) . '/';
     $config = array('windid' => 'client', 'serverUrl' => $baseUrl, 'clientId' => $clent['id'], 'clientKey' => $clent['secretkey'], 'clientDb' => 'mysql', 'clientCharser' => $charset);
     WindidClientBo::getInstance($config);
 }
コード例 #2
0
ファイル: WindidClientBo.php プロジェクト: fanqimeng/4tweb
 public static function getInstance($config = array())
 {
     if (!isset(self::$_clientBo)) {
         self::$_clientBo = new self($config);
     }
     return self::$_clientBo;
 }
コード例 #3
0
ファイル: IndexController.php プロジェクト: fanqimeng/4tweb
 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     $_windidkey = $this->getInput('windidkey', 'get');
     $_time = (int) $this->getInput('time', 'get');
     $_clentid = (int) $this->getInput('clientid', 'get');
     WindidClientBo::getInstance();
     $client = Windid::client();
     if (WindidUtility::appKey($client->clientId, $_time, $client->clientKey) != $_windidkey) {
         $this->showError('fail');
     }
     $time = Windid::getTime();
     if ($time - $_time > 120) {
         $this->showError('timeout');
     }
 }
コード例 #4
0
ファイル: Windid.php プロジェクト: fanqimeng/4tweb
 public static function client()
 {
     return WindidClientBo::getInstance();
 }
コード例 #5
0
ファイル: notify.php プロジェクト: sanzhumu/nextwind
<?php

require_once 'windid/src/windid/WindidApi.php';
require_once 'windid/src/windid/service/client/bo/WindidClientBo.php';
require_once 'windid/src/windid/library/WindidUtility.php';
$notify = array('999' => 'test', '101' => 'addUser', '111' => 'synLogin', '112' => 'synLogout', '201' => 'editUser', '202' => 'editUserInfo', '203' => 'uploadAvatar', '211' => 'editCredit', '222' => 'editMessageNum', '301' => 'deleteUser');
//check
$_windidkey = getInput('windidkey', 'get');
$_time = (int) getInput('time', 'get');
$_clentid = (int) getInput('clientid', 'get');
WindidClientBo::getInstance();
$client = Windid::client();
if (WindidUtility::appKey($client->clientId, $_time, $client->clientKey, $_GET, $_POST) != $_windidkey) {
    $this->showError('fail');
}
$time = Windid::getTime();
if ($time - $_time > 120) {
    showError('timeout');
}
$operation = (int) getInput('operation', 'get');
$uid = (int) getInput('uid', 'get');
if (!$uid) {
    showError('fail');
}
if (!isset($notify[$operation])) {
    showError('fail');
}
$method = $notify[$operation];
$notify = new notify();
if (!method_exists($notify, $method)) {
    showError('fail');