作者 刘锟

update

@@ -236,19 +236,22 @@ class ProjectUpdate extends Command @@ -236,19 +236,22 @@ class ProjectUpdate extends Command
236 if ($custom_types) { 236 if ($custom_types) {
237 $custom_model = new CustomModule(); 237 $custom_model = new CustomModule();
238 foreach ($custom_types as $v_custom) { 238 foreach ($custom_types as $v_custom) {
239 - try {  
240 - $custom_info = $custom_model->read(['route' => $v_custom]);  
241 - if (!$custom_info) {  
242 - $custom_model->add([  
243 - 'name' => $v_custom,  
244 - 'project_id' => $project_id,  
245 - 'route' => $v_custom  
246 - ]); 239 + $log = UpdateLog::where('project_id', $project_id)->where('api_type', $v_custom)->first();
  240 + if (empty($log)) {
  241 + try {
  242 + $custom_info = $custom_model->read(['route' => $v_custom]);
  243 + if (!$custom_info) {
  244 + $custom_model->add([
  245 + 'name' => $v_custom,
  246 + 'project_id' => $project_id,
  247 + 'route' => $v_custom
  248 + ]);
  249 + }
  250 + UpdateLog::createLog($project_id, $v_custom, $task->api_url);
  251 + } catch (\Exception $e) {
  252 + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
  253 + continue;
247 } 254 }
248 - UpdateLog::createLog($project_id, $v_custom, $task->api_url);  
249 - } catch (\Exception $e) {  
250 - echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;  
251 - continue;  
252 } 255 }
253 } 256 }
254 } 257 }