public function __construct() { parent::__construct(); $this->main_model = model_alias_to_name($this->main_model_alias); $this->detail_model = model_alias_to_name($this->detail_model_alias); }
public function response_to_node($response_to_model, $response_to_id, $source_data = []) { $model = D(model_alias_to_name($response_to_model)); $response_to_data = $model->where(['id' => $response_to_id])->find(); if (!$response_to_data) { return false; } $progress_model = D('Bpm/WorkflowProgress'); $latest_progress = $progress_model->get_latest_progress($response_to_data['workflow_id'], $response_to_id); if (!$latest_progress) { return false; } $next_nodes = explode(',', $latest_progress['next_nodes']); $next_nodes = D('Bpm/WorkflowNode')->where(['id' => ['IN', $next_nodes]])->select(); if (!$next_nodes) { return false; } foreach ($next_nodes as $node) { if ($node['executor'] === 'w:o') { return $this->exec($response_to_id, [], $node['id']); break; } } return false; }