mirror of https://gitee.com/karson/fastadmin.git
95 lines
3.3 KiB
PHP
95 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace app\admin\model;
|
|
|
|
use think\Model;
|
|
|
|
class CompanySet extends Model
|
|
{
|
|
// 表名
|
|
protected $name = 'company_set';
|
|
|
|
// 自动写入时间戳字段
|
|
protected $autoWriteTimestamp = false;
|
|
|
|
// 定义时间戳字段名
|
|
protected $createTime = false;
|
|
protected $updateTime = false;
|
|
|
|
// 追加属性
|
|
protected $append = [
|
|
'companyscaledata_text',
|
|
'companresourcesdata_text',
|
|
'offlinestoredata_text',
|
|
'cooperationplatformdata_text'
|
|
];
|
|
|
|
|
|
|
|
public function getCompanyscaledataList()
|
|
{
|
|
return ['1' => __('Companyscaledata 1'),'2' => __('Companyscaledata 2'),'3' => __('Companyscaledata 3'),'4' => __('Companyscaledata 4'),'5' => __('Companyscaledata 5')];
|
|
}
|
|
|
|
public function getCompanresourcesdataList()
|
|
{
|
|
return ['1' => __('Companresourcesdata 1'),'2' => __('Companresourcesdata 2'),'3' => __('Companresourcesdata 3'),'4' => __('Companresourcesdata 4'),'5' => __('Companresourcesdata 5'),'6' => __('Companresourcesdata 6'),'7' => __('Companresourcesdata 7'),'8' => __('Companresourcesdata 8'),'9' => __('Companresourcesdata 9')];
|
|
}
|
|
|
|
public function getOfflinestoredataList()
|
|
{
|
|
return ['1' => __('Offlinestoredata 1'),'2' => __('Offlinestoredata 2'),'3' => __('Offlinestoredata 3'),'4' => __('Offlinestoredata 4'),'5' => __('Offlinestoredata 5'),'6' => __('Offlinestoredata 6')];
|
|
}
|
|
|
|
public function getCooperationplatformdataList()
|
|
{
|
|
return ['1' => __('Cooperationplatformdata 1'),'2' => __('Cooperationplatformdata 2'),'3' => __('Cooperationplatformdata 3'),'4' => __('Cooperationplatformdata 4'),'5' => __('Cooperationplatformdata 5'),'6' => __('Cooperationplatformdata 6'),'7' => __('Cooperationplatformdata 7'),'8' => __('Cooperationplatformdata 8'),'9' => __('Cooperationplatformdata 9'),'10' => __('Cooperationplatformdata 10')];
|
|
}
|
|
|
|
|
|
public function getCompanyscaledataTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : $data['companyscaledata'];
|
|
$list = $this->getCompanyscaledataList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getCompanresourcesdataTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : $data['companresourcesdata'];
|
|
$valueArr = explode(',', $value);
|
|
$list = $this->getCompanresourcesdataList();
|
|
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
|
}
|
|
|
|
|
|
public function getOfflinestoredataTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : $data['offlinestoredata'];
|
|
$list = $this->getOfflinestoredataList();
|
|
return isset($list[$value]) ? $list[$value] : '';
|
|
}
|
|
|
|
|
|
public function getCooperationplatformdataTextAttr($value, $data)
|
|
{
|
|
$value = $value ? $value : $data['cooperationplatformdata'];
|
|
$valueArr = explode(',', $value);
|
|
$list = $this->getCooperationplatformdataList();
|
|
return implode(',', array_intersect_key($list, array_flip($valueArr)));
|
|
}
|
|
|
|
protected function setCompanresourcesdataAttr($value)
|
|
{
|
|
return is_array($value) ? implode(',', $value) : $value;
|
|
}
|
|
|
|
protected function setCooperationplatformdataAttr($value)
|
|
{
|
|
return is_array($value) ? implode(',', $value) : $value;
|
|
}
|
|
|
|
|
|
}
|