Merge branch 'new-miniapp'

This commit is contained in:
2026-05-22 17:55:54 +08:00
15 changed files with 1236 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace app\common\model;
use app\common\service\FileService;
class AssetResource extends BaseModel
{
protected $name = 'asset_resource';
protected $autoWriteTimestamp = true;
public function getFileUrlAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
public function setFileUrlAttr($value)
{
return trim($value) ? FileService::setFileUrl($value) : '';
}
public function getCoverUrlAttr($value)
{
return trim($value) ? FileService::getFileUrl($value) : '';
}
public function setCoverUrlAttr($value)
{
return trim($value) ? FileService::setFileUrl($value) : '';
}
// Relation to users via asset_user_resource
public function users()
{
return $this->belongsToMany(AssetUser::class, AssetUserResource::class, 'user_id', 'resource_id');
}
}
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace app\common\model;
use think\model\concern\SoftDelete;
class AssetUser extends BaseModel
{
protected $name = 'asset_user';
protected $autoWriteTimestamp = true;
// Optional: Hide password when returning array/json
protected $hidden = ['password'];
}
@@ -0,0 +1,10 @@
<?php
namespace app\common\model;
use think\model\Pivot;
class AssetUserResource extends Pivot
{
protected $name = 'asset_user_resource';
protected $autoWriteTimestamp = 'create_time';
protected $updateTime = false;
}