此插件在destoon6.0版本测试没问题,其他版本未测试。

效果如图:

destoon6.0积分兑换资金插件-冯金伟博客园

1、打开module\member\admin\template\setting.tpl.php文件
搜索:<div class=”tt”><?php echo $DT[‘credit_name’];?>兑换</div>
<table cellpadding=”2″ cellspacing=”1″ class=”tb”>
在下面增加以下代码:

[php]
<tr>
<td class="tl">会员<?php echo $DT[‘credit_name’];?>兑换<?php echo $DT[‘money_name’];?></td>
<td>
<input type="radio" name="setting[credit_dh]" value="0" <?php if(!$credit_dh) echo ‘checked’;?> onclick="Dh(‘jfdh’);"/> 关闭&nbsp;&nbsp;
<input type="radio" name="setting[credit_dh]" value="1" <?php if($credit_dh) echo ‘checked’;?> onclick="Ds(‘jfdh’);"/> 开启
</td>
</tr>
<tbody id="jfdh" style="display:<?php echo $credit_dh ? ” : ‘none’;?>">
<tr>
<td class="tl">最少兑换<?php echo $DT[‘credit_name’];?></td>
<td><input name="setting[zsjf]" type="text" size="15" value="<?php echo $zsjf;?>"/></td>
</tr>
<tr>
<td class="tl">兑换比率</td>
<td><input name="setting[dhbl]" type="text" size="15" value="<?php echo $dhbl;?>"/><?php tips(‘例如填1表示1个’.$DT[‘credit_name’].’可兑换1个’.$DT[‘money_name’]);?></td>
</tr>
</tbody>[/php]

2、打开module\member\record.inc.php文件
搜索:case ‘pay’:
在上面增加以下代码:

[php]
case ‘exchange’:
if($MOD[‘credit_dh’]) {
if($submit) {
$_credit >= $MOD[‘zsjf’] or message($L[‘credit_pass_ex_min’]);
$amount = intval($amount);
if($amount >= $MOD[‘zsjf’] && $amount <= $_credit) {
credit_add($_username, -$amount);
credit_record($_username, -$amount, ‘system’, $L[‘credit_exchange_title’], $amount.$L[‘credit_exchange_title’].$amount*$MOD[‘dhbl’].$DT[‘money_name’]);

money_add($_username, $amount*$MOD[‘dhbl’]);
money_record($_username, $amount*$MOD[‘dhbl’],$L[‘in_site’], ‘system’, $L[‘credit_exchange_title’], $amount.$L[‘credit_exchange_title’].$amount*$MOD[‘dhbl’].$DT[‘money_name’]);
dmsg($L[‘credit_msg_exchange’], ‘?’);
} else {
message($L[‘credit_pass_ex_max’].$_credit);
}
}
} else {
message($L[‘feature_close’], ‘?’);
}
$head_title = $L[‘credit_exchange_title’];
break;

[/php]

3、2、打开template\default\member\record.htm文件
搜索:<td class=”tab” id=”action_pay”><a href=”record.php?action=pay”><span>信息付费</span></a></td>
在下面增加以下代码:

[php]
{if $MOD[credit_exchange]}
<td class="tab_nav">&nbsp;</td>
<td class="tab" id="action_exchange"><a href="record.php?action=exchange"><span>{$DT[credit_name]}兑换</span></a></td>
{/if}[/php]

搜索:{if $action == ‘pay’}
替换为以下代码:

[php]
{if $action == ‘exchange’}
<form method="post" action="record.php" onsubmit="return check();" id="dform">
<input type="hidden" name="action" value="{$action}"/>
<input type="hidden" name="submit" value="1"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl">可用{$DT[credit_name]}</td>
<td class="tr"><strong class="f_blue">{$_credit}</strong> {$DT[credit_name]}</td>
</tr>
<tr>
<td class="tl">兑换比率</td>
<td class="tr"><span class="f_blue">1</span> {$DT[credit_name]} 兑换 <span class="f_red">{$MOD[dhbl]}</span> {$DT[money_name]}</td>
</tr>
<tr>
<td class="tl"><span class="f_red">*</span> 兑换额度</td>
<td class="tr"><input type="text" size="8`" name="amount"/> (兑换额度最少<span class="f_red">{$MOD[zsjf]}</span> {$DT[credit_name]}) <span id="damount" class="f_red"></span></td>
</tr>
<tr>
<td class="tl">&nbsp;</td>
<td class="tr" height="50"><input type="submit" value=" 确 定 " class="btn"/></td>
</tr>
</table>
</form>
<script type="text/javascript">
function check() {
m = parseInt(Dd(‘amount’).value);
n = {$_credit};
if(m >= {$MOD[zsjf]} && m <= n) {
return confirm(‘确定要兑换’+m+'{$DT[credit_name]}吗? 可换取’+(m*{$MOD[dhbl]})+'{$DT[money_name]}’);
} else {
Dd(‘amount’).value = ”;
Dmsg(‘请填写兑换额度’, ‘amount’);
return false;
}
}
</script>
<script type="text/javascript">s(‘record’);m(‘action_exchange’);</script>
{elseif $action == ‘pay’}[/php]

4、登录后台-会员管理-模块设置-积分规则-积分兑换
会员积分兑换资金:开启
填写最少兑换积分和兑换比例,确定保存就可以了到前台测试效果了