标签:card message result sgid ast 地理位置 服务器 绑定 func
https://www.easywechat.com/docs/master/installation
-----其它的回复
创建菜单
自定义菜单事件
地理位置
回复素材
发送一次性订阅消息 与 发送模板消息
-------- easy-wechat
获取微信服务器 IP (或IP段) $ips = $app->base->getValidIps();
$message = $server->getMessage(); //push 的闭包外调用, 直接使用 $message 参数
回复客服消息
$message = new Text(‘Hello world!‘);
$result = $app->customer_service->message($message)->to($openId)->send();
回复多图文消息
$news1 = new NewsItem(...);
$news = new News([$news1]);
$app->customer_service->message($news)->to($openId)->send();
$app->server->push(function ($message) {
$news = new NewsItem(...);
return new News([$news]);
});
$app->customer_service //客服
$server = $app->server;
$user = $app->user;
$app->broadcasting 群发
$app->media 媒体操作
$app->template_message 模版
$app->user_tag 用户标签
$app->material 素菜管理
server
$app->server->serve();
$server->push | $server->push(function($message) use ($user) {
$server->getMessage()
user
$user->get(openid);
broadcasting
sendText |群发消息 $app->broadcasting->sendText("大家好!欢迎使用 EasyWeChat。", [$openid1, $openid2]);
sendNews |群发图文 $app->broadcasting->sendNews($mediaId, [$openid1, $openid2]);
previewText |群发预览消息给指定用户 $app->broadcasting->previewText($text, $openId);
media
uploadVideoForBroadcasting | 上传视频 $app->media->uploadVideoForBroadcasting(‘/path/to/video.mp4‘, ‘视频标题‘, ‘视频描述‘);
user_tag
list |用户标签列表
create
update
usersOfTag |获取某标签下的用户 usersOfTag($tagId, $nextOpenId = ‘‘);
tagUsers |批量给用户加标签 $app->user_tag->tagUsers($openIds, $tagId);
material
list |素材列表 $app->material->list($type, $offset, $count); 图片(image)、视频(video)、语音 (voice)、图文(news)
delete |删除素材
stats |素材个数统计
get |获取素材 get($mediaId)
uploadVideo | 上传视频 uploadVideo("/path/to/your/video.mp4", "视频标题", "视频描述");
uploadVoice | uploadVoice("/path/to/your/voice.mp3")
uploadImage | uploadImage("/path/to/your/image.jpg");
----test
$app->broadcasting->status($msgId); //查看群发消息状态
回复图片
$app->server->push(function ($message) {
return new Image(‘media-id‘);
});
上传视频,群发
$video = ‘/path/to/video.mp4‘;
$videoMedia = $app->media->uploadVideoForBroadcasting($video, ‘视频标题‘, ‘视频描述‘);
发送预览群发消息给指定的 openId 用户
$app->broadcasting->sendVideo($videoMedia[‘media_id‘]);
$app->broadcasting->previewText($text, $openId);
$app->broadcasting->previewNews($mediaId, $openId);
$app->broadcasting->previewVoice($mediaId, $openId);
$app->broadcasting->previewImage($mediaId, $openId);
$app->broadcasting->previewVideo($message, $openId);
$app->broadcasting->previewCard($cardId, $openId);
发送预览群发消息给指定的微信号用户
$app->broadcasting->previewTextByName($text, $wxname);
snsapi_userinfo snsapi_userinfo
{
"id":"oOzN41W460lmUKTKzPkf8VZGLDfs",
"name":"\u82cf\u6653\u9f99",
"nickname":"\u82cf\u6653\u9f99",
"avatar":"http:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/Q0j4TwGTfTI5haosqZFqdU9ic4yGKXiavWfXtnsqmxMRoW7hSEtxMFXCzULurSn5K7ia7uddOerSGApOp3Vq1L2IA\/132",
"email":null,"original":{"openid":"oOzN41W460lmUKTKzPkf8VZGLDfs","nickname":"\u82cf\u6653\u9f99","sex":1,
"language":"zh_CN","city":"","province":"","country":"\u6cfd\u897f\u5c9b",
"headimgurl":"http:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/Q0j4TwGTfTI5haosqZFqdU9ic4yGKXiavWfXtnsqmxMRoW7hSEtxMFXCzULurSn5K7ia7uddOerSGApOp3Vq1L2IA\/132",
"privilege":[]},"token":"27_YutnAyTe9RS9hSXJxht8Yhc4DS8tIWOdPV-A0e-P3BPT-29JN06rJl3mzMvSLkNzJ7V6PJjtuiTa1VN7FiOHyJLEeSzthi3QYa80yUkm-dc","provider":"WeChat"}
scope 为 snsapi_base 时 $oauth->user(); 对象里只有 id (也就是openid)
{"id":"oOzN41W460lmUKTKzPkf8VZGLDfs","name":null,"nickname":null,"avatar":null,"email":null,"original":{"access_token":"27_vC7zi3Om_GVqvJVrsd_-k8a-jGp0EKWUj7AMjx6j8TTj8vg9yp2HL-u9mEbUV8LoH37iatekrjg4EWM91Qh70qpJwUCBkYmSLZ9HMZrQ0JI","expires_in":7200,"refresh_token":"27_ZfbmsXfRJmSC4cl9ffRzCIkf-2NsVI2TLVASFIa2GdoGoUvWUIfspTYNyXrO9Ltiz1Iv5eQARpjG7-BvdFmZKJmOp1lTqXTmgCZqPP9E_i4","openid":"oOzN41W460lmUKTKzPkf8VZGLDfs","scope":"snsapi_base"},"token":"27_vC7zi3Om_GVqvJVrsd_-k8a-jGp0EKWUj7AMjx6j8TTj8vg9yp2HL-u9mEbUV8LoH37iatekrjg4EWM91Qh70qpJwUCBkYmSLZ9HMZrQ0JI","provider":"WeChat"}
绑定微信开放平台 (https://open.weixin.qq.com/)
填写未被微信开放平台注册、未被微信公众平台注册
标签:card message result sgid ast 地理位置 服务器 绑定 func
原文地址:https://www.cnblogs.com/suxiaolong/p/11921677.html