BroadcastGoodsValidate.php 574 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/7/30
  7. *
  8. *
  9. */
  10. namespace app\validate\merchant;
  11. use think\Validate;
  12. class BroadcastGoodsValidate extends Validate
  13. {
  14. protected $failException = true;
  15. protected $rule = [
  16. 'name|商品名称' => 'require|min:3',
  17. 'cover_img|商品图' => 'require',
  18. 'price|价格' => 'require|min:0',
  19. 'product_id|商品' => 'require|array|length:2',
  20. ];
  21. public function isBatch()
  22. {
  23. $this->rule['product_id|商品'] = 'require|integer';
  24. return $this;
  25. }
  26. }