MobileExportLog.php 710 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class MobileExportLog extends Model
  5. {
  6. protected $autoWriteTimestamp=true;
  7. protected $updateTime=null;
  8. protected $append=['file_url','name'];
  9. public static function exists(){
  10. return self::where('status',0)->find();
  11. }
  12. public static function make($adminId){
  13. return self::create([
  14. 'admin_id'=>$adminId,
  15. //'filename'=>'/uploads/mobile_export/'.session_create_id().'.csv',
  16. ]);
  17. }
  18. public function getFileUrlAttr($_,$model){
  19. return request()->domain().$model['filename'];
  20. }
  21. public function getNameAttr($_,$model){
  22. return basename($model['filename']);
  23. }
  24. }