汪总电商平台
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.

61 lines
1.3 KiB

3 months ago
<?php
namespace app\index\model\wanlshop;
use think\Model;
use traits\model\SoftDelete;
class Find extends Model
{
use SoftDelete;
// 表名
protected $name = 'wanlshop_find';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'type_text'
];
public function getTypeList()
{
return ['new' => __('Type new'), 'video' => __('Type video'), 'live' => __('Type live'), 'want' => __('Type want'), 'activity' => __('Type activity'), 'show' => __('Type show')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function setImagesAttr($value)
{
return is_array($value) ? implode(',', $value) : $value;
}
public function setGoodsIdsAttr($value)
{
return is_array($value) ? implode(',', $value) : $value;
}
public function shop()
{
return $this->belongsTo('app\index\model\wanlshop\Shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}