Vipjifei.php 731 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. use traits\model\SoftDelete;
  5. class Vipjifei extends Model
  6. {
  7. use SoftDelete;
  8. // 表名
  9. protected $name = 'vip_jifei';
  10. // 自动写入时间戳字段
  11. protected $autoWriteTimestamp = 'int';
  12. // 定义时间戳字段名
  13. protected $createTime = 'createtime';
  14. protected $updateTime = 'updatetime';
  15. protected $deleteTime = 'deletetime';
  16. // 追加属性
  17. protected $append = [
  18. ];
  19. protected static function init()
  20. {
  21. self::afterInsert(function ($row) {
  22. $pk = $row->getPk();
  23. $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
  24. });
  25. }
  26. }