本文整理汇总了PHP中Http::jsonPost方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::jsonPost方法的具体用法?PHP Http::jsonPost怎么用?PHP Http::jsonPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::jsonPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* 设置菜单.
*
* @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, ['button' => $menus]);
return true;
}
示例2: to
/**
* 发送消息
*
* @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());
}
示例3: create
/**
* 创建二维码
*
* @param string $actionName
* @param array $actionInfo
* @param bool $temporary
* @param int $expireSeconds
*
* @return Collection
*/
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 Collection($this->http->jsonPost(self::API_CREATE, $params));
}
示例4: totag
/**
* 发送消息
*
* @param string $openId
*
* @return bool
*/
public function totag($tagid, $agentid = 1)
{
if (empty($this->message)) {
throw new Exception('未设置要发送的消息');
}
$this->message->totag = $tagid;
$this->message->agentid = $agentid;
$message_body = $this->message->buildForStaff();
return $this->http->jsonPost(self::API_MESSAGE_SEND, $message_body);
}
示例5: send
/**
* @param string $to
* @param string $templateId
* @param array $data
* @param string $url
* @param string $color
*
* @return int
*/
public function send($to = null, $templateId = null, array $data = array(), $url = null, $color = '#FF0000')
{
$params = array('touser' => $to, 'template_id' => $templateId, 'url' => $url, 'topcolor' => $color, 'data' => $data);
foreach ($params as $key => $value) {
if (empty($value) && empty($this->message[$key])) {
throw new Exception("消息属性 '{$key}' 不能为空!");
}
$params[$key] = empty($value) ? $this->message[$key] : $value;
}
$params['data'] = $this->formatData($params['data']);
$result = $this->http->jsonPost(self::API_SEND_NOTICE, $params);
return $result['msgid'];
}
示例6: moveUsers
/**
* Batch move users to a group.
*
* @param array $openIds
* @param int $groupId
*
* @return bool
*/
public function moveUsers(array $openIds, $groupId)
{
$params = ['openid_list' => $openIds, 'to_groupid' => $groupId];
$this->http->jsonPost(self::API_MEMBER_BATCH_UPDATE, $params);
return true;
}
示例7: short
/**
* 转短链接
*
* @param string $url
*
* @return string
*/
public function short($url)
{
$params = array('action' => 'long2short', 'long_url' => $url);
$response = $this->http->jsonPost(self::API_SHORT_URL, $params);
return $response['short_url'];
}
示例8: query
/**
* 查询数据.
*
* @param string $api
* @param string $from
* @param string $to
*
* @return array
*/
protected function query($api, $from, $to)
{
$params = ['begin_date' => $from, 'end_date' => $to];
$result = $this->http->jsonPost($api, $params);
return $result['list'];
}
示例9: setmute
/**
* 设置成员新消息免打扰
*
* @param array $user_mute_list 成员新消息免打扰参数,数组,最大支持10000个成员
* @return array
*/
public function setmute($user_mute_list)
{
$params = array('user_mute_list' => $user_mute_list);
return $this->http->jsonPost(self::API_SETMUTE, $params);
}
示例10: deleteTagUser
/**
* 删除标签成员
* @param int $tagId
* @param array $userList
* @param array $partyList
* @return array
*/
public function deleteTagUser($tagId, $userList, $partyList)
{
$params = array('tagid' => $tagId, 'userlist' => $userList, 'partylist' => $partyList);
return $this->http->jsonPost(self::API_DELETE_USER, $params);
}
示例11: delete
/**
* 删除门店.
*
* @param int $storeId
*
* @return bool
*/
public function delete($storeId)
{
$params = ['poi_id' => $storeId];
return $this->http->jsonPost(self::API_DELETE, $params);
}
示例12: checkin
/**
* 在线值机
*
* <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);
}
示例13: update
/**
* 更新部门
* @param string $name 部门名称
* @param integer $parentid 父亲部门id
* @param integer $order 在父部门中的次序值
* @param integer $id 部门id (可以自动生成)
* @return integer 部门id
*/
public function update($id, $name, $parentid = 1, $order = null)
{
$params = array('name' => $name, 'parentid' => $parentid, 'order' => $order, 'id' => $id);
return $this->http->jsonPost(self::API_UPDATE, $params);
}
示例14: lists
/**
* 获取永久素材列表.
*
* 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 = ['type' => $type, 'offset' => intval($offset), 'count' => min(20, $count)];
return $this->http->jsonPost(self::API_FOREVER_LIST, $params);
}
示例15: getGroup
/**
* Get user's group id.
*
* @param string $openId
*
* @return int
*/
public function getGroup($openId)
{
$params = ['openid' => $openId];
$response = $this->http->jsonPost(self::API_GROUP, $params);
return $response['groupid'];
}