From 6edbcc4638da3d40654d2a43603e156a65fd8048 Mon Sep 17 00:00:00 2001 From: koogua Date: Fri, 28 Oct 2022 17:05:24 +0800 Subject: [PATCH 01/22] =?UTF-8?q?v1.6.1=E5=BC=80=E5=B7=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Library/AppInfo.php | 2 +- public/static/home/js/chapter.vod.player.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 1ea13df1..1242f294 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -16,7 +16,7 @@ class AppInfo protected $link = 'https://www.koogua.com'; - protected $version = '1.6.0'; + protected $version = '1.6.1'; public function __get($name) { diff --git a/public/static/home/js/chapter.vod.player.js b/public/static/home/js/chapter.vod.player.js index c072658f..3aaa7f69 100644 --- a/public/static/home/js/chapter.vod.player.js +++ b/public/static/home/js/chapter.vod.player.js @@ -29,8 +29,6 @@ layui.use(['jquery', 'helper'], function () { } }); - console.log(quality) - var player = new DPlayer({ container: document.getElementById('player'), video: { From 372b996365620738860ea43833a09aa8ab6f8558 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 31 Oct 2022 09:53:24 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Article.php | 23 ----------- app/Http/Admin/Services/Course.php | 16 -------- app/Http/Admin/Services/Page.php | 16 -------- app/Http/Admin/Services/Question.php | 23 ----------- app/Services/Logic/PointGiftTrait.php | 2 +- app/Services/MyStorage.php | 56 +-------------------------- 6 files changed, 3 insertions(+), 133 deletions(-) diff --git a/app/Http/Admin/Services/Article.php b/app/Http/Admin/Services/Article.php index 6a9931f2..368dc2cb 100644 --- a/app/Http/Admin/Services/Article.php +++ b/app/Http/Admin/Services/Article.php @@ -9,7 +9,6 @@ namespace App\Http\Admin\Services; use App\Builders\ArticleList as ArticleListBuilder; use App\Builders\ReportList as ReportListBuilder; -use App\Caches\Article as ArticleCache; use App\Library\Paginator\Query as PagerQuery; use App\Library\Utils\Word as WordUtil; use App\Models\Article as ArticleModel; @@ -27,7 +26,6 @@ use App\Services\Logic\Article\XmTagList as XmTagListService; use App\Services\Logic\Notice\Internal\ArticleApproved as ArticleApprovedNotice; use App\Services\Logic\Notice\Internal\ArticleRejected as ArticleRejectedNotice; use App\Services\Logic\Point\History\ArticlePost as ArticlePostPointHistory; -use App\Services\Sync\ArticleIndex as ArticleIndexSync; use App\Validators\Article as ArticleValidator; class Article extends Service @@ -209,8 +207,6 @@ class Article extends Service $this->saveDynamicAttrs($article); - $this->rebuildArticleIndex($article); - $owner = $this->findUser($article->owner_id); $this->recountUserArticles($owner); @@ -230,8 +226,6 @@ class Article extends Service $this->saveDynamicAttrs($article); - $this->rebuildArticleIndex($article); - $owner = $this->findUser($article->owner_id); $this->recountUserArticles($owner); @@ -251,8 +245,6 @@ class Article extends Service $this->saveDynamicAttrs($article); - $this->rebuildArticleIndex($article); - $owner = $this->findUser($article->owner_id); $this->recountUserArticles($owner); @@ -292,7 +284,6 @@ class Article extends Service if ($type == 'approve') { - $this->rebuildArticleIndex($article); $this->handleArticlePostPoint($article); $this->handleArticleApprovedNotice($article, $sender); @@ -403,20 +394,6 @@ class Article extends Service $user->update(); } - protected function rebuildArticleCache(ArticleModel $article) - { - $cache = new ArticleCache(); - - $cache->rebuild($article->id); - } - - protected function rebuildArticleIndex(ArticleModel $article) - { - $sync = new ArticleIndexSync(); - - $sync->addItem($article->id); - } - protected function handleArticlePostPoint(ArticleModel $article) { if ($article->published != ArticleModel::PUBLISH_APPROVED) return; diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index cdd951f9..e3f20997 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -8,7 +8,6 @@ namespace App\Http\Admin\Services; use App\Builders\CourseList as CourseListBuilder; -use App\Caches\Course as CourseCache; use App\Caches\CourseCategoryList as CourseCategoryListCache; use App\Caches\CourseRelatedList as CourseRelatedListCache; use App\Caches\CourseTeacherList as CourseTeacherListCache; @@ -25,7 +24,6 @@ use App\Repos\CourseCategory as CourseCategoryRepo; use App\Repos\CourseRelated as CourseRelatedRepo; use App\Repos\CourseUser as CourseUserRepo; use App\Repos\User as UserRepo; -use App\Services\Sync\CourseIndex as CourseIndexSync; use App\Validators\Course as CourseValidator; use App\Validators\CourseOffline as CourseOfflineValidator; @@ -399,20 +397,6 @@ class Course extends Service return $validator->checkCourse($id); } - protected function rebuildCourseCache(CourseModel $course) - { - $cache = new CourseCache(); - - $cache->rebuild($course->id); - } - - protected function rebuildCourseIndex(CourseModel $course) - { - $sync = new CourseIndexSync(); - - $sync->addItem($course->id); - } - protected function saveTeachers(CourseModel $course, $teacherIds) { $courseRepo = new CourseRepo(); diff --git a/app/Http/Admin/Services/Page.php b/app/Http/Admin/Services/Page.php index 022afa64..3ed047c3 100644 --- a/app/Http/Admin/Services/Page.php +++ b/app/Http/Admin/Services/Page.php @@ -7,7 +7,6 @@ namespace App\Http\Admin\Services; -use App\Caches\Page as PageCache; use App\Library\Paginator\Query as PagerQuery; use App\Models\Page as PageModel; use App\Repos\Page as PageRepo; @@ -53,8 +52,6 @@ class Page extends Service $page->create($data); - $this->rebuildPageCache($page); - return $page; } @@ -96,8 +93,6 @@ class Page extends Service $page->update($data); - $this->rebuildPageCache($page); - return $page; } @@ -109,8 +104,6 @@ class Page extends Service $page->update(); - $this->rebuildPageCache($page); - return $page; } @@ -122,18 +115,9 @@ class Page extends Service $page->update(); - $this->rebuildPageCache($page); - return $page; } - protected function rebuildPageCache(PageModel $page) - { - $cache = new PageCache(); - - $cache->rebuild($page->id); - } - protected function findOrFail($id) { $validator = new PageValidator(); diff --git a/app/Http/Admin/Services/Question.php b/app/Http/Admin/Services/Question.php index 52b548b7..44a456ef 100644 --- a/app/Http/Admin/Services/Question.php +++ b/app/Http/Admin/Services/Question.php @@ -9,7 +9,6 @@ namespace App\Http\Admin\Services; use App\Builders\QuestionList as QuestionListBuilder; use App\Builders\ReportList as ReportListBuilder; -use App\Caches\Question as QuestionCache; use App\Library\Paginator\Query as PagerQuery; use App\Models\Category as CategoryModel; use App\Models\Question as QuestionModel; @@ -26,7 +25,6 @@ use App\Services\Logic\Point\History\QuestionPost as QuestionPostPointHistory; use App\Services\Logic\Question\QuestionDataTrait; use App\Services\Logic\Question\QuestionInfo as QuestionInfoService; use App\Services\Logic\Question\XmTagList as XmTagListService; -use App\Services\Sync\QuestionIndex as QuestionIndexSync; use App\Validators\Question as QuestionValidator; class Question extends Service @@ -191,8 +189,6 @@ class Question extends Service $this->saveDynamicAttrs($question); - $this->rebuildQuestionIndex($question); - $owner = $this->findUser($question->owner_id); $this->recountUserQuestions($owner); @@ -212,8 +208,6 @@ class Question extends Service $this->saveDynamicAttrs($question); - $this->rebuildQuestionIndex($question); - $owner = $this->findUser($question->owner_id); $this->recountUserQuestions($owner); @@ -231,8 +225,6 @@ class Question extends Service $question->update(); - $this->rebuildQuestionIndex($question); - $owner = $this->findUser($question->owner_id); $this->recountUserQuestions($owner); @@ -268,7 +260,6 @@ class Question extends Service if ($type == 'approve') { - $this->rebuildQuestionIndex($question); $this->handleQuestionPostPoint($question); $this->handleQuestionApprovedNotice($question, $sender); @@ -379,20 +370,6 @@ class Question extends Service $user->update(); } - protected function rebuildQuestionCache(QuestionModel $question) - { - $cache = new QuestionCache(); - - $cache->rebuild($question->id); - } - - protected function rebuildQuestionIndex(QuestionModel $question) - { - $sync = new QuestionIndexSync(); - - $sync->addItem($question->id); - } - protected function handleQuestionPostPoint(QuestionModel $question) { if ($question->published != QuestionModel::PUBLISH_APPROVED) return; diff --git a/app/Services/Logic/PointGiftTrait.php b/app/Services/Logic/PointGiftTrait.php index 8750b552..c81a577e 100644 --- a/app/Services/Logic/PointGiftTrait.php +++ b/app/Services/Logic/PointGiftTrait.php @@ -19,7 +19,7 @@ trait PointGiftTrait return $validator->checkPointGift($id); } - public function checkFlashSaleCache($id) + public function checkPointGiftCache($id) { $validator = new PointGiftValidator(); diff --git a/app/Services/MyStorage.php b/app/Services/MyStorage.php index 34729ccc..2ddc1927 100644 --- a/app/Services/MyStorage.php +++ b/app/Services/MyStorage.php @@ -183,58 +183,6 @@ class MyStorage extends Storage return $this->upload('/resource/', self::MIME_FILE, UploadModel::TYPE_RESOURCE); } - /** - * @param string $url - * - * @return UploadModel|bool - */ - public function uploadRemoteImage($url) - { - $path = parse_url($url, PHP_URL_PATH); - $extension = pathinfo($path, PATHINFO_EXTENSION); - $originalName = pathinfo($path, PATHINFO_BASENAME); - - $fileName = $this->generateFileName($extension); - - $filePath = tmp_path($fileName); - - $contents = file_get_contents($url); - - if (file_put_contents($filePath, $contents) === false) { - return false; - } - - $keyName = "/img/content/{$fileName}"; - - $uploadPath = $this->putFile($keyName, $filePath); - - if (!$uploadPath) return false; - - $md5 = md5_file($filePath); - - $uploadRepo = new UploadRepo(); - - $upload = $uploadRepo->findByMd5($md5); - - if ($upload == false) { - - $upload = new UploadModel(); - - $upload->name = $originalName; - $upload->mime = mime_content_type($filePath); - $upload->size = filesize($filePath); - $upload->type = UploadModel::TYPE_CONTENT_IMG; - $upload->path = $uploadPath; - $upload->md5 = $md5; - - $upload->create(); - } - - unlink($filePath); - - return $upload; - } - /** * 上传文件 * @@ -256,7 +204,7 @@ class MyStorage extends Storage foreach ($files as $file) { - if ($this->checkFile($file->getRealType(), $mimeType) == false) { + if (!$this->checkFile($file->getRealType(), $mimeType)) { continue; } @@ -264,7 +212,7 @@ class MyStorage extends Storage $upload = $uploadRepo->findByMd5($md5); - if ($upload == false) { + if (!$upload) { $name = $this->filter->sanitize($file->getName(), ['trim', 'string']); From 301557abbcc076e4ef9eb5bc53dc03f4a4d47bdc Mon Sep 17 00:00:00 2001 From: koogua Date: Mon, 31 Oct 2022 18:25:57 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8F=90=E4=BA=A4=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Views/trade/refund.volt | 14 +++++++++----- public/static/admin/js/common.js | 14 ++++++++------ public/static/home/js/common.js | 14 ++++++++------ 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/app/Http/Admin/Views/trade/refund.volt b/app/Http/Admin/Views/trade/refund.volt index d5c54c7b..0af6fdae 100644 --- a/app/Http/Admin/Views/trade/refund.volt +++ b/app/Http/Admin/Views/trade/refund.volt @@ -71,11 +71,15 @@ -
- - - - +
+ +
+ + + + + +
diff --git a/public/static/admin/js/common.js b/public/static/admin/js/common.js index 08a7acc6..4f4f9451 100644 --- a/public/static/admin/js/common.js +++ b/public/static/admin/js/common.js @@ -49,14 +49,15 @@ layui.use(['jquery', 'form', 'element', 'layer', 'kgDropdown'], function () { form.on('submit(go)', function (data) { var submit = $(this); - submit.attr('disabled', 'disabled').addClass('layui-btn-disabled'); + var orgText = $(this).text(); + submit.text('提交中···').attr('disabled', 'disabled').addClass('layui-btn-disabled'); $.ajax({ type: 'POST', url: data.form.action, data: data.field, success: function (res) { if (res.msg) { - layer.msg(res.msg, {icon: 1}); + layer.msg(res.msg, {icon: 1, time: 1500}); } if (res.location) { var target = res.target || 'self'; @@ -66,13 +67,14 @@ layui.use(['jquery', 'form', 'element', 'layer', 'kgDropdown'], function () { } else { window.location.href = res.location; } - }, 1500); - } else { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1000); } + setTimeout(function () { + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1500); }, error: function () { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); } }); return false; diff --git a/public/static/home/js/common.js b/public/static/home/js/common.js index 67d84753..dff6dd3d 100644 --- a/public/static/home/js/common.js +++ b/public/static/home/js/common.js @@ -68,14 +68,15 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { form.on('submit(go)', function (data) { var submit = $(this); - submit.attr('disabled', 'disabled').addClass('layui-btn-disabled'); + var orgText = $(this).text(); + submit.text('提交中···').attr('disabled', 'disabled').addClass('layui-btn-disabled'); $.ajax({ type: 'POST', url: data.form.action, data: data.field, success: function (res) { if (res.msg) { - layer.msg(res.msg, {icon: 1}); + layer.msg(res.msg, {icon: 1, time: 1500}); } if (res.location) { var target = res.target || 'self'; @@ -85,13 +86,14 @@ layui.use(['jquery', 'form', 'element', 'layer', 'helper'], function () { } else { window.location.href = res.location; } - }, 1500); - } else { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1000); } + setTimeout(function () { + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); + }, 1500); }, error: function () { - submit.removeAttr('disabled').removeClass('layui-btn-disabled'); + submit.text(orgText).removeAttr('disabled').removeClass('layui-btn-disabled'); } }); return false; From a941d1129a00944ce0c895d61733ccc469e1e76b Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 2 Nov 2022 15:01:25 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=A2=9E=E5=8A=A0=E7=B2=98=E8=B4=B4=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=92=8C=E8=BF=9C=E7=A8=8B=E5=9B=BE=E7=89=87=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/EditorStorage.php | 159 +++++++++++++++++++++++++++++++++ app/Validators/Answer.php | 5 ++ app/Validators/Article.php | 5 ++ app/Validators/Course.php | 5 ++ app/Validators/Help.php | 5 ++ app/Validators/Page.php | 5 ++ app/Validators/PointGift.php | 5 ++ app/Validators/Question.php | 5 ++ 8 files changed, 194 insertions(+) create mode 100644 app/Services/EditorStorage.php diff --git a/app/Services/EditorStorage.php b/app/Services/EditorStorage.php new file mode 100644 index 00000000..10fb488d --- /dev/null +++ b/app/Services/EditorStorage.php @@ -0,0 +1,159 @@ +handleBase64Image($content); + $content = $this->handleRemoteImage($content); + + return trim($content); + } + + protected function handleBase64Image($content) + { + $content = preg_replace("/data-ke-src=\"(.*?)\"/", '', $content); + + preg_match_all('/src="(data:image\/(\S+);base64,(\S+))"/U', $content, $matches); + + if (count($matches[3]) > 0) { + foreach ($matches[3] as $key => $value) { + $imageUrl = $this->uploadBase64Image($matches[3][$key], $matches[2][$key]); + $content = str_replace($matches[1][$key], $imageUrl, $content); + } + } + + return $content; + } + + protected function handleRemoteImage($content) + { + $baseUrl = $this->getBaseUrl(); + + preg_match_all('/ 0) { + foreach ($matches[1] as $key => $value) { + if (!Text::startsWith($value, $baseUrl)) { + $imageUrl = $this->uploadRemoteImage($value); + $content = str_replace($value, $imageUrl, $content); + } + } + } + + return $content; + } + + protected function uploadBase64Image($encodeContent, $extension) + { + $keyName = $this->generateFileName($extension, '/img/content/'); + + $content = base64_decode($encodeContent); + + $md5 = md5($content); + + $uploadRepo = new UploadRepo(); + + $upload = $uploadRepo->findByMd5($md5); + + if (!$upload) { + + $uploadPath = $this->putString($keyName, $content); + + if ($uploadPath) { + + $upload = new UploadModel(); + + $upload->type = UploadModel::TYPE_CONTENT_IMG; + $upload->mime = FileInfo::getMimeTypeByExt($extension); + $upload->name = pathinfo($uploadPath, PATHINFO_BASENAME); + $upload->size = strlen($content); + $upload->path = $uploadPath; + $upload->md5 = $md5; + + $upload->create(); + } + + $imageUrl = $uploadPath ? $this->getImageUrl($uploadPath) : ''; + + } else { + + $imageUrl = $this->getImageUrl($upload->path); + } + + return $imageUrl; + } + + protected function uploadRemoteImage($remoteUrl) + { + $extension = $this->getImageExtension($remoteUrl); + + $content = file_get_contents($remoteUrl); + + if ($content === false) return $remoteUrl; + + $keyName = $this->generateFileName($extension, '/img/content/'); + + $md5 = md5($content); + + $uploadRepo = new UploadRepo(); + + $upload = $uploadRepo->findByMd5($md5); + + if (!$upload) { + + $uploadPath = $this->putString($keyName, $content); + + if ($uploadPath) { + + $upload = new UploadModel(); + + $upload->type = UploadModel::TYPE_CONTENT_IMG; + $upload->mime = FileInfo::getMimeTypeByExt($extension); + $upload->name = pathinfo($uploadPath, PATHINFO_BASENAME); + $upload->size = strlen($content); + $upload->path = $uploadPath; + $upload->md5 = $md5; + + $upload->create(); + } + + $imageUrl = $uploadPath ? $this->getImageUrl($uploadPath) : $remoteUrl; + + } else { + + $imageUrl = $this->getImageUrl($upload->path); + } + + return $imageUrl; + } + + /** + * 例如:https://abc.com/123.jpg!large,这类不规范地址,需要特殊处理 + * + * @param string $imageUrl + * @return string + */ + protected function getImageExtension($imageUrl) + { + $path = parse_url($imageUrl, PHP_URL_PATH); + + preg_match('/(\S+)\.(png|gif|jpg|jpeg)/i', $path, $matches); + + return $matches[2] ? strtolower($matches[2]) : 'jpg'; + } + +} \ No newline at end of file diff --git a/app/Validators/Answer.php b/app/Validators/Answer.php index 32a3fbe7..bb1099a4 100644 --- a/app/Validators/Answer.php +++ b/app/Validators/Answer.php @@ -15,6 +15,7 @@ use App\Models\Reason as ReasonModel; use App\Models\User as UserModel; use App\Repos\Answer as AnswerRepo; use App\Repos\Question as QuestionRepo; +use App\Services\EditorStorage as EditorStorageService; class Answer extends Validator { @@ -58,6 +59,10 @@ class Answer extends Validator { $value = $this->filter->sanitize($content, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length < 10) { diff --git a/app/Validators/Article.php b/app/Validators/Article.php index 9656b652..9987d097 100644 --- a/app/Validators/Article.php +++ b/app/Validators/Article.php @@ -14,6 +14,7 @@ use App\Library\Validators\Common as CommonValidator; use App\Models\Article as ArticleModel; use App\Models\Reason as ReasonModel; use App\Repos\Article as ArticleRepo; +use App\Services\EditorStorage as EditorStorageService; class Article extends Validator { @@ -94,6 +95,10 @@ class Article extends Validator { $value = $this->filter->sanitize($content, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length < 10) { diff --git a/app/Validators/Course.php b/app/Validators/Course.php index eda4d6ff..b562d98f 100644 --- a/app/Validators/Course.php +++ b/app/Validators/Course.php @@ -13,6 +13,7 @@ use App\Exceptions\BadRequest as BadRequestException; use App\Library\Validators\Common as CommonValidator; use App\Models\Course as CourseModel; use App\Repos\Course as CourseRepo; +use App\Services\EditorStorage as EditorStorageService; class Course extends Validator { @@ -119,6 +120,10 @@ class Course extends Validator { $value = $this->filter->sanitize($details, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length > 30000) { diff --git a/app/Validators/Help.php b/app/Validators/Help.php index 95d567ab..c5acab63 100644 --- a/app/Validators/Help.php +++ b/app/Validators/Help.php @@ -12,6 +12,7 @@ use App\Caches\MaxHelpId as MaxHelpIdCache; use App\Exceptions\BadRequest as BadRequestException; use App\Models\Help as HelpModel; use App\Repos\Help as HelpRepo; +use App\Services\EditorStorage as EditorStorageService; class Help extends Validator { @@ -90,6 +91,10 @@ class Help extends Validator { $value = $this->filter->sanitize($content, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length < 10) { diff --git a/app/Validators/Page.php b/app/Validators/Page.php index fa222509..2080d7a6 100644 --- a/app/Validators/Page.php +++ b/app/Validators/Page.php @@ -13,6 +13,7 @@ use App\Exceptions\BadRequest as BadRequestException; use App\Library\Validators\Common as CommonValidator; use App\Models\Page as PageModel; use App\Repos\Page as PageRepo; +use App\Services\EditorStorage as EditorStorageService; class Page extends Validator { @@ -124,6 +125,10 @@ class Page extends Validator { $value = $this->filter->sanitize($content, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length < 10) { diff --git a/app/Validators/PointGift.php b/app/Validators/PointGift.php index 5c1460ca..4f7e30b1 100644 --- a/app/Validators/PointGift.php +++ b/app/Validators/PointGift.php @@ -13,6 +13,7 @@ use App\Exceptions\BadRequest as BadRequestException; use App\Library\Validators\Common as CommonValidator; use App\Models\PointGift as PointGiftModel; use App\Repos\PointGift as PointGiftRepo; +use App\Services\EditorStorage as EditorStorageService; class PointGift extends Validator { @@ -86,6 +87,10 @@ class PointGift extends Validator { $value = $this->filter->sanitize($details, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length > 30000) { diff --git a/app/Validators/Question.php b/app/Validators/Question.php index 1481868c..84d1e98d 100644 --- a/app/Validators/Question.php +++ b/app/Validators/Question.php @@ -13,6 +13,7 @@ use App\Exceptions\BadRequest as BadRequestException; use App\Models\Question as QuestionModel; use App\Models\Reason as ReasonModel; use App\Repos\Question as QuestionRepo; +use App\Services\EditorStorage as EditorStorageService; class Question extends Validator { @@ -106,6 +107,10 @@ class Question extends Validator { $value = $this->filter->sanitize($content, ['trim']); + $storage = new EditorStorageService(); + + $value = $storage->handle($value); + $length = kg_strlen($value); if ($length > 30000) { From 46176071b8c20e860586fc8370df388bbf374c86 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sun, 6 Nov 2022 12:55:12 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E4=BD=9C=E8=80=85=EF=BC=8C=E7=AD=94=E4=B8=BB=E5=92=8C=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Home/Views/article/list.volt | 2 +- app/Http/Home/Views/question/list.volt | 4 ++-- app/Services/Logic/Article/TopAuthorList.php | 10 ++++++++-- app/Services/Logic/Question/HotQuestionList.php | 10 ++++++++-- app/Services/Logic/Question/TopAnswererList.php | 10 ++++++++-- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/app/Http/Home/Views/article/list.volt b/app/Http/Home/Views/article/list.volt index aced081e..11fe75e8 100644 --- a/app/Http/Home/Views/article/list.volt +++ b/app/Http/Home/Views/article/list.volt @@ -4,7 +4,7 @@ {% set sort_val = request.get('sort','trim','latest') %} {% set pager_url = url({'for':'home.article.pager'}, params) %} - {% set top_authors_url = url({'for':'home.widget.top_authors'}) %} + {% set top_authors_url = url({'for':'home.widget.top_authors'},{'limit':5}) %} {% set my_tags_url = url({'for':'home.widget.my_tags'},{'type':'article'}) %}