12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
-
-
- namespace app\admin\validate;
- use think\Validate;
-
- class ProductAttribute extends Validate
- {
-
- protected $rule = array(
- array('typeid','checkTypeid'),
- array('attr_name','require','属性名称不能为空'),
- array('attr_input_type', 'require', '请选择表单类型'),
- array('attr_values','checkAttrValues'),
- );
-
-
-
- protected function checkTypeid($typeid, $rule)
- {
- if(empty($typeid) || I('param.typeid/d') == 0)
- return '请选择栏目……';
- else
- return true;
- }
-
-
-
- protected function checkAttrValues($attr_values,$rule)
- {
- if(empty($attr_values) && I('param.attr_input_type/d') == '1')
- return '可选值列表不能为空';
- else
- return true;
- }
- }
|