- 优化企业微信服务

v6 v6.0.65
Chaim 4 years ago
parent 250f4000d9
commit f94c60fabd

@ -43,7 +43,8 @@
"qiniu/php-sdk": "^7.2",
"upyun/sdk": "^3.4",
"netease/nos-php-sdk": "^1.0",
"aws/aws-sdk-php": "^3.142"
"aws/aws-sdk-php": "^3.142",
"liguangchun/qyweixin-grouprobot": "^1.0"
},
"require-dev": {
"symfony/var-dumper": "^4.2"

@ -16,6 +16,8 @@
namespace DtApp\ThinkLibrary\service\wechat;
use DtApp\Notice\QyWeiXin\QyWeXinException;
use DtApp\Notice\QyWeiXin\Send;
use DtApp\ThinkLibrary\exception\DtaException;
use DtApp\ThinkLibrary\Service;
use DtApp\ThinkLibrary\service\curl\HttpService;
@ -50,16 +52,17 @@ class QyService extends Service
* 发送文本消息
* @param string $content 消息内容
* @return bool
* @throws DtaException
* @throws DtaException|QyWeXinException
*/
public function text(string $content = '')
{
$this->msgType = 'text';
return $this->sendMsg([
'text' => [
'content' => $content,
],
]);
if (empty($this->key)) throw new DtaException("请检查KEY");
$config = [
'key' => $this->key
];
$qywx = new Send($config);
return $qywx->text($content);
}
/**
@ -67,15 +70,17 @@ class QyService extends Service
* @param string $content 消息内容
* @return bool
* @throws DtaException
* @throws QyWeXinException
*/
public function markdown(string $content = '')
{
$this->msgType = 'markdown';
return $this->sendMsg([
'markdown' => [
'content' => $content,
],
]);
if (empty($this->key)) throw new DtaException("请检查KEY");
$config = [
'key' => $this->key
];
$qywx = new Send($config);
return $qywx->text($content);
}
/**

Loading…
Cancel
Save