硕顺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.
 
 
 
 
 
 

43 lines
879 B

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