此改造优化了帝国CMS点卡功能,让点卡充值运作的站点客户操作更方便一些,点卡充值应该用一个卡号串就行,以前那种卡号 密码的方式有点麻烦了。
后台生成卡号截图
单独增加点卡:
批量增加点卡:
前台点卡充值:
具体方法如下:(请自行备份文件,以免不测。)
1.打开文件/e/admin/member/AddCard.php
找到下面代码删除
$r[password]=strtolower(no_make_password(6));
找到
$$r=$empire->fetch1("select card_no,password,money,cardfen,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where cardid='$cardid' limit 1");
改成:
$r=$empire->fetch1("select card_no,money,cardfen,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where cardid='$cardid' limit 1");
2.打开文件/e/admin/member/AddMoreCard.php
找到下面代码删除
<tr bgcolor="#FFFFFF">
<td height="25">点卡密码位数:</td>
<td height="25"><input name="passnum" type="text" id="passnum" value="6" size="6">
位 </td>
</tr>
3.打开文件/e/admin/member/ListCard.php
找到:
if(!$add[card_no]||!$add[password]||!$add[money])
改成:
if(!$add[card_no]||!$add[money])
找到下面代码删除:
$add['password']=hRepPostStr($add['password'],1);
找到:
$sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,password,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$add[card_no]','$add[password]',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
改成:
$sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$add[card_no]',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
找到下面代码删除:
$passnum=(int)$add['passnum'];
找到:
if(!$donum||!$cardnum||!$passnum||!$add[money])
改成:
if(!$donum||!$cardnum||!$add[money])
找到下面代码删除:
$password=strtolower(no_make_password($passnum));
找到:
$sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,password,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$card_no','$password',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
改成:
$sql=$empire->query("insert into {$dbtbpre}enewscard(card_no,cardfen,money,cardtime,endtime,carddate,cdgroupid,cdzgroupid) values('$card_no',$add[cardfen],$add[money],'$cardtime','$add[endtime]',$add[carddate],$add[cdgroupid],$add[cdzgroupid]);");
找到:
if(!$add[card_no]||!$add[password]||!$add[money]||!$add[cardid])
改成:
if(!$add[card_no]||!$add[money]||!$add[cardid])
找到以下代码删除:
$add['password']=hRepPostStr($add['password'],1);
找到:
$sql=$empire->query("update {$dbtbpre}enewscard set card_no='$add[card_no]',password='$add[password]',cardfen=$add[cardfen],money=$add[money],endtime='$add[endtime]',carddate=$add[carddate],cdgroupid=$add[cdgroupid],cdzgroupid=$add[cdzgroupid] where cardid='$add[cardid]'");
改成:
$sql=$empire->query("update {$dbtbpre}enewscard set card_no='$add[card_no]',cardfen=$add[cardfen],money=$add[money],endtime='$add[endtime]',carddate=$add[carddate],cdgroupid=$add[cdgroupid],cdzgroupid=$add[cdzgroupid] where cardid='$add[cardid]'");
至此,后台点卡功能部分修改完毕,如果小伙伴们觉得上面的修改过于繁琐,墨鱼下面也提供了原始的帝国CMS7.5-UTF8修改好的上述三个文件,你只需要下载覆盖就好。
帝国CMS会员充值卡只用卡号充值.zip
继续修改前台逻辑部分和前端
1.打开文件:/e/member/class/membercomfun.php
替换为如下代码:
<?php
//--------------- 会员相关处理函数 ---------------
//点卡冲值
function CardGetFen($username,$reusername,$card_no){
global $empire,$dbtbpre;
$card_no=RepPostVar($card_no);
$username=RepPostVar($username);
if(!trim($username)||!trim($card_no))
{
printerror("EmptyGetCard","history.go(-1)",1);
}
if($username!=$reusername)
{
printerror("DifCardUsername","history.go(-1)",1);
}
$user=$empire->fetch1("select ".eReturnSelectMemberF('userid,userdate,username,groupid')." from ".eReturnMemberTable()." where ".egetmf('username')."='$username' limit 1");
if(!$user['userid'])
{
printerror("ExiestCardUsername","history.go(-1)",1);
}
$num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewscard where card_no='".$card_no."' limit 1");
if(!$num)
{
printerror("CardPassError","history.go(-1)",1);
}
//是否过期
$buytime=date("Y-m-d H:i:s");
$r=$empire->fetch1("select cardfen,money,endtime,carddate,cdgroupid,cdzgroupid from {$dbtbpre}enewscard where card_no='$card_no' limit 1");
if($r[endtime]<>"0000-00-00")
{
$endtime=to_date($r[endtime]);
if($endtime<time())
{
printerror("CardOutDate","history.go(-1)",1);
}
}
//充值
eAddFenToUser($r[cardfen],$r[carddate],$r[cdgroupid],$r[cdzgroupid],$user);
$sql1=$empire->query("delete from {$dbtbpre}enewscard where card_no='$card_no'");//删除卡号
//备份购买记录
BakBuy($user['userid'],$username,$card_no,$r[cardfen],$r[money],$r[carddate],0);
printerror("CardGetFenSuccess","../member/card/",1);
}
?>
membercomfun.php文件下载,如果没修改可以直接覆盖:
membercomfun.zip
最后,修改前台点卡充值的表单模板/e/template/member/card.php
删除掉如下代码就好了
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<td height="25"> <div align="right">冲值卡密码:</div></td>
<td height="25"> <input name="password" type="password" id="password">
*</td>
</tr>
详情查看:
Copyright © 2024 妖气游戏网 www.17u1u.com All Rights Reserved