微信登录插件,前台推送素材到后台,无法作为群发材料
经过查看源代码。是因为前台的素材推送在造孽(也可以说是群发在作祟)
简单易懂的做法:
重新上传所有推送到后台的素材图片,随后就能正常发送了。
比较复杂的做法:
自行修改wechat插件下resourcepush.inc.php生成素材代码-line 26
$post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_GET['tid']);
if($thread['cover']) {
$picurl = getthreadcover($thread['tid'], $thread['cover']);
} else {
$attach = C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_GET['tid'], 'pid', array($post['pid']), '', true);
$picurl = '';
if($attach) {
$attach = array_shift($attach);
$picurl = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$attach['attachment'];
}
}
$data = array(
'name' => lang('plugin/wechat', 'resource_thread_push').': '.$thread['subject'],
'data' => array(
'title' => $thread['subject'],
'pic' => $picurl ? (preg_match('/^http:/', $picurl) ? '' : $_G['siteurl']).$picurl : '',
'desc' => messagecutstr($post['message'], 0, 120),
'content' => nl2br(messagecutstr($post['message'])),
'url' => $_G['siteurl'].'forum.php?mod=viewthread&tid='.$_GET['tid'],
),
);
整个过程中,$picurl未生成common目录下新的pic,也没有增加$data['data']['local'],导致报错。
或masssend_setting.inc.php的提交微信服务器端代码
-line 108
if ($res['type'] == 0) {
if ($res['data']['pic']) {
$thumb_media_id = $wechat_client->upload('image', $_G['setting']['attachdir'] . 'common/' . $res['data']['local']);
if (!$thumb_media_id) {
cpmsg_error($wechat_client->error());
}
$res['data']['thumb_media_id'] = $thumb_media_id;
$res['data']['author'] = '';
} else {
cpmsg('wechat:mass_no_pic');
}
array_push($news, $res['data']);
} else if ($res['type'] == 1) {
$news = array();
foreach (array_keys($res['data']['mergeids']) as $resource_id) {
$res = C::t('#wechat#mobile_wechat_resource')->fetch($resource_id);
if (!$res) {
cpmsg('wechat:mass_no_found');
}
if ($res['data']['pic']) {
$thumb_media_id = $wechat_client->upload('image', $_G['setting']['attachdir'] . 'common/' . $res['data']['local']);
if (!$thumb_media_id) {
cpmsg_error($wechat_client->error());
}
$res['data']['thumb_media_id'] = $thumb_media_id;
$res['data']['author'] = '';
array_push($news, $res['data']);
} else {
cpmsg_error('wechat:mass_no_pic');
}
}
}
都强制使用附件common目录下内容,以至于前台生成文件与这里强行拼接不符。
希望能及时修订。
|