attachmentId = $params['attachmentId']; } public function handle() { try { $attach = aModel::find($this->attachmentId); if (empty($attach)) return false; switch ($attach->module) { case "post_export": $res = pModel::exportData($attach->params); $res = true; break; default: throw new \Exception("导出模块不存在"); } aModel::edit([ 'attachment_id' => $this->attachmentId, 'status' => $res ? 1 : 2, 'fail_reason' => $res ? "" : "导出失败" ]); } catch (\Exception $e) { aModel::edit([ 'attachment_id' => $this->attachmentId, 'status' => 2, 'fail_reason' => $e->getMessage() ]); } return true; } }