功能:
1.实现看贴只扣一次,不计算回复数 (再次查看主题仍会扣分)
2.楼主不扣积分
说明:此插件版权为原作者,因为看到有朋友也需要这样的功能,所以略微改了一下
使用此方法请先看原作者的贴子
浏览消费积分 for dz4X 5X by lu5266
https://discuz.dismall.com/viewthread.php?tid=355075
修改部分:
在viewthread.php
1. 查找:
- include template('viewthread');
复制代码
在上面加上:
- // PayView Powered by lu5266
- @require_once DISCUZ_ROOT.'./forumdata/cache/plugin_pay_view.php';
- $pvvars = $_DPLUGIN['pay_view']['vars'];
- $creditid = intval(substr($pvvars['creditid'],-1,1));
- if(!$pvvars['fids'] || in_array($fid,explode(',',$pvvars[fids]))){
- if(!$discuz_uid) {
- showmessage("浏览帖子需要消耗扩展积分[".$extcredits[$creditid]['title']."],登陆后方可以浏览.", NULL, 'NOPERM');
- }else {
- $paycredits = ceil(count($postlist) * floatval($pvvars['price']));
- if($paycredits > $GLOBALS[extcredits.$creditid]) {
- showmessage("浏览帖子需要消耗扩展积分 [".$extcredits[$creditid]['title']."],你的只有[".$GLOBALS[extcredits.$creditid]."],已经不够消耗了(每贴需要消耗[".floatval($pvvars['price'])."]).", NULL, 'NOPERM');
- }
- $db->query("UPDATE {$tablepre}members SET extcredits$creditid = extcredits$creditid - $paycredits WHERE uid = '$discuz_uid'", 'UNBUFFERED');
- }
- }
复制代码
这段改成下面的[如果您的论坛上已经有上面的代码请用下面的替换]:
-
- // PayView Powered by lu5266
- @require_once DISCUZ_ROOT.'./forumdata/cache/plugin_pay_view.php';
- $pvvars = $_DPLUGIN['pay_view']['vars'];
- $creditid = intval(substr($pvvars['creditid'],-1,1));
- if((!$pvvars['fids'] || in_array($fid,explode(',',$pvvars[fids])))and $thread[authorid]!=$discuz_uid){//楼主不扣积分
- if(!$discuz_uid) {
- showmessage("浏览帖子需要消耗扩展积分[".$extcredits[$creditid]['title']."],登陆后方可以浏览.", NULL, 'NOPERM');
- }else {
- // $paycredits = ceil(count($postlist) * floatval($pvvars['price']));
- $paycredits = floatval($pvvars['price']);//此句修改,只扣一次积分
- if($paycredits > $GLOBALS[extcredits.$creditid]) {
- showmessage("浏览帖子需要消耗扩展积分 [".$extcredits[$creditid]['title']."],你的只有[".$GLOBALS[extcredits.$creditid]."],已经不够消耗了(每贴需要消耗[".floatval($pvvars['price'])."]发贴和回复都能增加体力).", NULL, 'NOPERM');
- }
- $db->query("UPDATE {$tablepre}members SET extcredits$creditid = extcredits$creditid - $paycredits WHERE uid = '$discuz_uid'", 'UNBUFFERED');
- }
- }
复制代码
注:本文只扣一次的意思是,看一个贴子只扣一次,而不是原作者的连每个回复也一块扣,
如果真正的看过一次贴子,以后再看就不再扣分,这个要增加数据表,每个会员每次看贴都会加重服务器负担,故没有采用
[ 本帖最后由 oldsword 于 2006-10-17 08:35 编辑 ] |