@param $appId
@param $verifyCode
@param $to
@param string $type

@throws Exception

@return mixed|string
@links http://www.ucpaas.com/page/doc/doc_rest3-2.jsp
976791
public function voiceCode($appId, $verifyCode, $to, $type = 'json')
    {
        $url = self::BaseUrl . self::SoftVersion . '/Accounts/' . $this->accountSid . '/Calls/voiceCode?sig=' . $this->getSigParameter();
        if ($type === 'json') {
            $body_json = array('voiceCode' => array(
                'appId'      => $appId,
                'verifyCode' => $verifyCode,
                'to'         => $to,
            ));
            $body = json_encode($body_json);
        } elseif ($type === 'xml') {
            $body_xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                        <voiceCode>
                            <verifyCode>' . $verifyCode . '</clientNumber>
                            <to>' . $to . '</charge>
                            <appId>' . $appId . '</appId>
                        </voiceCode>';
            $body = trim($body_xml);
        } else {
            throw new Exception('只能json或xml，默认为json');
        }
        $data = $this->getResult($url, $body, $type, 'post');

        return $data;
    }
653089
public function getById($appId, $profileId, $validatorId, array $queryParams = [])
    {
        $response = $this->api->applications()->profiles()->validators()->getById($appId, $profileId, $validatorId, $queryParams);

        return new ValidatorResponse($response);
    }
747239
@Override
	public byte[] getAppIdFloor(String appId) {

		int appIdCode = codecer.findId(APP_ID, appId).intValue();
		ByteBuffer byteBuffer = ByteBuffer.allocate(12);
		putUnsignedShort(byteBuffer, appIdCode);
		putUnsignedShort(byteBuffer, 0);
		putUnsignedShort(byteBuffer, 0);
		putUnsignedShort(byteBuffer, 0);
		putUnsignedShort(byteBuffer, 0);
		putUnsignedShort(byteBuffer, 0);
		
		return byteBuffer.array();
	}
838475
public function reset($userId = null, $code = null)
    {
        try {
            if (post('postback')) {
                return $this->reset_onSubmit();
            }

            if (!$userId || !$code) {
                throw new ApplicationException(trans('backend::lang.account.reset_error'));
            }
        }
        catch (Exception $ex) {
            Flash::error($ex->getMessage());
        }

        $this->vars['code'] = $code;
        $this->vars['id'] = $userId;
    }
1157844
public static function getInstance($appId,
                                       string $appKey,
                                       bool $jsonFormat = false,
                                       $timeout = 100,
                                       $retry = 1,
                                       bool $debug = false)
    {
        if (!(self::$tencentAI instanceof self)) {
            self::$tencentAI = new self($appId, $appKey, $jsonFormat, $timeout, $retry, $debug);
        }

        return self::$tencentAI;
    }
970324
public static boolean verify(String appId, String appSecretKey, byte[] body, HttpServletRequest request)
            throws IOException {
        HmacSignatureBuilder builder = new HmacSignatureBuilder();

        String signitSignature = request.getHeader("X-Signit-Signature");
        builder.scheme(request.getHeader("X-Signit-Scheme"))
                .apiKey(appId)
                .apiSecret(appSecretKey.getBytes())
                .method(request.getMethod()
                        .toUpperCase())
                .payload(body)
                .contentType(request.getContentType())
                .host(Validator.isEmpty(request.getHeader("X-Signit-Host")) ? "" : request.getHeader("X-Signit-Host"))
                .resource(Validator.isEmpty(request.getHeader("X-Signit-Resource")) ? ""
                        : request.getHeader("X-Signit-Resource"))
                .nonce(Validator.isEmpty(request.getHeader("X-Signit-Nonce")) ? ""
                        : request.getHeader("X-Signit-Nonce"))
                .date(Validator.isEmpty(request.getHeader("X-Signit-Date")) ? "" : request.getHeader("X-Signit-Date"));
        String selfBuiltHmac = builder.getDefaultAlgorithm() + " " + appId + ":" + builder.buildAsBase64();
        return selfBuiltHmac.equals(signitSignature);
    }
38028
protected static function third_jscode_to_session_uri($appid,$component_appid, $component_access_token,$js_code)
    {
        $param = [
            'appid' => $appid,
            'js_code'=>$js_code,
            'grant_type' => 'authorization_code',
            'component_appid' => $component_appid,
            'component_access_token' =>$component_access_token
        ];

        return self::COMPONENT_JSCODE_TO_SESSION_URI. http_build_query($param);
    }
404719
public static function verify($secret, $code)
    {
        $otp = new TOTP(null, $secret);
        return $otp->verify($code);
    }
