/** * 获取颜色列表. * * @return array */ public function lists() { $key = 'overtrue.wechat.colors'; return $this->cache->get($key, function ($key) { $result = $this->http->get(self::API_LIST); $this->cache->set($key, $result['colors'], 86400); // 1 day return $result['colors']; }); }
/** * Get jsticket. * * @return string */ public function ticket() { $key = self::TICKET_CACHE_PREFIX . $this->appId; return $this->cache->get($key, function ($key) { $result = $this->http->get(self::API_TICKET); $this->cache->set($key, $result['ticket'], $result['expires_in'] - 500); return $result['ticket']; }); }
/** * Get jsticket. * * @return string */ public function getTicket() { $key = 'overtrue.wechat.jsapi_ticket.' . $this->appId; return $this->cache->get($key, function ($key) { $result = $this->http->get(self::API_TICKET); $this->cache->set($key, $result['ticket'], $result['expires_in'] - 100); return $result['ticket']; }); }