diff --git a/app/admin/controller/MallNews.php b/app/admin/controller/MallNews.php new file mode 100644 index 00000000..5ae9af4b --- /dev/null +++ b/app/admin/controller/MallNews.php @@ -0,0 +1,47 @@ +request->isAjax()) { + $get = $this->request->get(); + $lists = LiveGoodsLogic::lists($get); + return JsonServer::success('', $lists); + } + return view('', [ + 'shop' => LiveRoomLogic::shopLists() + ]); + } + + public function add() + { + return view(''); + } + + public function edit() + { + + } + + /** + * 上传视频到OSS + */ + public function uploadVideo() + { + $result = MallNewsLogic::uploadVideo(); + if ($result['code'] == 1) { + return JsonServer::success('', $result['data']); + } + return JsonServer::error('', $result['msg']); + } +} \ No newline at end of file diff --git a/app/admin/logic/MallNewsLogic.php b/app/admin/logic/MallNewsLogic.php new file mode 100644 index 00000000..b7c111da --- /dev/null +++ b/app/admin/logic/MallNewsLogic.php @@ -0,0 +1,40 @@ +file('file'); + if ($file->getSize() > self::$MAX_UPLOAD_SIZE) { + return ['code' => -1, 'msg' => '视频最大上传为50M']; + } + + $config = [ + 'default' => ConfigServer::get('storage', 'default', 'local'), + 'engine' => ConfigServer::get('storage_engine') ?? ['local'=>[]] + ]; + + $StorageDriver = new StorageDriver($config); + $StorageDriver->setUploadFile('file'); + if (!$StorageDriver->upload(self::$FILE_PATH)) { + return ['code' => -1, 'msg' => '上传错误']; + } + + $fileName = $StorageDriver->getFileName(); + if ($fileName) { + return ['code' => 1, 'msg' => '', 'data' => array('file' => Config::get('aliyunoss.domain') . self::$FILE_PATH . '/'. $fileName)]; + } + + return ['code' => -1, 'msg' => '上传失败']; + } +} \ No newline at end of file diff --git a/app/admin/view/mall_news/add.html b/app/admin/view/mall_news/add.html new file mode 100644 index 00000000..8491ed7f --- /dev/null +++ b/app/admin/view/mall_news/add.html @@ -0,0 +1,243 @@ +{layout name="layout2" /} + + +