discuz手机触屏版显示付费附件,并支持手机端支付购买

[复制链接]
查看2725 | 回复0 | 2020-2-15 21:14 | 显示全部楼层 |阅读模式
机端默认不显示收费附件,除非你在PC端购买过这个附件,之所以这样,是因为手机端不支持附件购买,所以官方干脆就不显示付费附件。
修改教程如下,增加手机触屏版显示付费附件,并支持手机端支付购买:
打开/upload/source/language/lang_message.php,找到:
  1. 'attachment_buyall' => '本帖所有附件购买成功 ',
复制代码
底下加:
  1. 'attachment_mobile_buy' => '附件购买成功',
复制代码
打开/upload/source/module/forum/forum_misc.php,找到:
  1. if(count($aids) > 1) {
  2.                         showmessage('attachment_buyall', 'forum.php?mod=redirect&goto=findpost&ptid='.$attach['tid'].'&pid='.$attach['pid']);
  3.                 } else {
  4.                         $_G['forum_attach_filename'] = $attach['filename'];
  5.                         showmessage('attachment_buy', "forum.php?mod=attachment&aid=$aidencode", array('filename' => $_G['forum_attach_filename']), array('redirectmsg' => 1));
  6.                 }
复制代码
改为:
  1. if(defined('IN_MOBILE')) {
  2.                         showmessage('attachment_mobile_buy', 'forum.php?mod=redirect&goto=findpost&ptid='.$attach['tid'].'&pid='.$attach['pid']);
  3.                 } else {
  4.                         if(count($aids) > 1) {
  5.                                 showmessage('attachment_buyall', 'forum.php?mod=redirect&goto=findpost&ptid='.$attach['tid'].'&pid='.$attach['pid']);
  6.                         } else {
  7.                                 $_G['forum_attach_filename'] = $attach['filename'];
  8.                                 showmessage('attachment_buy', "forum.php?mod=attachment&aid=$aidencode", array('filename' => $_G['forum_attach_filename']), array('redirectmsg' => 1));
  9.                         }
  10.                 }
复制代码
打开/upload/template/default/touch/forum/discuzcode.htm,找到:
  1. <!--{if !$attach['price'] || $attach['payed']}-->
  2.                 <div id="attach_$attach[aid]" class="box attach mbn" >
  3.                         <!--{if $_G['setting']['mobile']['mobilesimpletype'] == 0}-->
  4.                         $attach[attachicon]
  5.                         <!--{/if}-->
  6.                         <!--{if !$attach['price'] || $attach['payed']}-->
  7.                                 <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode" target="_blank">$attach[filename]</a>
  8.                         <!--{else}-->
  9.                                 <a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" target="_blank">$attach[filename]</a>
  10.                         <!--{/if}-->
  11.                         <em class="xg1">($attach[attachsize])</em>
  12.                         <em class="xg1"><br />({lang downloads}: $attach[downloads], $attach[dateline] {lang upload})
  13.                         </em>
  14.                         <!--{if !$attach['attachimg'] && $_G['getattachcredits']}-->{lang attachcredits}: $_G[getattachcredits]<!--{/if}-->
  15.                 </div>
  16.                 <!--{/if}-->
复制代码
改为:
  1. <div id="attach_$attach[aid]" class="box attach mbn" >
  2.                         <!--{if $_G['setting']['mobile']['mobilesimpletype'] == 0}-->
  3.                         $attach[attachicon]
  4.                         <!--{/if}-->
  5.                         <!--{if !$attach['price'] || $attach['payed']}-->
  6.                                 <a href="forum.php?mod=attachment{$is_archive}&aid=$aidencode" target="_blank">$attach[filename]</a>
  7.                         <!--{else}-->
  8.                                 <a href="forum.php?mod=misc&action=attachpay&aid=$attach[aid]&tid=$attach[tid]" target="_blank">$attach[filename]</a>
  9.                         <!--{/if}-->
  10.                         <em class="xg1">($attach[attachsize])</em>
  11.                         <em class="xg1"><br />({lang downloads}: $attach[downloads], $attach[dateline] {lang upload})
  12.                         </em>
  13.                         <!--{if !$attach['attachimg'] && $_G['getattachcredits']}-->{lang attachcredits}: $_G[getattachcredits]<!--{/if}-->
  14.                 </div>
复制代码
下面附件上传到/upload/template/default/touch/forum/attachpay.htm(Discuz默认没有这个文件)
attachpay.zip (1.5 KB, 下载次数: 0, 售价: 10 丢币)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-4-16