Loading... ## 简介 Teepay支付插件是由[胖蒜网](https://pangsuan.com/)开发并开源,有支付宝当面付和[https://payjs.cn/](https://payjs.cn/) 提供的微信接口两种支付方式,通过这款插件可以设置付费阅读。我用为数不多的php知识和拙劣的代码给插件添加了一些功能,但也有很多代码是搬运和百度的ovo。 以下教程文章为原作者提供,有条件的朋友可购买他的TePass插件功能,美化更好 [Typecho 实现个人支付宝和微信及时收款](https://pangsuan.com/p/alipay-wxpay.html) [Typecho 实现个人微信收款及时回调通知](https://pangsuan.com/p/typecho-wxpay.html) [Typecho 实现个人支付宝及时收款](https://pangsuan.com/p/typecho-alipay-f2f.html) ## 样式修改 原版是有文字和单选框,这边我是隐藏单选框,并直接放了张支付宝图片。 修改文件:**Plugin.php** ```php if($option->show_Alipay_Wxpay == "alipay"){?> <img id="labe2" src="https://pangsuan.com/usr/plugins/TePass/static/alipay2.png" nogallery="nogallery" no-zoom="true"> <input type="radio" id="feetype1" name="feetype" value="alipay" style = "display:none" checked><!--支付宝支付--> <input type="radio" id="feetype2" name="feetype" value="wxpay" style="display:none;"> <?php }else{?> <input type="radio" id="feetype1" name="feetype" value="alipay" style="display:none;"> <input type="radio" id="feetype2" name="feetype" value="wxpay" checked>微信支付 <?php } }?> ``` **付款按钮推荐颜色**:<span style='color:rgb(25, 119, 255)'>*rgb(25, 119, 255);*</span> **价格外虚线框样式:** ```html div style="display: table; margin: 10px auto !important; font-size: 14px !important; line-height: 20px !important; color: #6d6d6d; border: 1px dashed #34a8eb; padding: 3px 9px; border-radius: 5px;"> 价格: <?php echo $row['teepay_price'] ?> 元 </div> ``` **修改完展示**  ## 后台功能 主要实现了4个功能:删除,查找订单,翻页,是否支付,总订单 写的比较杂乱就不单独列举出来了,复制下面代码覆盖paylist.php 修改文件:**manage/paylist.php** ```php <?php include 'common.php'; include 'header.php'; include 'menu.php'; ?> <style type="text/css"> .am-fr { float: right; margin-top: -10px; } li.am-pagination-prev { float: left; margin: 0 10px; list-style: none; } li.am-pagination-next { float: left; margin: 0 10px; list-style: none; } </style> <?php $db = Typecho_Db::get(); //计算分页 $pageSize = 20; $currentPage = isset($_REQUEST['p']) ? ($_REQUEST['p'] + 0) : 1; $all = $db->fetchAll($db->select()->from('table.teepay_fees') ->order('table.teepay_fees.feeinstime', Typecho_Db::SORT_DESC)); $pageCount = ceil( count($all)/$pageSize ); $queryGoods= $db->select()->from('table.teepay_fees') ->page($currentPage, $pageSize) ->join('table.contents', 'table.contents.cid = table.teepay_fees.feecid', Typecho_Db::LEFT_JOIN)->join('table.users', 'table.users.uid = table.teepay_fees.feeuid', Typecho_Db::LEFT_JOIN)->order('table.teepay_fees.feeid',Typecho_Db::SORT_DESC)->limit($pageSize); $rowGoods = $db->fetchAll($queryGoods);//行数 $cout = "SELECT COUNT(*) FROM `jyjjjto1_teepay_fees`;"; $Totalrow=$db->query($cout); $rows = $Totalrow->fetch(); $rowCount = $rows[0]; if(isset($_POST['dd'])){ $username = $_POST['username'];//筛选 //echo "<script>alert('$order');</script>"; foreach($rowGoods as $k=>$v){ if($v["name"] != $username){ unset($rowGoods[$k]); } } } if(isset($_POST['unpay'])){//未支付 foreach($rowGoods as $k=>$v){ if($v["feestatus"] == 1){ unset($rowGoods[$k]); } } } if(isset($_POST['pay']))//支付 { foreach($rowGoods as $k=>$v){ if($v["feestatus"] == 0){ unset($rowGoods[$k]); } } } if(isset($_POST['delete']))//删除 { $arr = $_POST["item"]; if($arr){ $str = implode(",",$arr); echo "<script>alert('$str');</script>"; $sql = "DELETE FROM `jyjjjto1_teepay_fees` WHERE `feeid` in ($str);"; $db->query($sql); //echo "<script>alert('$sql');</script>"; echo "<script language=JavaScript> location.replace(location.href);</script>"; }else{ echo "<script>alert('请选择要删除项目!');</script>"; } } ?> <div class="main"> <div class="body container"> <?php include 'page-title.php'; ?> <div class="row typecho-page-main" role="main"> <div class="col-mb-12 typecho-list"> <div class="col-mb-12 col-tb-12" role="main"> <form method="post" name="manage_posts" class="operate-form" action="" id="myform"> <div class="typecho-table-wrap"> <input type="checkbox" id="allChecks" name="item" onclick="ckAll()" />全选/全不选 <button type="submit" class="btn btn-s" name="delete" value="Delete"><?php _e('删 除'); ?></button> <button type="submit" class="btn btn-s" name="pay" value="pay"><?php _e('已支付'); ?></button> <button type="submit" class="btn btn-s" name="unpay" value="unpay"><?php _e('未支付'); ?></button> <input type="text" name="username" placeholder="请输入用户名"/> <button type="submit" class="btn btn-s" name="dd"><?php _e('搜索'); ?></button> <select name="p"> <?php for($i=1;$i<=$pageCount;$i++): ?> <option value="<?php echo $i; ?>"<?php if($i == $currentPage): ?> selected="true"<?php endif; ?>>第<?php echo $i; ?></option> <?php endfor; ?> </select> <button type="submit" class="btn btn-s" tyle="text-align:right;"><?php _e('筛选'); ?></button> <?php echo "总订单:".$rowCount; ?> <table class="typecho-list-table"> <colgroup> <col width="18%"/> <col width="30%"/> <col width="10%"/> <col width="6%"/> <col width="8%"/> <col width="8%"/> <col width="15%"/> </colgroup> <thead> <tr> <th ><?php _e('订单号'); ?></th> <th><?php _e('文章标题'); ?></th> <th><?php _e('付费人'); ?></th> <th><?php _e('价格'); ?></th> <th><?php _e('付费方式'); ?></th> <th><?php _e('状态'); ?></th> <th><?php _e('付款时间'); ?></th> </tr> </thead> <tbody > <?php foreach($rowGoods as $value){ ?> <td><input type="checkbox" name="item[]"value=<?php echo $value["feeid"]; ?>><?php echo $value["feeid"]; ?></td> <td onclick="setFocus()"><?php echo $value["title"]; ?></td> <td><?php if($value["feeuid"] == 0){ echo "游客"; }else{ echo $value["name"]; } ?></td> <td><?php echo $value["feeprice"];?></td> <td><?php echo $value["feetype"];?></td> <td><?php if($value["feestatus"] == 0){ echo "未付款"; }elseif($value["feestatus"] == 1){ echo '<span style="color:blue;">付款成功</span>'; }else{ echo '<span style="color:red;">付款失败</span>'; } ?></td> <td><?php echo $value["feeinstime"];?></td> </tr> <?php } ?> </tbody> </table> </div> </form><!-- end .operate-form --> <!--基础版仅能查看最近999条记录,专业版可查看全部记录。 --> </div> </div><!-- end .typecho-list-operate --> </div> </div><!-- end .typecho-list --> </div><!-- end .typecho-page-main --> </div> </div> <?php include 'copyright.php'; ?> <script> function ckAll(){ var flag=document.getElementById("allChecks").checked; var cks=document.getElementsByName("item[]"); for(var i=0;i<cks.length;i++){ cks[i].checked=flag; } } </script> ``` **修改完展示**  不想自行修改的也可以直接下载我打包号的文件覆盖原teepay插件 <button class=" btn m-b-xs btn-light " onclick='window.open("https://jyjjjtop.lanzouy.com/ih4Pi0efv1pc","_blank")'>下载</button> 最后修改:2022 年 10 月 23 日 © 允许规范转载 打赏 赞赏作者 赞 2 如果觉得我的文章对你有用,请随意赞赏