作者 lyh

gx生成评论

... ... @@ -93,12 +93,16 @@ class InitKeywordComment extends Command
if(!isset($item['name']) || !isset($item['comment'])){
continue;
}
$twoMonthsAgo = strtotime('-2 months');
$randomTimestamp = rand($twoMonthsAgo, time());
$randomDateTime = date('Y-m-d H:i:s', $randomTimestamp);
$data[] = [
'nickname'=>$item['name'],
'text'=>$item['comment'],
'project_id'=>$project_id,
'type'=>1,
'uid'=>0,
'start_time'=>$randomDateTime,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
... ...
... ... @@ -396,7 +396,6 @@ class KeywordLogic extends BaseLogic
preg_match_all('/\{[^{}]*\}/', $text, $matches);
$data = [];
$twoMonthsAgo = strtotime('-2 months');
if (!empty($text)) {
foreach ($matches[0] as $item) {
$item = str_replace("'", '"', $item);
... ...