硕顺crm后台
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.
 
 
 
 
 
 

42 lines
938 B

<?php
namespace addons\qingdong\model;
use think\Model;
use traits\model\SoftDelete;
/**
*联系人表
*/
class ContractFile Extends Model {
use SoftDelete;
// 表名,不含前缀
protected $name = 'qingdong_contract_file';
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
protected $deleteTime = false;
//附件表
public function file() {
return $this->hasOne(File::class, 'id', 'file_id')->with('staff')->bind('id,size,create_staff_id,types,name,file_path,staff');
}
public static function addFiles($files, $customer_id) {
$files = explode(',', $files);
$addFiles = [];
foreach ($files as $v) {
$addFiles[] = [
'contract_id' => $customer_id,
'file_id' => $v
];
}
$model=new self();
if($model->insertAll($addFiles)){
return true;
}
return false;
}
}