首頁 > php教程 > php手册 > 主體

WeMall微信商城原始碼插件代金券部分代碼

WBOY
發布: 2016-10-11 14:01:58
原創
1251 人瀏覽過

WeMall微信商城原始碼插件Coupon代金券代碼是用於商業推廣的比較有效的方式,分享了部分比較重要的程式碼,供技術員學習參考
WeMall微信商城原始碼插件Coupon代金券代碼是用於商業推廣的比較有效的方式,分享了部分比較重要的程式碼,供技術員學習參考

AdminController.class.php
<?php   <br /> namespace AddonsCouponController;  <br>   <br> class AdminController extends InitController  <br> {  <br>     public function index()  <br>     {  <br>         $num = 25;  <br>         $p = I("get.page") ? I("get.page") : 1;  <br>   <br>         $couponModel = D(’Addons://Coupon/AddonCouponMenu’);  <br>         $coupon = $couponModel->getPageConditionOrder($p, $num, "id desc");  <br>         $this->assign("couponList", $coupon);// 賦值資料集  <br>   <br>         $count = $couponModel->getCount();// 查詢符合要求的總記錄數  <br>         $Page = new ThinkPage($count, $num);// 實例化分頁類別 傳入總記錄數與每頁顯示的記錄數  <br> $Page->setConfig('theme', "<ul> <li>%FIRST%</li> <li>%UP_PAGE%</li>%LINK_PAGE%<li>%DOWN_PAGE%</li> <li>%END%</li> <li> <a> %HEADER%  %NOW_PAGE%/%TOTAL_PAGE% 頁</a> </li> </ul>");  <br>         $show = $Page->show();// 分頁顯示輸出  <br>         $this->assign(’page’, $show);// 賦值分頁輸出  <br>   <br>         $this->display(); // 輸出範本  <br>     }  <br>   <br>     public function add()  <br>     {  <br>         if (IS_POST) {  <br>             if (!I("post.name")) {  <br>                 return;  <br>             }  <br>   <br>             $data = I("post.");  <br>             $data[’last_time’] = I(’post.last_time’, ’’, ’strtotime’);  <br>             $coupon_id = D(’Addons://Coupon/AddonCouponMenu’)->addCouponMenu($data);  <br>   <br> isset($coupon_id) ? $this->success('新增成功', 'Admin/Admin/index/addon/Coupon') : $this->error('新增失敗', u_addons("Coupon://Admin/ Admin/index"));  <br>         } else {  <br>             $this->display(); // 輸出範本  <br>         }  <br>     }  <br>   <br>     public function detail()  <br>     {  <br>         $cdata[’coupon_menu_id’] = I(’get.id’);  <br>         $m = M(’AddonCoupon’);  <br>        $count = $m->where($cdata)->count(); // 查詢符合要求的總記錄數  <br>         $Page = new ThinkPage ($count, 15); // 實例化分頁類別 傳入總記錄數與每頁顯示的記錄數  <br> $Page->setConfig('theme', "<ul> <li>%FIRST%</li> <li>%UP_PAGE%</li>%LINK_PAGE%<li>%DOWN_PAGE%</li> <li>%END%</li> <li> <a> %HEADER%  %NOW_PAGE%/%TOTAL_PAGE% 頁</a> </li> </ul>");  <br>         $show = $Page->show(); // 分頁顯示輸出  <br>         $detail = $m->where($cdata)->limit($Page->firstRow . ’,’ . $Page->listRows)->select();  🎠    <br>         $this->assign("page", $show); // 賦值分頁輸出  <br>         $this->assign(’coupon’, $detail);  <br>         $this->display();  <br>     }  <br>   <br>     public function export()  <br>     {  <br>   <br>     }  <br>   <br>     public function del()  <br>     {  <br>         $cdata[’coupon_menu_id’] = $data[’id’] = I(’get.id’);  <br>         $c = M(’AddonCouponMenu’)->where($data)->delete();  <br>         $m = M(’AddonCoupon’)->where($cdata)->delete();  <br>         if ($c != false && $m != false) {  <br>             $this->success(’刪除成功』, ’Admin/Admin/index/addon/Coupon’);  <br>         } else {  <br>             $this->error(’操作失敗’, ’Admin/Admin/index/addon/Coupon’);  <br>         }  <br>     }  <br>   <br>     public function detail_del()  <br>     {  <br>         $cdata[’id’] = I(’get.id’);  <br>         $m = M(’AddonCoupon’)->where($cdata)->delete();  <br>         if ($m != false) {  <br>             $this->success(’刪除成功』, ’Admin/Admin/index/addon/Coupon’);  <br>         } else {  <br>             $this->error(’操作失敗’, ’Admin/Admin/index/addon/Coupon’);  <br>         }  <br>     }  <br> }  <br>
AddonCouponMenuModel.class.php
namespace AddonsCouponModel;  <br>   <br> use ThinkModelRelationModel;  <br>   <br> class AddonCouponMenuModel extends RelationModel  <br> {  <br>     protected $_link = array();  <br>   <br>     public function getCount()  <br>     {  <br>         $count = $this->count();  <br>         return $count;  <br>     }  <br>   <br>     public function getPageConditionOrder($p = 1, $num = 1, $order)  <br>     {  <br>         // 进行分页数据查询 注意page方法的参数的前面部分是当前的页数使用 $_GET[p]获取  <br>         $orderList = $this->page($p . ’,’ . $num . ’’)->order($order)->select();  <br>         return $orderList;  <br>     }  <br>   <br>     public function addCouponMenu($data)  <br>     {  <br>         $data[’ctime’] = time();  <br>         $number = $data[’num’] = intval($data[’num’]);  <br>         $data[’coupon_menu_id’] = $this->add($data);  <br>   <br>         for ($i = 0; $i              $data[’code’] = rand_code(6);  <br>             $code = M(’AddonCoupon’)->where(array(’code’ => $data[’code’]))->find();  <br>             if (!isset($code)) {  <br>                 $coupon_id = M(’AddonCoupon’)->add($data);  <br>             } else {  <br>                 $number = $number + 1;  <br>             }  <br>         }  <br>         return $coupon_id;  <br>     }  <br> }   Admin_detail.html<br> <code class="prettyprint linenums lang-php"><section>  <br>     <h1>  <br>         优惠券管理  <br>         <small></small>  <br>     </h1>  <br> </section>  <br>   <br> <!-- Main content -->  <br> <section>  <br>     <div>  <br>         <!-- /.col -->  <br>         <div>  <br>             <div>  <br>                 <div>  <br>                     <h3>优惠券管理</h3>  <br>                     <!-- /.box-tools -->  <br>                 </div>  <br>                 <!-- /.box-header -->  <br>                 <div>  <br>                     <div>  <br>                         <div>  <br>                             <a>  <br>                                 返回优惠券列表页  <br>                             </a>  <br>                         </div>  <br>                         <!-- /.btn-group -->  <br>                     </div>  <br>                     <div class="table-responsive" style="overflow-x:visible;">  <br>                         <table class="table table-bordered table-hover">  <br>                               <br>                             <tr>  <br>                                 <!--<th class="hidden-xs">-->    <!--<th class="hidden-xs">-->                                    的                                 <!--</th>-->         <!--</th>-->  <br>                                 第ID                                <th>優惠碼</th>         <th>折扣碼</th>  <br>                                 第<th>金額</th>         第<th>金額</th>  <br>                                 <th>狀態</th>  <br>                              地                                 <th>操作</th>  <br>                             </tr>  <br>                             <volist name="優惠券" id="優惠券">  <br>                                 <tr>  <br>                                                                     的                                   }">-->  <br>                                  地                                     <td>                                                                     地                                     </td> <td>                                                                       地                                     </td> <td>                                                                       地                                     </td> <td>                                                                       地                                     </td> <td>                                                                        地                                     </td> <td>$coupon[’id’]))}">删除</td>  <br>                                 </tr>  <br>                             </volist>  <br>                               <br>                         </table>  <br>                         <div>  <br>                             <div>  <br>                                 <!--<div class="btn-group">-->  <br>                                     <!--<button type="button" class="btn btn-danger"-->  <br>                                             <!--onclick="batchUrl(’{:U(\’Admin/coupon/delcoupon\’)}’)">全部删除-->  <br>                                     <!--</button>-->  <br>                                 <!--</div>-->  <br>                                 <div>  <br>                                     {$page}  <br>                                     <!-- /.btn-group -->  <br>                                 </div>  <br>                             </div>  <br>                         </div>  <br>                     </div>  <br>                     <!-- /.mail-box-messages -->  <br>                 </div>  <br>             </div>  <br>             <!-- /. box -->  <br>         </div>  <br>         <!-- /.col -->  <br>     </div>  <br> </section>   代碼來源: www.wemallshop.com
WeMall微信商城原始碼插件代金券部分代碼

WeMall微信商城原始碼插件代金券部分代碼 Coupon代金券.rar ( 8.65 KB 下載:2 次 )

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板