composer
composer require "youduphp/hyperf-youdu:^1.0"
publish
php bin/hyperf.php vendor:publish youduphp/hyperf-youdu
use YouduPhp\HyperfYoudu\Facades\Youdu;
Youdu::message()->send('user1|user2', 'dept1|dept2', 'test'); // send to user and dept
Youdu::message()->sendToUser('user1|user2', 'test'); // send to user
Youdu::message()->sendToDept('dept1|dept2', 'test'); // send to dept
use YouduPhp\HyperfYoudu\Facades\Youdu;
Youdu::message()->send('user1|user2', 'dept1|dept2',new Text('test'));
Youdu::message()->sendToUser('user1|user2', new Image($mediaId)); // $mediaId 通过 Youdu::media()->upload() 接口获得
Youdu::message()->sendToDept('dept1|dept2', new File($mediaId)); // $mediaId 通过 Youdu::media()->upload() 接口获得
// ...
类型 | 类 |
---|---|
文本 | YouduPhp\Youdu\Message\App\Text |
图片 | YouduPhp\Youdu\Message\App\Image |
文件 | YouduPhp\Youdu\Message\App\File |
图文 | YouduPhp\Youdu\Message\App\Mpnews |
链接 | YouduPhp\Youdu\Message\App\Link |
外部链接 | YouduPhp\Youdu\Message\App\Exlink |
系统 | YouduPhp\Youdu\Message\App\SysMsg |
短信 | YouduPhp\Youdu\Message\App\Sms |
邮件 | YouduPhp\Youdu\Message\App\Mail |
use YouduPhp\HyperfYoudu\Facades\Youdu;
$mediaId = Youdu::media()->upload($file, $fileType); // $fileType image代表图片、file代表普通文件、voice代表语音、video代表视频
use YouduPhp\HyperfYoudu\Facades\Youdu;
Youdu::media()->download($mediaId, $savePath);