From 3777395105d064499ae7358104cb0db7775bca2d Mon Sep 17 00:00:00 2001 From: Alone <675061370@qq.com> Date: Mon, 4 Nov 2024 11:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0666?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 + app/admin/controller/Source.php | 33 +- app/admin/controller/SourceCategory.php | 49 +-- app/api/controller/Chatbot.php | 382 ++++++++++++++++++++++++ app/api/controller/Other.php | 35 ++- app/api/controller/Tool.php | 35 +++ app/index/controller/Index.php | 79 +++++ app/index/view/common/footer.html | 6 +- app/index/view/news/detail.html | 57 ++-- app/index/view/news/index.html | 64 ++-- app/index/view/news/list.html | 127 ++++++-- app/qfadmin/view/source/category.html | 15 +- app/qfadmin/view/source/index.html | 49 ++- data.sql | 2 + public/static/index/css/app.css | 94 +++++- public/static/index/css/m.css | 48 ++- updateLog/24.11.4 | 8 + 17 files changed, 976 insertions(+), 117 deletions(-) create mode 100644 app/api/controller/Chatbot.php create mode 100644 updateLog/24.11.4 diff --git a/README.md b/README.md index 3c5c57b..334e144 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,16 @@ ## 更新日志 +### v2.1 + +- 增加网页全网搜功能 +- 对接微信对话功能 +- 更新优化Seo +- 后台增加批量删除功能 +- 优化表格导入功能 + +注:如何更新见文件夹updateLog/24.11.4 + ### v2 - UI改版:不再使用uniapp diff --git a/app/admin/controller/Source.php b/app/admin/controller/Source.php index 52c2713..08fcb24 100644 --- a/app/admin/controller/Source.php +++ b/app/admin/controller/Source.php @@ -153,14 +153,18 @@ class Source extends QfShop if (!$this->pk_value) { return jerr($this->pk . "必须填写", 400); } - - //根据主键获取一行数据 - $item = $this->getRowByPk(); - if (empty($item)) { - return jerr("数据查询失败", 404); - } - $this->model->where($this->pk, $this->pk_value)->delete(); + if (isInteger($this->pk_value)){ + //根据主键获取一行数据 + $item = $this->getRowByPk(); + if (empty($item)) { + return jerr("数据查询失败", 404); + } + $this->model->where($this->pk, $this->pk_value)->delete(); + }else{ + $list = explode(',', $this->pk_value); + $this->model->where($this->pk, 'in', $list)->delete(); + } return jok('删除成功'); } @@ -192,7 +196,7 @@ class Source extends QfShop if ($error) { return $error; } - // try { + try { $file = request()->file('file'); try { validate(['file' => 'filesize:' . config("qfshop.upload_max_file") . '|fileExt:' . config("qfshop.upload_file_type")]) @@ -205,11 +209,12 @@ class Source extends QfShop $extension = pathinfo($file_name, PATHINFO_EXTENSION); if ($extension == 'csv') { + return jerr('转成xlsx格式吧'); $PHPReader = new \PHPExcel_Reader_CSV(); $encoding = $this->detectFileEncoding($file_name); - if (!$encoding || strtoupper($encoding) == 'UTF-8') { - $encoding = 'GBK'; // 尝试将其强制转为GBK - } + // if (!$encoding || strtoupper($encoding) == 'UTF-8') { + // $encoding = 'GBK'; // 尝试将其强制转为GBK + // } $PHPReader->setInputEncoding($encoding); $PHPReader->setDelimiter(','); } elseif ($extension == 'xlsx') { @@ -284,9 +289,9 @@ class Source extends QfShop } catch (ValidateException $e) { return jerr($e->getMessage()); } - // } catch (\Exception $error) { - // return jerr('上传文件失败,请检查你的文件!'); - // } + } catch (\Exception $error) { + return jerr('上传文件失败,请检查你的文件!'); + } } diff --git a/app/admin/controller/SourceCategory.php b/app/admin/controller/SourceCategory.php index b36449a..852484a 100644 --- a/app/admin/controller/SourceCategory.php +++ b/app/admin/controller/SourceCategory.php @@ -22,11 +22,11 @@ class SourceCategory extends QfShop ]; $this->insertFields = [ //允许添加的字段列表 - "name","sort","status","image" + "name","sort","status","image","is_update" ]; $this->updateFields = [ //允许更新的字段列表 - "name","sort","status","image" + "name","sort","status","image","is_update" ]; $this->insertRequire = [ //添加时必须填写的字段 @@ -196,6 +196,19 @@ class SourceCategory extends QfShop if (!$source_category_id) { return jerr("ID参数必须填写", 400); } + + + $d = [ + "status" => 1, + "update_time" => time(), + ]; + if(input("type") == 1){ + $d = [ + "is_update" => 0, + "update_time" => time(), + ]; + } + if (isInteger($source_category_id)) { //根据主键获取一行数据 $item = $this->model->where("source_category_id", $source_category_id)->field($this->selectDetail)->find(); @@ -204,17 +217,11 @@ class SourceCategory extends QfShop } //单个操作 $map = ["source_category_id" => $source_category_id]; - $this->model->where($map)->update([ - "status" => 1, - "update_time" => time(), - ]); + $this->model->where($map)->update($d); } else { //批量操作 $list = explode(',', $source_category_id); - $this->model->where("source_category_id", 'in', $list)->update([ - "status" => 1, - "update_time" => time(), - ]); + $this->model->where("source_category_id", 'in', $list)->update($d); } return jok("禁用成功"); } @@ -236,6 +243,18 @@ class SourceCategory extends QfShop if (!$source_category_id) { return jerr("ID参数必须填写", 400); } + + $d = [ + "status" => 0, + "update_time" => time(), + ]; + if(input("type") == 1){ + $d = [ + "is_update" => 1, + "update_time" => time(), + ]; + } + if (isInteger($source_category_id)) { //根据主键获取一行数据 $item = $this->model->where("source_category_id", $source_category_id)->field($this->selectDetail)->find(); @@ -244,17 +263,11 @@ class SourceCategory extends QfShop } //单个操作 $map = ["source_category_id" => $source_category_id]; - $this->model->where($map)->update([ - "status" => 0, - "update_time" => time(), - ]); + $this->model->where($map)->update($d); } else { //批量操作 $list = explode(',', $source_category_id); - $this->model->where("source_category_id", 'in', $list)->update([ - "status" => 0, - "update_time" => time(), - ]); + $this->model->where("source_category_id", 'in', $list)->update($d); } return jok("启用成功"); } diff --git a/app/api/controller/Chatbot.php b/app/api/controller/Chatbot.php new file mode 100644 index 0000000..b1f4bfb --- /dev/null +++ b/app/api/controller/Chatbot.php @@ -0,0 +1,382 @@ +key = base64_decode($this->encodingAESKey . "="); + } + + public function index() + { + $encrypted = input('encrypted'); + + //解决全局搜时会多次接收相同消息导致多次请求的bug,原因未知 + if(!empty($encrypted)){ + if(Cache::get($encrypted) == 1){ + return; + } + Cache::set($encrypted, 1, 600); + } + + $msg = $this->decryptMessage($encrypted); + + + $msgtype = $msg['content']['msgtype']??''; + $message = $msg['content']['msg']??''; + if ($msgtype !== 'text' || empty($message)) { + if(Cache::get($msg['userid']) != 1){ + $messages = "欢迎来到 ".$this->wName."!🍿🎬 这里是影迷的梦幻天堂,准备好享受每一部影视的精彩时刻吧!\n\n"; + $messages .= "🔍 使用指南 🔍\n\n"; + $messages .= "1. 搜剧命令\n"; + $messages .= "回复 “搜剧+剧名”,免费获取最全的影视资源。\n"; + $messages .= "示例:搜剧我被美女包围了\n\n"; + $messages .= "2. 全网搜\n"; + $messages .= "回复 “全网搜+关键词”,快速找到全网资源!\n"; + $messages .= "示例:全网搜学剪辑\n\n"; + $messages .= "赶快准备好你的爆米花,和我们一起开启下一场视觉盛宴吧!🎥"; + + $this->sendMessage($msg, $messages); + } + Cache::set($msg['userid'], 1, 604800); + } + // 检查用户消息内容中开头第一个字是否包含“搜”关键字 + if (strncmp($message, '搜', 1) === 0 || strncmp($message, '全网搜', 1) === 0) { + + if(strncmp($message, '全网搜', 1) === 0){ + $list = []; + // 去除“全网搜”关键字,提取用户输入的剧名 + $newString = preg_replace('/^全网搜/u', '', $message); + }else{ + // 去除“搜剧”关键字,提取用户输入的剧名 + $newString = preg_replace('/^搜剧|^搜/u', '', $message); + + // 实例化资源模型,并搜索匹配的剧名 + $map['page_size'] = 5; + $map['title'] = $newString; + $SourceModel = new SourceModel(); + $result = $SourceModel->getList($map); + $list = $result['items']??[]; + } + + + + if(empty($list)){ + //系统没有资源去全网搜 + $this->sendMessage($msg, "正在深入搜索,请稍等..."); + + $list = $this->Qsearch($newString); + } + + $content = "🔍 ".$newString."丨搜索结果"; + $is_times = 0; + if (!empty($list)) { + foreach ($list as $item) { + $content = $content . "\n"; + if(!empty($item['is_time']) && $item['is_time'] == 1){ + $content = $content . "\n🌐️ " . $item['title'] . "\n" . $item['url'] . ""; + $is_times++; + }else{ + $content = $content . "\n" . $item['title'] . "\n" . $item['url'] . ""; + } + } + $content = $content . "\n"; + if($is_times>0){ + $content = $content . "\n🌐️ 资源来源网络,30分钟后删除"; + }else if(!empty($newString)){ + $content = $content . "\n 不是短剧?请尝试:全网搜".$newString.""; + } + $content = $content . "\n ------------------------------------------------"; + $content = $content . "\n 欢迎观看!如果喜欢可以喊你的朋友一起来哦"; + } else { + // 如果没有找到匹配的剧名,提示用户减少关键词尝试搜索 + $content = $content . "\n"; + $content = $content . "\n 未找到,可换个关键词尝试哦~"; + $content = $content . "\n ⚠️宁少写,不多写、错写~"; + } + + $this->sendMessage($msg, $content); + } + + + + } + + private function Qsearch($newString) + { + $list = []; + $urlData = array( + 'title' => $newString, + ); + $res = curlHelper(Request::domain()."/api/other/all_search", "POST", $urlData)['body']; + $res = json_decode($res, true); + + if($res['code'] === 200){ + $list = $res['data']??[]; + } + + return $list; + } + + // 解密消息 + private function decryptMessage($encrypted) + { + $result = $this->decrypt($encrypted,$this->appId); + if ($result[0] !== 0) { + return []; + } + return json_decode(json_encode(simplexml_load_string($result[1])), true); + } + + // 发送消息 + private function sendMessage($msg, $message) + { + $data = $this->createXmlMessage($msg, $message); + $result = $this->encrypt($data,$this->appId); + + if ($result[0] !== 0) { + return; + } + + $this->sendPostRequest("https://chatbot.weixin.qq.com/openapi/sendmsg/".$this->token, [ + 'encrypt' => $result[1], + ]); + } + + // 创建 XML 消息 + private function createXmlMessage($msg, $message) + { + return ' + + + + '.$msg['channel'].' + '; + } + + private function sendPostRequest($url, $data) + { + $options = [ + CURLOPT_URL => $url, + CURLOPT_POST => true, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_HTTPHEADER => [ + 'Content-Type: application/json', + ], + CURLOPT_POSTFIELDS => json_encode($data), + ]; + + $ch = curl_init(); + curl_setopt_array($ch, $options); + $response = curl_exec($ch); + + if (curl_errno($ch)) { + // 处理错误(可添加日志) + return ['error' => curl_error($ch)]; + } + + curl_close($ch); + return json_decode($response, true); + } + + + + + + /** + * 对密文进行解密 + * @param string $encrypted 需要解密的密文 + * @return string 解密得到的明文 + */ + private function decrypt($encrypted,$appid) + { + try { + if(version_compare(PHP_VERSION, '7','>=')) { + $iv = substr($this->key, 0, 16); + $decrypted = openssl_decrypt($encrypted,'AES-256-CBC',substr($this->key, 0, 32),OPENSSL_ZERO_PADDING,$iv); + } else { + //使用BASE64对需要解密的字符串进行解码 + $ciphertext_dec = base64_decode($encrypted); + $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); + $iv = substr($this->key, 0, 16); + mcrypt_generic_init($module, $this->key, $iv); + + //解密 + $decrypted = mdecrypt_generic($module, $ciphertext_dec); + mcrypt_generic_deinit($module); + mcrypt_module_close($module); + } + + } catch (Exception $e) { + return [-40007, null]; + } + + + try { + //去除补位字符 + $result = $this->decode($decrypted); + //去除16位随机字符串,网络字节序和AppId + if (strlen($result) < 16) + return ""; + $content = substr($result, 16, strlen($result)); + $len_list = unpack("N", substr($content, 0, 4)); + $xml_len = $len_list[1]; + $xml_content = substr($content, 4, $xml_len); + $from_appid = substr($content, $xml_len + 4); + if(version_compare(PHP_VERSION, '7','>=')) { + if (!$appid) { + //如果传入的appid是空的,则认为是订阅号,使用数据中提取出来的appid + $appid = $from_appid; + } + } + } catch (Exception $e) { + //print $e; + return [-40008, null]; + } + if ($from_appid != $appid) + return [-40005, null]; + //不注释上边两行,避免传入appid是错误的情况 + if(version_compare(PHP_VERSION, '7','>=')) { + //增加appid,为了解决后面加密回复消息的时候没有appid的订阅号会无法回复 + return array(0, $xml_content, $from_appid); + } else { + return array(0, $xml_content); + } + return $encrypted; + } + + /** + * 对解密后的明文进行补位删除 + * @param decrypted 解密后的明文 + * @return 删除填充补位后的明文 + */ + private function decode($text) + { + + $pad = ord(substr($text, -1)); + if ($pad < 1 || $pad > 32) { + $pad = 0; + } + return substr($text, 0, (strlen($text) - $pad)); + } + + + /** + * 对明文进行加密 + * @param string $text 需要加密的明文 + * @return string 加密后的密文 + */ + private function encrypt($text, $appid) + { + try { + if(version_compare(PHP_VERSION, '7','>=')) { + //获得16位随机字符串,填充到明文之前 + $random = $this->getRandomStr(); + $text = $random . pack("N", strlen($text)) . $text . $appid; + $iv = substr($this->key, 0, 16); + $text = $this->encode($text); + $encrypted = openssl_encrypt($text,'AES-256-CBC',substr($this->key, 0, 32),OPENSSL_ZERO_PADDING,$iv); + } else { + //获得16位随机字符串,填充到明文之前 + $random = $this->getRandomStr(); + $text = $random . pack("N", strlen($text)) . $text . $appid; + // 网络字节序 + $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); + $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); + $iv = substr($this->key, 0, 16); + //使用自定义的填充方式对明文进行补位填充 + $text = $this->encode($text); + mcrypt_generic_init($module, $this->key, $iv); + //加密 + $encrypted = mcrypt_generic($module, $text); + mcrypt_generic_deinit($module); + mcrypt_module_close($module); + $encrypted = base64_encode($encrypted); + } + + //print($encrypted); + //使用BASE64对加密后的字符串进行编码 + return [0, $encrypted]; + } catch (Exception $e) { + //print $e; + return [-40006, null]; + } + } + /** + * 对需要加密的明文进行填充补位 + * @param $text 需要进行填充补位操作的明文 + * @return 补齐明文字符串 + */ + private function encode($text) + { + $block_size = 32; + $text_length = strlen($text); + //计算需要填充的位数 + $amount_to_pad = 32 - ($text_length % 32); + if ($amount_to_pad == 0) { + $amount_to_pad = 32; + } + //获得补位所用的字符 + $pad_chr = chr($amount_to_pad); + $tmp = ""; + for ($index = 0; $index < $amount_to_pad; $index++) { + $tmp .= $pad_chr; + } + return $text . $tmp; + } + + /** + * 随机生成16位字符串 + * @return string 生成的字符串 + */ + private function getRandomStr() + { + + $str = ""; + $str_pol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; + $max = strlen($str_pol) - 1; + for ($i = 0; $i < 16; $i++) { + $str .= $str_pol[mt_rand(0, $max)]; + } + return $str; + } + + + private function writeLog($value) + { + // 获取当前目录 + $currentDir = __DIR__; // 当前控制器目录 + $logFile = $currentDir . '/log.txt'; // 日志文件名称,可以自定义 + + // 生成时间戳 + $timestamp = date('Y-m-d H:i:s'); + + // 判断 $value 是否为数组,如果是,则转换为 JSON 字符串 + if (is_array($value)) { + $value = json_encode($value); // 转换为 JSON 字符串 + } + + $logEntry = "[$timestamp] 参数值: $value\n"; // 日志内容 + + // 写入日志文件 + file_put_contents($logFile, $logEntry, FILE_APPEND); + } +} diff --git a/app/api/controller/Other.php b/app/api/controller/Other.php index cadbb6e..1887afa 100644 --- a/app/api/controller/Other.php +++ b/app/api/controller/Other.php @@ -3,6 +3,7 @@ namespace app\api\controller; use think\App; +use think\facade\Cache; use think\facade\Request; use app\api\QfShop; use app\model\Source as SourceModel; @@ -36,7 +37,7 @@ class Other extends QfShop $map[] = ['is_time', '=', 1]; $map[] = ['title|description', 'like', '%' . trim($title) . '%']; - $urls = $this->model->where($map)->field('source_id as id, title, url')->order('update_time', 'desc')->limit(5)->select()->toArray(); + $urls = $this->model->where($map)->field('source_id as id, title, url,is_time')->order('update_time', 'desc')->limit(5)->select()->toArray(); if (!empty($urls)) { // 获取所有需要更新的ID @@ -52,6 +53,33 @@ class Other extends QfShop return jok('临时资源获取成功',$urls); } + + + //同一个搜索内容锁机 + if (Cache::has($title)) { + // 检查缓存中是否已有结果 + return jok('临时资源获取成功1', Cache::get($title)); + } + + + // 检查是否有正在处理的请求 + if (Cache::has($title . '_processing')) { + // 如果当前正在处理相同关键词的请求,等待结果 + $startTime = time(); // 记录开始时间 + while (Cache::has($title . '_processing')) { + usleep(1000000); // 暂停1秒 + + // 检查是否超过60秒 + if (time() - $startTime > 60) { + return jok('临时资源获取成功3', []); // 返回空数组 + } + } + return jok('临时资源获取成功2', Cache::get($title)); + } + + + // 设置处理状态为正在处理 + Cache::set($title . '_processing', true, 60); // 锁定60秒 $searchList = []; //查询的结果集 $datas = []; //最终数据 @@ -115,6 +143,9 @@ class Other extends QfShop } } } + + Cache::set($title, $datas, 60); // 缓存结果60秒 + Cache::delete($title . '_processing'); // 解锁 return jok('临时资源获取成功',$datas); } @@ -176,7 +207,7 @@ class Other extends QfShop $data["is_time"] = 1; $data["update_time"] = time(); $data["create_time"] = time(); - $this->model->insertGetId($data); + $data["id"] = $this->model->insertGetId($data); $datas[] =$data; $num_success++; } diff --git a/app/api/controller/Tool.php b/app/api/controller/Tool.php index 2f6bb77..1073987 100644 --- a/app/api/controller/Tool.php +++ b/app/api/controller/Tool.php @@ -3,6 +3,8 @@ namespace app\api\controller; use think\App; +use think\facade\Request; +use think\facade\Cache; use app\api\QfShop; use app\model\User as Usermodel; use app\model\Ads as Adsmodel; @@ -147,4 +149,37 @@ class Tool extends QfShop } + /** + * 网页端全网搜接口 + * + * @return void + */ + public function Qsearch() + { + $title = input('title'); + $list = []; + + if (empty($title)) { + return jok('临时资源获取成功', $list); + } + + $keys = Request::ip()."_".$title; + if(Cache::get($keys) == 1){ + return jerr('调用太过频繁啦'); + } + Cache::set($keys, 1, 10); + + $urlData = array( + 'title' => $title, + ); + $res = curlHelper(Request::domain()."/api/other/all_search", "POST", $urlData)['body']; + $res = json_decode($res, true); + + if($res['code'] === 200){ + $list = $res['data']??[]; + } + Cache::delete($keys); + return jok('临时资源获取成功', $list); + } + } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index d830428..060402d 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -10,6 +10,8 @@ use app\index\QfShop; use app\model\Source as SourceModel; use app\model\SourceCategory as SourceCategoryModel; +use Lizhichao\Word\VicWord; + class Index extends QfShop { @@ -48,9 +50,26 @@ class Index extends QfShop }); } + + + //热门排行榜数据 + $hotList = []; + $cacheDir = root_path('runtime/api/cache'); // runtime/cache 目录 + foreach ($rankList as $value) { + $cacheFile = $cacheDir . "ranking_data_{$value['name']}.cache"; + if (file_exists($cacheFile)) { + $hotList[] = array( + 'name'=> $value['name'], + 'image'=> $value['image'], + 'list'=> json_decode(file_get_contents($cacheFile), true), + ); + } + } + $config = config("qfshop"); View::assign('newList', $newList); + View::assign('hotList', $hotList); View::assign('config', $config); View::assign('rankList', $rankList); View::assign('fixed', 1); @@ -80,9 +99,25 @@ class Index extends QfShop $category = $this->SourceCategoryModel->field('name,source_category_id as id')->where([['status','=',0]])->order('sort desc')->select(); + + //热门排行榜数据 + $hotList = []; + $cacheDir = root_path('runtime/api/cache'); // runtime/cache 目录 + foreach ($rankList as $value) { + $cacheFile = $cacheDir . "ranking_data_{$value['name']}.cache"; + if (file_exists($cacheFile)) { + $hotList[] = array( + 'name'=> $value['name'], + 'image'=> $value['image'], + 'list'=> json_decode(file_get_contents($cacheFile), true), + ); + } + } + $config = config("qfshop"); + View::assign('hotList', $hotList); View::assign('rankList', $rankList); View::assign('category', $category); View::assign('list', $list); @@ -118,9 +153,53 @@ class Index extends QfShop } $rankList = $this->SourceCategoryModel->field('name,image')->where([['status','=',0],['is_sys','=',1]])->order('sort desc')->select(); + + //热门排行榜数据 + $hotList = []; + $cacheDir = root_path('runtime/api/cache'); // runtime/cache 目录 + foreach ($rankList as $value) { + $cacheFile = $cacheDir . "ranking_data_{$value['name']}.cache"; + if (file_exists($cacheFile)) { + $hotList[] = array( + 'name'=> $value['name'], + 'image'=> $value['image'], + 'list'=> json_decode(file_get_contents($cacheFile), true), + ); + } + } + + + //相关资源 + $map[] = ['status', '=', 1]; + $map[] = ['is_delete', '=', 0]; + $fc = new VicWord(); + $keywords = $fc->getAutoWord(preg_replace('/[\(\(][^\)]*[\)\)]/u', '', $detail['title'])); + $keywords = filterAndExtractWords($keywords); + $keywords[] = '';//这个是为了在没有相关资源时不至于获取不到资源 + $weightExpr = []; + foreach ($keywords as $keyword) { + $weightExpr[] = "IF(title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%', 1, 0)"; + $searchTitle[] = $keyword; + } + $weightExpr = implode(' + ', $weightExpr); + // 在查询中添加权重计算和排序 + $query = $this->SourceModel->alias('a') + ->field('a.*, (' . $weightExpr . ') as weight')->where($map) + ->where(function($query) use ($keywords) { + foreach ($keywords as $keyword) { + $query->whereOr('title', 'like', '%' . trim($keyword) . '%') + ->whereOr('description', 'like', '%' . trim($keyword) . '%'); + } + }); + $order = ['weight' => 'desc', 'source_id' => 'desc']; + $sameList = $query->where('source_id','<>',$detail['id'])->order($order)->limit(10)->select(); + + $config = config("qfshop"); + View::assign('sameList', $sameList); + View::assign('hotList', $hotList); View::assign('rankList', $rankList); View::assign('detail', $detail); View::assign('config', $config); diff --git a/app/index/view/common/footer.html b/app/index/view/common/footer.html index 731fce2..3a8f054 100644 --- a/app/index/view/common/footer.html +++ b/app/index/view/common/footer.html @@ -19,6 +19,10 @@ const rankDj = ref([]); const is_m = ref(0); const newList = ref([]); + const QStatus = ref(0); + const QList = ref([]); + const QLoading = ref(false); + const total_result = ref(0); // 公共消息方法 @@ -167,7 +171,7 @@ }); // 返回数据和方法 - return { elementOpacity, scrollThreshold, keyword, searchBtn, rankList,newList, setnum, qcodeVisible, layerVisible, content, saveBtn, rankDj,goLink,changeBtn,copyText,drawer,selectBtn,is_m }; + return { elementOpacity, scrollThreshold, keyword, searchBtn, rankList,newList, setnum, qcodeVisible, layerVisible, content, saveBtn, rankDj,goLink,changeBtn,copyText,drawer,selectBtn,is_m,QList,QLoading,QStatus,total_result }; } }) .use(ElementPlus) // 使用 Element Plus diff --git a/app/index/view/news/detail.html b/app/index/view/news/detail.html index cfaf857..6b7ed67 100644 --- a/app/index/view/news/detail.html +++ b/app/index/view/news/detail.html @@ -76,47 +76,58 @@ {/notempty}
-
复制分享
+
复制分享
立即访问
+

