dlhmaster/app/admin/controller/MallNews.php
2024-07-22 17:53:12 +08:00

82 lines
2.2 KiB
PHP

<?php
namespace app\admin\controller;
use app\admin\logic\live\LiveGoodsLogic;
use app\admin\logic\live\LiveRoomLogic;
use app\admin\logic\MallNewsLogic;
use app\common\basics\AdminBase;
use app\common\server\JsonServer;
use think\Exception;
class MallNews extends AdminBase
{
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
$lists = MallNewsLogic::lists($get);
return JsonServer::success('', $lists);
}
return view('', [
'shop' => LiveRoomLogic::shopLists()
]);
}
public function add()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = MallNewsLogic::create($post);
if ($result['code'] == 1) {
return JsonServer::success('添加成功');
}
return JsonServer::error($result['msg']);
}
return view('', [
'max_upload_size' => MallNewsLogic::$MAX_UPLOAD_SIZE . 'Mb',
'max_upload_file' => MallNewsLogic::$MAX_UPLOAD_FILE,
]);
}
public function audit()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
$result = MallNewsLogic::audit($post);
if ($result['code'] == 1) {
return JsonServer::success('添加成功');
}
return JsonServer::error($result['msg']);
}
$id = $this->request->get('id');
return view('', [
'detail' => MallNewsLogic::detail($id),
'max_upload_size' => MallNewsLogic::$MAX_UPLOAD_SIZE . 'Mb',
'max_upload_file' => MallNewsLogic::$MAX_UPLOAD_FILE,
]);
}
/**
* 上传视频到OSS
*/
public function uploadVideo()
{
$result = MallNewsLogic::uploadVideo();
if ($result['code'] == 1) {
return JsonServer::success('', $result['data']);
}
return JsonServer::error('', $result['msg']);
}
public function delVideo()
{
if ($this->request->isAjax()) {
$file = $this->request->post('videoFile');
MallNewsLogic::delVideo($file);
}
}
}