You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
1 year ago
|
<?php
|
||
|
|
||
|
namespace app\common\model;
|
||
|
|
||
|
use think\Model;
|
||
|
|
||
|
class ProjectWorkerOrder extends Model
|
||
|
{
|
||
|
// 表名
|
||
|
protected $name = 'project_work_order';
|
||
|
// 开启自动写入时间戳字段
|
||
|
protected $autoWriteTimestamp = 'int';
|
||
|
|
||
|
|
||
|
// 追加属性
|
||
|
protected $append = [
|
||
|
'mgr_name',
|
||
|
'job_address',
|
||
|
'pro_members',
|
||
|
'iqc_name',
|
||
|
'category_name'
|
||
|
];
|
||
|
|
||
|
function getMgrNameAttr($value, $data) {
|
||
|
return User::get($data['mgr_id'])->nickname ?? '';
|
||
|
}
|
||
|
|
||
|
function getJobAddressAttr($value, $data) {
|
||
|
return $data['job_location'].$data['detail_address'];
|
||
|
}
|
||
|
|
||
|
function getProMembersAttr($value, $data) {
|
||
|
return User::getUsers($data['member_ids']) ?? '';
|
||
|
}
|
||
|
|
||
|
public function getIqcNameAttr($value, $data) {
|
||
|
return User::get($data['iqc_id'])->nickname ?? '';
|
||
|
}
|
||
|
|
||
|
public function getCategoryNameAttr($value,$data) {
|
||
|
return ProjectCategory::get($data['category_id'])->name ?? '';
|
||
|
}
|
||
|
|
||
|
//获取公司信息
|
||
|
public static function getCompanyInfo($order_id) {
|
||
|
$company_id = self::where('id', $order_id)->value('company_id');
|
||
|
$data = UserCompany::get($company_id);
|
||
|
$company = [];
|
||
|
if ($data) {
|
||
|
$company['name'] = $data['company_name'];
|
||
|
$company['phone'] = $data['contact_phone'];
|
||
|
$company['assignedSealId'] = $data['assignedSealId'];
|
||
|
}
|
||
|
return $company;
|
||
|
}
|
||
|
|
||
|
}
|