feat: add community tag icons

This commit is contained in:
hajimi
2026-08-02 02:14:40 +08:00
parent 73f1c2ceba
commit a6531a3ab1
4 changed files with 39 additions and 2 deletions
@@ -10,12 +10,14 @@ class CommunityTagValidate extends BaseValidate
protected $rule = [
'id' => 'require|checkTag',
'name' => 'require|length:1,50',
'icon' => 'max:500',
];
protected $message = [
'id.require' => '标签id不能为空',
'name.require' => '标签名称不能为空',
'name.length' => '标签名称长度须在1-50位字符',
'icon.max' => '标签图标地址不能超过500个字符',
];
public function sceneAdd()
@@ -3,8 +3,19 @@
namespace app\common\model\community;
use app\common\model\BaseModel;
use app\common\service\FileService;
class CommunityTag extends BaseModel
{
protected $name = 'community_tag';
public function getIconAttr($value): string
{
return trim((string) $value) ? FileService::getFileUrl((string) $value) : '';
}
public function setIconAttr($value): string
{
return trim((string) $value) ? FileService::setFileUrl($value) : '';
}
}