This commit is contained in:
2025-03-28 10:24:45 +08:00
parent de120360fd
commit d39a8f11de
5 changed files with 48 additions and 6 deletions

View File

@@ -14,8 +14,13 @@ use wanghua\general_utility_tools_php\tool\Tools;
class MessageLogic extends BaseLogic
{
///message/postText
/**
* desc发送私聊消息
* authorwh
* @param $data
* @return mixed
* @throws \Exception
*/
public function postText($data)
{
$url = '/message/postText';
@@ -31,4 +36,26 @@ class MessageLogic extends BaseLogic
Tools::log_to_write_txt(['发送文字消息,出参:$res'=>$res]);
return $res;
}
/**
* desc发送群消息
* authorwh
* @param $data
* @return mixed
*/
public function postGroupText($data)
{
$url = '/message/postText';
$post_data = [
'appId'=>$data['appId'],
'toWxid'=>$data['toWxid'],//群的ID
'content'=>$data['content'],
//@的好友,多个英文逗号分隔。群主或管理员@全部的人,则填写'notify@all'
'ats'=>$data['ats'],
];
Tools::log_to_write_txt(['发送文字消息,入参:$post_data'=>$post_data]);
$res = $this->curl_post_json($url, $post_data);
Tools::log_to_write_txt(['发送文字消息,出参:$res'=>$res]);
return $res;
}
}