用过destoon的站长都知道,destoon的会员购买和升级模式是按年付费的,有很多用户不愿意一次花很多钱买年费,所以,我们就改成月付模式,但destoon默认不支持月付,没办法,只能搞个小二开了
其实也很简单,修改部分php代码和模板就可以,下面以默认程序和默认模板为例(如果你对应的程序文件和模板有修改过,请对照教程自行修改,记得先备份)
1、修改 /module/member/account.inc.php ,找到 case 'vip':
- case 'vip':
- $user = userinfo($_username);
- if(!$MG['vip'] || !$MG['fee'] || $user['totime'] < $DT_TIME) dheader('?action=index');
- $auto = 0;
- $auth = isset($auth) ? decrypt($auth, DT_KEY.'CG') : '';
- if($auth && substr($auth, 0, 4) == 'vip|') {
- $auto = $submit = 1;
- $year = intval(substr($auth, 4));
- }
- if($submit) {
- $year = intval($year);
- in_array($year, array(1, 2, 3)) or $year = 1;
- $fee = dround($MG['fee']*$year);
- $fee > 0 or message($L['vip_msg_fee']);
- $fee <= $_money or message($L['money_not_enough']);
- if($fee <= $DT['quick_pay']) $auto = 1;
- if(!$auto) {
- is_payword($_username, $password) or message($L['error_payword']);
- }
- $totime = $user['totime'] + 365*86400*$year;
- money_add($_username, -$fee);
- money_record($_username, -$fee, $L['in_site'], 'system', $L['vip_renew'], lang($L['vip_record'], array($year, timetodate($totime, 3))));
- $db->query("UPDATE {$DT_PRE}company SET totime=$totime WHERe userid=$_userid");
- dmsg($L['vip_msg_success'], '?action=index');
- } else {
- $havedays = ceil(($user['totime'] - $DT_TIME)/86400);
- $todate = timetodate($user['totime'], 3);
- $year = 1;
- if($sum > 1 && $sum < 4) $year = $sum;
- $fee = dround($MG['fee']*$year);
- $head_title = $L['vip_renew'];
- }
- break;
把它换成
- case 'vip':
- $user = userinfo($_username);
- if(!$MG['vip'] || !$MG['fee'] || $user['totime'] < $DT_TIME) dheader('?action=index');
- $months = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36, 48, 60); //2020.05.02
- $auto = 0;
- $monthsxh = 12; //2020.05.02
- $auth = isset($auth) ? decrypt($auth, DT_KEY.'CG') : '';
- if($auth && substr($auth, 0, 4) == 'vip|') {
- $auto = $submit = 1;
- //$year = intval(substr($auth, 4));
- $month = intval($tmp[2]); //2020.05.02
- }
- if($submit) {
- //$year = intval($year);
- //in_array($year, array(1, 2, 3)) or $year = 1;
- //$fee = dround($MG['fee']*$year);
- $month = intval($month); //2020.05.02
- in_array($month, $months) or $month = 1; //2020.05.02
- $fee = dround($MG['fee']/$monthsxh*$month); //2020.05.02
- $fee > 0 or message($L['vip_msg_fee']);
- $fee <= $_money or message($L['money_not_enough']);
- if($fee <= $DT['quick_pay']) $auto = 1;
- if(!$auto) {
- is_payword($_username, $password) or message($L['error_payword']);
- }
- //$totime = $user['totime'] + 365*86400*$year;
- $totime = $user['totime'] + 86400*30*$month; //2020.05.02
- money_add($_username, -$fee);
- //money_record($_username, -$fee, $L['in_site'], 'system', $L['vip_renew'], lang($L['vip_record'], array($year, timetodate($totime, 3))));
- money_record($_username, -$fee, $L['in_site'], 'system', $L['vip_renew'], lang($L['vip_record'], array($month, timetodate($totime, 3)))); //2020.05.02
- $db->query("UPDATE {$DT_PRE}company SET totime=$totime WHERe userid=$_userid");
- dmsg($L['vip_msg_success'], '?action=index');
- } else {
- $havedays = ceil(($user['totime'] - $DT_TIME)/86400);
- $todate = timetodate($user['totime'], 3);
- //$year = 1;
- //if($sum > 1 && $sum < 4) $year = $sum;
- //$fee = dround($MG['fee']*$year);
- $month = 1; //2020.05.02
- if($sum > 1 && $sum < 4) $month = $sum; //2020.05.02
- $fee = dround($MG['fee']*$month); //2020.05.02
- $head_title = $L['vip_renew'];
- }
- break;
图例:
2、总后台的显示修改
找到 /module/member/admin/template/group_edit.tpl.php 搜索 “收费设置” 把年改成 月
如图:
3、修改升级提交后 后台审核时的到期时间以 月 为单位
找到/module/member/admin/grade.inc.php 搜索 $days = 364; 改成 $days = 30;
如图:
完成这3步,php就修改完成了。
接着修改前端模板部分(我们以默认模板为例)
1、打开 template/default/member/account.htm 找打 服务费用
- <tr>
- <td class="tl">服务费用</td>
- <td class="tr"><span class="f_red">{$MG[fee]}</span> {$DT[money_unit]}/年</td>
- </tr>
- <tr>
- <td class="tl"><span class="f_red">*</span> 续费年限</td>
- <td class="tr">
- <select name="year" id="year"$('#money').html(this.value*{$MG[fee]});">
- <option value="1"<?php if($year == 1) echo ' selected';?>>1年</option>
- <option value="2"<?php if($year == 2) echo ' selected';?>>2年</option>
- <option value="3"<?php if($year == 3) echo ' selected';?>>3年</option>
- </select>
- </td>
- </tr>
换成
- <tr>
- <td class="tl">服务费用</td>
- <td class="tr"><span class="f_red">{$MG[fee]}</span> {$DT[money_unit]}/月</td>
- </tr>
- <tr>
- <td class="tl"><span class="f_red">*</span> 续费期限</td>
- <td class="tr">
- <select name="month" id="month" onchange="$('#money').html(this.value*{$MG[fee]});">
- <option value="1"<?php if($month == 1) echo ' selected';?>>1月</option>
- <option value="2"<?php if($month == 2) echo ' selected';?>>2月</option>
- <option value="3"<?php if($month == 3) echo ' selected';?>>3月</option>
- <option value="4"<?php if($month == 4) echo ' selected';?>>4月</option>
- <option value="5"<?php if($month == 5) echo ' selected';?>>5月</option>
- <option value="6"<?php if($month == 6) echo ' selected';?>>6月</option>
- <option value="7"<?php if($month == 7) echo ' selected';?>>7月</option>
- <option value="8"<?php if($month == 8) echo ' selected';?>>8月</option>
- <option value="9"<?php if($month == 9) echo ' selected';?>>9月</option>
- <option value="10"<?php if($month == 10) echo ' selected';?>>10月</option>
- <option value="11"<?php if($month == 11) echo ' selected';?>>11月</option>
- <option value="12"<?php if($month == 12) echo ' selected';?>>12月</option>
- <option value="13"<?php if($month == 24) echo ' selected';?>>24月</option>
- <option value="14"<?php if($month == 36) echo ' selected';?>>36月</option>
- <option value="15"<?php if($month == 48) echo ' selected';?>>48月</option>
- <option value="16"<?php if($month == 60) echo ' selected';?>>60月</option>
- </select>
- </td>
- </tr>
继续找 大约 293行 {elseif $action == 'vip'}
- {elseif $action == 'vip'}
- function check() {
- var money = $('#year').val()*{$MG[fee]};
- if(money > {$_money}) {
- Go('charge.php?action=pay&reason=vip|'+$('#year').val()+'&amount='+money+'&bank='+$('#bank').val());
- return false;
- }
- if(money > {$DT[quick_pay]}){
- if(Dd('password').value.length < 6) {
- Dmsg('请填写支付密码', 'password');
- return false;
- }
- }
- return true;
- }
- window.setInterval(
- function() {
- var money = $('#year').val()*{$MG[fee]};
- if(money > {$_money} || {$_money} < 0.01) {
- $('#mymoney').hide();$('#paytype').show();$('#payword').hide();
- } else {
- $('#mymoney').show();$('#paytype').hide();if(money > {$DT[quick_pay]}){$('#payword').show();}
- }
- },
- 500);
- {/if}
改成
- {elseif $action == 'vip'}
- function check() {
- var money = $('#month').val()*{$MG[fee]};
- if(money > {$_money}) {
- Go('charge.php?action=pay&reason=vip|'+$('#month').val()+'&amount='+money+'&bank='+$('#bank').val());
- return false;
- }
- if(money > {$DT[quick_pay]}){
- if(Dd('password').value.length < 6) {
- Dmsg('请填写支付密码', 'password');
- return false;
- }
- }
- return true;
- }
- window.setInterval(
- function() {
- var money = $('#month').val()*{$MG[fee]};
- if(money > {$_money} || {$_money} < 0.01) {
- $('#mymoney').hide();$('#paytype').show();$('#payword').hide();
- } else {
- $('#mymoney').show();$('#paytype').hide();if(money > {$DT[quick_pay]}){$('#payword').show();}
- }
- },
- 500);
- {/if}
2、打开 template/default/member/grade.htm 找到 收费模式 ,如
- <tr align="center">
- <td>收费模式</td>
- {loop $GROUPS $k $v}{if $k > 4}
- <td>{if $v[fee_mode]}<span class="f_red">包年</span>{else}<span class="f_green">免费</span>{/if}</td>
- {/if}{/loop}
- </tr>
- <tr align="center">
- <td>年 费</td>
- {loop $GROUPS $k $v}{if $k > 4}
- <td>{if $v[fee]}<span class="f_price">{$DT[money_sign]}<strong>{$v[fee]}</strong>{$DT[money_unit]}/年</span>{else}--{/if}</td>
- {/if}{/loop}
- </tr>
改成
- <tr align="center">
- <td>收费模式</td>
- {loop $GROUPS $k $v}{if $k > 4}
- <td>{if $v[fee_mode]}<span class="f_red">包月</span>{else}<span class="f_green">免费</span>{/if}</td>
- {/if}{/loop}
- </tr>
- <tr align="center">
- <td>月 费</td>
- {loop $GROUPS $k $v}{if $k > 4}
- <td>{if $v[fee]}<span class="f_price">{$DT[money_sign]}<strong>{$v[fee]}</strong>{$DT[money_unit]}/月</span>{else}--{/if}</td>
- {/if}{/loop}
- </tr>
这样前端,后台就修改完成了 ,自己去体验吧,图为例