作者 lyh

gx生成评论

@@ -93,12 +93,16 @@ class InitKeywordComment extends Command @@ -93,12 +93,16 @@ class InitKeywordComment extends Command
93 if(!isset($item['name']) || !isset($item['comment'])){ 93 if(!isset($item['name']) || !isset($item['comment'])){
94 continue; 94 continue;
95 } 95 }
  96 + $twoMonthsAgo = strtotime('-2 months');
  97 + $randomTimestamp = rand($twoMonthsAgo, time());
  98 + $randomDateTime = date('Y-m-d H:i:s', $randomTimestamp);
96 $data[] = [ 99 $data[] = [
97 'nickname'=>$item['name'], 100 'nickname'=>$item['name'],
98 'text'=>$item['comment'], 101 'text'=>$item['comment'],
99 'project_id'=>$project_id, 102 'project_id'=>$project_id,
100 'type'=>1, 103 'type'=>1,
101 'uid'=>0, 104 'uid'=>0,
  105 + 'start_time'=>$randomDateTime,
102 'created_at'=>date('Y-m-d H:i:s'), 106 'created_at'=>date('Y-m-d H:i:s'),
103 'updated_at'=>date('Y-m-d H:i:s') 107 'updated_at'=>date('Y-m-d H:i:s')
104 ]; 108 ];
@@ -396,7 +396,6 @@ class KeywordLogic extends BaseLogic @@ -396,7 +396,6 @@ class KeywordLogic extends BaseLogic
396 preg_match_all('/\{[^{}]*\}/', $text, $matches); 396 preg_match_all('/\{[^{}]*\}/', $text, $matches);
397 $data = []; 397 $data = [];
398 $twoMonthsAgo = strtotime('-2 months'); 398 $twoMonthsAgo = strtotime('-2 months');
399 -  
400 if (!empty($text)) { 399 if (!empty($text)) {
401 foreach ($matches[0] as $item) { 400 foreach ($matches[0] as $item) {
402 $item = str_replace("'", '"', $item); 401 $item = str_replace("'", '"', $item);