123456789101112 |
- protected static function onAfterInsert($model)
- {
- if ($model->{%field%} == 0) {
- $pk = $model->getPk();
- if (strlen($model[$pk]) >= 19) {
- $model->where($pk, $model[$pk])->update(['{%field%}' => $model->count()]);
- } else {
- $model->where($pk, $model[$pk])->update(['{%field%}' => $model[$pk]]);
- }
- }
- }
|