SysSerial.php 636 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace app\model;
  3. use support\exception\BusinessException;
  4. use support\Model;
  5. class SysSerial extends Model
  6. {
  7. protected $table = 'sys_serial';
  8. protected $primaryKey = 'serial';
  9. const CREATED_AT = null;
  10. const UPDATED_AT = null;
  11. /**
  12. * @Desc 自增序列号
  13. * @Author Gorden
  14. * @Date 2024/3/11 10:45
  15. *
  16. * @return mixed
  17. * @throws BusinessException
  18. */
  19. public static function getSerial()
  20. {
  21. $model = new self();
  22. if ($model->save()) {
  23. return $model->serial;
  24. }
  25. throw new BusinessException("序列号生成失败~");
  26. }
  27. }