Home > php教程 > php手册 > body text

WeMall WeChat mall source code plug-in voucher part code

WBOY
Release: 2016-10-11 14:01:58
Original
1253 people have browsed it

WeMall WeChat mall source code plug-in Coupon voucher code is a more effective way to use for business promotion. Some of the more important codes are shared for technicians to learn and reference
WeMall WeChat mall source code plug-in Coupon voucher code is a more effective way to use for business promotion. Some of the more important codes are shared for technicians to learn and reference

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);//Assignment data set <br> <br>          $count = $couponModel->getCount();//Query the total number of records that meet the requirements <br>          $Page = new ThinkPage($count, $num); // Instantiate the paging class and pass in the total number of records and the number of records displayed on each page <br> $Page->setConfig('theme', "<ul class="pagination no-margin pull-right"> <li>%FIRST%</li> <li>% UP_PAGE%</li> <li>%LINK_PAGE%</li> <li>%DOWN_PAGE%</li> <li>%END%</li> <li><a page></a></li> </ul>"); <br>           $show = $Page->show();// Display output in pages <br>            $this->assign(’page’, $show);//Assignment paging output <br> <br>           $this->display(); // Output template <br> } <br> <br> Public function add() <br> { <br>           if (IS_POST) {                                         If (!I("post.name")) { <br>                                                                       return;                                                                                    <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('Add successfully', 'Admin/Admin/index/addon/Coupon') : $this->error('Add failed', u_addons("Coupon:// Admin/Admin/index")); <br>            } else {                                                                                                                                                                                                                                                                                                             $this->display();           } <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(); // Query the total number of records that meet the requirements <br>          $Page = new ThinkPage ($count, 15); // Instantiate the paging class and pass in the total number of records and the number of records displayed on each page <br> $Page->setConfig('theme', "<ul class="pagination no-margin pull-right"> <li>%FIRST%</li> <li>% UP_PAGE%</li> <li>%LINK_PAGE%</li> <li>%DOWN_PAGE%</li> <li>%END%</li> <li><a page></a></li> </ul>"); <br>          $show = $Page->show(); // Display output in pages <br>           $detail = $m->where($cdata)->limit($Page->firstRow . ’,’ . $Page->listRows)->select(); <br> <br>           $this->assign("page", $show); // Assignment paging output <br>           $this->assign(’coupon’, $detail);                                              $this->display();                                  } <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('Deletion successful', 'Admin/Admin/index/addon/Coupon'); <br>            } else {                                                                               $this->error(’Operation failed’, ‘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('Deletion successful', 'Admin/Admin/index/addon/Coupon'); <br>            } else {                                                                                 $this->error(’Operation failed’, ‘Admin/Admin/index/addon/Coupon’); <br>           } <br> } <br> } <br> <br> <br>AddonCouponMenuModel.class.php<br>
namespace AddonsCouponModel;
use ThinkModelRelationModel; <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
<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>  <br>                         <table>  <br>                             <tbody>  <br>                             <tr>  <br>                                 <!--<th class="hidden-xs">-->  <br>                                     <!--<label><input onchange="checkAll()" type="checkbox" value=""></label>-->  <br>                                 <!--</th>-->  <br>                                 <th>ID</th>  <br>                                 <th>优惠码</th>  <br>                                 <th>金额</th>  <br>                                 <th>状态</th>  <br>                                 <th>截止时间</th>  <br>                                 <th>操作</th>  <br>                             </tr>  <br>                             <volist>  <br>                                 <tr>  <br>                                     <!--<td class="hidden-xs">-->  <br>                                         <!--<label><input name="checkbox" class="check" type="checkbox"-->  <br>                                                      <!--value="{$coupon.id}"></label>-->  <br>                                     <!--</td>-->  <br>                                     <td>  <br>                                         {$coupon.id}  <br>                                     </td>  <br>                                     <td>  <br>                                         {$coupon.code}  <br>                                     </td>  <br>                                     <td>  <br>                                         {$coupon.price}  <br>                                     </td>  <br>                                     <td>  <br>                                         {$coupon.status}  <br>                                     </td>  <br>                                     <td>  <br>                                         {:date(’Y-m-d H:i:s’,$coupon[’last_time’])}  <br>                                     </td>  <br>                                     <td> <a></a>                                             href="{:u_addons(\’Coupon://Admin/Admin/detail_del\’,array(’id’=>$coupon[’id’]))}">删除</td>  <br>                                 </tr>  <br>                             </volist>  <br>                             </tbody>  <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>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           </div> <br> <br> Code source: www.wemallshop.com<br> <br> <br> <br> Coupon voucher.rar <br>( 8.65 KB Download: 2 times ) <br> <img src="/Uploads/editor/2016-10-10/57fb39fbc3e03.jpg" alt="WeMall WeChat mall source code plug-in voucher part code" ><p class="attach"><img src="/Public/Images/extension/common.gif" style="max-width:90%" style="max-width:90%" border="0" alt="WeMall WeChat mall source code plug-in voucher part code" align="absmiddle"><span class="date"> </span></p> </div> </div> </div></section>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template