mirror of
https://gitee.com/ulthon/ul-file-share.git
synced 2026-07-01 19:12:48 +08:00
45 lines
730 B
PHP
45 lines
730 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\model;
|
|
|
|
use think\Model;
|
|
|
|
/**
|
|
* @mixin \think\Model
|
|
*/
|
|
class Share extends Model
|
|
{
|
|
//
|
|
|
|
public function files()
|
|
{
|
|
return $this->hasMany(ShareFiles::class,'share_id');
|
|
}
|
|
|
|
public function getExpireDateAttr()
|
|
{
|
|
|
|
$date = date('Y-m-d H:i:s', $this->getAttr('expire_time'));
|
|
|
|
return $date;
|
|
}
|
|
|
|
public function getTotalSizeFormatAttr()
|
|
{
|
|
return format_size($this->getData('total_size'));
|
|
}
|
|
|
|
public function getExpireTimeAttr()
|
|
{
|
|
$exipre = $this->getData('expire');
|
|
return $this->getOrigin('create_time') + $exipre;
|
|
}
|
|
|
|
public function getReadUrlAttr()
|
|
{
|
|
return url('Index/read', ['uid' => $this->getData('uid')], false, true);
|
|
}
|
|
}
|