相关资源

+
+
+ {volist name="sameList" id="vo"} + +

+ {$key+1} + {$vo.title} +

+
+ {/volist} +
+
- + {volist name="hotList" id="vo"} - {include file="common/foot"}
{include file="common/footer"} diff --git a/app/index/view/news/index.html b/app/index/view/news/index.html index b7b3762..f8650de 100644 --- a/app/index/view/news/index.html +++ b/app/index/view/news/index.html @@ -36,78 +36,92 @@
{if $config.ranking_type == 1 }
- + {volist name="newList" id="vos"} + {if condition="strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') === false || $key < $config.ranking_m_num"} +
- + {$vos.title} Loading...
-

{{vo.title}}

+

{$vos.title}

+ {/if} + {/volist}
{else /}
- + {volist name="newList" id="vos"} + {if condition="strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') === false || $key < $config.ranking_m_num"} +

- {{i+1}} - {{vo.title}} + {$key+1} + {$vos.title}

+ {/if} + {/volist}
{/if}
-
+ + {volist name="hotList" id="vo"} +
+ {/volist} + +
{include file="common/foot"} {include file="common/footer"} diff --git a/app/index/view/news/list.html b/app/index/view/news/list.html index c568873..2d60450 100644 --- a/app/index/view/news/list.html +++ b/app/index/view/news/list.html @@ -32,9 +32,50 @@
-

