请求服务器jsapi_ticket
@param string $type
@return array|bool
9049
protected function requestJsApiTicket($type = 'jsapi')
    {
        $result = $this->httpGet(self::WECHAT_JS_API_TICKET_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'type' => $type
        ]);
        return isset($result['ticket']) ? $result : false;
    }
1329621
public function getJsapiTicketFromWechat()
    {
        $wechat_jsapi_url = 'https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token='.$this->getAccessToken();
        $client = new Client();
        $json = $client->get($wechat_jsapi_url)->getBody();
        $arr = json_decode($json, true);

        if(array_has($arr, 'errcode') && (array_get($arr, 'errcode') == 4001 || array_get($arr, 'errcode') == 4002)){
            $this->getAccessTokenFromWechat();
            $this->getJsapiTicket();
        }else{
            $jsapi_ticket = $arr['ticket'];
            $expire = $arr['expires_in'];
            ServerVal::updateOrCreate(['var_name' => 'jsapi'], ['var_value'=> $jsapi_ticket, 'expire'=>$expire, 'var_up_time' => time()]);
            return $arr['ticket'];
        }

    }
191907
public function delTicket($type = 'jsapi', $appid = null)
    {
        is_null($appid) && $appid = $this->config->get('appid');
        $cache_name = "{$appid}_ticket_{$type}";
        Tools::delCache($cache_name);
    }
742983
def get_jsapi_ticket(self):
        
        ticket_key = '{}_jsapi_ticket'.format(self._client.corp_id)
        expires_at_key = '{}_jsapi_ticket_expires_at'.format(self._client.corp_id)
        ticket = self.session.get(ticket_key)
        expires_at = self.session.get(expires_at_key, 0)
        if not ticket or expires_at < int(time.time()):
            jsapi_ticket = self.get_ticket()
            ticket = jsapi_ticket['ticket']
            expires_at = int(time.time()) + int(jsapi_ticket['expires_in'])
            self.session.set(ticket_key, ticket)
            self.session.set(expires_at_key, expires_at)
        return ticket
766206
public function getVerboseOutput($type = 'text')
    {
        switch ($type) {
            case 'text':
                return implode("\n", $this->outputSchedule);
            case 'html':
                return implode('<br>', $this->outputSchedule);
            case 'array':
                return $this->outputSchedule;
            default:
                throw new InvalidArgumentException('Invalid output type');
        }
    }
578548
public static function get($key,$type='sys')
    {
        /**
         * 获取缓存配置
         */
        self::$config = \Config::UNIVERSAL['cache'];

        /**
         * 初始化数据
         */
        self::$key = $key;

        $class = 'pizepei\model\cache\drive\\'.ucfirst(self::$config['driveType']);
        $class::$typeCache = $type;

        return $class::get(self::$key,self::$config);
    }
328958
private function checkType($type)
    {
        $isInType = true;

        foreach ($this->getKeys() as $key) {
            if (gettype($key) !== $type) {
                $isInType = false;
                break;
            }
        }

        return $isInType;
    }
935610
public function getJsapiTicket() {
		$time = time();
		if(empty($this->app->jsapi_ticket) || $this->app->jsapi_ticket_expired_at < $time) {
			$data = $this->getData('/cgi-bin/ticket/getticket', [
				'access_token' => $this->getAccessToken(),
				'type' => 'jsapi',
			]);
			if(isset($data['ticket']) && isset($data['expires_in'])) {
				$this->app->jsapi_ticket = $data['ticket'];
				$this->app->jsapi_ticket_expired_at = $time + $data['expires_in'];
				$this->app->save();
			}
		}

		return $this->app->jsapi_ticket;
	}
1200647
public static function getInterface($type)
    {
        if (array_key_exists($type, self::$interfaces)) {
            return self::$interfaces[$type];
        }

        return false;
    }
714706
public function write($msg, $type = 'info', $force = false)
    {
        // 封装日志信息
        $log = $this->log;

        if (true === $force || empty($this->config['level'])) {
            $log[$type][] = $msg;
        } elseif (in_array($type, $this->config['level'])) {
            $log[$type][] = $msg;
        } else {
            return false;
        }

        // 写入日志
        $result = $this->driver->save($log);

        if ($result) {
            $this->log = [];
        }

        return $result;
    }
820015
public function getApiTicketFromCache($type)
    {
        $cacheKey = 'ticket' . $type . $this->getAppId();
        $credential = $this->cache->get($cacheKey);
        if (!$credential || $credential['expireTime'] - time() < 60) {
            if (!$http = $this->getApiTicket($type)) {
                return false;
            }

            // 存储到缓存,方便下个请求获取
            $credential = [
                'ticket' => $http['ticket'],
                'expireTime' => time() + $http['expires_in'],
            ];
            $this->cache->set($cacheKey, $credential);
        }

        if (!$credential['ticket']) {
            $this->logger->alert(sprintf('生成 %s ticket失败', $type));
        }

        return $credential['ticket'];
    }
797679
public static function getFilter(string $type): array
    {
        return isset(self::$filters[$type]) ? self::$filters[$type] : [];
    }
1207860
def get_jsapi_signature(self, noncestr, ticket, timestamp, url):
        
        data = [
            'noncestr={noncestr}'.format(noncestr=noncestr),
            'jsapi_ticket={ticket}'.format(ticket=ticket),
            'timestamp={timestamp}'.format(timestamp=timestamp),
            'url={url}'.format(url=url),
        ]
        signer = WeChatSigner(delimiter=b'&')
        signer.add_data(*data)
        return signer.signature
633607
public static function isTemporalType($type)
    {
        return in_array($type, [
            self::DATE,
            self::TIME,
            self::TIMESTAMP,
            self::BU_DATE,
            self::BU_TIMESTAMP,
        ]);
    }
356330
public static function has($key, $type = 'ses')
    {
        return ($GLOBALS['TSFE']->fe_user->getKey(self::isType($type), $key)) ? true : false;
    }
169297
public function has(string $type): bool
    {
        return isset($this->values[$type]) && \count($this->values[$type]) > 0;
    }
242312
public static function getType($type)
    {
        $type = strtolower($type);

        if (!isset(static::$typeMapping[$type])) {
            return $type;
        }

        return static::$typeMapping[$type];
    }