This commit is contained in:
toom1996
2025-07-24 15:49:49 +08:00
parent 07fe136d62
commit b33b922b65
25 changed files with 25662 additions and 809 deletions

View File

@ -88,7 +88,7 @@ class NewsController extends AbstractController
public function insert()
{
$model = new NewsFormModel();
$model->setAttributes($this->request->post(), ['title', 'keywords', 'description', 'cover', 'content', 'platform']);
$model->setAttributes($this->request->post(), ['title', 'keywords', 'description', 'cover', 'content', 'platform', 'column1', 'column2']);
$model->insert();
return $this->response->json(['code' => 0, 'msg' => 'ok']);
}
@ -104,6 +104,7 @@ class NewsController extends AbstractController
$content = $this->request->post('content', null);
$platform = $this->request->post('platform', 0);
$column = $this->request->post('column', 0);
$column2 = $this->request->post('column2', 0);
// 随机图片
$directory = env('COVER_ROOT'); // 文件夹路径
$images = glob($directory . '/*.{jpg,jpeg,png,gif,bmp}', GLOB_BRACE); // 获取图片文件
@ -139,6 +140,7 @@ class NewsController extends AbstractController
EOF
]);
$model->column_tag = $column;
$model->second_column = $column2;
$model->save();
}
return $this->response->json(['code' => 0, 'msg' => 'ok']);