初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\app\complaint;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
protected $name = 'app_complaint_category';
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => '启用', '0' => '禁用'];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\app\complaint;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Record extends Model
|
||||
{
|
||||
protected $name = 'app_complaint_record';
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $append = [
|
||||
'status_text',
|
||||
'images_list'
|
||||
];
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['0' => '待处理', '1' => '已处理', '2' => '已驳回'];
|
||||
}
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value !== '' ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getImagesListAttr($value, $data)
|
||||
{
|
||||
if (empty($data['images'])) {
|
||||
return [];
|
||||
}
|
||||
$images = json_decode($data['images'], true);
|
||||
return is_array($images) ? $images : [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user