1019786
def _verified_content_type_from_id(content_type_id):
    # type: (int) -> ContentType
    
    try:
        return ContentType(content_type_id)
    except ValueError as error:
        raise UnknownIdentityError("Unknown content type {}".format(content_type_id), error)
119965
public static ComponentAccessToken api_component_token(String component_appid, String component_appsecret, String component_verify_ticket) {
        String postJsonData = String.format("{\"component_appid\":\"%1$s\" ,\"component_appsecret\": \"%2$s\",\"component_verify_ticket\": \"%3$s\"}",
                component_appid,
                component_appsecret,
                component_verify_ticket);
        HttpUriRequest httpUriRequest = RequestBuilder.post()
                .setHeader(jsonHeader)
                .setUri(BASE_URI + "/cgi-bin/component/api_component_token")
                .setEntity(new StringEntity(postJsonData, Charset.forName("utf-8")))
                .build();
        return LocalHttpClient.executeJsonResult(httpUriRequest, ComponentAccessToken.class);
    }
1061531
public function getOauthAccessToken($appid)
    {
        $code = isset($_GET['code']) ? $_GET['code'] : '';
        if (empty($code)) {
            return false;
        }
        empty($this->component_access_token) && $this->getComponentAccessToken();
        if (empty($this->component_access_token)) {
            return false;
        }
        $url = "https://api.weixin.qq.com/sns/oauth2/component/access_token?appid={$appid}&code={$code}&grant_type=authorization_code&"
            . "component_appid={$this->component_appid}&component_access_token={$this->component_access_token}";
        $json = $this->parseJson(Tools::httpGet($url));
        if ($json !== false) {
            return $json;
        }
        return false;
    }
146371
public function sendMiniProgramPage($toUser, $title, $appid, $pagepath, $thumb_media_id)
    {
        $ret = array();
        $ret['touser'] = $toUser;
        $ret['msgtype'] = 'miniprogrampage';
        $ret['miniprogrampage']['title'] = $title;
        $ret['miniprogrampage']['appid'] = $appid;
        $ret['miniprogrampage']['pagepath'] = $pagepath;
        $ret['miniprogrampage']['thumb_media_id'] = $thumb_media_id;
        return $this->send($ret);
    }
464880
protected function executeCustom($appId, $action, $object = null, $class = null)
    {
        return $this->requestAction(RequestOps::EXECUTE, $action, null, null, $object, $class, $appId);
    }
189119
public static function getOpenid($app_id, $app_secret, $code)
    {
        $url = WxpubOAuth::_createOauthUrlForOpenid($app_id, $app_secret, $code);
        $res = self::_getRequest($url);
        $data = json_decode($res, true);

        return $data['openid'];
    }
124006
private static function _createOauthUrlForOpenid($app_id, $app_secret, $code)
    {
        $urlObj = array();
        $urlObj['appid'] = $app_id;
        $urlObj['secret'] = $app_secret;
        $urlObj['code'] = $code;
        $urlObj['grant_type'] = 'authorization_code';
        $queryStr = http_build_query($urlObj);

        return 'https://api.weixin.qq.com/sns/oauth2/access_token?' . $queryStr;
    }
944668
public function getById($appId, array $queryParams = [])
    {
        $response = $this->api->licenses()->getById($appId, $queryParams);

        return new LicenseResponse($response);
    }
418652
protected function generateAppYaml($appId, $filePath, $publicPath)
    {
        if (file_exists($filePath))
        {
            $overwrite = $this->myCommand->confirm(
                'Overwrite the existing "app.yaml" file?', false
            );

            if ( ! $overwrite)
            {
                return;
            }
        }

        $contents =
<<<EOT
application:    {$appId}
version:        1
runtime:        php
api_version:    1

handlers:
        - url: /favicon\.ico
          static_files: public/favicon.ico
          upload: public/favicon\.ico

EOT;

        $ending =
<<<EOT
        - url: /.*
          script: public/index.php

skip_files:
        - ^(.*/)?#.*#$
        - ^(.*/)?.*~$
        - ^(.*/)?.*\.py[co]$
        - ^(.*/)?.*/RCS/.*$
        - ^(.*/)?\.(?!env\.php).*$
        - ^(.*/)?node_modules.*$
        - ^(.*/)?_ide_helper\.php$
EOT;

        foreach (new \DirectoryIterator($publicPath) as $fileInfo)
        {
            if($fileInfo->isDot() || ! $fileInfo->isDir())
            {
                continue;
            }

            $dirName = $fileInfo->getFilename();
            $pathMapping =
<<<EOT
        - url: /{$dirName}
          static_dir: public/{$dirName}

EOT;
            $contents .= PHP_EOL.$pathMapping;
        }

        $contents .= PHP_EOL.$ending;

        file_put_contents($filePath, $contents);

        $this->myCommand->info('Generated the "app.yaml" file.');
    }