/** * Retrieve item from Bag. * * @param string $key * @param mixed $default * * @return mixed */ public function get($key, $default = null) { return Arr::get($this->data, $key, $default); }
/** * 生成 js添加到卡包 需要的 card_list 项 * * @param string $cardId * @param array $extension * * @return string */ public function attachExtension($cardId, array $extension = array()) { $timestamp = time(); $ext = array('code' => Arr::get($extension, 'code'), 'openid' => Arr::get($extension, 'openid', Arr::get($extension, 'open_id')), 'timestamp' => $timestamp, 'outer_id' => Arr::get($extension, 'outer_id'), 'balance' => Arr::get($extension, 'balance')); $ext['signature'] = $this->getSignature($this->getTicket(), $timestamp, $cardId, $ext['code'], $ext['openid'], $ext['balance']); return array('card_id' => $cardId, 'card_ext' => JSON::encode($ext)); }
/** * 获取指定门店信息 * * @param int $storeId * * @return Overtrue\Wechat\Utils\Bag */ public function get($storeId) { $params = array('poi_id' => $storeId); $response = $this->http->jsonPost(self::API_GET, $params); return new Bag(Arr::get($response, 'business.base_info')); }