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.
60 lines
1.2 KiB
60 lines
1.2 KiB
3 weeks ago
|
<?php
|
||
|
|
||
|
namespace app\admin\model\wanlshop;
|
||
|
|
||
|
use think\Model;
|
||
|
use traits\model\SoftDelete;
|
||
|
|
||
|
class Live extends Model
|
||
|
{
|
||
|
|
||
|
use SoftDelete;
|
||
|
|
||
|
|
||
|
|
||
|
// 表名
|
||
|
protected $name = 'wanlshop_live';
|
||
|
|
||
|
// 自动写入时间戳字段
|
||
|
protected $autoWriteTimestamp = 'int';
|
||
|
|
||
|
// 定义时间戳字段名
|
||
|
protected $createTime = 'createtime';
|
||
|
protected $updateTime = 'updatetime';
|
||
|
protected $deleteTime = 'deletetime';
|
||
|
|
||
|
// 追加属性
|
||
|
protected $append = [
|
||
|
'state_text'
|
||
|
];
|
||
|
|
||
|
|
||
|
|
||
|
public function getStateList()
|
||
|
{
|
||
|
return ['0' => __('State 0'), '1' => __('State 1'), '2' => __('State 2'), '3' => __('State 3')];
|
||
|
}
|
||
|
|
||
|
|
||
|
public function getStateTextAttr($value, $data)
|
||
|
{
|
||
|
$value = $value ? $value : (isset($data['state']) ? $data['state'] : '');
|
||
|
$list = $this->getStateList();
|
||
|
return isset($list[$value]) ? $list[$value] : '';
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
public function wanlshopfind()
|
||
|
{
|
||
|
return $this->belongsTo('app\admin\model\wanlshop\Find', 'id', 'live_id', [], 'LEFT')->setEagerlyType(0);
|
||
|
}
|
||
|
|
||
|
|
||
|
public function wanlshopshop()
|
||
|
{
|
||
|
return $this->belongsTo('app\admin\model\wanlshop\Shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||
|
}
|
||
|
}
|