<?php
namespace app\common\model;

use think\Model;

class UserFollow extends Model
{
    // 设置字段信息
    protected $schema = [
        'id'          		=> 'int',
        'userid'			=> 'int',
        'ftype'				=> 'string',
        'fstatus'			=> 'tinyint',
        'remark'			=> 'string',
        'createtime'  		=> 'int'
    ];

    // 设置字段自动转换类型
    protected $type = [
        'createtime'  => 'timestamp:Y-m-d H:i:s'
    ];

    public function getFstatusTextAttr($value,$data)
    {
        $fstatus = [1=>'未跟进', 2=>'未面试', 3=>'面试通过', 4=>'面试未通过', 5=>'用户放弃', 6=>'已入职', 7=>'已离职'];
        return $fstatus[$data['fstatus']];
    }

    // 关联User
    public function user()
    {
        return $this->hasOne(User::class, "id", "userid");
    }


}