<?php
/**
 * 商品类型-属性管理
 * @Copyright (C) 2016 汉潮 All rights reserved.
 * @License http://www.hanchao9999.com
 * @Author xiaogg <xiaogg@sina.cn>
 */
namespace Admin\Controller;
class GoodsAttributeController extends BaseController{
    public function _initialize(){
        parent::_initialize();
        $this->inputtype = array('text' => L('TEXT'), 'checkbox' => L('REDIO'));
        $this->assign('inputtype', $this->inputtype);
    }

    public function index(){
        // $type_id = I('param.type_id');
        $name = CONTROLLER_NAME;
        // $map['type_id'] = $type_id;
		// $map['shop_id'] = 0;
		$map['status'] = 1;
        $list = $this->lists($name, $map);
        $this->assign('list', $list);
        $this->display();
    }

    public function _before_add(){
        $type_id = 19;
        if (!$type_id) $this->error(L('PLEASE_SELECT_GOODS_TYPE'), U("GoodsAttribute/index"));
    }

    public function _before_insert(){
        if (empty($_POST['goods_sn'])) $_POST['goods_sn'] = 'OAO' . time();
    }

    public function _before_edit(){
        $type_id = 19;
        if (!$type_id) $this->error(L('PLEASE_SELECT_GOODS_TYPE'), U("GoodsAttribute/index"));
    }
}