'int', 'workerid' => 'int', 'type' => 'int', 'title' => 'string', 'video' => 'string', 'cateid' => 'int', 'province' => 'string', 'city' => 'string', 'district' => 'string', 'agegroup' => 'string', 'tags' => 'string', 'enddate' => 'int', 'requirement' => 'string', 'comdetails' => 'string', 'picall' => 'string', 'wtype' => 'tinyint', 'bwagall' => 'string', 'zwagall' => 'string', 'ftype' => 'tinyint', 'fwagall' => 'string', 'telephone' => 'string', 'remark' => 'string', 'status' => 'tinyint', 'isfree' => 'tinyint', 'priority' => 'int', 'updatetime' => 'int', 'createtime' => 'int', 'volume' => 'int', 'telearr' => 'string', 'deletetime' => 'int', 'company_name' => 'string', 'company_contact' => 'string', 'company_mobile' => 'string', ]; // 设置字段自动转换类型 protected $type = [ 'tags' => 'json', 'telearr' => 'json', 'picall' => 'json', 'enddate' => 'timestamp:Y-m-d', 'updatetime' => 'timestamp:Y-m-d H:i:s', 'createtime' => 'timestamp:Y-m-d H:i:s', ]; // 设置JSON数据返回数组 protected $jsonAssoc = true; public function gettypeTextAttr($value, $data) { $wtype = [1 => '代招', 2 => '劳务派遣']; return $wtype[$data['wtype']]; } public function getWtypeTextAttr($value, $data) { $wtype = [1 => '按月', 2 => '按时', 3 => '按件', 4 => '按项目', 5 => '其他']; return $wtype[$data['wtype']]; } public function getFtypeTextAttr($value, $data) { $ftype = [1 => '一次性', 2 => '小时工', 3 => '管理费', 4 => '其他']; return $ftype[$data['ftype']]; } public function getStatusTextAttr($value, $data) { $status = [1 => '待交接', 2 => '部分交接', 3 => '已完成', 4 => '异常']; return $status[$data['status']]; } public function getIsfreeTextAttr($value, $data) { $isfree = [1 => '否', 2 => '是']; return $isfree[$data['isfree']]; } // 关联DemandCate public function demandCate() { return $this->hasOne(DemandCate::class, "id", "cateid"); } // 关联Worker public function worker() { return $this->hasOne(Worker::class, "id", "workerid"); } }