Finishedproduct.php 447 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class Finishedproduct extends Model
  5. {
  6. protected $connection = 'mongodb';
  7. protected $table = 'finished_products';
  8. // protected $append = ['status_text'];
  9. protected static function init()
  10. {
  11. self::afterInsert(function ($row) {
  12. $pk = $row->getPk();
  13. $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
  14. });
  15. }
  16. }