From 7e94b95c0525536ca7efa97b69e7832ea2f70c8d Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 7 Sep 2020 15:56:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Tasks/MaintainTask.php | 28 +++++++++++++++++-- app/Http/Admin/Controllers/VodController.php | 4 +-- app/Http/Admin/Views/course/edit_sale.volt | 3 +- app/Http/Admin/Views/setting/live.volt | 2 +- app/Http/Admin/Views/setting/live_pull.volt | 8 +++--- app/Http/Admin/Views/setting/live_push.volt | 8 +++--- app/Http/Admin/Views/setting/site.volt | 4 +-- app/Http/Admin/Views/setting/vod.volt | 16 +++++------ app/Http/Admin/Views/user/edit.volt | 20 +++++++------ app/Services/Vod.php | 2 +- config/cert/alipay/.gitignore | 2 ++ config/cert/wxpay/.gitignore | 2 ++ .../20200827112717_insert_setting_data.php | 4 +-- 13 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 config/cert/alipay/.gitignore create mode 100644 config/cert/wxpay/.gitignore diff --git a/app/Console/Tasks/MaintainTask.php b/app/Console/Tasks/MaintainTask.php index 97ac7e1e..f8b1d1e6 100644 --- a/app/Console/Tasks/MaintainTask.php +++ b/app/Console/Tasks/MaintainTask.php @@ -2,7 +2,9 @@ namespace App\Console\Tasks; +use App\Caches\Setting as SettingCache; use App\Library\Cache\Backend\Redis as RedisCache; +use App\Models\Setting as SettingModel; use Phalcon\Cli\Task; use Phalcon\Config; @@ -11,11 +13,31 @@ class MaintainTask extends Task public function mainAction() { + $this->resetSettingAction(); $this->resetAnnotationAction(); $this->resetMetadataAction(); $this->resetVoltAction(); } + /** + * 重置设置 + * + * @command: php console.php maintain reset_setting + */ + public function resetSettingAction() + { + echo "start reset setting..." . PHP_EOL; + + $rows = SettingModel::query()->columns('section')->distinct(true)->execute(); + + foreach ($rows as $row) { + $cache = new SettingCache(); + $cache->rebuild($row->section); + } + + echo "end reset setting..." . PHP_EOL; + } + /** * 重置注解 * @@ -38,7 +60,7 @@ class MaintainTask extends Task if (count($keys) > 0) { - $keys = $this->handleKeys($keys); + $keys = $this->handlePhKeys($keys); $redis->del(...$keys); $redis->del($statsKey); @@ -69,7 +91,7 @@ class MaintainTask extends Task if (count($keys) > 0) { - $keys = $this->handleKeys($keys); + $keys = $this->handlePhKeys($keys); $redis->del(...$keys); $redis->del($statsKey); @@ -118,7 +140,7 @@ class MaintainTask extends Task return $cache; } - protected function handleKeys($keys) + protected function handlePhKeys($keys) { return array_map(function ($key) { return "_PHCR{$key}"; diff --git a/app/Http/Admin/Controllers/VodController.php b/app/Http/Admin/Controllers/VodController.php index 91e9a187..72f4c35f 100644 --- a/app/Http/Admin/Controllers/VodController.php +++ b/app/Http/Admin/Controllers/VodController.php @@ -14,11 +14,11 @@ class VodController extends Controller /** * @Post("/upload/sign", name="admin.vod.upload_sign") */ - public function uploadSignAction() + public function uploadSignatureAction() { $service = new VodService(); - $sign = $service->getUploadSign(); + $sign = $service->getUploadSignature(); return $this->jsonSuccess(['sign' => $sign]); } diff --git a/app/Http/Admin/Views/course/edit_sale.volt b/app/Http/Admin/Views/course/edit_sale.volt index bffa86cf..071da233 100644 --- a/app/Http/Admin/Views/course/edit_sale.volt +++ b/app/Http/Admin/Views/course/edit_sale.volt @@ -1,4 +1,5 @@ {% set free = course.market_price == 0 %} +{% set price_display = course.market_price > 0 ? 'display:block' : 'display:none' %}
@@ -8,7 +9,7 @@
-
+
diff --git a/app/Http/Admin/Views/setting/live.volt b/app/Http/Admin/Views/setting/live.volt index 81ddc450..91808ff9 100644 --- a/app/Http/Admin/Views/setting/live.volt +++ b/app/Http/Admin/Views/setting/live.volt @@ -52,7 +52,7 @@ }); form.on('radio(pull_trans_enabled)', function (data) { - var block = $('#ptt-block'); + var block = $('#pull-trans-tpl-block'); if (data.value === '1') { block.show(); } else { diff --git a/app/Http/Admin/Views/setting/live_pull.volt b/app/Http/Admin/Views/setting/live_pull.volt index 4b73e7be..3dd4ec32 100644 --- a/app/Http/Admin/Views/setting/live_pull.volt +++ b/app/Http/Admin/Views/setting/live_pull.volt @@ -1,5 +1,5 @@ -{% set auth_display = pull.auth_enabled == 0 ? 'style="display:none;"' : '' %} -{% set ppt_display = pull.trans_enabled == 0 ? 'style="display:none;"' : '' %} +{% set pull_auth_display = pull.auth_enabled == 1 ? 'display:block' : 'display:none' %} +{% set pull_trans_tpl_display = pull.trans_enabled == 1 ? 'display:block' : 'display:none' %}
@@ -28,7 +28,7 @@
-
+
@@ -52,7 +52,7 @@
-
+
diff --git a/app/Http/Admin/Views/setting/live_push.volt b/app/Http/Admin/Views/setting/live_push.volt index 1727f086..3c1955c3 100644 --- a/app/Http/Admin/Views/setting/live_push.volt +++ b/app/Http/Admin/Views/setting/live_push.volt @@ -1,4 +1,4 @@ -{% set auth_display = push.auth_enabled == 0 ? 'style="display:none;"' : '' %} +{% set push_auth_display = push.auth_enabled == 1 ? 'display:block' : 'display:none' %}
@@ -16,11 +16,11 @@
- - + +
-
+
diff --git a/app/Http/Admin/Views/setting/site.volt b/app/Http/Admin/Views/setting/site.volt index bed80a89..a8e1ffb1 100644 --- a/app/Http/Admin/Views/setting/site.volt +++ b/app/Http/Admin/Views/setting/site.volt @@ -2,7 +2,7 @@ {% block content %} - {% set closed_tips_display = site.enabled == 1 ? 'style="display:none;"' : '' %} + {% set closed_tips_display = site.enabled == 0 ? 'display:block' : 'display:none' %}
@@ -15,7 +15,7 @@
-
+
diff --git a/app/Http/Admin/Views/setting/vod.volt b/app/Http/Admin/Views/setting/vod.volt index e900d326..c173a3ae 100644 --- a/app/Http/Admin/Views/setting/vod.volt +++ b/app/Http/Admin/Views/setting/vod.volt @@ -2,9 +2,9 @@ {% block content %} - {% set storage_region_display = vod.storage_type == 'nearby' ? 'style="display:none;"' : '' %} - {% set watermark_tpl_display = vod.watermark_enabled == 0 ? 'style="display:none;"' : '' %} - {% set key_anti_display = vod.key_anti_enabled == 0 ? 'style="display:none;"' : '' %} + {% set storage_region_display = vod.storage_type == 'fixed' ? 'display:block' : 'display:none' %} + {% set watermark_template_display = vod.watermark_enabled == 1 ? 'display:block' : 'display:none' %} + {% set key_anti_display = vod.key_anti_enabled == 1 ? 'display:block': 'display:none' %}
@@ -17,7 +17,7 @@
-
+
@@ -49,7 +49,7 @@
-
+
@@ -63,14 +63,14 @@
- - + +
- +
diff --git a/app/Http/Admin/Views/user/edit.volt b/app/Http/Admin/Views/user/edit.volt index 54f28c32..f10cb96c 100644 --- a/app/Http/Admin/Views/user/edit.volt +++ b/app/Http/Admin/Views/user/edit.volt @@ -2,6 +2,8 @@ {% block content %} + {% set lock_expiry_display = user.locked == 1 ? 'display:block': 'display:none' %} +
编辑用户 @@ -51,14 +53,16 @@
-
- -
- {% if user.lock_expiry_time > 0 %} - - {% else %} - - {% endif %} +
+
+ +
+ {% if user.lock_expiry_time > 0 %} + + {% else %} + + {% endif %} +
diff --git a/app/Services/Vod.php b/app/Services/Vod.php index dd656326..a9c456e7 100644 --- a/app/Services/Vod.php +++ b/app/Services/Vod.php @@ -84,7 +84,7 @@ class Vod extends Service * * @return string */ - public function getUploadSign() + public function getUploadSignature() { $secret = $this->getSectionSettings('secret'); diff --git a/config/cert/alipay/.gitignore b/config/cert/alipay/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/config/cert/alipay/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/config/cert/wxpay/.gitignore b/config/cert/wxpay/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/config/cert/wxpay/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/db/migrations/20200827112717_insert_setting_data.php b/db/migrations/20200827112717_insert_setting_data.php index 485c54e9..a0841441 100644 --- a/db/migrations/20200827112717_insert_setting_data.php +++ b/db/migrations/20200827112717_insert_setting_data.php @@ -402,12 +402,12 @@ final class InsertSettingData extends AbstractMigration ], [ 'section' => 'vod', - 'item_key' => 'dist_protocol', + 'item_key' => 'protocol', 'item_value' => 'https', ], [ 'section' => 'vod', - 'item_key' => 'dist_domain', + 'item_key' => 'domain', 'item_value' => '', ], [ From 295b27c567b81f091da5695868aff77636550952 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 7 Sep 2020 21:06:43 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Builders/ConsultList.php | 2 +- app/Builders/CourseFavoriteList.php | 4 +- app/Builders/CourseList.php | 2 +- app/Builders/CourseTopicList.php | 2 +- app/Builders/CourseUserList.php | 4 +- app/Builders/DanmuList.php | 2 +- app/Builders/ImFriendUserList.php | 2 +- app/Builders/ImGroupList.php | 2 +- app/Builders/ImGroupUserList.php | 4 +- app/Builders/ImMessageList.php | 2 +- app/Builders/OrderList.php | 2 +- app/Builders/ReviewList.php | 2 +- app/Builders/UserList.php | 2 +- app/Http/Admin/Services/Nav.php | 2 +- app/Http/Desktop/Services/Im.php | 6 +- app/Http/Desktop/Services/ImGroup.php | 2 +- app/Library/Helper.php | 12 ++-- app/Models/Carousel.php | 2 +- app/Models/Course.php | 2 +- app/Models/ImGroup.php | 2 +- app/Models/ImUser.php | 2 +- app/Models/User.php | 2 +- app/Providers/Volt.php | 4 +- app/Services/Frontend/Course/CourseList.php | 2 +- app/Services/Frontend/My/GroupList.php | 2 +- app/Services/Frontend/My/ProfileInfo.php | 2 +- app/Services/Frontend/Order/OrderInfo.php | 4 +- app/Services/Frontend/Search/Course.php | 5 ++ .../Frontend/Search/CourseHotQuery.php | 18 ----- app/Services/Frontend/Search/CourseList.php | 68 ------------------- .../Frontend/Search/CourseRelatedQuery.php | 18 ----- app/Services/Frontend/Search/Group.php | 5 ++ app/Services/Frontend/Search/User.php | 5 ++ app/Services/Frontend/Teacher/TeacherList.php | 2 +- app/Services/Frontend/Teaching/CourseList.php | 2 +- app/Services/Frontend/Vip/CourseList.php | 2 +- app/Services/Frontend/Vip/UserList.php | 2 +- app/Services/Refund.php | 4 +- app/Services/Search/CourseDocument.php | 2 + app/Services/Search/GroupDocument.php | 2 + app/Services/Search/UserDocument.php | 2 + .../20200827112717_insert_setting_data.php | 2 +- 42 files changed, 67 insertions(+), 150 deletions(-) delete mode 100644 app/Services/Frontend/Search/CourseHotQuery.php delete mode 100644 app/Services/Frontend/Search/CourseList.php delete mode 100644 app/Services/Frontend/Search/CourseRelatedQuery.php diff --git a/app/Builders/ConsultList.php b/app/Builders/ConsultList.php index 2223f559..44aa3f7e 100644 --- a/app/Builders/ConsultList.php +++ b/app/Builders/ConsultList.php @@ -73,7 +73,7 @@ class ConsultList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/CourseFavoriteList.php b/app/Builders/CourseFavoriteList.php index a516a3a4..2714c9af 100644 --- a/app/Builders/CourseFavoriteList.php +++ b/app/Builders/CourseFavoriteList.php @@ -45,7 +45,7 @@ class CourseFavoriteList extends Builder $courses = $courseRepo->findByIds($ids, $columns); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; @@ -69,7 +69,7 @@ class CourseFavoriteList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/CourseList.php b/app/Builders/CourseList.php index 667de997..74f4430b 100644 --- a/app/Builders/CourseList.php +++ b/app/Builders/CourseList.php @@ -61,7 +61,7 @@ class CourseList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/CourseTopicList.php b/app/Builders/CourseTopicList.php index 0d7ebd46..e90e367f 100644 --- a/app/Builders/CourseTopicList.php +++ b/app/Builders/CourseTopicList.php @@ -45,7 +45,7 @@ class CourseTopicList extends Builder $courses = $courseRepo->findByIds($ids, $columns); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/CourseUserList.php b/app/Builders/CourseUserList.php index b1579725..1b735e69 100644 --- a/app/Builders/CourseUserList.php +++ b/app/Builders/CourseUserList.php @@ -45,7 +45,7 @@ class CourseUserList extends Builder $courses = $courseRepo->findByIds($ids, $columns); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; @@ -66,7 +66,7 @@ class CourseUserList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/DanmuList.php b/app/Builders/DanmuList.php index 59fa36cb..49706caa 100644 --- a/app/Builders/DanmuList.php +++ b/app/Builders/DanmuList.php @@ -84,7 +84,7 @@ class DanmuList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/ImFriendUserList.php b/app/Builders/ImFriendUserList.php index 50d69ce7..c5ed65dd 100644 --- a/app/Builders/ImFriendUserList.php +++ b/app/Builders/ImFriendUserList.php @@ -31,7 +31,7 @@ class ImFriendUserList extends Builder $users = $userRepo->findByIds($ids, $columns); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/ImGroupList.php b/app/Builders/ImGroupList.php index 39316477..a21b9648 100644 --- a/app/Builders/ImGroupList.php +++ b/app/Builders/ImGroupList.php @@ -55,7 +55,7 @@ class ImGroupList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/ImGroupUserList.php b/app/Builders/ImGroupUserList.php index dafe443f..917eecd6 100644 --- a/app/Builders/ImGroupUserList.php +++ b/app/Builders/ImGroupUserList.php @@ -40,7 +40,7 @@ class ImGroupUserList extends Builder $users = $userRepo->findByIds($ids, $columns); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; @@ -64,7 +64,7 @@ class ImGroupUserList extends Builder $users = $this->getGroupOwners($groups->toArray()); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/ImMessageList.php b/app/Builders/ImMessageList.php index 0c394cc6..3b7b921f 100644 --- a/app/Builders/ImMessageList.php +++ b/app/Builders/ImMessageList.php @@ -26,7 +26,7 @@ class ImMessageList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/OrderList.php b/app/Builders/OrderList.php index 5a5a2ff6..2efcc4ba 100644 --- a/app/Builders/OrderList.php +++ b/app/Builders/OrderList.php @@ -12,7 +12,7 @@ class OrderList extends Builder public function __construct() { - $this->imgBaseUrl = kg_ss_url(); + $this->imgBaseUrl = kg_cos_url(); } /** diff --git a/app/Builders/ReviewList.php b/app/Builders/ReviewList.php index e16f430b..aa4aa766 100644 --- a/app/Builders/ReviewList.php +++ b/app/Builders/ReviewList.php @@ -55,7 +55,7 @@ class ReviewList extends Builder $users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; diff --git a/app/Builders/UserList.php b/app/Builders/UserList.php index 4731773e..42abfa97 100644 --- a/app/Builders/UserList.php +++ b/app/Builders/UserList.php @@ -10,7 +10,7 @@ class UserList extends Builder public function handleUsers(array $users) { - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); foreach ($users as $key => $user) { $users[$key]['avatar'] = $baseUrl . $user['avatar']; diff --git a/app/Http/Admin/Services/Nav.php b/app/Http/Admin/Services/Nav.php index a04d81e9..78c6e215 100644 --- a/app/Http/Admin/Services/Nav.php +++ b/app/Http/Admin/Services/Nav.php @@ -45,7 +45,7 @@ class Nav extends Service return $navRepo->findAll([ 'parent_id' => $parentId, - 'published' => 1, + 'deleted' => 0, ]); } diff --git a/app/Http/Desktop/Services/Im.php b/app/Http/Desktop/Services/Im.php index 251e0e2e..3e848b1d 100644 --- a/app/Http/Desktop/Services/Im.php +++ b/app/Http/Desktop/Services/Im.php @@ -59,7 +59,7 @@ class Im extends Service return []; } - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $result = []; @@ -252,7 +252,7 @@ class Im extends Service $users = $userRepo->findByIds($ids); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $mapping = []; @@ -303,7 +303,7 @@ class Im extends Service $groups = $groupRepo->findByIds($ids); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $mapping = []; diff --git a/app/Http/Desktop/Services/ImGroup.php b/app/Http/Desktop/Services/ImGroup.php index ac3d9c4c..c6dd1472 100644 --- a/app/Http/Desktop/Services/ImGroup.php +++ b/app/Http/Desktop/Services/ImGroup.php @@ -188,7 +188,7 @@ class ImGroup extends Service $users = $builder->getUsers($groups); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $items = []; diff --git a/app/Library/Helper.php b/app/Library/Helper.php index 5dd4b3b1..09b28cd5 100644 --- a/app/Library/Helper.php +++ b/app/Library/Helper.php @@ -172,7 +172,7 @@ function kg_default_cover_path() * * @return string */ -function kg_ss_url() +function kg_cos_url() { $storage = new StorageService(); @@ -186,7 +186,7 @@ function kg_ss_url() * @param string $style * @return string */ -function kg_ss_img_url($path, $style = null) +function kg_cos_img_url($path, $style = null) { if (!$path) return ''; @@ -206,11 +206,11 @@ function kg_ss_img_url($path, $style = null) * @param string $style * @return string */ -function kg_ss_avatar_url($path, $style = null) +function kg_cos_avatar_url($path, $style = null) { $path = $path ?: kg_default_avatar_path(); - return kg_ss_img_url($path, $style); + return kg_cos_img_url($path, $style); } /** @@ -220,11 +220,11 @@ function kg_ss_avatar_url($path, $style = null) * @param string $style * @return string */ -function kg_ss_cover_url($path, $style = null) +function kg_cos_cover_url($path, $style = null) { $path = $path ?: kg_default_cover_path(); - return kg_ss_img_url($path, $style); + return kg_cos_img_url($path, $style); } /** diff --git a/app/Models/Carousel.php b/app/Models/Carousel.php index 91195f96..4c7d29e2 100644 --- a/app/Models/Carousel.php +++ b/app/Models/Carousel.php @@ -158,7 +158,7 @@ class Carousel extends Model public function afterFetch() { if (!Text::startsWith($this->cover, 'http')) { - $this->cover = kg_ss_cover_url($this->cover); + $this->cover = kg_cos_cover_url($this->cover); } if (is_string($this->style) && !empty($this->style)) { diff --git a/app/Models/Course.php b/app/Models/Course.php index 360fd328..6da3c946 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -338,7 +338,7 @@ class Course extends Model $this->score = (float)$this->score; if (!Text::startsWith($this->cover, 'http')) { - $this->cover = kg_ss_cover_url($this->cover); + $this->cover = kg_cos_cover_url($this->cover); } if (is_string($this->attrs) && !empty($this->attrs)) { diff --git a/app/Models/ImGroup.php b/app/Models/ImGroup.php index 946df252..f93672cd 100644 --- a/app/Models/ImGroup.php +++ b/app/Models/ImGroup.php @@ -156,7 +156,7 @@ class ImGroup extends Model public function afterFetch() { if (!Text::startsWith($this->avatar, 'http')) { - $this->avatar = kg_ss_avatar_url($this->avatar); + $this->avatar = kg_cos_avatar_url($this->avatar); } } diff --git a/app/Models/ImUser.php b/app/Models/ImUser.php index 9b4ed69f..b70cfde7 100644 --- a/app/Models/ImUser.php +++ b/app/Models/ImUser.php @@ -133,7 +133,7 @@ class ImUser extends Model public function afterFetch() { if (!Text::startsWith($this->avatar, 'http')) { - $this->avatar = kg_ss_avatar_url($this->avatar); + $this->avatar = kg_cos_avatar_url($this->avatar); } } diff --git a/app/Models/User.php b/app/Models/User.php index 4553cf2c..62e9a3aa 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -221,7 +221,7 @@ class User extends Model public function afterFetch() { if (!Text::startsWith($this->avatar, 'http')) { - $this->avatar = kg_ss_avatar_url($this->avatar); + $this->avatar = kg_cos_avatar_url($this->avatar); } } diff --git a/app/Providers/Volt.php b/app/Providers/Volt.php index 835c7af8..dd121c68 100644 --- a/app/Providers/Volt.php +++ b/app/Providers/Volt.php @@ -46,8 +46,8 @@ class Volt extends Provider return 'kg_js_include(' . $resolvedArgs . ')'; }); - $compiler->addFunction('ss_img_url', function ($resolvedArgs) { - return 'kg_ss_img_url(' . $resolvedArgs . ')'; + $compiler->addFunction('cos_img_url', function ($resolvedArgs) { + return 'kg_cos_img_url(' . $resolvedArgs . ')'; }); $compiler->addFunction('substr', function ($resolvedArgs) { diff --git a/app/Services/Frontend/Course/CourseList.php b/app/Services/Frontend/Course/CourseList.php index 35e3b60a..11492e1e 100644 --- a/app/Services/Frontend/Course/CourseList.php +++ b/app/Services/Frontend/Course/CourseList.php @@ -57,7 +57,7 @@ class CourseList extends FrontendService $items = []; - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); foreach ($courses as $course) { diff --git a/app/Services/Frontend/My/GroupList.php b/app/Services/Frontend/My/GroupList.php index e399cad2..effae3b1 100644 --- a/app/Services/Frontend/My/GroupList.php +++ b/app/Services/Frontend/My/GroupList.php @@ -62,7 +62,7 @@ class GroupList extends FrontendService $users = $builder->getUsers($groups); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $items = []; diff --git a/app/Services/Frontend/My/ProfileInfo.php b/app/Services/Frontend/My/ProfileInfo.php index 7bf92074..9de15216 100644 --- a/app/Services/Frontend/My/ProfileInfo.php +++ b/app/Services/Frontend/My/ProfileInfo.php @@ -17,7 +17,7 @@ class ProfileInfo extends FrontendService protected function handleUser(UserModel $user) { - $user->avatar = kg_ss_avatar_url($user->avatar); + $user->avatar = kg_cos_avatar_url($user->avatar); $user->area = $this->handleArea($user->area); diff --git a/app/Services/Frontend/Order/OrderInfo.php b/app/Services/Frontend/Order/OrderInfo.php index cad86657..89361b33 100644 --- a/app/Services/Frontend/Order/OrderInfo.php +++ b/app/Services/Frontend/Order/OrderInfo.php @@ -91,14 +91,14 @@ class OrderInfo extends FrontendService protected function handleCourseInfo($itemInfo) { - $itemInfo['course']['cover'] = kg_ss_cover_url($itemInfo['course']['cover']); + $itemInfo['course']['cover'] = kg_cos_cover_url($itemInfo['course']['cover']); return $itemInfo; } protected function handlePackageInfo($itemInfo) { - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); foreach ($itemInfo['courses'] as &$course) { $course['cover'] = $baseUrl . $course['cover']; diff --git a/app/Services/Frontend/Search/Course.php b/app/Services/Frontend/Search/Course.php index 4784b38c..3bba34c1 100644 --- a/app/Services/Frontend/Search/Course.php +++ b/app/Services/Frontend/Search/Course.php @@ -55,7 +55,12 @@ class Course extends FrontendService $items = []; + $baseUrl = kg_cos_url(); + foreach ($pager->items as $item) { + + $item['cover'] = $baseUrl . $item['cover']; + $items[] = [ 'id' => (int)$item['id'], 'title' => $item['title'], diff --git a/app/Services/Frontend/Search/CourseHotQuery.php b/app/Services/Frontend/Search/CourseHotQuery.php deleted file mode 100644 index c01481b9..00000000 --- a/app/Services/Frontend/Search/CourseHotQuery.php +++ /dev/null @@ -1,18 +0,0 @@ -getHotQuery($limit, $type); - } - -} diff --git a/app/Services/Frontend/Search/CourseList.php b/app/Services/Frontend/Search/CourseList.php deleted file mode 100644 index cdfe4cd9..00000000 --- a/app/Services/Frontend/Search/CourseList.php +++ /dev/null @@ -1,68 +0,0 @@ -getParams(); - $page = $pagerQuery->getPage(); - $limit = $pagerQuery->getLimit(); - - $courseSearcher = new CourseSearcherService(); - - $paginator = new XunSearchPaginator([ - 'xs' => $courseSearcher->getXS(), - 'highlight' => $courseSearcher->getHighlightFields(), - 'query' => $params['query'], - 'page' => $page, - 'limit' => $limit, - ]); - - $pager = $paginator->getPaginate(); - - return $this->handleCourses($pager); - } - - public function handleCourses($pager) - { - if ($pager->total_items == 0) { - return $pager; - } - - $items = []; - - foreach ($pager->items as $course) { - $items[] = [ - 'id' => (int)$course['id'], - 'title' => $course['title'], - 'cover' => $course['cover'], - 'summary' => $course['summary'], - 'market_price' => (float)$course['market_price'], - 'vip_price' => (float)$course['vip_price'], - 'model' => $course['model'], - 'level' => $course['level'], - 'user_count' => (int)$course['user_count'], - 'lesson_count' => (int)$course['lesson_count'], - 'review_count' => (int)$course['review_count'], - 'favorite_count' => (int)$course['favorite_count'], - 'teacher' => json_decode($course['teacher']), - 'category' => json_decode($course['category']), - ]; - } - - $pager->items = $items; - - return $pager; - } - -} diff --git a/app/Services/Frontend/Search/CourseRelatedQuery.php b/app/Services/Frontend/Search/CourseRelatedQuery.php deleted file mode 100644 index 65d5306b..00000000 --- a/app/Services/Frontend/Search/CourseRelatedQuery.php +++ /dev/null @@ -1,18 +0,0 @@ -getRelatedQuery($query, $limit); - } - -} diff --git a/app/Services/Frontend/Search/Group.php b/app/Services/Frontend/Search/Group.php index f8e00272..85ca0d7f 100644 --- a/app/Services/Frontend/Search/Group.php +++ b/app/Services/Frontend/Search/Group.php @@ -55,7 +55,12 @@ class Group extends FrontendService $items = []; + $baseUrl = kg_cos_url(); + foreach ($pager->items as $item) { + + $item['avatar'] = $baseUrl . $item['avatar']; + $items[] = [ 'id' => (int)$item['id'], 'type' => $item['type'], diff --git a/app/Services/Frontend/Search/User.php b/app/Services/Frontend/Search/User.php index 1bc4b312..73bd85b4 100644 --- a/app/Services/Frontend/Search/User.php +++ b/app/Services/Frontend/Search/User.php @@ -55,7 +55,12 @@ class User extends FrontendService $items = []; + $baseUrl = kg_cos_url(); + foreach ($pager->items as $item) { + + $item['avatar'] = $baseUrl . $item['avatar']; + $items[] = [ 'id' => (int)$item['id'], 'name' => $item['name'], diff --git a/app/Services/Frontend/Teacher/TeacherList.php b/app/Services/Frontend/Teacher/TeacherList.php index 79db1330..b081c486 100644 --- a/app/Services/Frontend/Teacher/TeacherList.php +++ b/app/Services/Frontend/Teacher/TeacherList.php @@ -40,7 +40,7 @@ class TeacherList extends FrontendService $items = []; - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); foreach ($users as $user) { diff --git a/app/Services/Frontend/Teaching/CourseList.php b/app/Services/Frontend/Teaching/CourseList.php index ae2be19c..140a1db4 100644 --- a/app/Services/Frontend/Teaching/CourseList.php +++ b/app/Services/Frontend/Teaching/CourseList.php @@ -33,7 +33,7 @@ class CourseList extends FrontendService $items = []; - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); foreach ($pager->items->toArray() as $course) { diff --git a/app/Services/Frontend/Vip/CourseList.php b/app/Services/Frontend/Vip/CourseList.php index 97258237..de4140f4 100644 --- a/app/Services/Frontend/Vip/CourseList.php +++ b/app/Services/Frontend/Vip/CourseList.php @@ -37,7 +37,7 @@ class CourseList extends FrontendService $courses = $pager->items->toArray(); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $items = []; diff --git a/app/Services/Frontend/Vip/UserList.php b/app/Services/Frontend/Vip/UserList.php index 145c9590..28fc7ecd 100644 --- a/app/Services/Frontend/Vip/UserList.php +++ b/app/Services/Frontend/Vip/UserList.php @@ -37,7 +37,7 @@ class UserList extends FrontendService $users = $pager->items->toArray(); - $baseUrl = kg_ss_url(); + $baseUrl = kg_cos_url(); $items = []; diff --git a/app/Services/Refund.php b/app/Services/Refund.php index 8e544a15..124450ea 100644 --- a/app/Services/Refund.php +++ b/app/Services/Refund.php @@ -32,7 +32,7 @@ class Refund extends Service */ $itemInfo = $order->item_info; - $itemInfo['course']['cover'] = kg_ss_cover_url($itemInfo['course']['cover']); + $itemInfo['course']['cover'] = kg_cos_cover_url($itemInfo['course']['cover']); $refundPercent = 0.00; $refundAmount = 0.00; @@ -72,7 +72,7 @@ class Refund extends Service */ foreach ($itemInfo['courses'] as &$course) { - $course['cover'] = kg_ss_cover_url($course['cover']); + $course['cover'] = kg_cos_cover_url($course['cover']); $refundPercent = 0.00; $refundAmount = 0.00; diff --git a/app/Services/Search/CourseDocument.php b/app/Services/Search/CourseDocument.php index 81668eea..b4b24cd4 100644 --- a/app/Services/Search/CourseDocument.php +++ b/app/Services/Search/CourseDocument.php @@ -63,6 +63,8 @@ class CourseDocument extends Component ]); } + $course->cover = CourseModel::getCoverPath($course->cover); + return [ 'id' => $course->id, 'title' => $course->title, diff --git a/app/Services/Search/GroupDocument.php b/app/Services/Search/GroupDocument.php index 0135836e..f3367d1a 100644 --- a/app/Services/Search/GroupDocument.php +++ b/app/Services/Search/GroupDocument.php @@ -46,6 +46,8 @@ class GroupDocument extends Component ]); } + $group->avatar = GroupModel::getAvatarPath($group->avatar); + return [ 'id' => $group->id, 'type' => $group->type, diff --git a/app/Services/Search/UserDocument.php b/app/Services/Search/UserDocument.php index 795b7fca..f92cc89b 100644 --- a/app/Services/Search/UserDocument.php +++ b/app/Services/Search/UserDocument.php @@ -33,6 +33,8 @@ class UserDocument extends Component */ public function formatDocument(UserModel $user) { + $user->avatar = UserModel::getAvatarPath($user->avatar); + return [ 'id' => $user->id, 'name' => $user->name, diff --git a/db/migrations/20200827112717_insert_setting_data.php b/db/migrations/20200827112717_insert_setting_data.php index a0841441..949f0af7 100644 --- a/db/migrations/20200827112717_insert_setting_data.php +++ b/db/migrations/20200827112717_insert_setting_data.php @@ -343,7 +343,7 @@ final class InsertSettingData extends AbstractMigration [ 'section' => 'smser', 'item_key' => 'signature', - 'item_value' => 'abc', + 'item_value' => '酷瓜云课堂', ], [ 'section' => 'smser', From d21c0d72e5f406abb1db5f13eca9014f5485398b Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Tue, 8 Sep 2020 10:55:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=95=B4=E7=90=86=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/Category.php | 2 +- app/Http/Admin/Services/Nav.php | 2 +- app/Http/Admin/Services/Setting.php | 15 +-------------- app/Http/Admin/Views/category/list.volt | 9 ++++----- app/Http/Admin/Views/nav/list.volt | 4 ++-- app/Http/Admin/Views/setting/smser.volt | 16 ++++++++-------- .../20200827112717_insert_setting_data.php | 2 +- 7 files changed, 18 insertions(+), 32 deletions(-) diff --git a/app/Http/Admin/Services/Category.php b/app/Http/Admin/Services/Category.php index 7819da30..af6087ca 100644 --- a/app/Http/Admin/Services/Category.php +++ b/app/Http/Admin/Services/Category.php @@ -43,7 +43,7 @@ class Category extends Service public function getChildCategories($parentId) { - $deleted = $this->request->getQuery('deleted', ['int'], 0); + $deleted = $this->request->getQuery('deleted', 'int', 0); $categoryRepo = new CategoryRepo(); diff --git a/app/Http/Admin/Services/Nav.php b/app/Http/Admin/Services/Nav.php index 78c6e215..fceb868d 100644 --- a/app/Http/Admin/Services/Nav.php +++ b/app/Http/Admin/Services/Nav.php @@ -35,7 +35,7 @@ class Nav extends Service return $navRepo->findAll([ 'position' => NavModel::POS_TOP, 'parent_id' => 0, - 'published' => 1, + 'deleted' => 0, ]); } diff --git a/app/Http/Admin/Services/Setting.php b/app/Http/Admin/Services/Setting.php index a3f4104b..e6a18d10 100644 --- a/app/Http/Admin/Services/Setting.php +++ b/app/Http/Admin/Services/Setting.php @@ -114,20 +114,7 @@ class Setting extends Service public function updateSmserSettings($section, $settings) { - $template = $settings['template']; - - $keys = array_keys($template['id']); - - $myTemplate = []; - - foreach ($keys as $key) { - $myTemplate[$key] = [ - 'id' => $template['id'][$key], - 'content' => $template['content'][$key], - ]; - } - - $settings['template'] = kg_json_encode($myTemplate); + $settings['template'] = kg_json_encode($settings['template']); $this->updateSectionSettings($section, $settings); } diff --git a/app/Http/Admin/Views/category/list.volt b/app/Http/Admin/Views/category/list.volt index 76ca10d9..840af593 100644 --- a/app/Http/Admin/Views/category/list.volt +++ b/app/Http/Admin/Views/category/list.volt @@ -2,9 +2,9 @@ {% block content %} - {% set back_url = url({'for':'admin.category.list'}) %} + {% set back_url = url({'for':'admin.category.list'},{'type':type}) %} {% set add_url = url({'for':'admin.category.add'},{'type':type,'parent_id':parent.id}) %} - {% set allow_add = (type == 'course' and parent.level < 2) or (type == 'help' and parent.level < 1) %} + {% set allow_add = (type == 1 and parent.level < 2) or (type == 2 and parent.level < 1) %}
@@ -46,7 +46,6 @@
{% for item in categories %} - {% set show_child_url = item.type == 'course' and item.level < 2 %} {% set child_url = url({'for':'admin.category.list'},{'type':item.type,'parent_id':item.id}) %} {% set edit_url = url({'for':'admin.category.edit','id':item.id}) %} {% set update_url = url({'for':'admin.category.update','id':item.id}) %} @@ -54,10 +53,10 @@ {% set restore_url = url({'for':'admin.category.restore','id':item.id}) %} - {% if show_child_url %} + {% if item.type == 1 and item.level < 2 %} {% else %} - + {% endif %} diff --git a/app/Http/Admin/Views/nav/list.volt b/app/Http/Admin/Views/nav/list.volt index c20efa6c..2e6a65ab 100644 --- a/app/Http/Admin/Views/nav/list.volt +++ b/app/Http/Admin/Views/nav/list.volt @@ -72,10 +72,10 @@ {% set restore_url = url({'for':'admin.nav.restore','id':item.id}) %} - {% if item.position == 'top' and item.level < 2 %} + {% if item.position == 1 and item.level < 2 %} {% else %} - + {% endif %} diff --git a/app/Http/Admin/Views/setting/smser.volt b/app/Http/Admin/Views/setting/smser.volt index ce9f9e41..a9ba080c 100644 --- a/app/Http/Admin/Views/setting/smser.volt +++ b/app/Http/Admin/Views/setting/smser.volt @@ -47,26 +47,26 @@ - - + + - - + + - - + + - - + + diff --git a/db/migrations/20200827112717_insert_setting_data.php b/db/migrations/20200827112717_insert_setting_data.php index 949f0af7..f20635f1 100644 --- a/db/migrations/20200827112717_insert_setting_data.php +++ b/db/migrations/20200827112717_insert_setting_data.php @@ -348,7 +348,7 @@ final class InsertSettingData extends AbstractMigration [ 'section' => 'smser', 'item_key' => 'template', - 'item_value' => '{"verify":{"id":"561282","content":"验证码:{1},{2} 分钟内有效,如非本人操作请忽略。"},"order":{"id":"561954","content":"下单成功,商品名称:{1},订单序号:{2},订单金额:¥{3}"},"refund":{"id":"561286","content":"退款成功,商品名称:{1},订单序号:{2},退款金额:¥{3}"},"live":{"id":"561288","content":"直播预告,课程名称:{1},章节名称:{2},开播时间:{3}"}}', + 'item_value' => '{"verify":"561282","order":"561954","refund":"561286","live":"561288"}', ], [ 'section' => 'cos',
{{ item.id }}{{ item.name }}{{ item.name }}{{ item.name }}{{ item.level }} {{ item.child_count }}
{{ item.id }}{{ item.name }}{{ item.name }}{{ item.name }}{{ item.level }} {{ item.child_count }}
身份验证 复制
订单通知 复制
退款通知 复制
直播通知 复制