初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\app\agent;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Member extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'app_agent_member';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1')];
|
||||
}
|
||||
|
||||
public function getAuditList()
|
||||
{
|
||||
return [
|
||||
'0' => __('Audit 0'),
|
||||
'1' => __('Audit 1'),
|
||||
'2' => __('Audit 2'),
|
||||
'3' => __('Audit 3')
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'RIGHT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function relation()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\app\agent\Relation', 'user_id', 'user_id', [], 'left')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user