deal($data)) { $job->delete(); return true; } if ($job->attempts() >= 3) { $job->delete(); return false; } $job->release(10); //10秒后重试 } /** * 处理业务逻辑 * @param type $data * @return bool */ public function deal($data): bool { switch ($data["type"]) { case 1: //批量购房线下提交的部门审核结果 try { $idCard = $data["idCard"]; $checkState = $data["checkState"]; $checkMsg = $data["checkMsg"]; $old = HouseApi::getNewestInfoByIdCard($idCard); if (!$old) { return false; } if ($old["checkState"] != HouseStateEnum::NEED_REVIEW_CHECK) { return false; } $upd["id"] = $old["id"]; if ($checkState == 1) { //审核通过 $upd["importDepPassTime"] = date("Y-m-d H:i:s"); $state = 3; } else { //审核不通过 $upd["checkState"] = HouseStateEnum::DEP_REJECT; $upd["importDepPassTime"] = null; $state = 2; } HousePurchase::update($upd); //添加日志 TalentChecklog::create([ 'id' => getStringId(), 'mainId' => $old["id"], 'type' => intval(ProjectState::HOUSE), 'typeFileId' => null, 'active' => 1, 'state' => $state, 'step' => 2, 'stateChange' => "", 'description' => $checkMsg, 'createTime' => date("Y-m-d H:i:s", time()), 'createUser' => $data["createUser"] ]); return true; } catch (\Exception $e) { Log::write($e->getMessage(), "error"); } break; } return false; } }