'checkGoods', 'page' => 'require', ]; protected $message = [ 'page.require' => '路径缺失', ]; public function sceneGetMnpQrCode() { return $this->only(['id','page']); } protected function checkGoods($value,$rule,$data) { $goods = Goods::where('id',$value)->findOrEmpty()->toArray(); if(empty($goods)){ return '商品不存在'; } if(GoodsEnum::STATUS_STORE == $goods['status']){ return '商品已下架'; } return true; } }