Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Bean/OfficialAccount/RequestConst.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ class RequestConst
//点击菜单跳转小程序的事件推送
const EVENT_VIEW_MINIPROGRAM = 'view_miniprogram';


}
5 changes: 5 additions & 0 deletions src/OfficialAccount/ApiUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ class ApiUrl
*/
const MESSAGE_CUSTOM_TYPING = 'https://api.weixin.qq.com/cgi-bin/message/custom/typing?access_token=ACCESS_TOKEN';

/*
* 将一条长链接转成短链接
*/
const SHORT_URL = 'https://api.weixin.qq.com/cgi-bin/shorturl?access_token=ACCESS_TOKEN';

/*
* 创建二维码ticket
*/
Expand Down
6 changes: 3 additions & 3 deletions src/OfficialAccount/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function delete($msgDataId, $userCommentId, $index = 0)
* @throws \EasySwoole\HttpClient\Exception\InvalidUrl
* @throws \EasySwoole\WeChat\Exception\RequestError
*/
public function UnMarkelect($msgDataId, $userCommentId, $index = 0)
public function unMarkelect($msgDataId, $userCommentId, $index = 0)
{
return $this->send(ApiUrl::COMMENT_UNMARKELECT, [
'msg_data_id' => $msgDataId,
Expand All @@ -113,7 +113,7 @@ public function UnMarkelect($msgDataId, $userCommentId, $index = 0)
* @throws \EasySwoole\HttpClient\Exception\InvalidUrl
* @throws \EasySwoole\WeChat\Exception\RequestError
*/
public function Markelect($msgDataId, $userCommentId, $index = 0)
public function markelect($msgDataId, $userCommentId, $index = 0)
{
return $this->send(ApiUrl::COMMENT_MARKELECT, [
'msg_data_id' => $msgDataId,
Expand All @@ -136,7 +136,7 @@ public function Markelect($msgDataId, $userCommentId, $index = 0)
* @throws \EasySwoole\HttpClient\Exception\InvalidUrl
* @throws \EasySwoole\WeChat\Exception\RequestError
*/
public function View($msgDataId, $begin, $count, $type, $index = 0)
public function view($msgDataId, $begin, $count, $type, $index = 0)
{
return $this->send(ApiUrl::COMMENT_LIST, [
'msg_data_id' => $msgDataId,
Expand Down
30 changes: 30 additions & 0 deletions src/OfficialAccount/QrCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,34 @@ public static function tickToImageUrl(QrCodeBean $code): ?string
'TICKET' => $code->getTicket()
]);
}

/**
* 将一条长链接转成短链接
*
* @param string $url
*
* @return null|string
* @throws InvalidUrl
* @throws OfficialAccountError
* @throws RequestError
*/
public function shorturl(string $url): ?string
{

$response = NetWork::postJsonForJson(ApiUrl::generateURL(ApiUrl::SHORT_URL, [
'ACCESS_TOKEN' => $this->getOfficialAccount()->accessToken()->getToken()
]), [
'action' => 'long2short',
'long_url' => $url
]);

$ex = OfficialAccountError::hasException($response);
if ($ex) {
throw $ex;
} else {
return $response['short_url'];
}
}


}
4 changes: 2 additions & 2 deletions src/OfficialAccount/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function blacklist(string $beginOpenid = null)
* @throws \EasySwoole\WeChat\Exception\OfficialAccountError
* @throws \EasySwoole\WeChat\Exception\RequestError
*/
public function block($openidList)
public function black($openidList)
{
$url = ApiUrl::generateURL(ApiUrl::BATCH_BLACKLIST, [
'ACCESS_TOKEN'=> $this->getOfficialAccount()->accessToken()->getToken()
Expand All @@ -135,7 +135,7 @@ public function block($openidList)
* @throws \EasySwoole\WeChat\Exception\OfficialAccountError
* @throws \EasySwoole\WeChat\Exception\RequestError
*/
public function unblock($openidList)
public function unblack($openidList)
{
$url = ApiUrl::generateURL(ApiUrl::BATCH_UNBLACKLIST, [
'ACCESS_TOKEN'=> $this->getOfficialAccount()->accessToken()->getToken()
Expand Down