Files
fast_response/admin/application/api/logic/MessageWechatLogic.php
2025-03-29 13:59:40 +08:00

61 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/*
* description
* authorwh
* email
* createTime{2025/3/27} {19:50}
*/
namespace app\api\logic;
use wanghua\general_utility_tools_php\tool\Tools;
class MessageWechatLogic extends BaseWechatLogic
{
/**
* desc发送私聊消息
* authorwh
* @param $data
* @return mixed
* @throws \Exception
*/
public function postText($data)
{
$url = '/message/postText';
$post_data = [
'appId'=>$data['appId'],
'toWxid'=>$data['toWxid'],
'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;
}
/**
* 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;
}
}