コード例 #1
0
ファイル: ArticlesEvent.class.php プロジェクト: xswolf/dc
 /**
  * 新增图文消息
  */
 public function uploadNews()
 {
     //'pk7-ztaDrb1tKm6mPwKtxJO50386VvsJ6qgDw6isuUypA94v9xj3RdXYUMuqkI4b'
     $articles = [['title' => '请戳图', 'thumb_media_id' => 'ybFlQ9kmPTgiCWZT8Mq_1YnKtBziwpbaVDaftpJckPtFzlwROlgXpKCd9Dbl_JRs', 'author' => 'gy', 'digest' => '哈哈哈哈哈哈哈', 'show_cover_pic' => 1, 'content' => '', 'content_source_url' => 'www.baidu.com']];
     $info = AdvancedBroadcast::uploadNews($articles);
     dump($info);
 }
コード例 #2
0
ファイル: demo.php プロジェクト: liu33851861/WeChatThink
\LaneWeChat\Core\Media::download($mediaId);
/**
 * 自定义菜单
 */
//设置菜单
$menuList = array(array('id' => '1', 'pid' => '', 'name' => '常规', 'type' => '', 'code' => 'key_1'), array('id' => '2', 'pid' => '1', 'name' => '点击', 'type' => 'click', 'code' => 'key_2'), array('id' => '3', 'pid' => '1', 'name' => '浏览', 'type' => 'view', 'code' => 'http://www.lanecn.com'), array('id' => '4', 'pid' => '', 'name' => '扫码', 'type' => '', 'code' => 'key_4'), array('id' => '5', 'pid' => '4', 'name' => '扫码带提示', 'type' => 'scancode_waitmsg', 'code' => 'key_5'), array('id' => '6', 'pid' => '4', 'name' => '扫码推事件', 'type' => 'scancode_push', 'code' => 'key_6'), array('id' => '7', 'pid' => '', 'name' => '发图', 'type' => '', 'code' => 'key_7'), array('id' => '8', 'pid' => '7', 'name' => '系统拍照发图', 'type' => 'pic_sysphoto', 'code' => 'key_8'), array('id' => '9', 'pid' => '7', 'name' => '拍照或者相册发图', 'type' => 'pic_photo_or_album', 'code' => 'key_9'), array('id' => '10', 'pid' => '7', 'name' => '微信相册发图', 'type' => 'pic_weixin', 'code' => 'key_10'), array('id' => '11', 'pid' => '1', 'name' => '发送位置', 'type' => 'location_select', 'code' => 'key_11'));
\LaneWeChat\Core\Menu::setMenu($menuList);
//获取菜单
\LaneWeChat\Core\Menu::getMenu();
//删除菜单
\LaneWeChat\Core\Menu::delMenu();
/**
 * 应用一:给粉丝群发发送消息
 */
//群发消息
//获取粉丝列表
$fansList = \LaneWeChat\Core\UserManage::getFansList();
//上传图片
$menuId = \LaneWeChat\Core\Media::upload('/var/www/baidu_jgylogo3.jpg', 'image');
if (empty($menuId['media_id'])) {
    die('error');
}
//上传图文消息
$list = array();
$list[] = array('thumb_media_id' => $menuId['media_id'], 'author' => '作者', 'title' => '标题', 'content_source_url' => 'www.lanecn.com', 'digest' => '摘要', 'show_cover_pic' => '1');
$list[] = array('thumb_media_id' => $menuId['media_id'], 'author' => '作者', 'title' => '标题', 'content_source_url' => 'www.lanecn.com', 'digest' => '摘要', 'show_cover_pic' => '0');
$list[] = array('thumb_media_id' => $menuId['media_id'], 'author' => '作者', 'title' => '标题', 'content_source_url' => 'www.lanecn.com', 'digest' => '摘要', 'show_cover_pic' => '0');
$mediaId = \LaneWeChat\Core\AdvancedBroadcast::uploadNews($list);
//给粉丝列表的用户群发图文消息
$result = \LaneWeChat\Core\AdvancedBroadcast::sentNewsByOpenId($fansList['data']['openid'], $mediaId);