为您找到【{$keyword}】相关资源 {$list.total_result}

-
+

为您找到【{$keyword}】相关资源 {{total_result}} 

+

为您找到【{$keyword}】相关资源 {$list.total_result} 

+ + {if condition="$config.is_quan == 1"} +
+
+
+
+
+
+ + {{item.title}} + +
30分钟后自动删除,请及时保存
+
+ 来源:网络资源 +
+
+
复制分享
+ 查看详情 + + + 立即访问 + +
+
+
+ + +
+

未找到更多的资源~

+
+ +
+
+ {/if} + +
{if condition="$list.total_result>0"} + {if condition="$config.is_quan == 1"} +
+
以下资源不是你想要的?点击尝试获取新资源
+
+ {/if}
{foreach $list.items as $key=>$vo }
@@ -59,7 +100,7 @@ {/notempty}
-
复制分享
+
复制分享
查看详情 @@ -80,42 +121,78 @@
{include file="common/footer"} \ No newline at end of file diff --git a/app/qfadmin/view/source/category.html b/app/qfadmin/view/source/category.html index 7ae9e85..2839a2b 100644 --- a/app/qfadmin/view/source/category.html +++ b/app/qfadmin/view/source/category.html @@ -29,14 +29,14 @@ @@ -228,10 +228,15 @@ console.log(error); }).catch(() => { }); }, - clickStatus(row) { + clickStatus(row,type) { var that = this; - axios.post(row.status ? '/admin/source_category/enable' : '/admin/source_category/disable', Object.assign({}, PostBase, { - source_category_id: row.source_category_id + let url = row.status ? '/admin/source_category/enable' : '/admin/source_category/disable' + if(type==1){ + url = !row.is_update ? '/admin/source_category/enable' : '/admin/source_category/disable' + } + axios.post(url, Object.assign({}, PostBase, { + source_category_id: row.source_category_id, + type: type })) .then(function (response) { that.getList(); diff --git a/app/qfadmin/view/source/index.html b/app/qfadmin/view/source/index.html index 00f38d0..d7bec6d 100644 --- a/app/qfadmin/view/source/index.html +++ b/app/qfadmin/view/source/index.html @@ -8,6 +8,7 @@ 添加资源 + 批量删除 导出资源 夸克导入专用 批量导入 @@ -29,7 +30,9 @@
- + + + @@ -146,7 +149,7 @@
将文件拖到此处,或点击上传
- 请导入夸克官方导出的csv文件 + 请使用xlsx格式,第一列资源名称 第二列资源地址