Pre Merge pull request !463 from simon429/develop

pull/463/MERGE
simon429 2024-04-03 01:29:42 +00:00 committed by Gitee
commit d3ce3a413b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 11 additions and 5 deletions

View File

@ -2,7 +2,9 @@
protected static function init()
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
if (!$row['{%order%}']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['{%order%}' => $row[$pk]]);
}
});
}

View File

@ -23,8 +23,10 @@ class UserRule extends Model
protected static function init()
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}

View File

@ -24,7 +24,9 @@ class Category extends Model
protected static function init()
{
self::afterInsert(function ($row) {
$row->save(['weigh' => $row['id']]);
if (!$row['weigh']) {
$row->save(['weigh' => $row['id']]);
}
});
}