获取生肖信息.

@param string $birthdayCode 出生日期码

@return mixed
507216
private function _getChineseZodiac($birthdayCode)
    {
        $chineseZodiacList = include __DIR__.'/../data/chineseZodiac.php';
        $start = 1900; // 子鼠
        $end = substr($birthdayCode, 0, 4);
        $key = ($end - $start) % 12;

        return $chineseZodiacList[$key];
    }
841141
public static function vendorToHttp($code = Code::OK): int
    {
        if (Code::OK === $code) {
            return HttpCode::HTTP_OK;
        }

        switch ($code) {
            case Code::CANCELLED:
                return HttpCode::HTTP_CLIENT_CLOSED_REQUEST;

            case Code::UNKNOWN:
                return HttpCode::HTTP_INTERNAL_SERVER_ERROR;

            case Code::INVALID_ARGUMENT:
                return HttpCode::HTTP_BAD_REQUEST;

            case Code::DEADLINE_EXCEEDED:
                return HttpCode::HTTP_GATEWAY_TIMEOUT;

            case Code::NOT_FOUND:
                return HttpCode::HTTP_NOT_FOUND;

            case Code::ALREADY_EXISTS:
                return HttpCode::HTTP_CONFLICT;

            case Code::PERMISSION_DENIED:
                return HttpCode::HTTP_FORBIDDEN;

            case Code::UNAUTHENTICATED:
                return HttpCode::HTTP_UNAUTHORIZED;

            case Code::RESOURCE_EXHAUSTED:
                return HttpCode::HTTP_TOO_MANY_REQUESTS;

            // questionable... may not always be etag related.
            case Code::FAILED_PRECONDITION:
                return HttpCode::HTTP_PRECONDITION_FAILED;

            case Code::ABORTED:
                return HttpCode::HTTP_CONFLICT;

            case Code::OUT_OF_RANGE:
                return HttpCode::HTTP_BAD_REQUEST;

            case Code::UNIMPLEMENTED:
                return HttpCode::HTTP_NOT_IMPLEMENTED;

            case Code::INTERNAL:
                return HttpCode::HTTP_INTERNAL_SERVER_ERROR;

            case Code::UNAVAILABLE:
                return HttpCode::HTTP_SERVICE_UNAVAILABLE;

            case Code::DATA_LOSS:
                return HttpCode::HTTP_INTERNAL_SERVER_ERROR;

            default:
                return HttpCode::HTTP_UNPROCESSABLE_ENTITY;
        }
    }
729996
public function get($code)
    {
        foreach ($this->getDbConnection()->fetchAll(
            'SELECT * from oauth_auth_code
            WHERE auth_code = :authCode AND expire_time > :ts',
            [
                'authCode' => $code,
                'ts' => time()
            ]
        ) as $row) {
            if ($row) {
                return (new AuthCodeEntity($this->server))
                    ->setRedirectUri($row['client_redirect_uri'])
                    ->setExpireTime($row['expire_time'])
                    ->setId($row['auth_code']);
            }
        }
        return null;
    }
970121
private function queryFirstDate($assetTypeCode)
    {
        $query = $this->qbGetFirstDate->build();
        $bind = [
            $this->qbGetFirstDate::BND_ASSET_TYPE_CODE => $assetTypeCode
        ];
        $conn = $query->getConnection();
        $result = $conn->fetchOne($query, $bind);
        return $result;
    }
1155702
public function getUserId($code)
    {
        $apiUrl = 'https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo';

        $result = $this->_curl($apiUrl, [
            'access_token' => $this->getAccessToken(),
            'code' => $code,
        ]);

        return ($result and isset($result['UserId'])) ? $result['UserId'] : null;
    }
312220
public function getCurrencyIdByCode($code) {
        $this->sError = FALSE;

        if ($this->_currencyCode2Id === FALSE) {
            $this->_loadCurrencyCodes();
        }

        if (!isset($this->_currencyCode2Id[$code])) {
            $this->sError = 'Incorect currency code: ' . $code;
            return FALSE;
        }

        return $this->_currencyCode2Id[$code];
    }
480343
public function queryAuthCode($authCode)
    {
        $pay = new Order($this->config->get());
        return $pay->queryAuthCode($authCode);
    }
1346733
protected function getErrorMessage($errorCode)
    {
        if (!isset($this->errorMessageMatrix[$errorCode])) {
            $this->errorMessageMatrix[$errorCode] = 'ERROR_MSG_UNKNOWN';
        }

        // if additional information exist -> add it here
        if ($this->info) {
            if (is_string($this->info)) {
                $this->errorMessageMatrix[$errorCode] .= ' '.$this->info;
            } elseif (count($this->info) != 1 || $this->info[0] != null) {
                foreach ($this->info as $info) {
                    $info = serialize($info);
                    $this->errorMessageMatrix[$errorCode] .= ' '.$info;
                }
            }
        }

        // Return constructed error message
        return $this->errorMessageMatrix[$errorCode];
    }
1273288
public function getOpenIdByMini($code) {
        $url = 'https://api.weixin.qq.com/sns/jscode2session?appid='.self::$config['appId'].'&secret='.self::$config['appSecret'].'&js_code='.$code.'&grant_type=authorization_code';
        $result = $this->curl($url);
        $data = $this->get($result);
        return $data ? $data['openid'] : false;
    }
548529
public function getReturnCodeName($returnCode)
    {
        if (isset(self::$qosLevels[$returnCode])) {
            return self::$qosLevels[$returnCode][0];
        }

        return 'Unknown '.$returnCode;
    }
