<?php
namespace app\common\model;

use think\Model;

class ComjobsLog extends Model
{
	// 设置字段信息
    protected $schema = [
        'id'			=> 'int',
		'workerid'		=> 'int',
		'comjobsid'		=> 'int',
		'userid'		=> 'int',
		'status'		=> 'tinyint',
		'remark'		=> 'string',
        'createtime'	=> 'int',
        'del_status'	=> 'tinyint'
    ];
	
	// 设置字段自动转换类型
	protected $type = [
        'createtime'  => 'timestamp:Y-m-d H:i:s'
    ];
	
	public function getStatusTextAttr($value,$data)
	{
		$status = [1=>'未跟进', 2=>'未面试', 3=>'面试通过', 4=>'面试未通过', 5=>'用户放弃', 6=>'已入职', 7=>'已离职'];
		return $status[$data['status']];
	}
	
	// 关联Worker
	public function worker()
	{
	    return $this->hasOne(Worker::class, "id", "workerid");
	}
	
	// 关联Comjobs
	public function comjobs()
	{
	    return $this->hasOne(Comjobs::class, "id", "comjobsid");
	}
	
	// 关联User
	public function user()
	{
	    return $this->hasOne(User::class, "id", "userid");
	}

}