Exemplo n.º 1
0
/**
 * 处理附件下载
 * @param string $userId 微信用户ID
 * @param integer $appId 应用ID
 * @param string $aid 带附件类型的附件ID字符串
 * @return mixed
 */
function doAttachDownload($userId, $appId, $aid)
{
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $isIphone = strpos($agent, 'iphone') ? true : false;
    list($type, $id) = explode('/', $aid);
    if ($type == 'cloud') {
        list($id, $cloud) = explode('-', $id);
    } else {
        $cloud = 0;
    }
    $attachs = Attach::getAttachData($id);
    $attach = array_shift($attachs);
    if ($attach['uid'] != Ibos::app()->user->uid) {
        return close('您没有权限下载此文件');
    }
    $filepath = File::getAttachUrl() . '/' . $attach['attachment'];
    if ($cloud) {
        $core = new FileCloud($cloud);
        $url = $core->getRealUrl($filepath);
    } else {
        $url = Ibos::app()->request->getHostInfo() . '/' . $filepath;
    }
    if ($isIphone) {
        header('Location:' . $url, true);
        exit;
    } else {
        Env::iExit("<h1>微信现只支持IOS系统在微信内打开下载,请长按链接选择打开或者复制下载链接到手机浏览器下载<br/>{$url}</h1>");
    }
}
Exemplo n.º 2
0
// 接收信息处理
$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
 * @param string $corpId
 * @param integer $newTime
 * @param string $text
 * @return string
 */
function resByText($userId, $corpId, $newTime, $text = '')
{
    return "<xml>\r\n\t   <ToUserName><![CDATA[{$userId}]]></ToUserName>\r\n\t   <FromUserName><![CDATA[{$corpId}]]></FromUserName> \r\n\t   <CreateTime>{$newTime}</CreateTime>\r\n\t   <MsgType><![CDATA[text]]></MsgType>\r\n\t   <Content><![CDATA[{$text}]]></Content>\r\n\t</xml>";
}
Exemplo n.º 3
0
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');
    }
}
Env::iExit('用户验证失败,尝试以下步骤的操作:<br/>' . '1、在“微信企业号->通讯录”,找到并删除该用户<br/>' . '2、在“IBOS后台->微信->部门及用户同步”,同步该用户<br/>' . '3、邀请该用户关注企业号<br/>' . '如果还存在此提示,请将问题反馈给我们的工作人员');