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',