示例#1
0
 /**
  * 获取颜色列表.
  *
  * @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'];
     });
 }
示例#2
0
文件: Js.php 项目: khsing/wechat
 /**
  * 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'];
     });
 }
示例#3
0
文件: SDK.php 项目: heyjun/wechat
 /**
  * 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'];
     });
 }