|
@@ -39,11 +39,22 @@ class Trainactive extends Model
|
|
|
//文件名
|
|
|
self::afterUpdate(function ($row) {
|
|
|
|
|
|
+ $update = [];
|
|
|
+
|
|
|
$changed = $row->getChangedData();
|
|
|
if (isset($changed['files'])) {
|
|
|
+ //文件
|
|
|
$files = Db::name('attachment')->where('url','IN',$row['files'])->field('url,filename')->select();
|
|
|
|
|
|
- $update = ['files_json'=>json_encode($files)];
|
|
|
+ $update['files_json'] = json_encode($files);
|
|
|
+ }
|
|
|
+
|
|
|
+ //评价时间不能是null
|
|
|
+ if(empty($row['pingjia_time'])){
|
|
|
+ $update['pingjia_time'] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($update)){
|
|
|
Db::name('train_active')->where('id',$row['id'])->update($update);
|
|
|
}
|
|
|
});
|