Esempio n. 1
0
 /**
  * 保存记录
  *
  * @param Command $commandObj
  * @param $task_id
  * @param $action
  * @param $duration
  * @return mixed
  */
 public static function saveRecord(Command $commandObj, $task_id, $action, $duration)
 {
     $record = new static();
     $record->attributes = ['user_id' => \Yii::$app->user->id, 'task_id' => $task_id, 'status' => (int) $commandObj->getExeStatus(), 'action' => $action, 'created_at' => time(), 'command' => var_export($commandObj->getExeCommand(), true), 'memo' => var_export($commandObj->getExeLog(), true), 'duration' => $duration];
     //        file_put_contents('/tmp/xx', var_export($record->attributes, true).PHP_EOL.PHP_EOL, 8);
     return $record->save();
 }