model = new VipCashModel(); $cacheKey = "task_space_VipCash"; if (!Cache::has($cacheKey)) { // 处理提现申请逻辑 $this->processCashApplications(); // 处理打款逻辑 $this->processPayments(); Cache::set($cacheKey, time(), 60); } } catch (\Throwable $e) { echo 'ERROR VipCash: ' . $e->getMessage() . PHP_EOL; log_write('VipCash TASK : ' . '__ ' . $e->getMessage(), 'task'); } return true; } /** * 处理提现申请 */ private function processCashApplications() { // 获取待处理的提现申请列表 $list = $this->model->getPendingList(); if ($list->isEmpty()) return false; // 处理逻辑... $processedIds = []; foreach ($list as $item) { // 具体处理逻辑 $processedIds[] = $item['id']; } // 标记已处理 if (!empty($processedIds)) { $this->model->setProcessed($processedIds); } // 记录日志 $this->dologs('processCashApplications', ['Count' => count($processedIds)]); return true; } /** * 处理打款 */ private function processPayments() { // 获取已批准但未打款的申请列表 $list = $this->model->getApprovedList(); if ($list->isEmpty()) return false; // 处理逻辑... $processedIds = []; foreach ($list as $item) { // 具体处理逻辑 $processedIds[] = $item['id']; } // 标记已处理 if (!empty($processedIds)) { $this->model->setProcessed($processedIds); } // 记录日志 $this->dologs('processPayments', ['Count' => count($processedIds)]); return true; } /** * 记录日志 */ private function dologs($method, $params = []) { $value = 'behavior VipCash --' . $method; foreach ($params as $key => $val) { $value .= ' --' . $key . ' ' . (is_array($val) ? json_encode($val) : $val); } return log_write($value, 'task'); } }