<?php
namespace wstmart\admin\controller;
use wstmart\admin\model\Goods as M;
/**
 * ============================================================================
 * 商品控制器
 */
class Goods extends Base{
   /**
	* 查看上架商品列表
	*/
	public function index(){
    	$this->assign("areaList",model('areas')->listQuery(0));
		return $this->fetch('list_sale');
	}
   /**
    * 批量删除商品
    */
    public function batchDel(){
        $m = new M();
        return $m->batchDel();
    }

    /**
    * 设置违规商品
    */
    public function illegal(){
        $m = new M();
        return $m->illegal();
    }
    /**
    * 批量设置违规商品
    */
    public function batchIllegal(){
        $m = new M();
        return $m->batchIllegal();
    }
    /**
     * 通过商品审核
     */
    public function allow(){
        $m = new M();
        return $m->allow();
    } 
    /**
     * 批量通过商品审核
     */
    public function batchAllow(){
        $m = new M();
        return $m->batchAllow();
    }
	/**
	 * 获取上架商品列表
	 */
	public function saleByPage(){
		$m = new M();
		$rs = $m->saleByPage();
		$rs['status'] = 1;
		return WSTGrid($rs);
	}
	/**
     * 已下架的商品
     */
    public function shelves(){
        $this->assign("areaList",model('areas')->listQuery(0));
        return $this->fetch('goods/list_shelves');
    }
    /**
     * 获取已下架的商品
     */
    public function shelvesByPage(){
        $m = new M();
        $rs = $m->shelvesByPage();
        $rs['status'] = 1;
        return WSTGrid($rs);
    }
    /**
     * 审核中的商品
     */
    public function auditIndex(){
        $this->assign("areaList",model('areas')->listQuery(0));
        return $this->fetch('goods/list_audit');
    }
    /**
     * 获取审核中的商品
     */
    public function auditByPage(){
        $m = new M();
        $rs = $m->auditByPage();
        $rs['status'] = 1;
        return WSTGrid($rs);
    }
   /**
	 * 审核中的商品
	 */
    public function illegalIndex(){
    	$this->assign("areaList",model('areas')->listQuery(0));
		return $this->fetch('list_illegal');
	}
    /**
	 * 获取违规商品列表
	 */
	public function illegalByPage(){
		$m = new M();
		$rs = $m->illegalByPage();
		$rs['status'] = 1;
		return WSTGrid($rs);
	}
    
    /**
     * 删除商品
     */
    public function del(){
    	$m = new M();
    	return $m->del();
    }
    /**
     * 导出购物车数据
     */
    public function toExportSale(){
        $m = new M();
        $rs = $m->toExportSale();
        $this->assign('rs',$rs);
    }
    /**
     * 商品ECT支付状态
     */
    public function goodsEct(){
        $m = new M();
        return $m->goodsEct();
    }
}