当前位置: 首页>>代码示例>>PHP>>正文


PHP CategoryModel::getCategoryNameByPath方法代码示例

本文整理汇总了PHP中CategoryModel::getCategoryNameByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryModel::getCategoryNameByPath方法的具体用法?PHP CategoryModel::getCategoryNameByPath怎么用?PHP CategoryModel::getCategoryNameByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CategoryModel的用法示例。


在下文中一共展示了CategoryModel::getCategoryNameByPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: act_addInput

 function act_addInput()
 {
     //$pidNew = $_POST['pidNew']?post_check($_POST['pidNew']):'';//类别
     $finalIdArr = $_POST['finalIdStr'];
     //新建属性-类别4
     $inputName = $_POST['inputName'] ? post_check($_POST['inputName']) : '';
     //类别
     $textStatus = $_POST['textStatus'] ? post_check($_POST['textStatus']) : '';
     //文本方式
     if (empty($finalIdArr) || empty($inputName)) {
         self::$errCode = 101;
         self::$errMsg = '类别或属性名不能为空';
         return false;
     }
     if (intval($textStatus) <= 0) {
         self::$errCode = 102;
         self::$errMsg = '文本方式有误';
         return false;
     }
     $tmpArr = array();
     if (!is_array($finalIdArr)) {
         $tmpArr[] = $finalIdArr;
         $finalIdArr = $tmpArr;
     }
     $finalPathArr = array();
     foreach ($finalIdArr as $cid) {
         $catePath = CategoryModel::getCategoryPathById($cid);
         if (empty($catePath)) {
             self::$errCode = 109;
             self::$errMsg = '类别有误';
             return false;
         }
         $finalPathArr[] = $catePath;
     }
     $tName = 'pc_goods_category';
     foreach ($finalPathArr as $value) {
         $where = "WHERE path like'%{$value}-%' and is_delete=0";
         $count = OmAvailableModel::getTNameCount($tName, $where);
         if ($count) {
             self::$errCode = 105;
             self::$errMsg = '只能在最小分类进行复制';
             return false;
         }
     }
     try {
         $pidNewStr = '';
         BaseModel::begin();
         $tName = 'pc_archive_input';
         foreach ($finalPathArr as $value) {
             $where = "WHERE inputName='{$inputName}' AND categoryPath='{$value}'";
             $countIN = OmAvailableModel::getTNameCount($tName, $where);
             if (!$countIN) {
                 $pidNewStr .= CategoryModel::getCategoryNameByPath($value) . ' ';
                 $set = "SET inputName='{$inputName}',categoryPath='{$value}',textStatus='{$textStatus}'";
                 OmAvailableModel::addTNameRow($tName, $set);
             }
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         self::$errCode = 200;
         self::$errMsg = "{$inputName} 添加到 {$pidNewStr} 成功";
         return true;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = 201;
         self::$errMsg = $e->getMessage();
         return false;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:70,代码来源:property.action.php

示例2: view_updatePropertyOn


//.........这里部分代码省略.........
         $where = "WHERE propertyId={$id}";
         $ppvList = OmAvailableModel::getTNameList($tName, $select, $where);
         //该属性下所有的属性值
         foreach ($ppvList as $value) {
             $propertyValueId = $value['id'];
             if (intval($propertyValueId) != 0) {
                 $tName = 'pc_archive_spu_property_value_relation';
                 $where = "WHERE propertyId={$id} and propertyValueId={$propertyValueId}";
                 $countPPV = OmAvailableModel::getTNameCount($tName, $where);
                 if ($countPPV) {
                     $status = "该属性下已有属性值绑定了SPU,不能删除";
                     header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
                     exit;
                 }
             }
         }
         try {
             BaseModel::begin();
             foreach ($ppvList as $value) {
                 $propertyValueId = $value['id'];
                 if (intval($propertyValueId) != 0) {
                     $tName = 'pc_archive_property_value';
                     $where = "WHERE id={$propertyValueId}";
                     OmAvailableModel::deleteTNameRow($tName, $where);
                 }
             }
             $tName = 'pc_archive_property';
             $where = "WHERE id={$id}";
             OmAvailableModel::deleteTNameRow($tName, $where);
             BaseModel::commit();
             BaseModel::autoCommit();
             $status = "属性删除成功";
             header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
             exit;
         } catch (Exception $e) {
             BaseModel::rollback();
             BaseModel::autoCommit();
             $status = $e->getMessage();
             header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
             exit;
         }
     }
     if (empty($pid)) {
         $status = "类型不能为空";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     if (empty($isRadio)) {
         $status = "录入方式不能为空";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     if (intval($isRequired) == 0) {
         $status = "是否必填不能为空";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $tName = 'pc_archive_property';
     $select = '*';
     $where = "WHERE id='{$id}'";
     $propertyList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($propertyList)) {
         $status = "不存在该属性记录";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $categoryName = getAllCateNameByPath($pid);
     $pathImplodeStr = getAllPathBypid($pid);
     $i = strrpos($pathImplodeStr, ',');
     if ($i !== false) {
         $pathImplodeStr = substr($pathImplodeStr, 0, $i);
     }
     $where = "WHERE propertyName='{$propertyName}' and categoryPath IN ({$pathImplodeStr})";
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if ($count) {
         $status = "{$categoryName} 其父类已经存在 {$propertyName} 属性";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $where = "WHERE propertyName='{$propertyName}' and categoryPath='{$pid}' and id<>{$id}";
     $count = OmAvailableModel::getTNameCount($tName, $where);
     if ($count) {
         $status = "{$categoryName} 已经存在 {$propertyName} 属性";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $set = "SET propertyName='{$propertyName}',categoryPath='{$pid}',isRadio='{$isRadio}',isRequired='{$isRequired}'";
     $where = "WHERE id='{$id}'";
     $affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
     if (!$affectRow) {
         $status = "无数据修改";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $categoryName1 = CategoryModel::getCategoryNameByPath($propertyList[0]['categoryPath']);
     $categoryName2 = CategoryModel::getCategoryNameByPath($pid);
     $isRadioStr = $isRadio == 1 ? '单选' : '多选';
     $status = "{$categoryName1} 下 {$propertyList[0]['propertyName']} 修改为 {$categoryName2} 下 {$propertyName} 成功,录入方式为 {$isRadioStr}";
     header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:property.view.php


注:本文中的CategoryModel::getCategoryNameByPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。