/** * 请求数据检测 * @param int $iType * @param array $param * @return array|bool */ public function _checkData($iType, $param = array()) { $aRow = empty($param) ? $this->_getParams($iType) : $param; if (!Util_Validate::isCLength($aRow['sName'], 2, 20)) { return $this->showMsg('商品标题长度范围为2到20个字!', false); } if (!Util_Validate::isCLength($aRow['sDesc'], 2, 20)) { return $this->showMsg('商品描述长度范围为2到200个字!', false); } if (!Util_Validate::isFloat($aRow['iCosts'])) { return $this->showMsg('商品成本必须是数字!', false); } if (!Util_Validate::isFloat($aRow['iPrice'])) { return $this->showMsg('商品价格必须是数字!', false); } if (!Util_Validate::isInt($aRow['iCatID'])) { return $this->showMsg('商品类别必须是数字!', false); } if (!Util_Validate::isInt($aRow['iAgentRate'])) { return $this->showMsg('代理商比例必须是数字!', false); } if ($aRow['iUnlockType'] == -1) { return $this->showMsg('请选择商品解锁类型!', false); } if ($aRow['iUnlockType'] == 0 && $aRow['iUnlockLevel'] <= 0) { return $this->showMsg('请选择商品解锁级别!', false); } if ($aRow['iUnlockType'] == 0 && $aRow['iUnlockPoint'] == 0) { return $this->showMsg('请选择商品解锁点!', false); } if ($aRow['sThumbImg'] == '') { return $this->showMsg('商品缩略图不能为空', false); } if ($aRow['iPrice'] < $aRow['iCosts'] * 2) { return $this->showMsg('价格必须为成本的2倍以上', false); } if ($iType == 1) { $aGoods = Model_Goods::getGoodsByName($aRow['sName']); if ($aGoods['sName'] == $aRow['sName']) { return $this->showMsg('商品名称不能重复', false); } } return $aRow; }