data_center/app/common/model/dict/WorkerDictData.php

24 lines
637 B
PHP
Raw Normal View History

2023-11-06 16:19:20 +08:00
<?php
namespace app\common\model\dict;
use app\common\model\BaseModel;
class WorkerDictData extends BaseModel
{
protected $connection = 'mysql2';
protected $name = 'la_dict_data';
public function getStatusDescAttr($value, $data): string
{
return $data['status'] ? '正常' : '停用';
}
// 根据镇农科公司任务类型获取code
public function getTownTaskType($typeId){
$townTaskTypeList = WorkerDictData::where(['type_value' => 'town_task_type', 'status' => 1])->column('value', 'id');
if(isset($townTaskTypeList[$typeId])) {
return $townTaskTypeList[$typeId];
}
return '';
}
}