mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-18 18:16:55 +08:00
Compare commits
No commits in common. "master" and "v1.7.0" have entirely different histories.
103
CHANGELOG.md
103
CHANGELOG.md
@ -1,106 +1,3 @@
|
|||||||
### [v1.7.8](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.8)(2025-06-20)
|
|
||||||
|
|
||||||
- 移除ThrottleLimit
|
|
||||||
- 增加CloseLiveTask
|
|
||||||
- 增加搜索页图片alt属性striptags过滤
|
|
||||||
- 后台增加返回顶部快捷方式
|
|
||||||
- 前台fixbar增加联系电话
|
|
||||||
- 优化安装脚本
|
|
||||||
- 优化课时列表直播提示
|
|
||||||
- 优化后台返回链接
|
|
||||||
- 优化统计分析代码位置
|
|
||||||
- 直播回调后更新课时缓存
|
|
||||||
- 后台清空头像->上传头像
|
|
||||||
- sitemap.xml直接写入网站根目录
|
|
||||||
|
|
||||||
### [v1.7.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.7)(2025-04-20)
|
|
||||||
|
|
||||||
- 优化索引管理工具
|
|
||||||
- 优化章节等页面UI
|
|
||||||
- 修正workerman中onMessage问题
|
|
||||||
- 修正非免费课程试听问题
|
|
||||||
- 优化layer窗口中的表单跳转
|
|
||||||
- 文件清理以及命名优化
|
|
||||||
- 优化倒计时
|
|
||||||
|
|
||||||
### [v1.7.6](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.6)(2025-03-22)
|
|
||||||
|
|
||||||
- 升级layui-v2.9.25
|
|
||||||
- 去除发货中不必要的异常抛出
|
|
||||||
- 去除文章和问题缓存重建
|
|
||||||
- 去除多余的文件引用
|
|
||||||
- 修正每日访问站点积分问题
|
|
||||||
- 限制全文搜索关键字长度
|
|
||||||
- 统一规划二维码样式
|
|
||||||
|
|
||||||
### [v1.7.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.5)(2025-02-22)
|
|
||||||
|
|
||||||
- 优化后台统计图表
|
|
||||||
- 优化图片放大查看
|
|
||||||
- 优化错误处理机制
|
|
||||||
- 优化前台编辑器页面
|
|
||||||
- 去除一些过度的设计
|
|
||||||
- 精简属性空判断
|
|
||||||
- 规整redirect
|
|
||||||
- 优化bootstrap
|
|
||||||
- 优化logger
|
|
||||||
- 优化contact
|
|
||||||
- 优化logo
|
|
||||||
- 优化nav
|
|
||||||
|
|
||||||
### [v1.7.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.4)(2024-12-10)
|
|
||||||
|
|
||||||
- 更新layui-v2.9.20
|
|
||||||
- 优化编辑器内容自动提交
|
|
||||||
- 修正课时详情页目录高亮问题
|
|
||||||
- 修正CommentInfo中点赞判断
|
|
||||||
- 精简AccountSearchTrait
|
|
||||||
- 优化kg_h5_index_url()
|
|
||||||
- 优化CourseUserTrait
|
|
||||||
- 优化kg_setting()
|
|
||||||
- 优化CsrfToken
|
|
||||||
|
|
||||||
### [v1.7.3](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.3)(2024-10-10)
|
|
||||||
|
|
||||||
- 更新layui-v2.9.16
|
|
||||||
- 增加编辑器内容自动提交
|
|
||||||
- 修改文章和提问可用tag数量
|
|
||||||
- 优化findUserActiveSessions
|
|
||||||
- 优化findUserActiveTokens
|
|
||||||
- 优化上传文件失败抛出异常
|
|
||||||
- 优化默认文件上传
|
|
||||||
- 优化用户锁定相关
|
|
||||||
|
|
||||||
### [v1.7.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.2)(2024-07-31)
|
|
||||||
|
|
||||||
- 更新layui-v2.9.14
|
|
||||||
- 优化docker自动化脚本
|
|
||||||
- 修正教师直播通知
|
|
||||||
- 修正课程分类删选问题
|
|
||||||
- 后台增加客户服务入口
|
|
||||||
- redis增加expire方法
|
|
||||||
- 日志记录增加log.trace参数
|
|
||||||
- 精简代码
|
|
||||||
|
|
||||||
### [v1.7.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.1)(2024-06-31)
|
|
||||||
|
|
||||||
- 更新layui-v2.9.10
|
|
||||||
- 更新docker国内镜像地址
|
|
||||||
- 增加导入镜像构建容器的方式
|
|
||||||
- 调整微信公众号模板消息
|
|
||||||
- 移除加载富文本编辑器初始化的语言文件
|
|
||||||
- 移除consult中多余的chapter_id属性
|
|
||||||
- 修正课程列表顶部过滤条件区块不能收缩问题
|
|
||||||
- 用户中心第三方登录列表增加过滤条件
|
|
||||||
- 后台增加打开/关闭左侧菜单提示
|
|
||||||
- 优化整理文件mimeType
|
|
||||||
- iconfont资源本地化
|
|
||||||
- 优化UploadController
|
|
||||||
- 优化富文本内容显示样式
|
|
||||||
- 简化内容图片放大监听
|
|
||||||
- 去除课程打赏相关内容
|
|
||||||
- 课程增加能否发布检查
|
|
||||||
|
|
||||||
### [v1.7.0](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.0)(2024-05-15)
|
### [v1.7.0](https://gitee.com/koogua/course-tencent-cloud/releases/v1.7.0)(2024-05-15)
|
||||||
|
|
||||||
- 升级layui-2.9.8
|
- 升级layui-2.9.8
|
||||||
|
10
README.md
10
README.md
@ -1,6 +1,6 @@
|
|||||||
## 酷瓜云课堂
|
## 酷瓜云课堂
|
||||||
|
|
||||||
[](https://www.koogua.com)
|

|
||||||
|
|
||||||
### 系统介绍
|
### 系统介绍
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
友情提示:
|
友情提示:
|
||||||
|
|
||||||
- 演示系统配置低(2核,2G,1M 跑多个容器)切莫压测
|
- 演示系统配置低(1Core,1G,1M 跑多个容器)切莫压测
|
||||||
- 课程数据来源于网络(无实质内容)切莫购买
|
- 课程数据来源于网络(无实质内容)切莫购买
|
||||||
- 管理后台已禁止数据提交,私密配置已过滤
|
- 管理后台已禁止数据提交,私密配置已过滤
|
||||||
|
|
||||||
@ -48,9 +48,9 @@ Tips: 请用手机注册一个新账号,用户中心 -> 关注订阅,扫码
|
|||||||
|
|
||||||
### 项目组件
|
### 项目组件
|
||||||
|
|
||||||
- 后台框架:[phalcon 3.4](https://phalcon.io)
|
- 后台框架:[phalcon 3.4.5](https://phalcon.io)
|
||||||
- 前端框架:[layui 2.9](https://layui.dev)
|
- 前端框架:[layui 2.9.3](https://layui.dev)
|
||||||
- 全文检索:[xunsearch 1.4](http://www.xunsearch.com)
|
- 全文检索:[xunsearch 1.4.17](http://www.xunsearch.com)
|
||||||
- 基础依赖:[php7.3](https://php.net), [mysql5.7](https://mysql.com), [redis5.0](https://redis.io)
|
- 基础依赖:[php7.3](https://php.net), [mysql5.7](https://mysql.com), [redis5.0](https://redis.io)
|
||||||
|
|
||||||
### 项目文档
|
### 项目文档
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Question as QuestionRepo;
|
use App\Repos\Question as QuestionRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class AnswerList extends Builder
|
class AnswerList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ class AnswerList extends Builder
|
|||||||
$questions = $this->getQuestions($answers);
|
$questions = $this->getQuestions($answers);
|
||||||
|
|
||||||
foreach ($answers as $key => $answer) {
|
foreach ($answers as $key => $answer) {
|
||||||
$answers[$key]['question'] = $questions[$answer['question_id']] ?? null;
|
$answers[$key]['question'] = $questions[$answer['question_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $answers;
|
return $answers;
|
||||||
@ -28,7 +29,7 @@ class AnswerList extends Builder
|
|||||||
$users = $this->getUsers($answers);
|
$users = $this->getUsers($answers);
|
||||||
|
|
||||||
foreach ($answers as $key => $answer) {
|
foreach ($answers as $key => $answer) {
|
||||||
$answers[$key]['owner'] = $users[$answer['owner_id']] ?? null;
|
$answers[$key]['owner'] = $users[$answer['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $answers;
|
return $answers;
|
||||||
@ -55,7 +56,20 @@ class AnswerList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($answers, 'owner_id');
|
$ids = kg_array_column($answers, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Article as ArticleRepo;
|
use App\Repos\Article as ArticleRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
use Phalcon\Text;
|
use Phalcon\Text;
|
||||||
|
|
||||||
class ArticleFavoriteList extends Builder
|
class ArticleFavoriteList extends Builder
|
||||||
@ -18,7 +19,7 @@ class ArticleFavoriteList extends Builder
|
|||||||
$articles = $this->getArticles($relations);
|
$articles = $this->getArticles($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['article'] = $articles[$value['article_id']] ?? null;
|
$relations[$key]['article'] = $articles[$value['article_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -29,7 +30,7 @@ class ArticleFavoriteList extends Builder
|
|||||||
$users = $this->getUsers($relations);
|
$users = $this->getUsers($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
|
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -69,7 +70,20 @@ class ArticleFavoriteList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($relations, 'user_id');
|
$ids = kg_array_column($relations, 'user_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Builders;
|
|||||||
|
|
||||||
use App\Caches\CategoryAllList as CategoryAllListCache;
|
use App\Caches\CategoryAllList as CategoryAllListCache;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class ArticleList extends Builder
|
class ArticleList extends Builder
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ class ArticleList extends Builder
|
|||||||
$categories = $this->getCategories();
|
$categories = $this->getCategories();
|
||||||
|
|
||||||
foreach ($articles as $key => $article) {
|
foreach ($articles as $key => $article) {
|
||||||
$articles[$key]['category'] = $categories[$article['category_id']] ?? null;
|
$articles[$key]['category'] = $categories[$article['category_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $articles;
|
return $articles;
|
||||||
@ -38,7 +39,7 @@ class ArticleList extends Builder
|
|||||||
$users = $this->getUsers($articles);
|
$users = $this->getUsers($articles);
|
||||||
|
|
||||||
foreach ($articles as $key => $article) {
|
foreach ($articles as $key => $article) {
|
||||||
$articles[$key]['owner'] = $users[$article['owner_id']] ?? null;
|
$articles[$key]['owner'] = $users[$article['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $articles;
|
return $articles;
|
||||||
@ -68,7 +69,20 @@ class ArticleList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($articles, 'owner_id');
|
$ids = kg_array_column($articles, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\User as UserRepo;
|
|
||||||
use Phalcon\Di\Injectable;
|
use Phalcon\Di\Injectable;
|
||||||
|
|
||||||
class Builder extends Injectable
|
class Builder extends Injectable
|
||||||
@ -18,22 +17,4 @@ class Builder extends Injectable
|
|||||||
return kg_array_object($items);
|
return kg_array_object($items);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getShallowUserByIds(array $ids)
|
|
||||||
{
|
|
||||||
$userRepo = new UserRepo();
|
|
||||||
|
|
||||||
$users = $userRepo->findShallowUserByIds($ids);
|
|
||||||
|
|
||||||
$baseUrl = kg_cos_url();
|
|
||||||
|
|
||||||
$result = [];
|
|
||||||
|
|
||||||
foreach ($users->toArray() as $user) {
|
|
||||||
$user['avatar'] = $baseUrl . $user['avatar'];
|
|
||||||
$result[$user['id']] = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class CommentList extends Builder
|
class CommentList extends Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -15,8 +17,8 @@ class CommentList extends Builder
|
|||||||
$users = $this->getUsers($comments);
|
$users = $this->getUsers($comments);
|
||||||
|
|
||||||
foreach ($comments as $key => $comment) {
|
foreach ($comments as $key => $comment) {
|
||||||
$comments[$key]['owner'] = $users[$comment['owner_id']] ?? null;
|
$comments[$key]['owner'] = $users[$comment['owner_id']] ?? new \stdClass();
|
||||||
$comments[$key]['to_user'] = $users[$comment['to_user_id']] ?? null;
|
$comments[$key]['to_user'] = $users[$comment['to_user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $comments;
|
return $comments;
|
||||||
@ -28,7 +30,20 @@ class CommentList extends Builder
|
|||||||
$toUserIds = kg_array_column($comments, 'to_user_id');
|
$toUserIds = kg_array_column($comments, 'to_user_id');
|
||||||
$ids = array_merge($ownerIds, $toUserIds);
|
$ids = array_merge($ownerIds, $toUserIds);
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
|
use App\Repos\Chapter as ChapterRepo;
|
||||||
use App\Repos\Course as CourseRepo;
|
use App\Repos\Course as CourseRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class ConsultList extends Builder
|
class ConsultList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +19,7 @@ class ConsultList extends Builder
|
|||||||
$courses = $this->getCourses($consults);
|
$courses = $this->getCourses($consults);
|
||||||
|
|
||||||
foreach ($consults as $key => $consult) {
|
foreach ($consults as $key => $consult) {
|
||||||
$consults[$key]['course'] = $courses[$consult['course_id']] ?? null;
|
$consults[$key]['course'] = $courses[$consult['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $consults;
|
return $consults;
|
||||||
@ -28,8 +30,8 @@ class ConsultList extends Builder
|
|||||||
$users = $this->getUsers($consults);
|
$users = $this->getUsers($consults);
|
||||||
|
|
||||||
foreach ($consults as $key => $consult) {
|
foreach ($consults as $key => $consult) {
|
||||||
$consults[$key]['owner'] = $users[$consult['owner_id']] ?? null;
|
$consults[$key]['owner'] = $users[$consult['owner_id']] ?? new \stdClass();
|
||||||
$consults[$key]['replier'] = $users[$consult['replier_id']] ?? null;
|
$consults[$key]['replier'] = $users[$consult['replier_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $consults;
|
return $consults;
|
||||||
@ -52,13 +54,43 @@ class ConsultList extends Builder
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getChapters(array $consults)
|
||||||
|
{
|
||||||
|
$ids = kg_array_column($consults, 'chapter_id');
|
||||||
|
|
||||||
|
$chapterRepo = new ChapterRepo();
|
||||||
|
|
||||||
|
$chapters = $chapterRepo->findByIds($ids, ['id', 'title']);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($chapters->toArray() as $chapter) {
|
||||||
|
$result[$chapter['id']] = $chapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
public function getUsers(array $consults)
|
public function getUsers(array $consults)
|
||||||
{
|
{
|
||||||
$ownerIds = kg_array_column($consults, 'owner_id');
|
$ownerIds = kg_array_column($consults, 'owner_id');
|
||||||
$replierIds = kg_array_column($consults, 'replier_id');
|
$replierIds = kg_array_column($consults, 'replier_id');
|
||||||
$ids = array_merge($ownerIds, $replierIds);
|
$ids = array_merge($ownerIds, $replierIds);
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Course as CourseRepo;
|
use App\Repos\Course as CourseRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class CourseFavoriteList extends Builder
|
class CourseFavoriteList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ class CourseFavoriteList extends Builder
|
|||||||
$courses = $this->getCourses($relations);
|
$courses = $this->getCourses($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
|
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -28,7 +29,7 @@ class CourseFavoriteList extends Builder
|
|||||||
$users = $this->getUsers($relations);
|
$users = $this->getUsers($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
|
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -69,7 +70,20 @@ class CourseFavoriteList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($relations, 'user_id');
|
$ids = kg_array_column($relations, 'user_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Builders;
|
|||||||
|
|
||||||
use App\Caches\CategoryAllList as CategoryAllListCache;
|
use App\Caches\CategoryAllList as CategoryAllListCache;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class CourseList extends Builder
|
class CourseList extends Builder
|
||||||
{
|
{
|
||||||
@ -18,7 +19,7 @@ class CourseList extends Builder
|
|||||||
$categories = $this->getCategories();
|
$categories = $this->getCategories();
|
||||||
|
|
||||||
foreach ($courses as $key => $course) {
|
foreach ($courses as $key => $course) {
|
||||||
$courses[$key]['category'] = $categories[$course['category_id']] ?? null;
|
$courses[$key]['category'] = $categories[$course['category_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $courses;
|
return $courses;
|
||||||
@ -29,7 +30,7 @@ class CourseList extends Builder
|
|||||||
$teachers = $this->getTeachers($courses);
|
$teachers = $this->getTeachers($courses);
|
||||||
|
|
||||||
foreach ($courses as $key => $course) {
|
foreach ($courses as $key => $course) {
|
||||||
$courses[$key]['teacher'] = $teachers[$course['teacher_id']] ?? null;
|
$courses[$key]['teacher'] = $teachers[$course['teacher_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $courses;
|
return $courses;
|
||||||
@ -59,7 +60,20 @@ class CourseList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($courses, 'teacher_id');
|
$ids = kg_array_column($courses, 'teacher_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class CourseTopicList extends Builder
|
|||||||
$courses = $this->getCourses($relations);
|
$courses = $this->getCourses($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
|
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -29,7 +29,7 @@ class CourseTopicList extends Builder
|
|||||||
$topics = $this->getTopics($relations);
|
$topics = $this->getTopics($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['topic'] = $topics[$value['topic_id']] ?? null;
|
$relations[$key]['topic'] = $topics[$value['topic_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Course as CourseRepo;
|
use App\Repos\Course as CourseRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class CourseUserList extends Builder
|
class CourseUserList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ class CourseUserList extends Builder
|
|||||||
$courses = $this->getCourses($relations);
|
$courses = $this->getCourses($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
|
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -28,7 +29,7 @@ class CourseUserList extends Builder
|
|||||||
$users = $this->getUsers($relations);
|
$users = $this->getUsers($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
|
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -73,7 +74,20 @@ class CourseUserList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($relations, 'user_id');
|
$ids = kg_array_column($relations, 'user_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class HelpList extends Builder
|
|||||||
$categories = $this->getCategories();
|
$categories = $this->getCategories();
|
||||||
|
|
||||||
foreach ($helps as $key => $help) {
|
foreach ($helps as $key => $help) {
|
||||||
$helps[$key]['category'] = $categories[$help['category_id']] ?? null;
|
$helps[$key]['category'] = $categories[$help['category_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $helps;
|
return $helps;
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Builders;
|
|||||||
|
|
||||||
use App\Repos\Chapter as ChapterRepo;
|
use App\Repos\Chapter as ChapterRepo;
|
||||||
use App\Repos\Course as CourseRepo;
|
use App\Repos\Course as CourseRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class LearningList extends Builder
|
class LearningList extends Builder
|
||||||
{
|
{
|
||||||
@ -18,7 +19,7 @@ class LearningList extends Builder
|
|||||||
$courses = $this->getCourses($relations);
|
$courses = $this->getCourses($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
|
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -29,7 +30,7 @@ class LearningList extends Builder
|
|||||||
$chapters = $this->getChapters($relations);
|
$chapters = $this->getChapters($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['chapter'] = $chapters[$value['chapter_id']] ?? null;
|
$relations[$key]['chapter'] = $chapters[$value['chapter_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -40,7 +41,7 @@ class LearningList extends Builder
|
|||||||
$users = $this->getUsers($relations);
|
$users = $this->getUsers($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
|
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -84,7 +85,17 @@ class LearningList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($relations, 'user_id');
|
$ids = kg_array_column($relations, 'user_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findByIds($ids, ['id', 'name']);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class LiveList extends Builder
|
|||||||
$courses = $this->getCourses($lives);
|
$courses = $this->getCourses($lives);
|
||||||
|
|
||||||
foreach ($lives as $key => $live) {
|
foreach ($lives as $key => $live) {
|
||||||
$lives[$key]['course'] = $courses[$live['course_id']] ?? null;
|
$lives[$key]['course'] = $courses[$live['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $lives;
|
return $lives;
|
||||||
@ -30,7 +30,7 @@ class LiveList extends Builder
|
|||||||
$chapters = $this->getChapters($lives);
|
$chapters = $this->getChapters($lives);
|
||||||
|
|
||||||
foreach ($lives as $key => $live) {
|
foreach ($lives as $key => $live) {
|
||||||
$lives[$key]['chapter'] = $chapters[$live['chapter_id']] ?? null;
|
$lives[$key]['chapter'] = $chapters[$live['chapter_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $lives;
|
return $lives;
|
||||||
@ -63,7 +63,7 @@ class LiveList extends Builder
|
|||||||
|
|
||||||
foreach ($courses->toArray() as $course) {
|
foreach ($courses->toArray() as $course) {
|
||||||
$course['cover'] = $baseUrl . $course['cover'];
|
$course['cover'] = $baseUrl . $course['cover'];
|
||||||
$course['teacher'] = $teachers[$course['teacher_id']] ?? null;
|
$course['teacher'] = $teachers[$course['teacher_id']] ?? new \stdClass();
|
||||||
$result[$course['id']] = [
|
$result[$course['id']] = [
|
||||||
'id' => $course['id'],
|
'id' => $course['id'],
|
||||||
'title' => $course['title'],
|
'title' => $course['title'],
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class NotificationList extends Builder
|
class NotificationList extends Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -15,8 +17,8 @@ class NotificationList extends Builder
|
|||||||
$users = $this->getUsers($notifications);
|
$users = $this->getUsers($notifications);
|
||||||
|
|
||||||
foreach ($notifications as $key => $notification) {
|
foreach ($notifications as $key => $notification) {
|
||||||
$notifications[$key]['sender'] = $users[$notification['sender_id']] ?? null;
|
$notifications[$key]['sender'] = $users[$notification['sender_id']] ?? new \stdClass();
|
||||||
$notifications[$key]['receiver'] = $users[$notification['receiver_id']] ?? null;
|
$notifications[$key]['receiver'] = $users[$notification['receiver_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $notifications;
|
return $notifications;
|
||||||
@ -28,7 +30,20 @@ class NotificationList extends Builder
|
|||||||
$receiverIds = kg_array_column($notifications, 'receiver_id');
|
$receiverIds = kg_array_column($notifications, 'receiver_id');
|
||||||
$ids = array_merge($senderIds, $receiverIds);
|
$ids = array_merge($senderIds, $receiverIds);
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Builders;
|
|||||||
|
|
||||||
use App\Models\Course as CourseModel;
|
use App\Models\Course as CourseModel;
|
||||||
use App\Models\Order as OrderModel;
|
use App\Models\Order as OrderModel;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class OrderList extends Builder
|
class OrderList extends Builder
|
||||||
{
|
{
|
||||||
@ -29,7 +30,7 @@ class OrderList extends Builder
|
|||||||
$users = $this->getUsers($orders);
|
$users = $this->getUsers($orders);
|
||||||
|
|
||||||
foreach ($orders as $key => $order) {
|
foreach ($orders as $key => $order) {
|
||||||
$orders[$key]['owner'] = $users[$order['owner_id']] ?? null;
|
$orders[$key]['owner'] = $users[$order['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $orders;
|
return $orders;
|
||||||
@ -112,13 +113,8 @@ class OrderList extends Builder
|
|||||||
$me['allow_refund'] = $refundStatusOk && $refundTimeOk ? 1 : 0;
|
$me['allow_refund'] = $refundStatusOk && $refundTimeOk ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($payStatusOk == 1) {
|
$me['allow_pay'] = $payStatusOk;
|
||||||
$me['allow_pay'] = 1;
|
$me['allow_cancel'] = $cancelStatusOk;
|
||||||
}
|
|
||||||
|
|
||||||
if ($cancelStatusOk == 1) {
|
|
||||||
$me['allow_cancel'] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $me;
|
return $me;
|
||||||
}
|
}
|
||||||
@ -153,6 +149,20 @@ class OrderList extends Builder
|
|||||||
return $itemInfo;
|
return $itemInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $itemInfo
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function handleRewardInfo($itemInfo)
|
||||||
|
{
|
||||||
|
if (!empty($itemInfo) && is_string($itemInfo)) {
|
||||||
|
$itemInfo = json_decode($itemInfo, true);
|
||||||
|
$itemInfo['course']['cover'] = $this->imgBaseUrl . $itemInfo['course']['cover'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $itemInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $itemInfo
|
* @param string $itemInfo
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@ -174,7 +184,17 @@ class OrderList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($orders, 'owner_id');
|
$ids = kg_array_column($orders, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Question as QuestionRepo;
|
use App\Repos\Question as QuestionRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
use Phalcon\Text;
|
use Phalcon\Text;
|
||||||
|
|
||||||
class QuestionFavoriteList extends Builder
|
class QuestionFavoriteList extends Builder
|
||||||
@ -18,7 +19,7 @@ class QuestionFavoriteList extends Builder
|
|||||||
$questions = $this->getQuestions($relations);
|
$questions = $this->getQuestions($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['question'] = $questions[$value['question_id']] ?? null;
|
$relations[$key]['question'] = $questions[$value['question_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -29,7 +30,7 @@ class QuestionFavoriteList extends Builder
|
|||||||
$users = $this->getUsers($relations);
|
$users = $this->getUsers($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
|
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -69,7 +70,20 @@ class QuestionFavoriteList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($relations, 'user_id');
|
$ids = kg_array_column($relations, 'user_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Builders;
|
|||||||
|
|
||||||
use App\Caches\CategoryAllList as CategoryAllListCache;
|
use App\Caches\CategoryAllList as CategoryAllListCache;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class QuestionList extends Builder
|
class QuestionList extends Builder
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ class QuestionList extends Builder
|
|||||||
$categories = $this->getCategories();
|
$categories = $this->getCategories();
|
||||||
|
|
||||||
foreach ($questions as $key => $question) {
|
foreach ($questions as $key => $question) {
|
||||||
$questions[$key]['category'] = $categories[$question['category_id']] ?? null;
|
$questions[$key]['category'] = $categories[$question['category_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $questions;
|
return $questions;
|
||||||
@ -38,8 +39,8 @@ class QuestionList extends Builder
|
|||||||
$users = $this->getUsers($questions);
|
$users = $this->getUsers($questions);
|
||||||
|
|
||||||
foreach ($questions as $key => $question) {
|
foreach ($questions as $key => $question) {
|
||||||
$questions[$key]['owner'] = $users[$question['owner_id']] ?? null;
|
$questions[$key]['owner'] = $users[$question['owner_id']] ?? new \stdClass();
|
||||||
$questions[$key]['last_replier'] = $users[$question['last_replier_id']] ?? null;
|
$questions[$key]['last_replier'] = $users[$question['last_replier_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $questions;
|
return $questions;
|
||||||
@ -71,7 +72,20 @@ class QuestionList extends Builder
|
|||||||
$lastReplierIds = kg_array_column($questions, 'last_replier_id');
|
$lastReplierIds = kg_array_column($questions, 'last_replier_id');
|
||||||
$ids = array_merge($ownerIds, $lastReplierIds);
|
$ids = array_merge($ownerIds, $lastReplierIds);
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Builders;
|
|||||||
|
|
||||||
use App\Models\Refund as RefundModel;
|
use App\Models\Refund as RefundModel;
|
||||||
use App\Repos\Order as OrderRepo;
|
use App\Repos\Order as OrderRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class RefundList extends Builder
|
class RefundList extends Builder
|
||||||
{
|
{
|
||||||
@ -18,7 +19,7 @@ class RefundList extends Builder
|
|||||||
$orders = $this->getOrders($trades);
|
$orders = $this->getOrders($trades);
|
||||||
|
|
||||||
foreach ($trades as $key => $trade) {
|
foreach ($trades as $key => $trade) {
|
||||||
$trades[$key]['order'] = $orders[$trade['order_id']] ?? null;
|
$trades[$key]['order'] = $orders[$trade['order_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $trades;
|
return $trades;
|
||||||
@ -29,7 +30,7 @@ class RefundList extends Builder
|
|||||||
$users = $this->getUsers($refunds);
|
$users = $this->getUsers($refunds);
|
||||||
|
|
||||||
foreach ($refunds as $key => $refund) {
|
foreach ($refunds as $key => $refund) {
|
||||||
$refunds[$key]['owner'] = $users[$refund['owner_id']] ?? null;
|
$refunds[$key]['owner'] = $users[$refund['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $refunds;
|
return $refunds;
|
||||||
@ -74,7 +75,20 @@ class RefundList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($refunds, 'owner_id');
|
$ids = kg_array_column($refunds, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class ReportList extends Builder
|
class ReportList extends Builder
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ class ReportList extends Builder
|
|||||||
$users = $this->getUsers($reports);
|
$users = $this->getUsers($reports);
|
||||||
|
|
||||||
foreach ($reports as $key => $report) {
|
foreach ($reports as $key => $report) {
|
||||||
$reports[$key]['owner'] = $users[$report['owner_id']] ?? null;
|
$reports[$key]['owner'] = $users[$report['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reports;
|
return $reports;
|
||||||
@ -25,7 +27,20 @@ class ReportList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($reports, 'owner_id');
|
$ids = kg_array_column($reports, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class ResourceList extends Builder
|
|||||||
$uploads = $this->getUploads($relations);
|
$uploads = $this->getUploads($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['upload'] = $uploads[$value['upload_id']] ?? null;
|
$relations[$key]['upload'] = $uploads[$value['upload_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Course as CourseRepo;
|
use App\Repos\Course as CourseRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class ReviewList extends Builder
|
class ReviewList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ class ReviewList extends Builder
|
|||||||
$courses = $this->getCourses($reviews);
|
$courses = $this->getCourses($reviews);
|
||||||
|
|
||||||
foreach ($reviews as $key => $review) {
|
foreach ($reviews as $key => $review) {
|
||||||
$reviews[$key]['course'] = $courses[$review['course_id']] ?? null;
|
$reviews[$key]['course'] = $courses[$review['course_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reviews;
|
return $reviews;
|
||||||
@ -28,7 +29,7 @@ class ReviewList extends Builder
|
|||||||
$users = $this->getUsers($reviews);
|
$users = $this->getUsers($reviews);
|
||||||
|
|
||||||
foreach ($reviews as $key => $review) {
|
foreach ($reviews as $key => $review) {
|
||||||
$reviews[$key]['owner'] = $users[$review['owner_id']] ?? null;
|
$reviews[$key]['owner'] = $users[$review['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $reviews;
|
return $reviews;
|
||||||
@ -55,7 +56,20 @@ class ReviewList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($reviews, 'owner_id');
|
$ids = kg_array_column($reviews, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Tag as TagRepo;
|
use App\Repos\Tag as TagRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class TagFollowList extends Builder
|
class TagFollowList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ class TagFollowList extends Builder
|
|||||||
$tags = $this->getTags($relations);
|
$tags = $this->getTags($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['tag'] = $tags[$value['tag_id']] ?? null;
|
$relations[$key]['tag'] = $tags[$value['tag_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -28,7 +29,7 @@ class TagFollowList extends Builder
|
|||||||
$users = $this->getUsers($relations);
|
$users = $this->getUsers($relations);
|
||||||
|
|
||||||
foreach ($relations as $key => $value) {
|
foreach ($relations as $key => $value) {
|
||||||
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
|
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $relations;
|
return $relations;
|
||||||
@ -60,7 +61,20 @@ class TagFollowList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($relations, 'user_id');
|
$ids = kg_array_column($relations, 'user_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findByIds($ids, ['id', 'name', 'avatar']);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
namespace App\Builders;
|
namespace App\Builders;
|
||||||
|
|
||||||
use App\Repos\Order as OrderRepo;
|
use App\Repos\Order as OrderRepo;
|
||||||
|
use App\Repos\User as UserRepo;
|
||||||
|
|
||||||
class TradeList extends Builder
|
class TradeList extends Builder
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ class TradeList extends Builder
|
|||||||
$orders = $this->getOrders($trades);
|
$orders = $this->getOrders($trades);
|
||||||
|
|
||||||
foreach ($trades as $key => $trade) {
|
foreach ($trades as $key => $trade) {
|
||||||
$trades[$key]['order'] = $orders[$trade['order_id']] ?? null;
|
$trades[$key]['order'] = $orders[$trade['order_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $trades;
|
return $trades;
|
||||||
@ -28,7 +29,7 @@ class TradeList extends Builder
|
|||||||
$users = $this->getUsers($trades);
|
$users = $this->getUsers($trades);
|
||||||
|
|
||||||
foreach ($trades as $key => $trade) {
|
foreach ($trades as $key => $trade) {
|
||||||
$trades[$key]['owner'] = $users[$trade['owner_id']] ?? null;
|
$trades[$key]['owner'] = $users[$trade['owner_id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $trades;
|
return $trades;
|
||||||
@ -55,7 +56,20 @@ class TradeList extends Builder
|
|||||||
{
|
{
|
||||||
$ids = kg_array_column($trades, 'owner_id');
|
$ids = kg_array_column($trades, 'owner_id');
|
||||||
|
|
||||||
return $this->getShallowUserByIds($ids);
|
$userRepo = new UserRepo();
|
||||||
|
|
||||||
|
$users = $userRepo->findShallowUserByIds($ids);
|
||||||
|
|
||||||
|
$baseUrl = kg_cos_url();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($users->toArray() as $user) {
|
||||||
|
$user['avatar'] = $baseUrl . $user['avatar'];
|
||||||
|
$result[$user['id']] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ class UserList extends Builder
|
|||||||
$accounts = $this->getAccounts($users);
|
$accounts = $this->getAccounts($users);
|
||||||
|
|
||||||
foreach ($users as $key => $user) {
|
foreach ($users as $key => $user) {
|
||||||
$users[$key]['account'] = $accounts[$user['id']] ?? null;
|
$users[$key]['account'] = $accounts[$user['id']] ?? new \stdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $users;
|
return $users;
|
||||||
|
36
app/Caches/Article.php
Normal file
36
app/Caches/Article.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Repos\Article as ArticleRepo;
|
||||||
|
|
||||||
|
class Article extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return "article:{$id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$articleRepo = new ArticleRepo();
|
||||||
|
|
||||||
|
$article = $articleRepo->findById($id);
|
||||||
|
|
||||||
|
return $article ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
app/Caches/Help.php
Normal file
36
app/Caches/Help.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Repos\Help as HelpRepo;
|
||||||
|
|
||||||
|
class Help extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 7 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return "help:{$id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$helpRepo = new HelpRepo();
|
||||||
|
|
||||||
|
$help = $helpRepo->findById($id);
|
||||||
|
|
||||||
|
return $help ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
97
app/Caches/HelpList.php
Normal file
97
app/Caches/HelpList.php
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Category as CategoryModel;
|
||||||
|
use App\Models\Help as HelpModel;
|
||||||
|
use Phalcon\Mvc\Model\Resultset;
|
||||||
|
use Phalcon\Mvc\Model\ResultsetInterface;
|
||||||
|
|
||||||
|
class HelpList extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 7 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'help_list';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$categories = $this->findCategories();
|
||||||
|
|
||||||
|
if ($categories->count() == 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($categories as $category) {
|
||||||
|
|
||||||
|
$item = [];
|
||||||
|
|
||||||
|
$item['category'] = [
|
||||||
|
'id' => $category->id,
|
||||||
|
'name' => $category->name,
|
||||||
|
];
|
||||||
|
|
||||||
|
$item['helps'] = [];
|
||||||
|
|
||||||
|
$helps = $this->findHelps($category->id);
|
||||||
|
|
||||||
|
if ($helps->count() > 0) {
|
||||||
|
foreach ($helps as $help) {
|
||||||
|
$item['helps'][] = [
|
||||||
|
'id' => $help->id,
|
||||||
|
'title' => $help->title,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result[] = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ResultsetInterface|Resultset|CategoryModel[]
|
||||||
|
*/
|
||||||
|
protected function findCategories()
|
||||||
|
{
|
||||||
|
return CategoryModel::query()
|
||||||
|
->where('type = :type:', ['type' => CategoryModel::TYPE_HELP])
|
||||||
|
->andWhere('level = 1')
|
||||||
|
->andWhere('published = 1')
|
||||||
|
->andWhere('deleted = 0')
|
||||||
|
->orderBy('priority ASC')
|
||||||
|
->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $categoryId
|
||||||
|
* @return ResultsetInterface|Resultset|CategoryModel[]
|
||||||
|
*/
|
||||||
|
protected function findHelps($categoryId)
|
||||||
|
{
|
||||||
|
return HelpModel::query()
|
||||||
|
->where('category_id = :category_id:', ['category_id' => $categoryId])
|
||||||
|
->andWhere('published = 1')
|
||||||
|
->andWhere('deleted = 0')
|
||||||
|
->orderBy('priority ASC')
|
||||||
|
->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxAnswerId.php
Normal file
34
app/Caches/MaxAnswerId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Answer as AnswerModel;
|
||||||
|
|
||||||
|
class MaxAnswerId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_answer_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$answer = AnswerModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $answer->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxArticleId.php
Normal file
34
app/Caches/MaxArticleId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Article as ArticleModel;
|
||||||
|
|
||||||
|
class MaxArticleId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_article_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$article = ArticleModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $article->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxCommentId.php
Normal file
34
app/Caches/MaxCommentId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Comment as CommentModel;
|
||||||
|
|
||||||
|
class MaxCommentId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_comment_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$comment = CommentModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $comment->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxHelpId.php
Normal file
34
app/Caches/MaxHelpId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Help as HelpModel;
|
||||||
|
|
||||||
|
class MaxHelpId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_help_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$help = HelpModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $help->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxPageId.php
Normal file
34
app/Caches/MaxPageId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Page as PageModel;
|
||||||
|
|
||||||
|
class MaxPageId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_page_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$page = PageModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $page->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxPointGiftId.php
Normal file
34
app/Caches/MaxPointGiftId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\PointGift as PointGiftModel;
|
||||||
|
|
||||||
|
class MaxPointGiftId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_point_gift_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$gift = PointGiftModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $gift->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxQuestionId.php
Normal file
34
app/Caches/MaxQuestionId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Question as QuestionModel;
|
||||||
|
|
||||||
|
class MaxQuestionId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_question_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$question = QuestionModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $question->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
34
app/Caches/MaxUploadId.php
Normal file
34
app/Caches/MaxUploadId.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Models\Upload as UploadModel;
|
||||||
|
|
||||||
|
class MaxUploadId extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 365 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'max_upload_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$upload = UploadModel::findFirst(['order' => 'id DESC']);
|
||||||
|
|
||||||
|
return $upload->id ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
44
app/Caches/ModerationStat.php
Normal file
44
app/Caches/ModerationStat.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Repos\Stat as StatRepo;
|
||||||
|
|
||||||
|
class ModerationStat extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 15 * 60;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return 'moderation_stat';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$statRepo = new StatRepo();
|
||||||
|
|
||||||
|
$articleCount = $statRepo->countPendingArticles();
|
||||||
|
$questionCount = $statRepo->countPendingQuestions();
|
||||||
|
$answerCount = $statRepo->countPendingAnswers();
|
||||||
|
$commentCount = $statRepo->countPendingComments();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'article_count' => $articleCount,
|
||||||
|
'question_count' => $questionCount,
|
||||||
|
'answer_count' => $answerCount,
|
||||||
|
'comment_count' => $commentCount,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
app/Caches/Page.php
Normal file
36
app/Caches/Page.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Repos\Page as PageRepo;
|
||||||
|
|
||||||
|
class Page extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 7 * 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return "page:{$id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$pageRepo = new PageRepo();
|
||||||
|
|
||||||
|
$page = $pageRepo->findById($id);
|
||||||
|
|
||||||
|
return $page ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
app/Caches/PointGift.php
Normal file
36
app/Caches/PointGift.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Repos\PointGift as PointGiftRepo;
|
||||||
|
|
||||||
|
class PointGift extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return "point_gift:{$id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$giftRepo = new PointGiftRepo();
|
||||||
|
|
||||||
|
$gift = $giftRepo->findById($id);
|
||||||
|
|
||||||
|
return $gift ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
app/Caches/Question.php
Normal file
36
app/Caches/Question.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
||||||
|
* @license https://opensource.org/licenses/GPL-2.0
|
||||||
|
* @link https://www.koogua.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Caches;
|
||||||
|
|
||||||
|
use App\Repos\Question as QuestionRepo;
|
||||||
|
|
||||||
|
class Question extends Cache
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $lifetime = 86400;
|
||||||
|
|
||||||
|
public function getLifetime()
|
||||||
|
{
|
||||||
|
return $this->lifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKey($id = null)
|
||||||
|
{
|
||||||
|
return "question:{$id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getContent($id = null)
|
||||||
|
{
|
||||||
|
$questionRepo = new QuestionRepo();
|
||||||
|
|
||||||
|
$question = $questionRepo->findById($id);
|
||||||
|
|
||||||
|
return $question ?: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,36 +7,11 @@
|
|||||||
|
|
||||||
namespace App\Console\Migrations;
|
namespace App\Console\Migrations;
|
||||||
|
|
||||||
use App\Models\Setting as SettingModel;
|
|
||||||
use App\Repos\Setting as SettingRepo;
|
|
||||||
use App\Traits\Service as ServiceTrait;
|
use App\Traits\Service as ServiceTrait;
|
||||||
|
|
||||||
abstract class Migration
|
abstract class Migration
|
||||||
{
|
{
|
||||||
|
|
||||||
use ServiceTrait;
|
use ServiceTrait;
|
||||||
|
|
||||||
abstract public function run();
|
abstract public function run();
|
||||||
|
|
||||||
protected function saveSettings(array $settings)
|
|
||||||
{
|
|
||||||
foreach ($settings as $setting) {
|
|
||||||
$this->saveSetting($setting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function saveSetting(array $setting)
|
|
||||||
{
|
|
||||||
$settingRepo = new SettingRepo();
|
|
||||||
|
|
||||||
$item = $settingRepo->findItem($setting['section'], $setting['item_key']);
|
|
||||||
|
|
||||||
if (!$item) {
|
|
||||||
$item = new SettingModel();
|
|
||||||
$item->create($setting);
|
|
||||||
} else {
|
|
||||||
$item->update($setting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2024 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Console\Migrations;
|
|
||||||
|
|
||||||
use App\Models\Chapter as ChapterModel;
|
|
||||||
use App\Models\Course as CourseModel;
|
|
||||||
use Phalcon\Mvc\Model\Resultset;
|
|
||||||
|
|
||||||
class V20240608145810 extends Migration
|
|
||||||
{
|
|
||||||
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->handleReadChapters();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function handleReadChapters()
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var $chapters Resultset|ChapterModel[]
|
|
||||||
*/
|
|
||||||
$chapters = ChapterModel::query()
|
|
||||||
->where('model = :model:', ['model' => CourseModel::MODEL_READ])
|
|
||||||
->andWhere('parent_id > 0')
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
if ($chapters->count() == 0) return;
|
|
||||||
|
|
||||||
foreach ($chapters as $chapter) {
|
|
||||||
|
|
||||||
$attrs = $chapter->attrs;
|
|
||||||
|
|
||||||
if (isset($attrs['format'])) continue;
|
|
||||||
|
|
||||||
$attrs['format'] = 'html';
|
|
||||||
|
|
||||||
$chapter->attrs = $attrs;
|
|
||||||
|
|
||||||
$chapter->update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2024 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Console\Migrations;
|
|
||||||
|
|
||||||
class V20241110191316 extends Migration
|
|
||||||
{
|
|
||||||
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->handleContactSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function handleContactSettings()
|
|
||||||
{
|
|
||||||
$setting = [
|
|
||||||
'section' => 'contact',
|
|
||||||
'item_key' => 'douyin',
|
|
||||||
'item_value' => '',
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->saveSetting($setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2025 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Console\Migrations;
|
|
||||||
|
|
||||||
use App\Models\UserBalance;
|
|
||||||
use App\Repos\User as UserRepo;
|
|
||||||
|
|
||||||
class V20250110191618 extends Migration
|
|
||||||
{
|
|
||||||
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$this->handleRootUserBalance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 之前migration初始化root账号缺少user_balance数据
|
|
||||||
*/
|
|
||||||
protected function handleRootUserBalance()
|
|
||||||
{
|
|
||||||
$userId = 10000;
|
|
||||||
|
|
||||||
$userRepo = new UserRepo();
|
|
||||||
|
|
||||||
$userBalance = $userRepo->findUserBalance($userId);
|
|
||||||
|
|
||||||
if ($userBalance) return;
|
|
||||||
|
|
||||||
$userBalance = new UserBalance();
|
|
||||||
|
|
||||||
$userBalance->user_id = $userId;
|
|
||||||
|
|
||||||
$userBalance->create();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -20,6 +20,8 @@ class ArticleIndexTask extends Task
|
|||||||
* 搜索测试
|
* 搜索测试
|
||||||
*
|
*
|
||||||
* @command: php console.php article_index search {query}
|
* @command: php console.php article_index search {query}
|
||||||
|
* @param array $params
|
||||||
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
public function searchAction($params)
|
public function searchAction($params)
|
||||||
{
|
{
|
||||||
@ -29,9 +31,7 @@ class ArticleIndexTask extends Task
|
|||||||
exit('please special a query word' . PHP_EOL);
|
exit('please special a query word' . PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$handler = new ArticleSearcher();
|
$result = $this->searchArticles($query);
|
||||||
|
|
||||||
$result = $handler->search($query);
|
|
||||||
|
|
||||||
var_export($result);
|
var_export($result);
|
||||||
}
|
}
|
||||||
@ -42,6 +42,24 @@ class ArticleIndexTask extends Task
|
|||||||
* @command: php console.php article_index clean
|
* @command: php console.php article_index clean
|
||||||
*/
|
*/
|
||||||
public function cleanAction()
|
public function cleanAction()
|
||||||
|
{
|
||||||
|
$this->cleanArticleIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重建索引
|
||||||
|
*
|
||||||
|
* @command: php console.php article_index rebuild
|
||||||
|
*/
|
||||||
|
public function rebuildAction()
|
||||||
|
{
|
||||||
|
$this->rebuildArticleIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空索引
|
||||||
|
*/
|
||||||
|
protected function cleanArticleIndex()
|
||||||
{
|
{
|
||||||
$handler = new ArticleSearcher();
|
$handler = new ArticleSearcher();
|
||||||
|
|
||||||
@ -56,10 +74,8 @@ class ArticleIndexTask extends Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 重建索引
|
* 重建索引
|
||||||
*
|
|
||||||
* @command: php console.php article_index rebuild
|
|
||||||
*/
|
*/
|
||||||
public function rebuildAction()
|
protected function rebuildArticleIndex()
|
||||||
{
|
{
|
||||||
$articles = $this->findArticles();
|
$articles = $this->findArticles();
|
||||||
|
|
||||||
@ -67,7 +83,7 @@ class ArticleIndexTask extends Task
|
|||||||
|
|
||||||
$handler = new ArticleSearcher();
|
$handler = new ArticleSearcher();
|
||||||
|
|
||||||
$doc = new ArticleDocument();
|
$documenter = new ArticleDocument();
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
$index = $handler->getXS()->getIndex();
|
||||||
|
|
||||||
@ -76,7 +92,7 @@ class ArticleIndexTask extends Task
|
|||||||
$index->beginRebuild();
|
$index->beginRebuild();
|
||||||
|
|
||||||
foreach ($articles as $article) {
|
foreach ($articles as $article) {
|
||||||
$document = $doc->setDocument($article);
|
$document = $documenter->setDocument($article);
|
||||||
$index->add($document);
|
$index->add($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,39 +102,17 @@ class ArticleIndexTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新索引缓存
|
* 搜索文章
|
||||||
*
|
*
|
||||||
* @command: php console.php article_index flush_index
|
* @param string $query
|
||||||
|
* @return array
|
||||||
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
public function flushIndexAction()
|
protected function searchArticles($query)
|
||||||
{
|
{
|
||||||
$handler = new ArticleSearcher();
|
$handler = new ArticleSearcher();
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
return $handler->search($query);
|
||||||
|
|
||||||
echo '------ start flush article index ------' . PHP_EOL;
|
|
||||||
|
|
||||||
$index->flushIndex();
|
|
||||||
|
|
||||||
echo '------ end flush article index ------' . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新搜索日志
|
|
||||||
*
|
|
||||||
* @command: php console.php article_index flush_logging
|
|
||||||
*/
|
|
||||||
public function flushLoggingAction()
|
|
||||||
{
|
|
||||||
$handler = new ArticleSearcher();
|
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
|
||||||
|
|
||||||
echo '------ start flush article logging ------' . PHP_EOL;
|
|
||||||
|
|
||||||
$index->flushLogging();
|
|
||||||
|
|
||||||
echo '------ end flush article logging ------' . PHP_EOL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
namespace App\Console\Tasks;
|
namespace App\Console\Tasks;
|
||||||
|
|
||||||
use App\Caches\CategoryAllList as CategoryAllListCache;
|
|
||||||
use App\Caches\CategoryList as CategoryListCache;
|
use App\Caches\CategoryList as CategoryListCache;
|
||||||
|
use App\Caches\CategoryAllList as CategoryAllListCache;
|
||||||
use App\Caches\CategoryTreeList as CategoryTreeListCache;
|
use App\Caches\CategoryTreeList as CategoryTreeListCache;
|
||||||
use App\Caches\IndexSlideList as IndexSlideListCache;
|
use App\Caches\IndexSlideList as IndexSlideListCache;
|
||||||
use App\Models\Account as AccountModel;
|
use App\Models\Account as AccountModel;
|
||||||
@ -39,8 +39,8 @@ class CleanDemoDataTask extends Task
|
|||||||
echo '------ start truncate tables ------' . PHP_EOL;
|
echo '------ start truncate tables ------' . PHP_EOL;
|
||||||
|
|
||||||
$excludeTables = [
|
$excludeTables = [
|
||||||
'kg_area', 'kg_migration', 'kg_migration_task', 'kg_nav',
|
'kg_area', 'kg_migration', 'kg_migration_task', 'kg_nav', 'kg_page',
|
||||||
'kg_page', 'kg_role', 'kg_setting', 'kg_vip',
|
'kg_reward', 'kg_role', 'kg_setting', 'kg_vip',
|
||||||
];
|
];
|
||||||
|
|
||||||
$tables = $this->db->listTables();
|
$tables = $this->db->listTables();
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2024 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://opensource.org/licenses/GPL-2.0
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Console\Tasks;
|
|
||||||
|
|
||||||
use App\Caches\CourseChapterList as CourseChapterListCache;
|
|
||||||
use App\Models\Chapter as ChapterModel;
|
|
||||||
use App\Models\ChapterLive as ChapterLiveModel;
|
|
||||||
use App\Repos\Chapter as ChapterRepo;
|
|
||||||
use Phalcon\Mvc\Model\Resultset;
|
|
||||||
use Phalcon\Mvc\Model\ResultsetInterface;
|
|
||||||
|
|
||||||
class CloseLiveTask extends Task
|
|
||||||
{
|
|
||||||
|
|
||||||
public function mainAction()
|
|
||||||
{
|
|
||||||
$chapterLives = $this->findChapterLives();
|
|
||||||
|
|
||||||
echo sprintf('pending lives: %s', $chapterLives->count()) . PHP_EOL;
|
|
||||||
|
|
||||||
if ($chapterLives->count() == 0) return;
|
|
||||||
|
|
||||||
echo '------ start close live task ------' . PHP_EOL;
|
|
||||||
|
|
||||||
foreach ($chapterLives as $chapterLive) {
|
|
||||||
|
|
||||||
$chapterLive->status = ChapterLiveModel::STATUS_INACTIVE;
|
|
||||||
|
|
||||||
$chapterLive->update();
|
|
||||||
|
|
||||||
$chapterRepo = new ChapterRepo();
|
|
||||||
|
|
||||||
$chapter = $chapterRepo->findById($chapterLive->chapter_id);
|
|
||||||
|
|
||||||
$attrs = $chapter->attrs;
|
|
||||||
$attrs['stream']['status'] = ChapterModel::SS_INACTIVE;
|
|
||||||
$chapter->attrs = $attrs;
|
|
||||||
|
|
||||||
$chapter->update();
|
|
||||||
|
|
||||||
$cache = new CourseChapterListCache();
|
|
||||||
|
|
||||||
$cache->rebuild($chapterLive->course_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '------ end close live task ------' . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查找待关闭直播
|
|
||||||
*
|
|
||||||
* @param int $limit
|
|
||||||
* @return ResultsetInterface|Resultset|ChapterLiveModel[]
|
|
||||||
*/
|
|
||||||
protected function findChapterLives(int $limit = 100)
|
|
||||||
{
|
|
||||||
$status = ChapterLiveModel::STATUS_ACTIVE;
|
|
||||||
$endTime = time() - 3600;
|
|
||||||
|
|
||||||
return ChapterLiveModel::query()
|
|
||||||
->where('status = :status:', ['status' => $status])
|
|
||||||
->andWhere('end_time < :end_time:', ['end_time' => $endTime])
|
|
||||||
->limit($limit)
|
|
||||||
->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -20,6 +20,8 @@ class CourseIndexTask extends Task
|
|||||||
* 搜索测试
|
* 搜索测试
|
||||||
*
|
*
|
||||||
* @command: php console.php course_index search {query}
|
* @command: php console.php course_index search {query}
|
||||||
|
* @param array $params
|
||||||
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
public function searchAction($params)
|
public function searchAction($params)
|
||||||
{
|
{
|
||||||
@ -29,9 +31,7 @@ class CourseIndexTask extends Task
|
|||||||
exit('please special a query word' . PHP_EOL);
|
exit('please special a query word' . PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$handler = new CourseSearcher();
|
$result = $this->searchCourses($query);
|
||||||
|
|
||||||
$result = $handler->search($query);
|
|
||||||
|
|
||||||
var_export($result);
|
var_export($result);
|
||||||
}
|
}
|
||||||
@ -42,6 +42,24 @@ class CourseIndexTask extends Task
|
|||||||
* @command: php console.php course_index clean
|
* @command: php console.php course_index clean
|
||||||
*/
|
*/
|
||||||
public function cleanAction()
|
public function cleanAction()
|
||||||
|
{
|
||||||
|
$this->cleanCourseIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重建索引
|
||||||
|
*
|
||||||
|
* @command: php console.php course_index rebuild
|
||||||
|
*/
|
||||||
|
public function rebuildAction()
|
||||||
|
{
|
||||||
|
$this->rebuildCourseIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空索引
|
||||||
|
*/
|
||||||
|
protected function cleanCourseIndex()
|
||||||
{
|
{
|
||||||
$handler = new CourseSearcher();
|
$handler = new CourseSearcher();
|
||||||
|
|
||||||
@ -56,10 +74,8 @@ class CourseIndexTask extends Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 重建索引
|
* 重建索引
|
||||||
*
|
|
||||||
* @command: php console.php course_index rebuild
|
|
||||||
*/
|
*/
|
||||||
public function rebuildAction()
|
protected function rebuildCourseIndex()
|
||||||
{
|
{
|
||||||
$courses = $this->findCourses();
|
$courses = $this->findCourses();
|
||||||
|
|
||||||
@ -67,7 +83,7 @@ class CourseIndexTask extends Task
|
|||||||
|
|
||||||
$handler = new CourseSearcher();
|
$handler = new CourseSearcher();
|
||||||
|
|
||||||
$doc = new CourseDocument();
|
$documenter = new CourseDocument();
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
$index = $handler->getXS()->getIndex();
|
||||||
|
|
||||||
@ -76,7 +92,7 @@ class CourseIndexTask extends Task
|
|||||||
$index->beginRebuild();
|
$index->beginRebuild();
|
||||||
|
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
$document = $doc->setDocument($course);
|
$document = $documenter->setDocument($course);
|
||||||
$index->add($document);
|
$index->add($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,39 +102,17 @@ class CourseIndexTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新索引缓存
|
* 搜索课程
|
||||||
*
|
*
|
||||||
* @command: php console.php course_index flush_index
|
* @param string $query
|
||||||
|
* @return array
|
||||||
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
public function flushIndexAction()
|
protected function searchCourses($query)
|
||||||
{
|
{
|
||||||
$handler = new CourseSearcher();
|
$handler = new CourseSearcher();
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
return $handler->search($query);
|
||||||
|
|
||||||
echo '------ start flush course index ------' . PHP_EOL;
|
|
||||||
|
|
||||||
$index->flushIndex();
|
|
||||||
|
|
||||||
echo '------ end flush course index ------' . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新搜索日志
|
|
||||||
*
|
|
||||||
* @command: php console.php course_index flush_logging
|
|
||||||
*/
|
|
||||||
public function flushLoggingAction()
|
|
||||||
{
|
|
||||||
$handler = new CourseSearcher();
|
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
|
||||||
|
|
||||||
echo '------ start flush course logging ------' . PHP_EOL;
|
|
||||||
|
|
||||||
$index->flushLogging();
|
|
||||||
|
|
||||||
echo '------ end flush course logging ------' . PHP_EOL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,7 +124,7 @@ class CourseIndexTask extends Task
|
|||||||
{
|
{
|
||||||
return CourseModel::query()
|
return CourseModel::query()
|
||||||
->where('published = 1')
|
->where('published = 1')
|
||||||
->andWhere('deleted = 0')
|
->where('deleted = 0')
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ class DeliverTask extends Task
|
|||||||
case OrderModel::ITEM_VIP:
|
case OrderModel::ITEM_VIP:
|
||||||
$this->handleVipOrder($order);
|
$this->handleVipOrder($order);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$this->noMatchedHandler($order);
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->status = OrderModel::STATUS_FINISHED;
|
$order->status = OrderModel::STATUS_FINISHED;
|
||||||
@ -153,6 +155,11 @@ class DeliverTask extends Task
|
|||||||
$this->closePendingOrders($user->id);
|
$this->closePendingOrders($user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function noMatchedHandler(OrderModel $order)
|
||||||
|
{
|
||||||
|
throw new \RuntimeException("No Matched Handler For Order: {$order->id}");
|
||||||
|
}
|
||||||
|
|
||||||
protected function closePendingOrders($userId)
|
protected function closePendingOrders($userId)
|
||||||
{
|
{
|
||||||
$orders = $this->findUserPendingOrders($userId);
|
$orders = $this->findUserPendingOrders($userId);
|
||||||
|
@ -10,7 +10,7 @@ namespace App\Console\Tasks;
|
|||||||
use App\Http\Admin\Services\Setting as SettingService;
|
use App\Http\Admin\Services\Setting as SettingService;
|
||||||
use App\Library\Utils\Password as PasswordUtil;
|
use App\Library\Utils\Password as PasswordUtil;
|
||||||
use App\Models\ChapterVod as ChapterVodModel;
|
use App\Models\ChapterVod as ChapterVodModel;
|
||||||
use App\Services\Utils\IndexPageCache as IndexPageCacheUtil;
|
use App\Services\Utils\IndexCourseCache as IndexCourseCacheUtil;
|
||||||
use App\Validators\Account as AccountValidator;
|
use App\Validators\Account as AccountValidator;
|
||||||
|
|
||||||
class MaintainTask extends Task
|
class MaintainTask extends Task
|
||||||
@ -26,7 +26,7 @@ class MaintainTask extends Task
|
|||||||
{
|
{
|
||||||
$section = $params[0] ?? null;
|
$section = $params[0] ?? null;
|
||||||
|
|
||||||
$util = new IndexPageCacheUtil();
|
$util = new IndexCourseCacheUtil();
|
||||||
|
|
||||||
$util->rebuild($section);
|
$util->rebuild($section);
|
||||||
|
|
||||||
@ -64,6 +64,34 @@ class MaintainTask extends Task
|
|||||||
echo '------ reset password success ------' . PHP_EOL;
|
echo '------ reset password success ------' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭验证码
|
||||||
|
*
|
||||||
|
* @command: php console.php maintain disable_captcha
|
||||||
|
*/
|
||||||
|
public function disableCaptchaAction()
|
||||||
|
{
|
||||||
|
$service = new SettingService();
|
||||||
|
|
||||||
|
$service->updateSettings('captcha', ['enabled' => 0]);
|
||||||
|
|
||||||
|
echo '------ disable captcha success ------' . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用验证码
|
||||||
|
*
|
||||||
|
* @command: php console.php maintain enable_captcha
|
||||||
|
*/
|
||||||
|
public function enableCaptchaAction()
|
||||||
|
{
|
||||||
|
$service = new SettingService();
|
||||||
|
|
||||||
|
$service->updateSettings('captcha', ['enabled' => 1]);
|
||||||
|
|
||||||
|
echo '------ enable captcha success ------' . PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭站点
|
* 关闭站点
|
||||||
*
|
*
|
||||||
|
@ -20,6 +20,8 @@ class QuestionIndexTask extends Task
|
|||||||
* 搜索测试
|
* 搜索测试
|
||||||
*
|
*
|
||||||
* @command: php console.php question_index search {query}
|
* @command: php console.php question_index search {query}
|
||||||
|
* @param array $params
|
||||||
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
public function searchAction($params)
|
public function searchAction($params)
|
||||||
{
|
{
|
||||||
@ -29,9 +31,7 @@ class QuestionIndexTask extends Task
|
|||||||
exit('please special a query word' . PHP_EOL);
|
exit('please special a query word' . PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$handler = new QuestionSearcher();
|
$result = $this->searchQuestions($query);
|
||||||
|
|
||||||
$result = $handler->search($query);
|
|
||||||
|
|
||||||
var_export($result);
|
var_export($result);
|
||||||
}
|
}
|
||||||
@ -42,6 +42,24 @@ class QuestionIndexTask extends Task
|
|||||||
* @command: php console.php question_index clean
|
* @command: php console.php question_index clean
|
||||||
*/
|
*/
|
||||||
public function cleanAction()
|
public function cleanAction()
|
||||||
|
{
|
||||||
|
$this->cleanQuestionIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重建索引
|
||||||
|
*
|
||||||
|
* @command: php console.php question_index rebuild
|
||||||
|
*/
|
||||||
|
public function rebuildAction()
|
||||||
|
{
|
||||||
|
$this->rebuildQuestionIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空索引
|
||||||
|
*/
|
||||||
|
protected function cleanQuestionIndex()
|
||||||
{
|
{
|
||||||
$handler = new QuestionSearcher();
|
$handler = new QuestionSearcher();
|
||||||
|
|
||||||
@ -56,10 +74,8 @@ class QuestionIndexTask extends Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 重建索引
|
* 重建索引
|
||||||
*
|
|
||||||
* @command: php console.php question_index rebuild
|
|
||||||
*/
|
*/
|
||||||
public function rebuildAction()
|
protected function rebuildQuestionIndex()
|
||||||
{
|
{
|
||||||
$questions = $this->findQuestions();
|
$questions = $this->findQuestions();
|
||||||
|
|
||||||
@ -67,7 +83,7 @@ class QuestionIndexTask extends Task
|
|||||||
|
|
||||||
$handler = new QuestionSearcher();
|
$handler = new QuestionSearcher();
|
||||||
|
|
||||||
$doc = new QuestionDocument();
|
$documenter = new QuestionDocument();
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
$index = $handler->getXS()->getIndex();
|
||||||
|
|
||||||
@ -76,7 +92,7 @@ class QuestionIndexTask extends Task
|
|||||||
$index->beginRebuild();
|
$index->beginRebuild();
|
||||||
|
|
||||||
foreach ($questions as $question) {
|
foreach ($questions as $question) {
|
||||||
$document = $doc->setDocument($question);
|
$document = $documenter->setDocument($question);
|
||||||
$index->add($document);
|
$index->add($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,39 +102,17 @@ class QuestionIndexTask extends Task
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 刷新索引缓存
|
* 搜索文章
|
||||||
*
|
*
|
||||||
* @command: php console.php question_index flush_index
|
* @param string $query
|
||||||
|
* @return array
|
||||||
|
* @throws \XSException
|
||||||
*/
|
*/
|
||||||
public function flushIndexAction()
|
protected function searchQuestions($query)
|
||||||
{
|
{
|
||||||
$handler = new QuestionSearcher();
|
$handler = new QuestionSearcher();
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
return $handler->search($query);
|
||||||
|
|
||||||
echo '------ start flush question index ------' . PHP_EOL;
|
|
||||||
|
|
||||||
$index->flushIndex();
|
|
||||||
|
|
||||||
echo '------ end flush question index ------' . PHP_EOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 刷新搜索日志
|
|
||||||
*
|
|
||||||
* @command: php console.php question_index flush_logging
|
|
||||||
*/
|
|
||||||
public function flushLoggingAction()
|
|
||||||
{
|
|
||||||
$handler = new QuestionSearcher();
|
|
||||||
|
|
||||||
$index = $handler->getXS()->getIndex();
|
|
||||||
|
|
||||||
echo '------ start flush question logging ------' . PHP_EOL;
|
|
||||||
|
|
||||||
$index->flushLogging();
|
|
||||||
|
|
||||||
echo '------ end flush question logging ------' . PHP_EOL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,6 +151,9 @@ class RefundTask extends Task
|
|||||||
case OrderModel::ITEM_VIP:
|
case OrderModel::ITEM_VIP:
|
||||||
$this->handleVipOrderRefund($order);
|
$this->handleVipOrderRefund($order);
|
||||||
break;
|
break;
|
||||||
|
case OrderModel::ITEM_REWARD:
|
||||||
|
$this->handleRewardOrderRefund($order);
|
||||||
|
break;
|
||||||
case OrderModel::ITEM_TEST:
|
case OrderModel::ITEM_TEST:
|
||||||
$this->handleTestOrderRefund($order);
|
$this->handleTestOrderRefund($order);
|
||||||
break;
|
break;
|
||||||
@ -227,6 +230,16 @@ class RefundTask extends Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理赞赏订单退款
|
||||||
|
*
|
||||||
|
* @param OrderModel $order
|
||||||
|
*/
|
||||||
|
protected function handleRewardOrderRefund(OrderModel $order)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理测试订单退款
|
* 处理测试订单退款
|
||||||
*
|
*
|
||||||
|
@ -177,13 +177,13 @@ class ServerMonitorTask extends Task
|
|||||||
|
|
||||||
$searcher = new CourseSearcher();
|
$searcher = new CourseSearcher();
|
||||||
|
|
||||||
$course = $searcher->search('id:1');
|
$user = $searcher->search('id:1');
|
||||||
|
|
||||||
$benchmark->stop();
|
$benchmark->stop();
|
||||||
|
|
||||||
$elapsedTime = $benchmark->getElapsedTime();
|
$elapsedTime = $benchmark->getElapsedTime();
|
||||||
|
|
||||||
if (empty($course)) {
|
if (empty($user)) {
|
||||||
return "xunsearch搜索失败";
|
return "xunsearch搜索失败";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class SitemapTask extends Task
|
|||||||
|
|
||||||
$this->sitemap = new Sitemap();
|
$this->sitemap = new Sitemap();
|
||||||
|
|
||||||
$filename = public_path('sitemap.xml');
|
$filename = tmp_path('sitemap.xml');
|
||||||
|
|
||||||
echo '------ start sitemap task ------' . PHP_EOL;
|
echo '------ start sitemap task ------' . PHP_EOL;
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ use GuzzleHttp\Client;
|
|||||||
class SyncAppInfoTask extends Task
|
class SyncAppInfoTask extends Task
|
||||||
{
|
{
|
||||||
|
|
||||||
const API_BASE_URL = 'https://www.koogua.com/api';
|
|
||||||
|
|
||||||
public function mainAction()
|
public function mainAction()
|
||||||
{
|
{
|
||||||
echo '------ start sync app info ------' . PHP_EOL;
|
echo '------ start sync app info ------' . PHP_EOL;
|
||||||
|
|
||||||
|
$url = 'https://www.koogua.com/api/instance/collect';
|
||||||
|
|
||||||
$site = $this->getSettings('site');
|
$site = $this->getSettings('site');
|
||||||
|
|
||||||
$serverHost = parse_url($site['url'], PHP_URL_HOST);
|
$serverHost = parse_url($site['url'], PHP_URL_HOST);
|
||||||
@ -38,8 +38,6 @@ class SyncAppInfoTask extends Task
|
|||||||
|
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
$url = sprintf('%s/instance/collect', self::API_BASE_URL);
|
|
||||||
|
|
||||||
$client->request('POST', $url, ['form_params' => $params]);
|
$client->request('POST', $url, ['form_params' => $params]);
|
||||||
|
|
||||||
echo '------ end sync app info ------' . PHP_EOL;
|
echo '------ end sync app info ------' . PHP_EOL;
|
||||||
|
@ -30,7 +30,7 @@ class TeacherLiveNoticeTask extends Task
|
|||||||
$keyName = $this->getCacheKeyName();
|
$keyName = $this->getCacheKeyName();
|
||||||
|
|
||||||
foreach ($lives as $live) {
|
foreach ($lives as $live) {
|
||||||
$redis->sAdd($keyName, $live->id);
|
$redis->sAdd($keyName, $live->chapter_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$redis->expire($keyName, 86400);
|
$redis->expire($keyName, 86400);
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://opensource.org/licenses/GPL-2.0
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Http\Admin\Controllers;
|
|
||||||
|
|
||||||
use App\Traits\Response as ResponseTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @RoutePrefix("/admin/koogua")
|
|
||||||
*/
|
|
||||||
class KooguaController extends \Phalcon\Mvc\Controller
|
|
||||||
{
|
|
||||||
|
|
||||||
use ResponseTrait;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/wiki", name="admin.koogua.wiki")
|
|
||||||
*/
|
|
||||||
public function wikiAction()
|
|
||||||
{
|
|
||||||
$url = 'https://www.koogua.com/page/wiki';
|
|
||||||
|
|
||||||
$this->response->redirect($url, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Get("/community", name="admin.koogua.community")
|
|
||||||
*/
|
|
||||||
public function communityAction()
|
|
||||||
{
|
|
||||||
|
|
||||||
$url = 'https://www.koogua.com/question/list';
|
|
||||||
|
|
||||||
return $this->response->redirect($url, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
namespace App\Http\Admin\Controllers;
|
namespace App\Http\Admin\Controllers;
|
||||||
|
|
||||||
use App\Http\Admin\Services\Upload as UploadService;
|
|
||||||
use App\Services\MyStorage as StorageService;
|
use App\Services\MyStorage as StorageService;
|
||||||
use App\Services\Vod as VodService;
|
use App\Services\Vod as VodService;
|
||||||
use App\Validators\Validator as AppValidator;
|
use App\Validators\Validator as AppValidator;
|
||||||
@ -41,9 +40,8 @@ class UploadController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $file->id,
|
|
||||||
'name' => $file->name,
|
|
||||||
'url' => $service->getImageUrl($file->path),
|
'url' => $service->getImageUrl($file->path),
|
||||||
|
'title' => $file->name,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->jsonSuccess(['data' => $data]);
|
return $this->jsonSuccess(['data' => $data]);
|
||||||
@ -63,9 +61,29 @@ class UploadController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $file->id,
|
|
||||||
'name' => $file->name,
|
|
||||||
'url' => $service->getImageUrl($file->path),
|
'url' => $service->getImageUrl($file->path),
|
||||||
|
'title' => $file->name,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->jsonSuccess(['data' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Post("/avatar/img", name="admin.upload.avatar_img")
|
||||||
|
*/
|
||||||
|
public function uploadAvatarImageAction()
|
||||||
|
{
|
||||||
|
$service = new StorageService();
|
||||||
|
|
||||||
|
$file = $service->uploadAvatarImage();
|
||||||
|
|
||||||
|
if (!$file) {
|
||||||
|
return $this->jsonError(['msg' => '上传文件失败']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'url' => $service->getImageUrl($file->path),
|
||||||
|
'title' => $file->name,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->jsonSuccess(['data' => $data]);
|
return $this->jsonSuccess(['data' => $data]);
|
||||||
@ -82,7 +100,7 @@ class UploadController extends Controller
|
|||||||
|
|
||||||
if (!$file) {
|
if (!$file) {
|
||||||
return $this->jsonError([
|
return $this->jsonError([
|
||||||
'message' => '上传文件失败',
|
'message' => '上传图片失败',
|
||||||
'error' => 1,
|
'error' => 1,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -98,25 +116,20 @@ class UploadController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function uploadDefaultImageAction()
|
public function uploadDefaultImageAction()
|
||||||
{
|
{
|
||||||
$service = new UploadService();
|
$service = new StorageService();
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
$items['category_icon'] = $service->uploadDefaultCategoryIcon();
|
|
||||||
$items['user_avatar'] = $service->uploadDefaultUserAvatar();
|
$items['user_avatar'] = $service->uploadDefaultUserAvatar();
|
||||||
$items['article_cover'] = $service->uploadDefaultArticleCover();
|
|
||||||
$items['course_cover'] = $service->uploadDefaultCourseCover();
|
$items['course_cover'] = $service->uploadDefaultCourseCover();
|
||||||
$items['package_cover'] = $service->uploadDefaultPackageCover();
|
$items['package_cover'] = $service->uploadDefaultPackageCover();
|
||||||
$items['topic_cover'] = $service->uploadDefaultTopicCover();
|
$items['topic_cover'] = $service->uploadDefaultTopicCover();
|
||||||
$items['slide_cover'] = $service->uploadDefaultSlideCover();
|
|
||||||
$items['gift_cover'] = $service->uploadDefaultGiftCover();
|
$items['gift_cover'] = $service->uploadDefaultGiftCover();
|
||||||
$items['vip_cover'] = $service->uploadDefaultVipCover();
|
$items['vip_cover'] = $service->uploadDefaultVipCover();
|
||||||
|
$items['category_icon'] = $service->uploadDefaultCategoryIcon();
|
||||||
|
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $item) {
|
||||||
$msg = sprintf('上传文件失败: %s', $key);
|
if (!$item) return $this->jsonError(['msg' => '上传文件失败']);
|
||||||
if (!$item) {
|
|
||||||
return $this->jsonError(['msg' => $msg]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->jsonSuccess(['msg' => '上传文件成功']);
|
return $this->jsonSuccess(['msg' => '上传文件成功']);
|
||||||
|
@ -9,8 +9,10 @@ namespace App\Http\Admin\Services;
|
|||||||
|
|
||||||
use App\Builders\ArticleList as ArticleListBuilder;
|
use App\Builders\ArticleList as ArticleListBuilder;
|
||||||
use App\Builders\ReportList as ReportListBuilder;
|
use App\Builders\ReportList as ReportListBuilder;
|
||||||
|
use App\Caches\Article as ArticleCache;
|
||||||
use App\Http\Admin\Services\Traits\AccountSearchTrait;
|
use App\Http\Admin\Services\Traits\AccountSearchTrait;
|
||||||
use App\Library\Paginator\Query as PagerQuery;
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
|
use App\Library\Utils\Word as WordUtil;
|
||||||
use App\Models\Article as ArticleModel;
|
use App\Models\Article as ArticleModel;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
use App\Models\Reason as ReasonModel;
|
use App\Models\Reason as ReasonModel;
|
||||||
@ -72,6 +74,10 @@ class Article extends Service
|
|||||||
|
|
||||||
$params = $this->handleAccountSearchParams($params);
|
$params = $this->handleAccountSearchParams($params);
|
||||||
|
|
||||||
|
if (!empty($params['xm_tag_ids'])) {
|
||||||
|
$params['tag_id'] = explode(',', $params['xm_tag_ids']);
|
||||||
|
}
|
||||||
|
|
||||||
$params['deleted'] = $params['deleted'] ?? 0;
|
$params['deleted'] = $params['deleted'] ?? 0;
|
||||||
|
|
||||||
$sort = $pagerQuery->getSort();
|
$sort = $pagerQuery->getSort();
|
||||||
@ -135,6 +141,7 @@ class Article extends Service
|
|||||||
$article->create();
|
$article->create();
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($user);
|
$this->recountUserArticles($user);
|
||||||
|
|
||||||
@ -192,8 +199,9 @@ class Article extends Service
|
|||||||
$data['published'] = $validator->checkPublishStatus($post['published']);
|
$data['published'] = $validator->checkPublishStatus($post['published']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['category_id'])) {
|
if (isset($post['category_id']) && !empty($post['category_id'])) {
|
||||||
$data['category_id'] = $validator->checkCategoryId($post['category_id']);
|
$category = $validator->checkCategory($post['category_id']);
|
||||||
|
$data['category_id'] = $category->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['xm_tag_ids'])) {
|
if (isset($post['xm_tag_ids'])) {
|
||||||
@ -205,6 +213,7 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -224,6 +233,7 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -243,6 +253,7 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($article);
|
$this->saveDynamicAttrs($article);
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -281,6 +292,7 @@ class Article extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
|
||||||
@ -316,6 +328,7 @@ class Article extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
}
|
}
|
||||||
@ -354,6 +367,7 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,6 +394,7 @@ class Article extends Service
|
|||||||
$owner = $this->findUser($article->owner_id);
|
$owner = $this->findUser($article->owner_id);
|
||||||
|
|
||||||
$this->recountUserArticles($owner);
|
$this->recountUserArticles($owner);
|
||||||
|
$this->rebuildArticleCache($article);
|
||||||
$this->rebuildArticleIndex($article);
|
$this->rebuildArticleIndex($article);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,6 +413,13 @@ class Article extends Service
|
|||||||
return $userRepo->findById($id);
|
return $userRepo->findById($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function rebuildArticleCache(ArticleModel $article)
|
||||||
|
{
|
||||||
|
$cache = new ArticleCache();
|
||||||
|
|
||||||
|
$cache->rebuild($article->id);
|
||||||
|
}
|
||||||
|
|
||||||
protected function rebuildArticleIndex(ArticleModel $article)
|
protected function rebuildArticleIndex(ArticleModel $article)
|
||||||
{
|
{
|
||||||
$sync = new ArticleIndexSync();
|
$sync = new ArticleIndexSync();
|
||||||
|
@ -251,16 +251,14 @@ class ChapterContent extends Service
|
|||||||
|
|
||||||
$content = $validator->checkContent($post['content']);
|
$content = $validator->checkContent($post['content']);
|
||||||
|
|
||||||
$read->content = $content;
|
$read->update(['content' => $content]);
|
||||||
|
|
||||||
$read->update();
|
|
||||||
|
|
||||||
$attrs = $chapter->attrs;
|
$attrs = $chapter->attrs;
|
||||||
|
|
||||||
$attrs['word_count'] = WordUtil::getWordCount($content);
|
$attrs['word_count'] = WordUtil::getWordCount($content);
|
||||||
$attrs['duration'] = WordUtil::getWordDuration($content);
|
$attrs['duration'] = WordUtil::getWordDuration($content);
|
||||||
$chapter->attrs = $attrs;
|
|
||||||
|
|
||||||
$chapter->update();
|
$chapter->update(['attrs' => $attrs]);
|
||||||
|
|
||||||
$this->updateCourseReadAttrs($read->course_id);
|
$this->updateCourseReadAttrs($read->course_id);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ class Course extends Service
|
|||||||
|
|
||||||
$params = $pagerQuery->getParams();
|
$params = $pagerQuery->getParams();
|
||||||
|
|
||||||
|
if (!empty($params['xm_tag_ids'])) {
|
||||||
|
$params['tag_id'] = explode(',', $params['xm_tag_ids']);
|
||||||
|
}
|
||||||
|
|
||||||
$params['deleted'] = $params['deleted'] ?? 0;
|
$params['deleted'] = $params['deleted'] ?? 0;
|
||||||
|
|
||||||
$sort = $pagerQuery->getSort();
|
$sort = $pagerQuery->getSort();
|
||||||
@ -159,17 +163,16 @@ class Course extends Service
|
|||||||
|
|
||||||
if (isset($post['published'])) {
|
if (isset($post['published'])) {
|
||||||
$data['published'] = $validator->checkPublishStatus($post['published']);
|
$data['published'] = $validator->checkPublishStatus($post['published']);
|
||||||
if ($post['published'] == 1) {
|
|
||||||
$validator->checkPublishAbility($course);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['category_id'])) {
|
if (isset($post['category_id']) && !empty($post['category_id'])) {
|
||||||
$data['category_id'] = $validator->checkCategoryId($post['category_id']);
|
$category = $validator->checkCategory($post['category_id']);
|
||||||
|
$data['category_id'] = $category->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['teacher_id'])) {
|
if (isset($post['teacher_id']) && !empty($post['teacher_id'])) {
|
||||||
$data['teacher_id'] = $validator->checkTeacherId($post['teacher_id']);
|
$teacher = $validator->checkTeacher($post['teacher_id']);
|
||||||
|
$data['teacher_id'] = $teacher->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['xm_tag_ids'])) {
|
if (isset($post['xm_tag_ids'])) {
|
||||||
|
@ -40,7 +40,7 @@ class CourseUser extends Service
|
|||||||
|
|
||||||
$sourceType = CourseUserModel::SOURCE_MANUAL;
|
$sourceType = CourseUserModel::SOURCE_MANUAL;
|
||||||
|
|
||||||
$this->assignUserCourse($course, $user, $expiryTime, $sourceType);
|
return $this->assignUserCourse($course, $user, $expiryTime, $sourceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUsers($id)
|
public function getUsers($id)
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
namespace App\Http\Admin\Services;
|
namespace App\Http\Admin\Services;
|
||||||
|
|
||||||
use App\Builders\HelpList as HelpListBuilder;
|
use App\Builders\HelpList as HelpListBuilder;
|
||||||
|
use App\Caches\Help as HelpCache;
|
||||||
|
use App\Caches\HelpList as HelpListCache;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
use App\Models\Help as HelpModel;
|
use App\Models\Help as HelpModel;
|
||||||
use App\Repos\Category as CategoryRepo;
|
use App\Repos\Category as CategoryRepo;
|
||||||
@ -63,15 +65,20 @@ class Help extends Service
|
|||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
$category = $validator->checkCategory($post['category_id']);
|
||||||
|
|
||||||
$data['title'] = $validator->checkTitle($post['title']);
|
$data['title'] = $validator->checkTitle($post['title']);
|
||||||
$data['content'] = $validator->checkContent($post['content']);
|
$data['content'] = $validator->checkContent($post['content']);
|
||||||
$data['priority'] = $validator->checkPriority($post['priority']);
|
$data['priority'] = $validator->checkPriority($post['priority']);
|
||||||
$data['category_id'] = $validator->checkCategoryId($post['category_id']);
|
$data['category_id'] = $category->id;
|
||||||
|
|
||||||
$help = new HelpModel();
|
$help = new HelpModel();
|
||||||
|
|
||||||
$help->create($data);
|
$help->create($data);
|
||||||
|
|
||||||
|
$this->rebuildHelpCache($help);
|
||||||
|
$this->rebuildHelpListCache();
|
||||||
|
|
||||||
return $help;
|
return $help;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +93,8 @@ class Help extends Service
|
|||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
if (isset($post['category_id'])) {
|
if (isset($post['category_id'])) {
|
||||||
$data['category_id'] = $validator->checkCategoryId($post['category_id']);
|
$category = $validator->checkCategory($post['category_id']);
|
||||||
|
$data['category_id'] = $category->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['title'])) {
|
if (isset($post['title'])) {
|
||||||
@ -111,6 +119,9 @@ class Help extends Service
|
|||||||
|
|
||||||
$help->update($data);
|
$help->update($data);
|
||||||
|
|
||||||
|
$this->rebuildHelpCache($help);
|
||||||
|
$this->rebuildHelpListCache();
|
||||||
|
|
||||||
return $help;
|
return $help;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +133,9 @@ class Help extends Service
|
|||||||
|
|
||||||
$help->update();
|
$help->update();
|
||||||
|
|
||||||
|
$this->rebuildHelpCache($help);
|
||||||
|
$this->rebuildHelpListCache();
|
||||||
|
|
||||||
return $help;
|
return $help;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +147,9 @@ class Help extends Service
|
|||||||
|
|
||||||
$help->update();
|
$help->update();
|
||||||
|
|
||||||
|
$this->rebuildHelpCache($help);
|
||||||
|
$this->rebuildHelpListCache();
|
||||||
|
|
||||||
return $help;
|
return $help;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +160,20 @@ class Help extends Service
|
|||||||
return $validator->checkHelp($id);
|
return $validator->checkHelp($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function rebuildHelpCache(HelpModel $help)
|
||||||
|
{
|
||||||
|
$cache = new HelpCache();
|
||||||
|
|
||||||
|
$cache->rebuild($help->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function rebuildHelpListCache()
|
||||||
|
{
|
||||||
|
$cache = new HelpListCache();
|
||||||
|
|
||||||
|
$cache->rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Resultset $helps
|
* @param Resultset $helps
|
||||||
* @return array|object
|
* @return array|object
|
||||||
|
@ -85,7 +85,6 @@ class Nav extends Service
|
|||||||
if ($parent) {
|
if ($parent) {
|
||||||
$nav->path = $parent->path . $nav->id . ',';
|
$nav->path = $parent->path . $nav->id . ',';
|
||||||
$nav->level = $parent->level + 1;
|
$nav->level = $parent->level + 1;
|
||||||
$nav->position = $parent->position;
|
|
||||||
} else {
|
} else {
|
||||||
$nav->path = ',' . $nav->id . ',';
|
$nav->path = ',' . $nav->id . ',';
|
||||||
$nav->level = 1;
|
$nav->level = 1;
|
||||||
@ -141,11 +140,6 @@ class Nav extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nav->parent_id > 0) {
|
|
||||||
$parent = $this->findOrFail($nav->parent_id);
|
|
||||||
$data['position'] = $parent->position;
|
|
||||||
}
|
|
||||||
|
|
||||||
$nav->update($data);
|
$nav->update($data);
|
||||||
|
|
||||||
$this->updateNavStats($nav);
|
$this->updateNavStats($nav);
|
||||||
|
@ -59,8 +59,9 @@ class Package extends Service
|
|||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
$price = $item->market_price > 0 ? sprintf("¥%0.2f", $item->market_price) : '免费';
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $item->market_price),
|
'name' => sprintf('%s - %s(¥%0.2f)', $item->id, $item->title, $price),
|
||||||
'value' => $item->id,
|
'value' => $item->id,
|
||||||
'selected' => in_array($item->id, $courseIds),
|
'selected' => in_array($item->id, $courseIds),
|
||||||
];
|
];
|
||||||
@ -151,7 +152,7 @@ class Package extends Service
|
|||||||
$package->update($data);
|
$package->update($data);
|
||||||
|
|
||||||
$this->handlePackagedCourses($package->id);
|
$this->handlePackagedCourses($package->id);
|
||||||
$this->recountPackageCourses($package->id);
|
$this->updatePackageCourseCount($package->id);
|
||||||
$this->rebuildPackageCache($package->id);
|
$this->rebuildPackageCache($package->id);
|
||||||
|
|
||||||
return $package;
|
return $package;
|
||||||
@ -216,7 +217,7 @@ class Package extends Service
|
|||||||
'course_id' => $courseId,
|
'course_id' => $courseId,
|
||||||
'package_id' => $package->id,
|
'package_id' => $package->id,
|
||||||
]);
|
]);
|
||||||
$this->recountCoursePackages($courseId);
|
$this->updateCoursePackageCount($courseId);
|
||||||
$this->rebuildCoursePackageCache($courseId);
|
$this->rebuildCoursePackageCache($courseId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +229,7 @@ class Package extends Service
|
|||||||
foreach ($deletedCourseIds as $courseId) {
|
foreach ($deletedCourseIds as $courseId) {
|
||||||
$coursePackage = $coursePackageRepo->findCoursePackage($courseId, $package->id);
|
$coursePackage = $coursePackageRepo->findCoursePackage($courseId, $package->id);
|
||||||
$coursePackage->delete();
|
$coursePackage->delete();
|
||||||
$this->recountCoursePackages($courseId);
|
$this->updateCoursePackageCount($courseId);
|
||||||
$this->rebuildCoursePackageCache($courseId);
|
$this->rebuildCoursePackageCache($courseId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,7 +249,7 @@ class Package extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function recountPackageCourses($packageId)
|
protected function updatePackageCourseCount($packageId)
|
||||||
{
|
{
|
||||||
$packageRepo = new PackageRepo();
|
$packageRepo = new PackageRepo();
|
||||||
|
|
||||||
@ -261,7 +262,7 @@ class Package extends Service
|
|||||||
$package->update();
|
$package->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function recountCoursePackages($courseId)
|
protected function updateCoursePackageCount($courseId)
|
||||||
{
|
{
|
||||||
$courseRepo = new CourseRepo();
|
$courseRepo = new CourseRepo();
|
||||||
|
|
||||||
@ -292,4 +293,15 @@ class Package extends Service
|
|||||||
$cache->rebuild($courseId);
|
$cache->rebuild($courseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function recountCoursePackages($courseId)
|
||||||
|
{
|
||||||
|
$courseRepo = new CourseRepo();
|
||||||
|
|
||||||
|
$course = $courseRepo->findById($courseId);
|
||||||
|
|
||||||
|
$course->package_count = $courseRepo->countPackages($courseId);
|
||||||
|
|
||||||
|
$course->update();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Admin\Services;
|
namespace App\Http\Admin\Services;
|
||||||
|
|
||||||
|
use App\Caches\Page as PageCache;
|
||||||
use App\Library\Paginator\Query as PagerQuery;
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
use App\Models\Page as PageModel;
|
use App\Models\Page as PageModel;
|
||||||
use App\Repos\Page as PageRepo;
|
use App\Repos\Page as PageRepo;
|
||||||
@ -52,6 +53,8 @@ class Page extends Service
|
|||||||
|
|
||||||
$page->create($data);
|
$page->create($data);
|
||||||
|
|
||||||
|
$this->rebuildPageCache($page);
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +96,8 @@ class Page extends Service
|
|||||||
|
|
||||||
$page->update($data);
|
$page->update($data);
|
||||||
|
|
||||||
|
$this->rebuildPageCache($page);
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +109,8 @@ class Page extends Service
|
|||||||
|
|
||||||
$page->update();
|
$page->update();
|
||||||
|
|
||||||
|
$this->rebuildPageCache($page);
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +122,8 @@ class Page extends Service
|
|||||||
|
|
||||||
$page->update();
|
$page->update();
|
||||||
|
|
||||||
|
$this->rebuildPageCache($page);
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,4 +134,11 @@ class Page extends Service
|
|||||||
return $validator->checkPage($id);
|
return $validator->checkPage($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function rebuildPageCache(PageModel $page)
|
||||||
|
{
|
||||||
|
$cache = new PageCache();
|
||||||
|
|
||||||
|
$cache->rebuild($page->id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Admin\Services;
|
namespace App\Http\Admin\Services;
|
||||||
|
|
||||||
|
use App\Caches\PointGift as PointGiftCache;
|
||||||
use App\Library\Paginator\Query as PagerQuery;
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
use App\Models\PointGift as PointGiftModel;
|
use App\Models\PointGift as PointGiftModel;
|
||||||
use App\Repos\Course as CourseRepo;
|
use App\Repos\Course as CourseRepo;
|
||||||
@ -115,6 +116,8 @@ class PointGift extends Service
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->rebuildPointGiftCache($gift);
|
||||||
|
|
||||||
return $gift;
|
return $gift;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +165,8 @@ class PointGift extends Service
|
|||||||
|
|
||||||
$gift->update($data);
|
$gift->update($data);
|
||||||
|
|
||||||
|
$this->rebuildPointGiftCache($gift);
|
||||||
|
|
||||||
return $gift;
|
return $gift;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +178,8 @@ class PointGift extends Service
|
|||||||
|
|
||||||
$gift->update();
|
$gift->update();
|
||||||
|
|
||||||
|
$this->rebuildPointGiftCache($gift);
|
||||||
|
|
||||||
return $gift;
|
return $gift;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,6 +191,8 @@ class PointGift extends Service
|
|||||||
|
|
||||||
$gift->update();
|
$gift->update();
|
||||||
|
|
||||||
|
$this->rebuildPointGiftCache($gift);
|
||||||
|
|
||||||
return $gift;
|
return $gift;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +203,13 @@ class PointGift extends Service
|
|||||||
return $validator->checkPointGift($id);
|
return $validator->checkPointGift($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function rebuildPointGiftCache(PointGiftModel $gift)
|
||||||
|
{
|
||||||
|
$cache = new PointGiftCache();
|
||||||
|
|
||||||
|
$cache->rebuild($gift->id);
|
||||||
|
}
|
||||||
|
|
||||||
protected function createCoursePointGift($post)
|
protected function createCoursePointGift($post)
|
||||||
{
|
{
|
||||||
$validator = new PointGiftValidator();
|
$validator = new PointGiftValidator();
|
||||||
|
@ -9,6 +9,7 @@ namespace App\Http\Admin\Services;
|
|||||||
|
|
||||||
use App\Builders\QuestionList as QuestionListBuilder;
|
use App\Builders\QuestionList as QuestionListBuilder;
|
||||||
use App\Builders\ReportList as ReportListBuilder;
|
use App\Builders\ReportList as ReportListBuilder;
|
||||||
|
use App\Caches\Question as QuestionCache;
|
||||||
use App\Http\Admin\Services\Traits\AccountSearchTrait;
|
use App\Http\Admin\Services\Traits\AccountSearchTrait;
|
||||||
use App\Library\Paginator\Query as PagerQuery;
|
use App\Library\Paginator\Query as PagerQuery;
|
||||||
use App\Models\Category as CategoryModel;
|
use App\Models\Category as CategoryModel;
|
||||||
@ -67,6 +68,10 @@ class Question extends Service
|
|||||||
|
|
||||||
$params = $this->handleAccountSearchParams($params);
|
$params = $this->handleAccountSearchParams($params);
|
||||||
|
|
||||||
|
if (!empty($params['xm_tag_ids'])) {
|
||||||
|
$params['tag_id'] = explode(',', $params['xm_tag_ids']);
|
||||||
|
}
|
||||||
|
|
||||||
$params['deleted'] = $params['deleted'] ?? 0;
|
$params['deleted'] = $params['deleted'] ?? 0;
|
||||||
|
|
||||||
$sort = $pagerQuery->getSort();
|
$sort = $pagerQuery->getSort();
|
||||||
@ -130,6 +135,7 @@ class Question extends Service
|
|||||||
$question->create();
|
$question->create();
|
||||||
|
|
||||||
$this->saveDynamicAttrs($question);
|
$this->saveDynamicAttrs($question);
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($user);
|
$this->recountUserQuestions($user);
|
||||||
|
|
||||||
@ -180,8 +186,9 @@ class Question extends Service
|
|||||||
$data['published'] = $validator->checkPublishStatus($post['published']);
|
$data['published'] = $validator->checkPublishStatus($post['published']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['category_id'])) {
|
if (isset($post['category_id']) && !empty($post['category_id'])) {
|
||||||
$data['category_id'] = $validator->checkCategoryId($post['category_id']);
|
$category = $validator->checkCategory($post['category_id']);
|
||||||
|
$data['category_id'] = $category->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['xm_tag_ids'])) {
|
if (isset($post['xm_tag_ids'])) {
|
||||||
@ -193,6 +200,7 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($question);
|
$this->saveDynamicAttrs($question);
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
|
||||||
@ -216,6 +224,7 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->saveDynamicAttrs($question);
|
$this->saveDynamicAttrs($question);
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
|
||||||
@ -234,6 +243,7 @@ class Question extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
|
||||||
@ -273,6 +283,7 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
|
|
||||||
return $question;
|
return $question;
|
||||||
@ -307,6 +318,7 @@ class Question extends Service
|
|||||||
|
|
||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
}
|
}
|
||||||
@ -345,6 +357,7 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,6 +384,7 @@ class Question extends Service
|
|||||||
$owner = $this->findUser($question->owner_id);
|
$owner = $this->findUser($question->owner_id);
|
||||||
|
|
||||||
$this->recountUserQuestions($owner);
|
$this->recountUserQuestions($owner);
|
||||||
|
$this->rebuildQuestionCache($question);
|
||||||
$this->rebuildQuestionIndex($question);
|
$this->rebuildQuestionIndex($question);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -389,6 +403,13 @@ class Question extends Service
|
|||||||
return $userRepo->findById($id);
|
return $userRepo->findById($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function rebuildQuestionCache(QuestionModel $question)
|
||||||
|
{
|
||||||
|
$cache = new QuestionCache();
|
||||||
|
|
||||||
|
$cache->rebuild($question->id);
|
||||||
|
}
|
||||||
|
|
||||||
protected function rebuildQuestionIndex(QuestionModel $question)
|
protected function rebuildQuestionIndex(QuestionModel $question)
|
||||||
{
|
{
|
||||||
$sync = new QuestionIndexSync();
|
$sync = new QuestionIndexSync();
|
||||||
|
@ -45,7 +45,7 @@ class Resource extends Service
|
|||||||
|
|
||||||
$this->recountCourseResources($course);
|
$this->recountCourseResources($course);
|
||||||
|
|
||||||
return $resource;
|
return $upload;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateResource($id)
|
public function updateResource($id)
|
||||||
@ -67,8 +67,6 @@ class Resource extends Service
|
|||||||
$upload->update($data);
|
$upload->update($data);
|
||||||
|
|
||||||
$resource->update();
|
$resource->update();
|
||||||
|
|
||||||
return $resource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteResource($id)
|
public function deleteResource($id)
|
||||||
@ -82,8 +80,6 @@ class Resource extends Service
|
|||||||
$resource->delete();
|
$resource->delete();
|
||||||
|
|
||||||
$this->recountCourseResources($course);
|
$this->recountCourseResources($course);
|
||||||
|
|
||||||
return $resource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function findOrFail($id)
|
protected function findOrFail($id)
|
||||||
|
@ -52,8 +52,8 @@ class Setting extends Service
|
|||||||
{
|
{
|
||||||
$alipay = $this->getSettings('pay.alipay');
|
$alipay = $this->getSettings('pay.alipay');
|
||||||
|
|
||||||
$alipay['return_url'] = $alipay['return_url'] ?: kg_full_url(['for' => 'home.alipay.callback']);
|
$alipay['return_url'] = $alipay['return_url'] ?: kg_full_url(['for' => 'home.alipay_callback']);
|
||||||
$alipay['notify_url'] = $alipay['notify_url'] ?: kg_full_url(['for' => 'home.alipay.notify']);
|
$alipay['notify_url'] = $alipay['notify_url'] ?: kg_full_url(['for' => 'home.alipay_notify']);
|
||||||
|
|
||||||
return $alipay;
|
return $alipay;
|
||||||
}
|
}
|
||||||
@ -62,8 +62,8 @@ class Setting extends Service
|
|||||||
{
|
{
|
||||||
$wxpay = $this->getSettings('pay.wxpay');
|
$wxpay = $this->getSettings('pay.wxpay');
|
||||||
|
|
||||||
$wxpay['return_url'] = $wxpay['return_url'] ?: kg_full_url(['for' => 'home.wxpay.callback']);
|
$wxpay['return_url'] = $wxpay['return_url'] ?: kg_full_url(['for' => 'home.wxpay_callback']);
|
||||||
$wxpay['notify_url'] = $wxpay['notify_url'] ?: kg_full_url(['for' => 'home.wxpay.notify']);
|
$wxpay['notify_url'] = $wxpay['notify_url'] ?: kg_full_url(['for' => 'home.wxpay_notify']);
|
||||||
|
|
||||||
return $wxpay;
|
return $wxpay;
|
||||||
}
|
}
|
||||||
@ -109,11 +109,11 @@ class Setting extends Service
|
|||||||
$result = $this->getSettings($section);
|
$result = $this->getSettings($section);
|
||||||
|
|
||||||
if ($section == 'live.notify') {
|
if ($section == 'live.notify') {
|
||||||
$result['stream_begin_url'] = $result['stream_begin_url'] ?: kg_full_url(['for' => 'home.live.notify'], ['action' => 'streamBegin']);
|
$result['stream_begin_url'] = $result['stream_begin_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'streamBegin']);
|
||||||
$result['stream_end_url'] = $result['stream_end_url'] ?: kg_full_url(['for' => 'home.live.notify'], ['action' => 'streamEnd']);
|
$result['stream_end_url'] = $result['stream_end_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'streamEnd']);
|
||||||
$result['record_url'] = $result['record_url'] ?: kg_full_url(['for' => 'home.live.notify'], ['action' => 'record']);
|
$result['record_url'] = $result['record_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'record']);
|
||||||
$result['snapshot_url'] = $result['snapshot_url'] ?: kg_full_url(['for' => 'home.live.notify'], ['action' => 'snapshot']);
|
$result['snapshot_url'] = $result['snapshot_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'snapshot']);
|
||||||
$result['porn_url'] = $result['porn_url'] ?: kg_full_url(['for' => 'home.live.notify'], ['action' => 'porn']);
|
$result['porn_url'] = $result['porn_url'] ?: kg_full_url(['for' => 'home.live_notify'], ['action' => 'porn']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -23,11 +23,11 @@ class Stat extends Service
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'title' => sprintf('%02d-%02d', $year, $month),
|
'title' => "{$year}-{$month}",
|
||||||
'sales' => $this->handleHotSales($type, $year, $month),
|
'sales' => $this->handleHotSales($type, $year, $month),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'title' => sprintf('%02d-%02d', $prev['year'], $prev['month']),
|
'title' => "{$prev['year']}-{$prev['month']}",
|
||||||
'sales' => $this->handleHotSales($type, $prev['year'], $prev['month']),
|
'sales' => $this->handleHotSales($type, $prev['year'], $prev['month']),
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@ -42,13 +42,12 @@ class Stat extends Service
|
|||||||
$currSales = $this->handleSales($year, $month);
|
$currSales = $this->handleSales($year, $month);
|
||||||
$prevSales = $this->handleSales($prev['year'], $prev['month']);
|
$prevSales = $this->handleSales($prev['year'], $prev['month']);
|
||||||
|
|
||||||
$currMonth = sprintf('%02d-%02d', $year, $month);
|
|
||||||
$prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']);
|
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
foreach (range(1, 31) as $day) {
|
foreach (range(1, 31) as $day) {
|
||||||
$date = sprintf('%02d', $day);
|
$date = sprintf('%02d', $day);
|
||||||
|
$prevMonth = "{$prev['year']}-{$prev['month']}";
|
||||||
|
$currMonth = "{$year}-{$month}";
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
$currMonth => $currSales[$date] ?? 0,
|
$currMonth => $currSales[$date] ?? 0,
|
||||||
@ -68,13 +67,12 @@ class Stat extends Service
|
|||||||
$currRefunds = $this->handleRefunds($year, $month);
|
$currRefunds = $this->handleRefunds($year, $month);
|
||||||
$prevRefunds = $this->handleRefunds($prev['year'], $prev['month']);
|
$prevRefunds = $this->handleRefunds($prev['year'], $prev['month']);
|
||||||
|
|
||||||
$currMonth = sprintf('%02d-%02d', $year, $month);
|
|
||||||
$prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']);
|
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
foreach (range(1, 31) as $day) {
|
foreach (range(1, 31) as $day) {
|
||||||
$date = sprintf('%02d', $day);
|
$date = sprintf('%02d', $day);
|
||||||
|
$prevMonth = "{$prev['year']}-{$prev['month']}";
|
||||||
|
$currMonth = "{$year}-{$month}";
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
$currMonth => $currRefunds[$date] ?? 0,
|
$currMonth => $currRefunds[$date] ?? 0,
|
||||||
@ -94,13 +92,12 @@ class Stat extends Service
|
|||||||
$currUsers = $this->handleRegisteredUsers($year, $month);
|
$currUsers = $this->handleRegisteredUsers($year, $month);
|
||||||
$prevUsers = $this->handleRegisteredUsers($prev['year'], $prev['month']);
|
$prevUsers = $this->handleRegisteredUsers($prev['year'], $prev['month']);
|
||||||
|
|
||||||
$currMonth = sprintf('%02d-%02d', $year, $month);
|
|
||||||
$prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']);
|
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
foreach (range(1, 31) as $day) {
|
foreach (range(1, 31) as $day) {
|
||||||
$date = sprintf('%02d', $day);
|
$date = sprintf('%02d', $day);
|
||||||
|
$prevMonth = "{$prev['year']}-{$prev['month']}";
|
||||||
|
$currMonth = "{$year}-{$month}";
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
$currMonth => $currUsers[$date] ?? 0,
|
$currMonth => $currUsers[$date] ?? 0,
|
||||||
@ -120,13 +117,12 @@ class Stat extends Service
|
|||||||
$currUsers = $this->handleOnlineUsers($year, $month);
|
$currUsers = $this->handleOnlineUsers($year, $month);
|
||||||
$prevUsers = $this->handleOnlineUsers($prev['year'], $prev['month']);
|
$prevUsers = $this->handleOnlineUsers($prev['year'], $prev['month']);
|
||||||
|
|
||||||
$currMonth = sprintf('%02d-%02d', $year, $month);
|
|
||||||
$prevMonth = sprintf('%02d-%02d', $prev['year'], $prev['month']);
|
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
|
|
||||||
foreach (range(1, 31) as $day) {
|
foreach (range(1, 31) as $day) {
|
||||||
$date = sprintf('%02d', $day);
|
$date = sprintf('%02d', $day);
|
||||||
|
$prevMonth = "{$prev['year']}-{$prev['month']}";
|
||||||
|
$currMonth = "{$year}-{$month}";
|
||||||
$items[] = [
|
$items[] = [
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
$currMonth => $currUsers[$date] ?? 0,
|
$currMonth => $currUsers[$date] ?? 0,
|
||||||
@ -158,10 +154,7 @@ class Stat extends Service
|
|||||||
|
|
||||||
protected function isCurrMonth($year, $month)
|
protected function isCurrMonth($year, $month)
|
||||||
{
|
{
|
||||||
$yearOk = date('Y') == $year;
|
return date('Y-m') == "{$year}-{$month}";
|
||||||
$monthOk = date('m') == $month;
|
|
||||||
|
|
||||||
return $yearOk && $monthOk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getLifetime()
|
protected function getLifetime()
|
||||||
|
@ -15,28 +15,31 @@ trait AccountSearchTrait
|
|||||||
|
|
||||||
protected function handleAccountSearchParams($params)
|
protected function handleAccountSearchParams($params)
|
||||||
{
|
{
|
||||||
$key = null;
|
|
||||||
|
|
||||||
if (isset($params['user_id'])) {
|
|
||||||
$key = 'user_id';
|
|
||||||
} elseif (isset($params['owner_id'])) {
|
|
||||||
$key = 'owner_id';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($key == null) return $params;
|
|
||||||
|
|
||||||
$accountRepo = new AccountRepo();
|
$accountRepo = new AccountRepo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 兼容用户编号|手机号码|邮箱地址查询
|
* 兼容用户编号|手机号码|邮箱地址查询
|
||||||
*/
|
*/
|
||||||
if (!empty($params[$key])) {
|
if (!empty($params['user_id'])) {
|
||||||
if (CommonValidator::phone($params[$key])) {
|
if (CommonValidator::phone($params['user_id'])) {
|
||||||
$account = $accountRepo->findByPhone($params[$key]);
|
$account = $accountRepo->findByPhone($params['user_id']);
|
||||||
$params[$key] = $account ? $account->id : -1000;
|
$params['user_id'] = $account ? $account->id : -1000;
|
||||||
} elseif (CommonValidator::email($params[$key])) {
|
} elseif (CommonValidator::email($params['user_id'])) {
|
||||||
$account = $accountRepo->findByEmail($params[$key]);
|
$account = $accountRepo->findByEmail($params['user_id']);
|
||||||
$params[$key] = $account ? $account->id : -1000;
|
$params['user_id'] = $account ? $account->id : -1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兼容用户编号|手机号码|邮箱地址查询
|
||||||
|
*/
|
||||||
|
if (!empty($params['owner_id'])) {
|
||||||
|
if (CommonValidator::phone($params['owner_id'])) {
|
||||||
|
$account = $accountRepo->findByPhone($params['owner_id']);
|
||||||
|
$params['owner_id'] = $account ? $account->id : -1000;
|
||||||
|
} elseif (CommonValidator::email($params['owner_id'])) {
|
||||||
|
$account = $accountRepo->findByEmail($params['owner_id']);
|
||||||
|
$params['owner_id'] = $account ? $account->id : -1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,153 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
|
|
||||||
* @license https://opensource.org/licenses/GPL-2.0
|
|
||||||
* @link https://www.koogua.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Http\Admin\Services;
|
|
||||||
|
|
||||||
|
|
||||||
use App\Services\MyStorage;
|
|
||||||
|
|
||||||
class Upload extends Service
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var MyStorage
|
|
||||||
*/
|
|
||||||
protected $storage;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->storage = new MyStorage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认用户头像
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultUserAvatar()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/user_avatar.png');
|
|
||||||
|
|
||||||
$key = '/img/default/user_avatar.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认课程封面
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultCourseCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/course_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/course_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认套餐封面
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultPackageCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/package_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/package_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认话题封面
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultTopicCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/topic_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/topic_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认会员封面
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultVipCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/vip_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/vip_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认专栏封面
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultArticleCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/article_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/article_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认礼品封面
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultGiftCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/gift_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/gift_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认轮播图片
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultSlideCover()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/slide_cover.png');
|
|
||||||
|
|
||||||
$key = '/img/default/slide_cover.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传默认分类图标
|
|
||||||
*
|
|
||||||
* @return false|mixed|string
|
|
||||||
*/
|
|
||||||
public function uploadDefaultCategoryIcon()
|
|
||||||
{
|
|
||||||
$filename = static_path('admin/img/default/category_icon.png');
|
|
||||||
|
|
||||||
$key = '/img/default/category_icon.png';
|
|
||||||
|
|
||||||
return $this->storage->putFile($key, $filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -142,7 +142,7 @@ class User extends Service
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
if ($adminRole > 0) {
|
if ($adminRole > 0) {
|
||||||
$this->recountRoleUsers($adminRole);
|
$this->updateAdminUserCount($adminRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->rebuildUserCache($user);
|
$this->rebuildUserCache($user);
|
||||||
@ -204,10 +204,6 @@ class User extends Service
|
|||||||
$data['vip'] = $validator->checkVipStatus($post['vip']);
|
$data['vip'] = $validator->checkVipStatus($post['vip']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['locked'])) {
|
|
||||||
$data['locked'] = $validator->checkLockStatus($post['locked']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($post['vip_expiry_time'])) {
|
if (!empty($post['vip_expiry_time'])) {
|
||||||
$data['vip_expiry_time'] = $validator->checkVipExpiryTime($post['vip_expiry_time']);
|
$data['vip_expiry_time'] = $validator->checkVipExpiryTime($post['vip_expiry_time']);
|
||||||
if ($data['vip_expiry_time'] < time()) {
|
if ($data['vip_expiry_time'] < time()) {
|
||||||
@ -215,6 +211,10 @@ class User extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($post['locked'])) {
|
||||||
|
$data['locked'] = $validator->checkLockStatus($post['locked']);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($post['lock_expiry_time'])) {
|
if (!empty($post['lock_expiry_time'])) {
|
||||||
$data['lock_expiry_time'] = $validator->checkLockExpiryTime($post['lock_expiry_time']);
|
$data['lock_expiry_time'] = $validator->checkLockExpiryTime($post['lock_expiry_time']);
|
||||||
if ($data['lock_expiry_time'] < time()) {
|
if ($data['lock_expiry_time'] < time()) {
|
||||||
@ -231,11 +231,11 @@ class User extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($oldAdminRole > 0) {
|
if ($oldAdminRole > 0) {
|
||||||
$this->recountRoleUsers($oldAdminRole);
|
$this->updateAdminUserCount($oldAdminRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->admin_role > 0) {
|
if ($user->admin_role > 0) {
|
||||||
$this->recountRoleUsers($user->admin_role);
|
$this->updateAdminUserCount($user->admin_role);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->rebuildUserCache($user);
|
$this->rebuildUserCache($user);
|
||||||
@ -347,7 +347,7 @@ class User extends Service
|
|||||||
$apiAuth->logoutClients($user->id);
|
$apiAuth->logoutClients($user->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function recountRoleUsers($roleId)
|
protected function updateAdminUserCount($roleId)
|
||||||
{
|
{
|
||||||
$roleRepo = new RoleRepo();
|
$roleRepo = new RoleRepo();
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
{% block include_js %}
|
{% block include_js %}
|
||||||
|
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -39,6 +39,7 @@
|
|||||||
{% block include_js %}
|
{% block include_js %}
|
||||||
|
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -14,7 +14,7 @@
|
|||||||
<span><a href="{{ owner_url }}" target="_blank">{{ answer.owner.name }}</a></span>
|
<span><a href="{{ owner_url }}" target="_blank">{{ answer.owner.name }}</a></span>
|
||||||
<span>{{ date('Y-m-d H:i:s',answer.create_time) }}</span>
|
<span>{{ date('Y-m-d H:i:s',answer.create_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content ke-content kg-zoom">{{ answer.content }}</div>
|
<div class="content ke-content">{{ answer.content }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset class="layui-elem-field layui-field-title">
|
<fieldset class="layui-elem-field layui-field-title">
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<span><a href="{{ owner_url }}" target="_blank">{{ answer.owner.name }}</a></span>
|
<span><a href="{{ owner_url }}" target="_blank">{{ answer.owner.name }}</a></span>
|
||||||
<span>{{ date('Y-m-d H:i:s',answer.create_time) }}</span>
|
<span>{{ date('Y-m-d H:i:s',answer.create_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content ke-content kg-zoom">{{ answer.content }}</div>
|
<div class="content ke-content">{{ answer.content }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
{{ js_include('lib/xm-select.js') }}
|
{{ js_include('lib/xm-select.js') }}
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
{{ js_include('admin/js/cover.upload.js') }}
|
{{ js_include('admin/js/cover.upload.js') }}
|
||||||
|
|
||||||
@ -47,9 +48,9 @@
|
|||||||
xmSelect.render({
|
xmSelect.render({
|
||||||
el: '#xm-tag-ids',
|
el: '#xm-tag-ids',
|
||||||
name: 'xm_tag_ids',
|
name: 'xm_tag_ids',
|
||||||
max: 5,
|
max: 3,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
filterMethod: function (val, item) {
|
filterMethod: function (val, item, index, prop) {
|
||||||
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
data: {{ xm_tags|json_encode }}
|
data: {{ xm_tags|json_encode }}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<span><a href="{{ owner_url }}" target="_blank">{{ article.owner.name }}</a></span>
|
<span><a href="{{ owner_url }}" target="_blank">{{ article.owner.name }}</a></span>
|
||||||
<span>{{ date('Y-m-d H:i:s',article.create_time) }}</span>
|
<span>{{ date('Y-m-d H:i:s',article.create_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content ke-content kg-zoom">{{ article.content }}</div>
|
<div class="content ke-content">{{ article.content }}</div>
|
||||||
{% if article.tags %}
|
{% if article.tags %}
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
{% for item in article.tags %}
|
{% for item in article.tags %}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<span><a href="{{ owner_url }}" target="_blank">{{ article.owner.name }}</a></span>
|
<span><a href="{{ owner_url }}" target="_blank">{{ article.owner.name }}</a></span>
|
||||||
<span>{{ date('Y-m-d H:i:s',article.create_time) }}</span>
|
<span>{{ date('Y-m-d H:i:s',article.create_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content ke-content kg-zoom">{{ article.content }}</div>
|
<div class="content ke-content">{{ article.content }}</div>
|
||||||
{% if article.tags %}
|
{% if article.tags %}
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
{% for item in article.tags %}
|
{% for item in article.tags %}
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
<th>用户IP</th>
|
<th>用户IP</th>
|
||||||
<th>请求路由</th>
|
<th>请求路由</th>
|
||||||
<th>请求路径</th>
|
<th>请求路径</th>
|
||||||
<th>创建时间</th>
|
<th>请求时间</th>
|
||||||
<th>操作</th>
|
<th>请求内容</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">用户IP</label>
|
<label class="layui-form-label">用户名称</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input class="layui-input" type="text" name="user_ip" placeholder="用户IP精确匹配">
|
<input class="layui-input" type="text" name="user_name" placeholder="用户名称精确匹配">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label">创建时间</label>
|
<label class="layui-form-label">请求时间</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input class="layui-input time-range" type="text" name="start_time" autocomplete="off">
|
<input class="layui-input time-range" type="text" name="start_time" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div class="kg-nav-left">
|
<div class="kg-nav-left">
|
||||||
<span class="layui-breadcrumb">
|
<span class="layui-breadcrumb">
|
||||||
{% if parent.id > 0 %}
|
{% if parent.id > 0 %}
|
||||||
<a href="{{ back_url }}"><i class="layui-icon layui-icon-return"></i>返回</a>
|
<a class="kg-back" href="{{ back_url }}"><i class="layui-icon layui-icon-return"></i>返回</a>
|
||||||
<a><cite>{{ parent.name }}</cite></a>
|
<a><cite>{{ parent.name }}</cite></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a><cite>分类管理</cite></a>
|
<a><cite>分类管理</cite></a>
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
{% if chapter.model == 3 %}
|
{% if chapter.model == 3 %}
|
||||||
|
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
|
|
||||||
{% elseif chapter.model == 1 %}
|
{% elseif chapter.model == 1 %}
|
||||||
@ -88,7 +89,7 @@
|
|||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
title: '推流测试',
|
title: '推流测试',
|
||||||
area: ['720px', '540px'],
|
area: ['720px', '500px'],
|
||||||
content: [url, 'no']
|
content: [url, 'no']
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
<div class="kg-nav">
|
<div class="kg-nav">
|
||||||
<div class="kg-nav-left">
|
<div class="kg-nav-left">
|
||||||
<span class="layui-breadcrumb">
|
<span class="layui-breadcrumb">
|
||||||
<a href="{{ back_url }}"><i class="layui-icon layui-icon-return"></i>返回</a>
|
<a class="kg-back" href="{{ back_url }}"><i class="layui-icon layui-icon-return"></i>返回</a>
|
||||||
<a><cite>{{ course.title }}</cite></a>
|
<a><cite>{{ course.title }}</cite></a>
|
||||||
<a><cite>{{ chapter.title }}</cite></a>
|
<a><cite>{{ chapter.title }}</cite></a>
|
||||||
<a><cite>课时管理</cite></a>
|
<a><cite>课时管理</cite></a>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<span><a href="{{ owner_url }}" target="_blank">{{ comment.owner.name }}</a></span>
|
<span><a href="{{ owner_url }}" target="_blank">{{ comment.owner.name }}</a></span>
|
||||||
<span>{{ date('Y-m-d H:i:s',comment.create_time) }}</span>
|
<span>{{ date('Y-m-d H:i:s',comment.create_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">{{ comment.content }}</div>
|
<div class="content ke-content">{{ comment.content }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset class="layui-elem-field layui-field-title">
|
<fieldset class="layui-elem-field layui-field-title">
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<span><a href="{{ owner_url }}" target="_blank">{{ comment.owner.name }}</a></span>
|
<span><a href="{{ owner_url }}" target="_blank">{{ comment.owner.name }}</a></span>
|
||||||
<span>{{ date('Y-m-d H:i:s',comment.create_time) }}</span>
|
<span>{{ date('Y-m-d H:i:s',comment.create_time) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">{{ comment.content }}</div>
|
<div class="content ke-content">{{ comment.content }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
name: 'course_id',
|
name: 'course_id',
|
||||||
filterable: true,
|
filterable: true,
|
||||||
radio: true,
|
radio: true,
|
||||||
filterMethod: function (val, item) {
|
filterMethod: function (val, item, index, prop) {
|
||||||
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
data: {{ xm_courses|json_encode }}
|
data: {{ xm_courses|json_encode }}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div class="kg-nav">
|
<div class="kg-nav">
|
||||||
<div class="kg-nav-left">
|
<div class="kg-nav-left">
|
||||||
<span class="layui-breadcrumb">
|
<span class="layui-breadcrumb">
|
||||||
<a href="{{ back_url }}"><i class="layui-icon layui-icon-return"></i>返回</a>
|
<a class="kg-back" href="{{ back_url }}"><i class="layui-icon layui-icon-return"></i>返回</a>
|
||||||
<a><cite>{{ course.title }}</cite></a>
|
<a><cite>{{ course.title }}</cite></a>
|
||||||
<a><cite>章节管理</cite></a>
|
<a><cite>章节管理</cite></a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
{{ js_include('lib/xm-select.js') }}
|
{{ js_include('lib/xm-select.js') }}
|
||||||
{{ js_include('lib/cos-js-sdk-v5.min.js') }}
|
{{ js_include('lib/cos-js-sdk-v5.min.js') }}
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
{{ js_include('admin/js/cover.upload.js') }}
|
{{ js_include('admin/js/cover.upload.js') }}
|
||||||
{{ js_include('admin/js/course.resource.js') }}
|
{{ js_include('admin/js/course.resource.js') }}
|
||||||
@ -65,7 +66,7 @@
|
|||||||
name: 'xm_tag_ids',
|
name: 'xm_tag_ids',
|
||||||
max: 5,
|
max: 5,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
filterMethod: function (val, item) {
|
filterMethod: function (val, item, index, prop) {
|
||||||
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
data: {{ xm_tags|json_encode }}
|
data: {{ xm_tags|json_encode }}
|
||||||
@ -77,7 +78,7 @@
|
|||||||
max: 10,
|
max: 10,
|
||||||
autoRow: true,
|
autoRow: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
filterMethod: function (val, item) {
|
filterMethod: function (val, item, index, prop) {
|
||||||
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
return item.name.toLowerCase().indexOf(val.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
data: {{ xm_courses|json_encode }}
|
data: {{ xm_courses|json_encode }}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="kg-nav-right">
|
<div class="kg-nav-right">
|
||||||
<a class="layui-btn layui-btn-sm" href="{{ category_url }}">
|
<a class="layui-btn layui-btn-sm" href="{{ category_url }}">
|
||||||
<i class="layui-icon layui-icon-add-1"></i>课程分类
|
<i class="layui-icon layui-icon-add-1"></i>分类管理
|
||||||
</a>
|
</a>
|
||||||
<a class="layui-btn layui-btn-sm" href="{{ add_url }}">
|
<a class="layui-btn layui-btn-sm" href="{{ add_url }}">
|
||||||
<i class="layui-icon layui-icon-add-1"></i>添加课程
|
<i class="layui-icon layui-icon-add-1"></i>添加课程
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<table class="kg-table layui-table">
|
<table class="kg-table layui-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>名称</th>
|
<th>名称</th>
|
||||||
|
<th>类型</th>
|
||||||
<th>大小</th>
|
<th>大小</th>
|
||||||
<th>日期</th>
|
<th>日期</th>
|
||||||
<th width="15%">操作</th>
|
<th width="15%">操作</th>
|
||||||
@ -12,6 +13,7 @@
|
|||||||
{% set delete_url = url({'for':'admin.resource.delete','id':item.id}) %}
|
{% set delete_url = url({'for':'admin.resource.delete','id':item.id}) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><input class="layui-input res-name" type="text" value="{{ item.upload.name }}" data-url="{{ update_url }}"></td>
|
<td><input class="layui-input res-name" type="text" value="{{ item.upload.name }}" data-url="{{ update_url }}"></td>
|
||||||
|
<td>{{ item.upload.mime }}</td>
|
||||||
<td>{{ item.upload.size|human_size }}</td>
|
<td>{{ item.upload.size|human_size }}</td>
|
||||||
<td>{{ date('Y-m-d H:i:s',item.create_time) }}</td>
|
<td>{{ date('Y-m-d H:i:s',item.create_time) }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
{% block include_js %}
|
{% block include_js %}
|
||||||
|
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -62,6 +62,7 @@
|
|||||||
{% block include_js %}
|
{% block include_js %}
|
||||||
|
|
||||||
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
{{ js_include('lib/kindeditor/kindeditor.min.js') }}
|
||||||
|
{{ js_include('lib/kindeditor/lang/zh-CN.js') }}
|
||||||
{{ js_include('admin/js/content.editor.js') }}
|
{{ js_include('admin/js/content.editor.js') }}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -15,7 +15,7 @@
|
|||||||
<div class="layui-header">
|
<div class="layui-header">
|
||||||
<div class="layui-logo">{{ site_info.title }}</div>
|
<div class="layui-logo">{{ site_info.title }}</div>
|
||||||
<div class="kg-side-menu-bar">
|
<div class="kg-side-menu-bar">
|
||||||
<a href="javascript:" title="关闭左侧菜单"><i class="layui-icon layui-icon-spread-left"></i></a>
|
<a href="javascript:"><i class="layui-icon layui-icon-spread-left"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="layui-nav layui-layout-left kg-nav-module">
|
<ul class="layui-nav layui-layout-left kg-nav-module">
|
||||||
<li class="layui-nav-item">
|
<li class="layui-nav-item">
|
||||||
@ -28,16 +28,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="layui-nav layui-layout-right">
|
<ul class="layui-nav layui-layout-right">
|
||||||
<li class="layui-nav-item">
|
|
||||||
<a href="{{ url({'for':'home.index'}) }}" target="_blank">前台首页</a>
|
|
||||||
</li>
|
|
||||||
<li class="layui-nav-item">
|
|
||||||
<a href="javascript:">用户服务</a>
|
|
||||||
<dl class="layui-nav-child">
|
|
||||||
<dd><a href="{{ url({'for':'admin.koogua.wiki'}) }}" target="_blank">系统文档</a></dd>
|
|
||||||
<dd><a href="{{ url({'for':'admin.koogua.community'}) }}" target="_blank">开源社区</a></dd>
|
|
||||||
</dl>
|
|
||||||
</li>
|
|
||||||
<li class="layui-nav-item">
|
<li class="layui-nav-item">
|
||||||
<a href="javascript:">{{ auth_user.name }}</a>
|
<a href="javascript:">{{ auth_user.name }}</a>
|
||||||
<dl class="layui-nav-child">
|
<dl class="layui-nav-child">
|
||||||
@ -46,6 +36,9 @@
|
|||||||
<dd><a href="{{ url({'for':'admin.logout'}) }}">退出登录</a></dd>
|
<dd><a href="{{ url({'for':'admin.logout'}) }}">退出登录</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="{{ url({'for':'home.index'}) }}" target="_blank">前台</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-side layui-bg-black">
|
<div class="layui-side layui-bg-black">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="25%">
|
<col width="100">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<div class="layui-card layui-text">
|
<div class="layui-card layui-text" xmlns="http://www.w3.org/1999/html">
|
||||||
<div class="layui-card-header">服务器信息</div>
|
<div class="layui-card-header">服务器信息</div>
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="25%">
|
<col width="100">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table class="layui-table">
|
<table class="layui-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="25%">
|
<col width="100">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user