1, 'msg' => '{attr}必须是大于0的整数' ], // 验证商品是否存在且可购买 [ 'good_id', new ShopItemValidator($this, ['shop_item']), 'msg' => '商品验证失败' ], // 验证购买限制 [ 'good_id', new ShopBuyLimitValidator($this, ['user_id', 'number', 'shop_item']), 'msg' => '购买限制验证失败' ], // 验证用户资金是否充足 [ 'good_id', new ShopFundValidator($this, ['user_id', 'number', 'shop_item']), 'msg' => '资金不足' ] ]; } /** * 设置默认值 * * @return array */ public function default(): array { return []; } }