<?php

namespace app\common\model\odd_job;

use think\Model;
use think\model\concern\SoftDelete;

class BrokerModel extends Model
{
    protected $connection = 'odd_job';

    use SoftDelete;
    protected $deleteTime = 'deletetime';
    protected $defaultSoftDelete = 0;

    //设置表名
    protected $name = 'broker';

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

    public function getStatusTextAttr($value, $data)
    {
        $status = [1 => '正常', 2 => '禁用'];
        return $status[$data['status']];
    }

    public function getPowerreportTextAttr($value, $data)
    {
        $status = [1 => '是', 2 => '否'];
        return $status[$data['powerreport']];
    }

    public function getTypeTextAttr($value, $data)
    {
        $status = [1 => '经纪人', 2 => '红色合伙人', 3 => '省外经纪人'];
        return $status[$data['type']];
    }
}