|
@@ -45,22 +45,22 @@ class FertilizerValidation extends ValidationCore
|
|
|
],
|
|
],
|
|
|
// 验证土地是否属于用户
|
|
// 验证土地是否属于用户
|
|
|
[
|
|
[
|
|
|
- 'land_id', LandOwnershipValidator::class, 'args' => ['user_id', 'land'],
|
|
|
|
|
|
|
+ 'land_id', new LandOwnershipValidator($this, ['user_id', 'land']),
|
|
|
'msg' => '土地不存在或不属于当前用户'
|
|
'msg' => '土地不存在或不属于当前用户'
|
|
|
],
|
|
],
|
|
|
// 验证用户是否拥有该物品
|
|
// 验证用户是否拥有该物品
|
|
|
[
|
|
[
|
|
|
- 'item_id', ItemOwnershipValidator::class, 'args' => ['user_id', 'instance_id', 'quantity'],
|
|
|
|
|
|
|
+ 'item_id', new ItemOwnershipValidator($this, ['user_id', 'instance_id', 'quantity']),
|
|
|
'msg' => '您没有该肥料物品'
|
|
'msg' => '您没有该肥料物品'
|
|
|
],
|
|
],
|
|
|
// 验证物品是否为肥料类型
|
|
// 验证物品是否为肥料类型
|
|
|
[
|
|
[
|
|
|
- 'item_id', FertilizerItemValidator::class, 'args' => ['fertilizer_item', 'crop_growth_time'],
|
|
|
|
|
|
|
+ 'item_id', new FertilizerItemValidator($this, ['fertilizer_item', 'crop_growth_time']),
|
|
|
'msg' => '该物品不是有效的肥料'
|
|
'msg' => '该物品不是有效的肥料'
|
|
|
],
|
|
],
|
|
|
// 验证是否可以使用肥料
|
|
// 验证是否可以使用肥料
|
|
|
[
|
|
[
|
|
|
- 'land_id', FertilizerUsageValidator::class, 'args' => ['land', 'crop'],
|
|
|
|
|
|
|
+ 'land_id', new FertilizerUsageValidator($this, ['land', 'crop']),
|
|
|
'msg' => '当前土地状态或作物生长阶段不允许使用肥料'
|
|
'msg' => '当前土地状态或作物生长阶段不允许使用肥料'
|
|
|
]
|
|
]
|
|
|
];
|
|
];
|