public function insertAction()
 {
     //获取POST值
     $typeName = iconv_substr($this->_getParam('typename'), 0, 100, 'utf-8');
     $propertyList = trim($this->_getParam('propertylist'));
     if (empty($typeName) || empty($propertyList)) {
         Zshop_Message::show($this, '请输入完整信息', 'back', 2);
     } else {
         //商品类型名称
         $type = array('type_name' => $typeName);
         //插入商品类型表
         $typeId = $this->goodsTypeModel->insert($type);
         //构造商品类型属性数组
         $property['type_id'] = $typeId;
         $goodsTypeProperty = new GoodsTypePropertyModel();
         //商品类型属性名称分割
         $propertyList = array_unique(explode("\r\n", $propertyList));
         //构造商品类型属性数组
         foreach ($propertyList as $propertyName) {
             if (!empty($propertyName)) {
                 $property['property_name'] = iconv_substr($propertyName, 0, 100, 'utf-8');
                 $propertyID[] = $goodsTypeProperty->insert($property);
                 //插入商品类型属性表
             }
         }
         //检查插入是否失败
         $error = false;
         foreach ($propertyID as $value) {
             if (empty($value)) {
                 $error = true;
                 break;
             }
         }
         if (!$error && $typeId) {
             $message = '添加成功';
             $backUrl = 'admin/goodstype/index';
         } else {
             $message = '添加失败';
             $backUrl = 'back';
         }
         Zshop_Message::show($this, $message, $backUrl, 2);
     }
 }