首页 > php教程 > php手册 > 正文

WeMall微信商城源码插件代金券部分代码

php中文网
发布: 2016-10-11 14:01:58
原创
1450人浏览过

WeMall微信商城源码插件Coupon代金券代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考
WeMall微信商城源码插件Coupon代金券代码是用于商业推广的比较有效的方式,分享了部分比较重要的代码,供技术员学习参考

AdminController.class.php
namespace Addons\Coupon\Controller;  
  
class AdminController extends InitController  
{  
    public function index()  
    {  
        $num = 25;  
        $p = I("get.page") ? I("get.page") : 1;  
  
        $couponModel = D(’Addons://Coupon/AddonCouponMenu’);  
        $coupon = $couponModel->getPageConditionOrder($p, $num, "id desc");  
        $this->assign("couponList", $coupon);// 赋值数据集  
  
        $count = $couponModel->getCount();// 查询满足要求的总记录数  
        $Page = new \Think\Page($count, $num);// 实例化分页类 传入总记录数和每页显示的记录数  
        $Page->setConfig(’theme’, "

");  
        $show = $Page->show();// 分页显示输出  
        $this->assign(’page’, $show);// 赋值分页输出  
  
        $this->display(); // 输出模板  
    }  
  
    public function add()  
    {  
        if (IS_POST) {  
            if (!I("post.name")) {  
                return;  
            }  
  
            $data = I("post.");  
            $data[’last_time’] = I(’post.last_time’, ’’, ’strtotime’);  
            $coupon_id = D(’Addons://Coupon/AddonCouponMenu’)->addCouponMenu($data);  
  
            isset($coupon_id) ? $this->success(’添加成功’, ’Admin/Admin/index/addon/Coupon’) : $this->error(’添加失败’, u_addons("Coupon://Admin/Admin/index"));  
        } else {  
            $this->display(); // 输出模板  
        }  
    }  
  
    public function detail()  
    {  
        $cdata[’coupon_menu_id’] = I(’get.id’);  
        $m = M(’AddonCoupon’);  
        $count = $m->where($cdata)->count(); // 查询满足要求的总记录数  
        $Page = new \Think\Page ($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数  
        $Page->setConfig(’theme’, "");  
        $show = $Page->show(); // 分页显示输出  
        $detail = $m->where($cdata)->limit($Page->firstRow . ’,’ . $Page->listRows)->select();  
  
        $this->assign("page", $show); // 赋值分页输出  
        $this->assign(’coupon’, $detail);  
        $this->display();  
    }  
  
    public function export()  
    {  
  
    }  
  
    public function del()  
    {  
        $cdata[’coupon_menu_id’] = $data[’id’] = I(’get.id’);  
        $c = M(’AddonCouponMenu’)->where($data)->delete();  
        $m = M(’AddonCoupon’)->where($cdata)->delete();  
        if ($c != false && $m != false) {  
            $this->success(’删除成功’, ’Admin/Admin/index/addon/Coupon’);  
        } else {  
            $this->error(’操作失败’, ’Admin/Admin/index/addon/Coupon’);  
        }  
    }  
  
    public function detail_del()  
    {  
        $cdata[’id’] = I(’get.id’);  
        $m = M(’AddonCoupon’)->where($cdata)->delete();  
        if ($m != false) {  
            $this->success(’删除成功’, ’Admin/Admin/index/addon/Coupon’);  
        } else {  
            $this->error(’操作失败’, ’Admin/Admin/index/addon/Coupon’);  
        }  
    }  
}  
AddonCouponMenuModel.class.php
namespace Addons\Coupon\Model;  
  
use Think\Model\RelationModel;  
  
class AddonCouponMenuModel extends RelationModel  
{  
    protected $_link = array();  
  
    public function getCount()  
    {  
        $count = $this->count();  
        return $count;  
    }  
  
    public function getPageConditionOrder($p = 1, $num = 1, $order)  
    {  
        // 进行分页数据查询 注意page方法的参数的前面部分是当前的页数使用 $_GET[p]获取  
        $orderList = $this->page($p . ’,’ . $num . ’’)->order($order)->select();  
        return $orderList;  
    }  
  
    public function addCouponMenu($data)  
    {  
        $data[’ctime’] = time();  
        $number = $data[’num’] = intval($data[’num’]);  
        $data[’coupon_menu_id’] = $this->add($data);  
  
        for ($i = 0; $i              $data[’code’] = rand_code(6);  
            $code = M(’AddonCoupon’)->where(array(’code’ => $data[’code’]))->find();  
            if (!isset($code)) {  
                $coupon_id = M(’AddonCoupon’)->add($data);  
            } else {  
                $number = $number + 1;  
            }  
        }  
        return $coupon_id;  
    }  
}   Admin_detail.html
  
    

  
        优惠券管理  
          
    

  
  
  
  
  
    
  
          
        
  
            
  
                
  
                    

优惠券管理

  
                      
                
  
                  
                
  
                    
  
                        
  
                              
                                返回优惠券列表页  
                            
  
                        
  
                          
                    
  
                    
  
                          
                              
                              
                                  
                                      
                                  
                                  
                                  
                                  
                                  
                                  
                                  
                              
                              
                                
  
                                      
                                          
                                                        
                                      
                                      
                                      
                                      
                                      
                                      
                                      
                                  
                              
                              
                        
ID优惠码金额状态截止时间操作
  
                                        {$coupon.id}  
                                    
  
                                        {$coupon.code}  
                                    
  
                                        {$coupon.price}  
                                    
  
                                        {$coupon.status}  
                                    
  
                                        {:date(’Y-m-d H:i:s’,$coupon[’last_time’])}  
                                    
                                            href="{:u_addons(\’Coupon://Admin/Admin/detail_del\’,array(’id’=>$coupon[’id’]))}">删除
  
                        
  
                            
  
                                  
                                      
                                              
                                      
                                  
                                
  
                                    {$page}  
                                      
                                
  
                            
  
                        
  
                    
  
                      
                
  
            
  
              
        
  
          
    
  
   代码来源: www.wemallshop.com
WeMall微信商城源码插件代金券部分代码

附件 Coupon代金券.rar ( 8.65 KB 下载:2 次 )

微信app下载
微信app下载

微信是一款手机通信软件,支持通过手机网络发送语音短信、视频、图片和文字。微信可以单聊及群聊,还能根据地理位置找到附近的人,带给大家全新的移动沟通体验,有需要的小伙伴快来保存下载体验吧!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号