'红包ID不能为空'], [['id'], 'integer', 'min' => 1, 'tooSmall' => '红包ID参数错误'], [['status'], 'in', 'range' => [-1, 0, 1], 'message' => '红包状态不正确'], [['beginTime', 'endTime', 'willTime'], 'integer', 'min' => 0, 'tooSmall' => '{attribute}必须大于等于0'], [['duration'], 'integer', 'min' => 0, 'max' => 3650, 'tooSmall' => '有效天数必须大于等于0', 'tooBig' => '有效天数过大'], [['amount'], 'number', 'min' => 0.01, 'tooSmall' => '{attribute}不能小于0.01'], [['minConsume'], 'number', 'min' => 0.00, 'tooSmall' => '{attribute}不能小于0'], [['remark'], 'default', 'value' => ''], [['remark'], 'filter', 'filter' => 'trim'], [['remark'], 'string'], //[['orderId'], 'default', 'value' => 0], [['orderId'], 'integer', 'min' => 1], [['orderId'], 'required', 'when' => function ($model) { return $model->status == 0; }, 'message' => '订单ID不能为空'], ]; } /** * 获取属性标签 * @return array */ public function attributeLabels() { return [ 'id' => '红包ID', 'status' => '红包状态', 'amount' => '红包金额', 'minConsume' => '最低消费金额', 'beginTime' => '生效时间', 'endTime' => '失效时间', 'willTime' => '预期失效时间', 'duration' => '有效天数', 'remark' => '备注', 'orderId' => '订单ID', ]; } }