123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- /**
- * 小梦科技资源nanodreamtech.com
- *
- * ==========================================================================
- * @link https://www.nanodreamtech.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license https://www.nanodreamtech.com/license.html License
- * ==========================================================================
- *
- * @author fish
- *
- */
- namespace Seller\Controller;
- use Admin\Model\VoucherModel;
- class VoucherController extends CommonController{
-
- protected function _initialize(){
- parent::_initialize();
- $this->breadcrumb1='优惠券中心';
- $this->breadcrumb2='优惠券管理';
- }
-
- public function index(){
-
- $model=new VoucherModel();
-
- $data=$model->show_voucher_class_page(SELLERUID);
-
- $this->assign('empty',$data['empty']);// 赋值数据集
- $this->assign('list',$data['list']);// 赋值数据集
- $this->assign('page',$data['page']);// 赋值分页输出
-
- $this->display();
- }
- function get_goods_voucher_all()
- {
- $html = $this->fetch('Voucher:fetch_goods_ajax');
- echo json_encode( array('code' => 0 , 'html' => $html) );
- die();
- }
-
- function add(){
-
- if(IS_POST){
-
- $model=new VoucherModel();
- $data=I('post.');
-
- $data['store_id'] = SELLERUID;
- if( empty($data['voucher_title']) ) {
- $status = array('status'=>'back','message'=>'优惠券名称不能为空');
- $this->osc_alert($status);
- }
-
- if( empty($data['credit']) ) {
- $status = array('status'=>'back','message'=>'优惠券金额不能为空');
- $this->osc_alert($status);
- }
-
- if( empty($data['total_count']) ) {
- $status = array('status'=>'back','message'=>'可领取人数不能为空');
- $this->osc_alert($status);
- }
-
-
- $return=$model->add_voucher($data);
-
- $this->osc_alert($return);
- die();
- }
-
- $this->crumbs='新增';
- $this->action=U('Voucher/add');
- $this->display('edit');
- }
-
-
- public function voucherlist()
- {
- $id = I('get.id');
-
- $model=new VoucherModel();
-
- $data=$model->show_voucher_list_page($id);
-
- $voucher_info = M('voucher')->where( array('id' => $id) )->find();
-
- $this->voucher_info = $voucher_info;
- $this->assign('empty',$data['empty']);// 赋值数据集
- $this->assign('list',$data['list']);// 赋值数据集
- $this->assign('page',$data['page']);// 赋值分页输出
-
- $this->display();
-
- }
-
- public function del(){
- $id = I('get.id');
-
- $model=new VoucherModel();
-
- $return=$model->del_voucher($id);
- $this->osc_alert($return);
- }
-
- }
- ?>
|