no message
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\popup;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\service\FileService;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 页面弹窗配置模型
|
||||
*/
|
||||
class PagePopup extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'page_popup';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
/**
|
||||
* 完整图片URL
|
||||
*/
|
||||
public function getImageAttr($value): string
|
||||
{
|
||||
if (empty($value)) return '';
|
||||
if (preg_match('/^https?:\/\//i', $value)) return $value;
|
||||
return FileService::getFileUrl($value);
|
||||
}
|
||||
|
||||
public function getPopupTypeTextAttr($value, $data): string
|
||||
{
|
||||
$map = [1 => '图片弹窗', 2 => '文字弹窗', 3 => '图文混合'];
|
||||
return $map[$data['popup_type']] ?? '';
|
||||
}
|
||||
|
||||
public function getLinkTypeTextAttr($value, $data): string
|
||||
{
|
||||
$map = [0 => '不跳转', 1 => '站内路径', 2 => '外部H5', 3 => '拨打电话'];
|
||||
return $map[$data['link_type']] ?? '';
|
||||
}
|
||||
|
||||
public function getFrequencyTextAttr($value, $data): string
|
||||
{
|
||||
$map = [1 => '每次', 2 => '每会话一次', 3 => '每天一次', 4 => '仅一次'];
|
||||
return $map[$data['frequency']] ?? '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user