完成基本功能

This commit is contained in:
augushong
2021-06-20 01:02:11 +08:00
parent 36c059e5be
commit a869aadf95
8 changed files with 343 additions and 54 deletions

View File

@@ -12,4 +12,33 @@ use 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);
}
}

View File

@@ -21,5 +21,11 @@ class ShareFiles extends Model
return $root_dir . $safe_dir . $save_name;
}
public function getFileSizeFormatAttr()
{
$value = $this->getData('file_size');
return format_size($value);
}
//
}