You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
1.1 KiB

<?php
declare (strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model;
/**
*/
class Ad extends Model
{
/**
* 跳转类型及说明
*/
const ITEM = [
1 => 'page',
2 => 'webview',
3 => 'applet',
];
/**
* 类型 1 = 首页banners
*/
const TYPE_BANNER = 1;
/**
* 启用状态
*/
const STATUS_YES = 1;
const STATUS_NO = 2;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'ims_cjdc_ad';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [];
protected $appends = [
'item_text',
'redirect_url'
];
/**
* 获取跳转说明
*/
public function getItemTextAttribute()
{
return self::ITEM[$this->item];
}
/**
* 获取跳转连接
*/
public function getRedirectUrlAttribute()
{
return $this->src ?: $this->src2;
}
}