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" /} + + +
+
+
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ + +
+ + + +
+ +
+ +
+
+ +
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/app/admin/view/mall_news/lists.html b/app/admin/view/mall_news/lists.html new file mode 100644 index 00000000..0c1a82ce --- /dev/null +++ b/app/admin/view/mall_news/lists.html @@ -0,0 +1,279 @@ +{layout name="layout1" /} + +
+
+
+ +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+ 搜索 + 重置 +
+
+
+ +
+
+
+
+ +
+ + + + + + + + + +
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/composer.json b/composer.json index 673fe8f1..58c821a1 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,10 @@ } }, "config": { - "preferred-install": "dist" + "preferred-install": "dist", + "allow-plugins": { + "easywechat-composer/easywechat-composer": true + } }, "scripts": { "post-autoload-dump": [ diff --git a/config/aliyunoss.php b/config/aliyunoss.php new file mode 100644 index 00000000..e5edf04f --- /dev/null +++ b/config/aliyunoss.php @@ -0,0 +1,8 @@ + "zjeloong", + "access_key_id" => "LTAI5t5dcGDXvRSM9k2MAtqC", + "access_key_secret" => "X2cRzvWbtKpzSip8o3m8URJKFo1piJ", + "domain" => "https://zjeloong.oss-cn-hangzhou.aliyuncs.com/" +]; \ No newline at end of file