1047808
public function authenticateByCode($provider, string $code)
    {
        $provider_user = $provider->user();

        /** @var \Railken\Amethyst\Repositories\UserRepository */
        $repository = $this->manager->getRepository();

        $user = $repository->findOneByEmail($provider_user->getEmail());

        if (!$user) {
            $result = $this->manager->create([
                'name'     => $provider_user->getNickname() ? $provider_user->getNickname() : $provider_user->getName(),
                'role'     => 'user',
                'password' => str_random(32),
                'email'    => $provider_user->getEmail(),
            ]);

            if (!$result->ok()) {
                return $this->response(['errors' => $result->getSimpleErrors()], Response::HTTP_BAD_REQUEST);
            }

            $user = $result->getResource();
        }

        $token = Container::getInstance()->make(\Laravel\Passport\PersonalAccessTokenFactory::class)->make(
            $user->getKey(),
            'login',
            []
        );

        return $this->response([
            'token_type'   => 'Bearer',
            'expires_in'   => 0,
            'access_token' => $token->accessToken,
        ], Response::HTTP_OK);
    }
689140
public function getToken($code)
	{
		$request = 	new Request('POST', 'token', [], http_build_query([
			'redirect_uri'  => $this->getRedirectUri(),
			'client_id'		=> $this->getClientId(),
			'client_secret' => $this->getClientSecret(),
			'grant_type' 	=> 'authorization_code',
			'code' 			=> $code
		]));

		try {
			$response = $this->getHttpClient()->send($request);
		} catch (\Exception $e) {
			throw new SurveyMonkeyApiException($e->getMessage(), $e->getCode(), $e);
		}

		if (!$response->hasHeader('content-type') || !preg_match('/application\/json/i', $response->getHeader('content-type')[0])) {
			throw new SurveyMonkeyApiException(spritnf('Response expected to be a JSON response. Received %s', $response->getHeader('content-type')[0]));
		}

		return json_decode($response->getBody(), true);
	}
1289791
public function findUserByPersistenceCode($code)
    {
        $persistence = $this->findByPersistenceCode($code);

        if ($persistence)
        {
            return $persistence->getUser();
        }

        return false;
    }
647863
public function getRegisterUri(string $registerCode = '')
    {
        $registerCode || $registerCode = $this->getRegisterCode()['register_code'];
        $params = ['register_code' => $registerCode];

        return 'https://open.work.weixin.qq.com/3rdservice/wework/register?'.http_build_query($params);
    }
918195
public function getCode($type, $code='')
    {
        /** @var Fontis_Australia_Helper_Data $helper */
        $helper = Mage::helper('australia');
        $codes = array(
            'services' => array(
                'AUS_LETTER_EXPRESS_SMALL'          => $helper->__('Express Post Small Envelope'),
                'AUS_LETTER_REGULAR_LARGE'          => $helper->__('Large Letter'),
                'AUS_PARCEL_COURIER'                => $helper->__('Courier Post'),
                'AUS_PARCEL_COURIER_SATCHEL_MEDIUM' => $helper->__('Courier Post Assessed Medium Satchel'),
                'AUS_PARCEL_EXPRESS'                => $helper->__('Express Post'),
                'AUS_PARCEL_REGULAR'                => $helper->__('Parcel Post'),

                'INT_PARCEL_COR_OWN_PACKAGING'      => $helper->__('International Courier'),
                'INT_PARCEL_EXP_OWN_PACKAGING'      => $helper->__('International Express'),
                'INT_PARCEL_STD_OWN_PACKAGING'      => $helper->__('International Standard'),
                'INT_PARCEL_AIR_OWN_PACKAGING'      => $helper->__('International Economy Air'),
                'INT_PARCEL_SEA_OWN_PACKAGING'      => $helper->__('International Economy Sea'),
            ),
            'extra_cover' => array(
                'AUS_SERVICE_OPTION_SIGNATURE_ON_DELIVERY'       => $helper->__('Signature on Delivery'),
                'AUS_SERVICE_OPTION_COURIER_EXTRA_COVER_SERVICE' => $helper->__('Standard cover')
            )
        );

        if (!isset($codes[$type])) {
            return false;
        } elseif (''===$code) {
            return $codes[$type];
        }

        if (!isset($codes[$type][$code])) {
            return false;
        } else {
            return $codes[$type][$code];
        }
    }
18545
public function checkSignature($verifyCode)
    {
        if (empty($verifyCode))
            throw new Exception("请设定校验签名所需的verify_code");
        
        $verifyCode = trim($verifyCode);
        $this->_verifyToken = $verifyCode;
        $signature = isset($_GET['signature']) ? trim($_GET['signature']) : '';
        $timestamp = isset($_GET['timestamp']) ? trim($_GET['timestamp']) : '';
        $nonce = isset($_GET['nonce']) ? trim($_GET['nonce']) : '';
        $tmpArr = array(
            $verifyCode,
            $timestamp,
            $nonce
        );
        sort($tmpArr, SORT_STRING); // 按照字符串来进行比较，否则在某些数字的情况下，sort的结果与微信要求不符合，官方文档中给出的签名算法有误
        $tmpStr = sha1(implode($tmpArr));
        $this->_signature = $tmpStr;
        return $tmpStr === $signature ? true : false;
    }
81791
public function tokenExchange($code)
        {
            $parameters = array(
                'client_id'     => $this->clientId,
                'client_secret' => $this->clientSecret,
                'code'          => $code,
            );

            return $this->request(
                $this->authUrl . 'token',
                $parameters
            );
        }