Ocr.php 883 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace addons\qingdongams\model;
  3. use think\Exception;
  4. use think\Model;
  5. /**
  6. * ocr识别
  7. */
  8. class Ocr Extends Model {
  9. protected $name = 'qingdongams_ocr';
  10. // 开启自动写入时间戳字段
  11. protected $autoWriteTimestamp = 'int';
  12. // 定义时间戳字段名
  13. protected $createTime = 'createtime';
  14. protected $updateTime = 'updatetime';
  15. //获取创建时间
  16. public function getCreatetimeAttr($value) {
  17. return date('Y-m-d H:i:s', $value);
  18. }
  19. //获取附件
  20. public function getFileidsAttr($value) {
  21. return cdnurl(File::getUrl($value), true);
  22. }
  23. //销售
  24. public function staff() {
  25. return $this->hasOne(Staff::class, 'id', 'staff_id')->field('id,img,name');
  26. }
  27. //类型
  28. public function types() {
  29. return $this->hasOne(OcrType::class, 'id', 'type_id')->field('id,name');
  30. }
  31. }