Ejemplo n.º 1
0
$aeskey = WxApi::getInstance()->getAeskey();
$echoStr = rawurldecode(Env::getRequest('echoStr'));
if (strcmp($msgSignature, md5($aeskey . $timestamp)) != 0) {
    Env::iExit('access denied');
}
if (!empty($echoStr)) {
    WxApi::getInstance()->resetCorp();
    Env::iExit($echoStr);
}
// 接收信息处理
$result = trim(file_get_contents("php://input"), " \t\n\r");
// 解析
if (!empty($result)) {
    $msg = json_decode($result, true);
    if (!empty($msg)) {
        $uid = UserBinding::model()->fetchUidByValue($msg['properties']['userId'], 'wxqy');
        if ($uid) {
            dologin($uid);
            $factory = new Factory();
            $res = $factory->createHandle($msg['class'], $msg['properties'])->handle();
        } else {
            $res = resByText($userId, $corpId, $newTime, '您的账号尚未绑定,无法进行任何操作');
        }
        Env::iExit($res);
    } else {
        Env::iExit('');
    }
}
/**
 * 以文本格式回复
 * @param string $userId
Ejemplo n.º 2
0
defined('TIMESTAMP') or define('TIMESTAMP', time());
$yii = PATH_ROOT . '/library/yii.php';
$mainConfig = (require_once PATH_ROOT . '/system/config/common.php');
require_once $defines;
require_once $yii;
require_once '../../login.php';
Yii::setPathOfAlias('application', PATH_ROOT . DIRECTORY_SEPARATOR . 'system');
Yii::createApplication('application\\core\\components\\Application', $mainConfig);
$signature = Env::getRequest('signature');
$aeskey = Setting::model()->fetchSettingValueByKey('aeskey');
$userId = Env::getRequest('userid');
if (strcmp($signature, md5($aeskey . $userId)) != 0) {
    Env::iExit("签名错误");
}
if (!empty($userId)) {
    $uid = UserBinding::model()->fetchUidByValue($userId, 'wxqy');
    if ($uid) {
        dologin($uid);
        if (!Ibos::app()->user->isGuest) {
            $redirect = Env::getRequest('redirect');
            $url = base64_decode($redirect);
            $parse = parse_url($url);
            if (isset($parse['scheme'])) {
                header('Location:' . $url, true);
                exit;
            } else {
                header('Location:../../../' . $url, true);
                exit;
            }
        }
        Env::iExit(Ibos::app()->user->isGuest ? 'fail' : 'success');