Exemplo n.º 1
0
 /**
  * 设置菜单
  *
  * @return bool
  */
 public function set($menus)
 {
     if ($menus instanceof Closure) {
         $menus = $menus($this);
     }
     if (!is_array($menus)) {
         throw new Exception('子菜单必须是数组或者匿名函数返回数组', 1);
     }
     $menus = $this->extractMenus($menus);
     $this->http->jsonPost(self::API_CREATE, array('button' => $menus));
     return true;
 }
Exemplo n.º 2
0
 /**
  * 发送消息
  *
  * @param string $openId
  *
  * @return bool
  */
 public function to($openId)
 {
     if (empty($this->message)) {
         throw new Exception('未设置要发送的消息');
     }
     $this->message->to = $openId;
     return $this->http->jsonPost(self::API_MESSAGE_SEND, $this->message->buildForStaff());
 }
Exemplo n.º 3
0
 /**
  * 创建二维码
  *
  * @param string $actionName
  * @param array  $actionInfo
  * @param bool   $temporary
  * @param int    $expireSeconds
  *
  * @return Bag
  */
 protected function create($actionName, $actionInfo, $temporary = true, $expireSeconds = null)
 {
     $expireSeconds !== null || ($expireSeconds = 7 * self::DAY);
     $params = array('action_name' => $actionName, 'action_info' => array('scene' => $actionInfo));
     if ($temporary) {
         $params['expire_seconds'] = min($expireSeconds, 7 * self::DAY);
     }
     return new Bag($this->http->jsonPost(self::API_CREATE, $params));
 }
Exemplo n.º 4
0
 /**
  * 获取永久素材列表
  *
  * example:
  *
  * {
  *   "total_count": TOTAL_COUNT,
  *   "item_count": ITEM_COUNT,
  *   "item": [{
  *             "media_id": MEDIA_ID,
  *             "name": NAME,
  *             "update_time": UPDATE_TIME
  *         },
  *         //可能会有多个素材
  *   ]
  * }
  *
  * @param string $type
  * @param int    $offset
  * @param int    $count
  *
  * @return array
  */
 public function lists($type, $offset = 0, $count = 20)
 {
     $params = array('type' => $type, 'offset' => intval($offset), 'count' => min(20, $count));
     return $this->http->jsonPost(self::API_FOREVER_LIST, $params);
 }
Exemplo n.º 5
0
 /**
  * 添加个性化的菜单.
  *
  * @param mixed $menus
  * @param array $condition
  */
 public function addConditional($menus, array $condition)
 {
     $menus = $this->extractMenus($menus);
     $this->http->jsonPost(self::API_CONDITIONAL_CREATE, array('button' => $menus, 'matchrule' => $condition));
     return true;
 }
Exemplo n.º 6
0
 /**
  * 查询群发消息发送状态
  *
  * @param string $msgId 全消息ID
  *
  * @return array
  */
 public function status($msgId)
 {
     return $this->http->jsonPost(self::API_GET, array('msg_id' => $msgId));
 }
Exemplo n.º 7
0
 /**
  * 在线值机
  *
  * <pre>
  * $data:
  * {
  *     "code": "198374613512",
  *     "card_id":"p1Pj9jr90_SQRaVqYI239Ka1erkI",
  *     "passenger_name": "乘客姓名",
  *     "class": "舱等",
  *     "seat": "座位号",
  *     "etkt_bnr": "电子客票号", "qrcode_data": "二维码数据", "is_cancel ": false
  * }
  * </pre>
  *
  * @param string $cardId
  * @param array  $data
  *
  * @return bool
  */
 public function checkin($cardId, array $data)
 {
     $params = array_merge(array('card_id' => $cardId), $data);
     return $this->http->jsonPost(self::API_BOARDING_PASS_CHECKIN, $params);
 }
Exemplo n.º 8
0
 /**
  * 创建卡券货架
  *
  * <pre>
  * $data:
  * {
  *     "banner": "http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7h  icFN",
  *     "page_title": "惠城优惠大派送",
  *     "can_share": true,
  *     "scene": 'SCENE_H5',
  *     "card_list": [
  *         {
  *             'card_id':"pXch-jnOlGtbuWwIO2NDftZeynRE",
  *             'thumb_url':"www.qq.com/a.jpg"
  *         },
  *         {
  *             'card_id':"pXch-jnAN-ZBoRbiwgqBZ1RV60fI",
  *             'thumb_url':"www.qq.com/b.jpg"
  *         }
  *     ]
  * }
  * </pre>
  *
  * @param array $data
  *
  * @return array
  */
 public function createLandingPage(array $data)
 {
     $defaultParams = array('banner' => '', 'page_title' => '', 'can_share' => true, 'scene' => 'SCENE_H5', 'card_list' => array(array('card_id' => '', 'thumb_url' => '')));
     $params = array_merge($defaultParams, $data);
     return $this->http->jsonPost(self::API_LANDINGPAGE_CREATE, $params);
 }
Exemplo n.º 9
0
 /**
  * 删除门店
  *
  * @param int $storeId
  *
  * @return bool
  */
 public function delete($storeId)
 {
     $params = array('poi_id' => $storeId);
     return $this->http->jsonPost(self::API_DELETE, $params);
 }
Exemplo n.º 10
0
 /**
  * 获取用户所在的组
  *
  * @param string $openId
  *
  * @return int
  */
 public function getGroup($openId)
 {
     $params = array('openid' => $openId);
     $response = $this->http->jsonPost(self::API_GROUP, $params);
     return $response['groupid'];
 }
Exemplo n.º 11
0
 /**
  * 语义理解
  *
  * @param string         $keyword
  * @param array | string $categories
  * @param array          $other
  *
  * @return Bag
  */
 public function query($keyword, $categories, array $other = array())
 {
     $params = array('query' => $keyword, 'category' => implode(',', (array) $categories), 'appid' => $this->appId);
     return new Bag($this->http->jsonPost(self::API_CREATE, array_merge($params, $other)));
 }