This commit is contained in:
2020-11-14 02:36:05 +08:00
parent 7e3a959096
commit b556ebffa2
+37 -27
View File
@@ -32,51 +32,55 @@ class Message extends SmallProgram
/**
* @param string $content
* @return Message
* @return Result
* @throws \Exception
*/
public function sendTextNews(string $content)
{
$this->msgData['msgtype'] = 'text';
$this->msgData['text'] = ['content' => $content];
return $this;
return $this->sendKefuMsg();
}
/**
* @param string $media_id
* @return Message
* @param $media_id
* @return Result
* @throws \Exception
*/
public function sendImageNews(string $media_id)
{
$this->msgData['msgtype'] = 'image';
$this->msgData['image'] = ['media_id' => $media_id];
return $this;
return $this->sendKefuMsg();
}
/**
* @param string $media_id
* @return Message
* @param $media_id
* @return Result
* @throws \Exception
*/
public function sendVoiceNews(string $media_id)
{
$this->msgData['msgtype'] = 'voice';
$this->msgData['voice'] = ['media_id' => $media_id];
return $this;
return $this->sendKefuMsg();
}
/**
* @param string $media_id
* @return Message
* @param $media_id
* @return Result
* @throws \Exception
*/
public function sendMpNewsNews(string $media_id)
{
$this->msgData['msgtype'] = 'mpnews';
$this->msgData['mpnews'] = ['media_id' => $media_id];
return $this;
return $this->sendKefuMsg();
}
@@ -85,7 +89,8 @@ class Message extends SmallProgram
* @param string $description
* @param string $url
* @param string $picurl
* @return Message
* @return Result
* @throws \Exception
*/
public function sendNewsNews(string $title, string $description, string $url, string $picurl)
{
@@ -96,20 +101,21 @@ class Message extends SmallProgram
'url' => $url,
'picurl' => $picurl
]]];
return $this;
return $this->sendKefuMsg();
}
/**
* @param string $title
* @return Message
* @return Result
* @throws \Exception
*/
public function sendCardNews(string $title)
{
$this->msgData['msgtype'] = 'wxcard';
$this->msgData['wxcard'] = ['card_id' => $title];
return $this;
return $this->sendKefuMsg();
}
@@ -118,7 +124,8 @@ class Message extends SmallProgram
* @param string $thumb_media_id
* @param string $title
* @param string $description
* @return Message
* @return Result
* @throws \Exception
*/
public function sendVideoNews(string $media_id, string $thumb_media_id, string $title, string $description)
{
@@ -129,7 +136,7 @@ class Message extends SmallProgram
'title' => $title,
'description' => $description
]];
return $this;
return $this->sendKefuMsg();
}
@@ -139,7 +146,8 @@ class Message extends SmallProgram
* @param string $thumb_media_id
* @param string $title
* @param string $description
* @return Message
* @return Result
* @throws \Exception
*/
public function sendMusicNews(string $musicurl, string $hqmusicurl, string $thumb_media_id, string $title, string $description)
{
@@ -151,7 +159,7 @@ class Message extends SmallProgram
'hqmusicurl' => $hqmusicurl,
'thumb_media_id' => $thumb_media_id
];
return $this;
return $this->sendKefuMsg();
}
@@ -159,7 +167,7 @@ class Message extends SmallProgram
* @param string $head_content
* @param string $tail_content
* @param array $menus
* @return Message
* @return Result
* @throws \Exception
*/
public function sendMenuNews(string $head_content, string $tail_content, array $menus = [])
@@ -175,7 +183,7 @@ class Message extends SmallProgram
foreach ($menus as $key => $val) {
$this->addNewsMenu($val['id'], $val['name']);
}
return $this;
return $this->sendKefuMsg();
}
private int $index = 0;
@@ -195,11 +203,12 @@ class Message extends SmallProgram
}
/**
* @param string $title
* @param string $appid
* @param string $pagepath
* @param string $thumb_media_id
* @return Message
* @param $title
* @param $appid
* @param $pagepath
* @param $thumb_media_id
* @return Result
* @throws \Exception
*/
public function sendMiniprogrampageNews(string $title, string $appid, string $pagepath, string $thumb_media_id)
{
@@ -210,7 +219,7 @@ class Message extends SmallProgram
'pagepath' => $pagepath,
'thumb_media_id' => $thumb_media_id,
];
return $this;
return $this->sendKefuMsg();
}
/**
@@ -270,6 +279,7 @@ class Message extends SmallProgram
/**
* @param $data
* @return Result
* @throws \Exception
*/