<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$result = $api->getUserMobile($companyId, $model->getToken($companyId), getClientIp(), $openId);
OpenUtils::outputJson($result);
<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$userlist = $api->getUserList($companyId, $model->getToken($companyId), getClientIp());
OpenUtils::outputJson($userlist);
<?php

//负责接收 设置第三方应用的开通状态 http://第三方应用/api/corporation/statuschange 的开启关闭状态
require '../../lib.php';
$companyId = $_GET['company_id'];
$hashkey = $_GET['hashkey'];
$status = $_GET['status'];
if ($hashkey == md5($companyId . OpenConfig::APPID . OpenConfig::APPSECRET)) {
    $model = new CSCorpModel();
    $model->setStatus($companyId, $status);
    $data = array('ret' => 0, 'msg' => "关闭成功,({$status})");
} else {
    $data = array('ret' => 1, 'msg' => "关闭失败,({$status})");
}
OpenUtils::outputJson($data);
<?php

require 'lib.php';
$data = array('title' => '企业QQ开放平台示例APP及sdk须知', 'step1' => '确认可以使用curl,当前:' . OpenUtils::checkCurlInstalled(), 'step2' => '确认已注册企业QQ开放平台appid,将appid,appsecret与callbackurl填入OpenConfig文件', 'step3' => '确认web服务器设置允许读取', 'step4' => '将示例app部署之后,确认在https://id.b.qq.com/hrtx/app/index 中应用管理界面将企业QQ主号开通该App', 'step5' => '使用某个员工企业QQ号码登录示例app,所有示例app操作都是针对该工号以及所在企业QQ主号', 'step6' => '本示例仅供参考,忽略安全防范问题,实际开发过程中开发者需要把握');
header('Content-Type: application/json; charset=UTF-8');
echo json_encode($data);
<?php

//sae_debug("in oath2/callback!!!!");
require '../../lib.php';
$ret = array('ret' => 0, 'msg' => '成功');
$oauth = OpenHelper::oauthCompany();
//默认会从Get参数中拿到code去获得companyToken
$result = $oauth->getCompanyToken();
if (OpenConfig::SAE_MODE) {
    $s = new SaeStorage();
    $s->upload(OpenConfig::SAE_DOMAIN, 'data.dat', '../../data.dat');
}
if ($result['ret'] == 0 && !empty($result['data'])) {
    $company_token = $result['data'];
    $company_token['status'] = 0;
    saveToken($company_token);
} else {
    $ret['ret'] = 1;
    $ret['msg'] = '失败';
}
if (OpenConfig::SAE_MODE) {
    ini_set('display_errors', 0);
    sae_debug(json_encode($ret));
    ini_set('display_errors', 1);
}
OpenUtils::outputJson($ret);