1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-29 11:22:22 +08:00

Compare commits

...

335 Commits

Author SHA1 Message Date
xiaochong0302
2c9f3b7577 补充course_user中教师来源类型 2025-06-19 10:02:10 +08:00
xiaochong0302
13b3327b2f 教师可访问其教授课程 2025-06-18 15:45:44 +08:00
xiaochong0302
247050f4ef Merge branch 'koogua/v1.7.8'
# Conflicts:
#	public/static/admin/js/avatar.upload.js
2025-06-15 16:51:20 +08:00
xiaochong0302
57409cb630 v1.7.8 2025-06-15 15:08:42 +08:00
xiaochong0302
4e1e8340b9 1.添加closeLiveTask
2.优化kg-back返回
3.优化统计分析代码位置
2025-06-11 15:01:23 +08:00
xiaochong0302
2ab6ae71cd 1.优化直播状态显示
2.优化关闭注册提示
2025-06-09 22:46:28 +08:00
xiaochong0302
303442f446 搜索结果中图片alt属性增加striptags过滤 2025-06-09 19:08:33 +08:00
xiaochong0302
7281029dd0 sitemap.xml直接写入public目录 2025-06-05 17:53:06 +08:00
xiaochong0302
f5ed2ce239 优化fixbar电话图标 2025-05-26 19:19:12 +08:00
xiaochong0302
2a1b4b69fd fixbar增加电话图标 2025-05-26 10:41:17 +08:00
xiaochong0302
123e1ec97f 后台重置头像->上传头像 2025-05-23 17:03:58 +08:00
xiaochong0302
b2f795eb3b 还原几个不能为空的腾讯云配置 2025-05-22 23:31:26 +08:00
xiaochong0302
12db90d9c1 还原几个不能为空的腾讯云配置 2025-05-22 23:31:12 +08:00
xiaochong0302
59bfe4a765 gitee webhook测试 2025-05-21 11:05:18 +08:00
xiaochong0302
fb0b760e2e 1.优化后台配置默认值
2.后台增加返回顶部功能
3.精简优化逻辑
2025-05-20 18:09:19 +08:00
xiaochong0302
e31b86580d 优化课时列表直播提示 2025-05-20 18:09:15 +08:00
xiaochong0302
f2a446a876 移除Throttle 2025-05-20 18:09:12 +08:00
xiaochong0302
27440fe679 1.优化后台配置默认值
2.后台增加返回顶部功能
3.精简优化逻辑
2025-05-20 18:06:11 +08:00
xiaochong0302
7a9fee5545 优化课时列表直播提示 2025-05-08 17:18:20 +08:00
xiaochong0302
d927e619e8 移除Throttle 2025-05-02 07:55:38 +08:00
xiaochong0302
77cdc594ff 优化layer窗口中表单的跳转 2025-04-20 17:05:30 +08:00
xiaochong0302
0d8b07033a 优化layer窗口中表单的跳转 2025-04-20 17:03:36 +08:00
xiaochong0302
9ad15b72cf 优化倒计时 2025-04-20 17:03:32 +08:00
xiaochong0302
12f0f6dc87 重命令若干路由 2025-04-20 17:03:28 +08:00
xiaochong0302
3efa081e81 LiveChapter -> LiveChat 2025-04-20 17:03:24 +08:00
xiaochong0302
47a6c5cce1 修正workerman中onMessage无法调用问题 2025-04-20 17:03:20 +08:00
xiaochong0302
328aea1e2d 1.优化章节列表UI
2.优化评价UI
2025-04-20 17:03:17 +08:00
xiaochong0302
e5869e1e8f 1.优化课程目录UI
2.优化收藏UI
3.修正收费课程试听问题
2025-04-20 17:03:14 +08:00
xiaochong0302
9fcea65989 1.优化vip页面
2.优化索引管理工具
2025-04-20 17:03:11 +08:00
xiaochong0302
08d3859e38 1.抽离refund.info.js
2.优化获取临时令牌日志
2025-04-03 19:02:48 +08:00
xiaochong0302
02983a27c9 优化微信公众号相关 2025-04-03 19:02:45 +08:00
xiaochong0302
72deb17daa 增强注册验证 2025-04-03 19:02:42 +08:00
xiaochong0302
76edeef591 v1.7.6 2025-03-19 22:09:45 +08:00
xiaochong0302
9c737c7241 更新layui-v2.9.25 2025-03-19 22:09:41 +08:00
xiaochong0302
21f9bdd4b1 去除不必要的deliver阻断 2025-03-19 22:09:36 +08:00
xiaochong0302
9b0700e5c1 统一支付和登录二维码样式 2025-03-19 22:09:23 +08:00
xiaochong0302
054ab77f08 去除多余的引入 2025-03-11 18:51:50 +08:00
xiaochong0302
90ab9bc018 修正文章和问题缓存 2025-03-11 18:48:58 +08:00
xiaochong0302
77b7224901 限制全文搜索长度为50 2025-03-11 18:48:55 +08:00
xiaochong0302
f5665bc94a 修正SiteVisit积分问题 2025-02-25 16:41:48 +08:00
xiaochong0302
2b08bf737d v1.7.5 2025-02-22 16:03:56 +08:00
xiaochong0302
fce99c2472 优化编辑器页 2025-02-20 20:10:24 +08:00
xiaochong0302
5854d86875 整理categoryId相关 2025-02-20 20:10:21 +08:00
xiaochong0302
e22f3b4bdc 精简优化错误处理机制 2025-02-17 20:16:15 +08:00
xiaochong0302
3070231ca8 优化错误处理机制 2025-02-17 12:42:11 +08:00
xiaochong0302
38f8e27c9c 修正用户注册时502 bad gateway 2025-02-16 13:14:34 +08:00
xiaochong0302
fb7301de4c 1.优化Nav导航
2.优化logo样式
2025-02-16 13:14:31 +08:00
xiaochong0302
9206166910 1.优化后台数据统计日期问题
2.优化内容图片放大查看
2025-02-16 13:14:17 +08:00
xiaochong0302
97af1081d3 修正root账号初始数据 2025-01-10 21:14:37 +08:00
xiaochong0302
2d26c2659b 统一规范$this->response->redirect 2025-01-08 17:42:39 +08:00
xiaochong0302
f273e874e7 Merge branch 'koogua/v1.7.5' 2025-01-05 21:34:33 +08:00
xiaochong0302
b919239308 v1.7.5 release 2025-01-05 21:33:29 +08:00
xiaochong0302
9d210deedf 去除过度设计的缓存 2025-01-05 20:51:54 +08:00
xiaochong0302
09723a9d34 优化积分兑换页 2025-01-05 09:21:45 +08:00
xiaochong0302
9d8ed0f863 还原分页中kg_array_object 2025-01-04 17:21:29 +08:00
xiaochong0302
e27a203ac8 精简整理代码 2025-01-02 11:29:06 +08:00
xiaochong0302
c3887845a9 更新QQ支持群 2024-12-28 14:40:18 +08:00
xiaochong0302
4d810eae98 更新QQ支持群 2024-12-28 14:39:29 +08:00
xiaochong0302
601c71b8a4 精简代码 2024-12-27 21:21:29 +08:00
xiaochong0302
3a6d295aa1 精简判断 2024-12-24 10:56:02 +08:00
xiaochong0302
6614cdc8d2 1.优化boostrap
2.优化logger
3.优化contact
2024-12-16 20:27:40 +08:00
xiaochong0302
0f38ce7d62 1.优化搜索索引
2.优化服务状态监控
3.优化ChapterUserTrait
2024-12-13 08:37:31 +08:00
xiaochong0302
6f005f741c Merge remote-tracking branch 'origin/master' 2024-12-08 16:00:41 +08:00
xiaochong0302
9a51f95d26 v1.7.4 release 2024-12-07 18:23:43 +08:00
xiaochong0302
41cb93d6d5 升级layui-v2.9.20 2024-12-07 11:35:57 +08:00
xiaochong0302
978b77a184 优化CourseUserTrait等 2024-12-06 21:56:49 +08:00
xiaochong0302
98cc8da285 1.精简AccountSearchTrait
2.优化CsrfToken
3.优化kg_setting
4.修正CommentInfo
2024-12-02 17:14:31 +08:00
xiaochong0302
a0e7bce18b 优化kg_h5_index_url() 2024-11-14 17:26:35 +08:00
xiaochong0302
9811186434 修正chapter详情页目录中当前课时高亮问题 2024-11-13 21:59:10 +08:00
xiaochong0302
cdc8074f88 联系方式增加抖音二维码 2024-11-10 22:26:37 +08:00
xiaochong0302
0f446fef10 优化课程期限 2024-11-09 20:38:29 +08:00
xiaochong0302
7ff6f470aa 优化定时自动提交 2024-11-09 20:38:15 +08:00
xiaochong0302
5b30d5d880 优化定时自动提交 2024-11-09 20:37:43 +08:00
xiaochong0302
f482a8ec9e 优化课程期限 2024-10-20 19:32:33 +08:00
xiaochong0302
2302f44c03 Merge branch 'koogua/v1.7.3' 2024-10-10 21:01:29 +08:00
xiaochong0302
4ec6f60b06 v1.7.3 release 2024-10-10 21:00:33 +08:00
xiaochong0302
fa8d27d668 v1.7.3 release 2024-10-10 20:59:23 +08:00
xiaochong0302
a24ea6149e 更新layui-v2.9.16 2024-09-21 11:09:49 +08:00
xiaochong0302
978f064e2b 增加编辑器内容自动提交 2024-09-18 10:23:02 +08:00
xiaochong0302
a360ce0f83 1.优化findUserActiveSessions
2.优化findUserActiveTokens
3.修改文章和提问可用tag数量
4.优化用户锁定相关
2024-09-14 08:32:33 +08:00
xiaochong0302
9b37570a78 1.优化默认文件上传
2.上传文件失败抛出异常
2024-08-13 19:47:38 +08:00
xiaochong0302
86efc64651 Merge branch 'koogua/v1.7.2' 2024-08-13 09:29:06 +08:00
xiaochong0302
d5353ff5d2 1.增加log.trace日志配置
2.migration抽象增加saveSetting方法
2024-08-13 09:27:26 +08:00
xiaochong0302
3a703dd0e1 1.redis增加expire()方法
2.精简代码
2024-07-30 20:06:17 +08:00
xiaochong0302
7c5ea7fe34 后台增加客户服务入口 2024-07-27 08:30:03 +08:00
xiaochong0302
17691a6a1b 修正课程列表分类筛选条件 2024-07-25 11:51:28 +08:00
xiaochong0302
759253cfc5 修正TeacherLiveNotice 2024-07-24 14:21:53 +08:00
xiaochong0302
0f5ed61158 更新layui-v2.9.14 2024-07-12 17:46:01 +08:00
xiaochong0302
e39c140d35 整理doc参数 2024-07-05 20:30:56 +08:00
xiaochong0302
91a878ba98 整理doc参数 2024-07-05 20:30:32 +08:00
xiaochong0302
56f94d3ea8 修正邮件内容格式化 2024-07-04 15:31:24 +08:00
xiaochong0302
36ee91c1cf 修正邮件内容格式化 2024-07-04 15:31:00 +08:00
xiaochong0302
8aaed108b9 Merge branch 'koogua/v1.7.1' 2024-07-01 10:03:35 +08:00
xiaochong0302
4a5cc68915 优化公众号关注订阅 2024-07-01 09:24:29 +08:00
xiaochong0302
f0470c027d 优化邮件发送格式化 2024-06-29 21:26:53 +08:00
xiaochong0302
703d5cbc3d 短信发送处理中增加描述对照 2024-06-28 20:41:45 +08:00
xiaochong0302
f04c23e90f 1.添加课程和章节事件监听
2.优化SEO类
2024-06-28 08:26:28 +08:00
xiaochong0302
b55350a9a4 整理文件,去除无用代码 2024-06-23 08:16:59 +08:00
xiaochong0302
0aa07da41b 整理文件,去除无用代码 2024-06-23 08:16:20 +08:00
xiaochong0302
f66dab48ec Merge branch 'koogua/v1.7.1' 2024-06-21 10:06:14 +08:00
xiaochong0302
2014d99c7e 更新layui-v2.9.10 2024-06-21 09:59:13 +08:00
xiaochong0302
3efdc0698e 课程增加是否能够发布检查 2024-06-12 15:52:24 +08:00
xiaochong0302
675ee63674 清理创建kindeditor默认语言文件 2024-06-12 12:37:59 +08:00
xiaochong0302
14534b8461 去除课程打赏 2024-06-08 15:40:09 +08:00
xiaochong0302
30d9b80ca8 更新文件mimeType 2024-06-02 16:50:35 +08:00
xiaochong0302
17b7f64de7 1.优化富文本内容显示样式
2.简化内容图片放大监听
2024-06-01 16:27:15 +08:00
xiaochong0302
8e618b5bc7 更新mimeTypes 2024-05-29 20:49:23 +08:00
xiaochong0302
4467f8748f 优化FileInfo中MimeType检查 2024-05-28 17:31:39 +08:00
xiaochong0302
45125453e0 iconfont资源本地化 2024-05-28 17:19:52 +08:00
xiaochong0302
200a0b0d16 1.优化storage上传mimeType检查
2.增加打开/关闭左侧菜单提示
2024-05-26 11:49:02 +08:00
xiaochong0302
272a3255d2 优化UploadController 2024-05-26 11:48:18 +08:00
xiaochong0302
dfb88ee09e 1.优化storage上传mimeType检查
2.增加打开/关闭左侧菜单提示
2024-05-25 21:55:04 +08:00
xiaochong0302
0c962920de connect_list增加过滤条件 2024-05-18 09:28:39 +08:00
xiaochong0302
b0b28117f5 connect_list增加过滤条件 2024-05-18 09:28:01 +08:00
xiaochong0302
e22a716aa5 1.调整微信公众号模板消息 2024-05-17 15:46:18 +08:00
xiaochong0302
dd469752e1 1.调整微信公众号模板消息 2024-05-17 15:45:58 +08:00
xiaochong0302
f5ba565f99 修正课程列表顶部过滤条件部分无法收缩问题 2024-05-16 21:29:26 +08:00
xiaochong0302
d0921a8afd 修正课程列表顶部过滤条件部分无法收缩问题 2024-05-16 21:29:02 +08:00
xiaochong0302
fba681a4b5 移除consult中多余的chapter_id属性 2024-05-16 16:46:33 +08:00
xiaochong0302
56f66c01bd 调整微信公众号模板消息 2024-05-16 11:29:19 +08:00
xiaochong0302
8a5aa01d1c 支付限额1w->10w 2024-05-13 18:52:57 +08:00
xiaochong0302
a31c991b1c 1.优化ShareUrl
2.第三方登录增加账号可用性判断
3.优化公众号关注相关
2024-05-12 19:17:57 +08:00
xiaochong0302
b2eb5d56d3 Merge branch 'koogua/v1.6.9' 2024-05-10 09:41:19 +08:00
xiaochong0302
0c30cda0c3 v1.7.0 2024-05-09 21:40:40 +08:00
xiaochong0302
a0e8e932e1 v1.7.0 2024-05-09 21:37:23 +08:00
xiaochong0302
bd14979e9b 调整编辑器htmlTags属性 2024-05-05 21:52:13 +08:00
xiaochong0302
4e80f3938a 登录后台同时登录前台 2024-05-02 11:04:21 +08:00
xiaochong0302
9addc3debe 调整编辑器条目 2024-04-29 16:26:59 +08:00
xiaochong0302
e24cf1bd1c 1.调整编辑器条目
2.增加代码块复制
2024-04-28 21:17:36 +08:00
xiaochong0302
c355709d03 Merge branch 'koogua/v1.6.9' 2024-04-24 15:42:19 +08:00
xiaochong0302
2b3372c8e8 更新layui-v2.9.8 2024-04-24 15:20:16 +08:00
xiaochong0302
a790cf878b 清理无用的Captcha配置 2024-04-23 22:52:35 +08:00
xiaochong0302
4171039f16 contact改QQ上传二维码图片 2024-04-23 22:12:34 +08:00
xiaochong0302
9a29e21441 contact改QQ上传二维码图片 2024-04-23 22:12:23 +08:00
xiaochong0302
502bd8588d 修正contact二维码图片上传上传 2024-04-23 20:59:15 +08:00
xiaochong0302
621123ee3d 修正contact二维码图片上传上传 2024-04-23 20:58:44 +08:00
xiaochong0302
0d6420ef16 修正logo,favicon上传 2024-04-20 10:50:02 +08:00
xiaochong0302
547bb72910 修正logo,favicon上传 2024-04-20 10:49:37 +08:00
xiaochong0302
046db8877c Merge branch 'koogua/v1.6.9'
# Conflicts:
#	app/Validators/Security.php
2024-04-13 08:05:15 +08:00
xiaochong0302
c968a3a69f v1.6.9 2024-04-10 19:42:48 +08:00
xiaochong0302
d31ae5b7be 1.修正chapter_user中duration重复计数的问题 2024-04-10 18:58:55 +08:00
xiaochong0302
65b0bf1678 补充缺失的CourseUserTrait 2024-04-10 17:10:18 +08:00
xiaochong0302
af4b570681 增加删除和还原用户功能 2024-04-08 10:59:19 +08:00
xiaochong0302
d95b218812 优化CourseUserTrait 2024-04-06 22:27:43 +08:00
xiaochong0302
d3623b2654 优化CategoryTreeList 2024-04-02 10:48:33 +08:00
xiaochong0302
b96c711a6f 更新layui-v2.9.7 2024-03-24 21:00:17 +08:00
xiaochong0302
89145284aa 1.Response增加unauthorized响应
2.open_avatar字段增加长度为255
3.清理无用的代码
2024-03-13 08:57:55 +08:00
xiaochong0302
00cb8bf963 1.拆解migration创建表脚本
2.增加post方式传递csrf_token
3.优化storage上传
2024-02-26 09:56:51 +08:00
xiaochong0302
c304fbd423 1.修正home模块编辑器图片上传
2.精简CsrfToken白名单
2024-02-04 16:59:08 +08:00
xiaochong0302
2506ea4078 1.优化文章和提问搜索条件
2.优化课程详情页排版
2024-02-04 16:57:13 +08:00
xiaochong0302
542e96846f 1.修正home模块编辑器图片上传
2.精简CsrfToken白名单
2024-02-02 20:58:22 +08:00
xiaochong0302
3b18267c6f 1.删除chapter中resource_count,consult_count属性
2.重新统计course中resource_count
2024-01-31 18:06:01 +08:00
xiaochong0302
c4259d78f3 1.删除chapter中resource_count,consult_count属性
2.重新统计course中resource_count
2024-01-31 18:01:25 +08:00
xiaochong0302
6a5c4845dc 修正首页缓存刷新问题 2024-01-30 17:54:32 +08:00
xiaochong0302
9b7a244fa3 修正首页缓存刷新问题 2024-01-30 17:54:09 +08:00
xiaochong0302
d0091f4695 Merge branch 'koogua/v1.6.8'
# Conflicts:
#	app/Http/Admin/Views/chapter/lessons.volt
#	app/Http/Admin/Views/chapter/lessons_live.volt
#	app/Http/Admin/Views/chapter/lessons_offline.volt
#	app/Http/Admin/Views/chapter/lessons_read.volt
#	app/Http/Admin/Views/chapter/lessons_vod.volt
2024-01-30 12:02:00 +08:00
xiaochong0302
01587189cb v1.6.8发布 2024-01-30 11:47:15 +08:00
xiaochong0302
45dfa0d269 去除league/commonmark包 2024-01-25 21:45:01 +08:00
xiaochong0302
56e04fc3a3 优化分类等必选判断 2024-01-22 12:37:58 +08:00
xiaochong0302
3079a9855a 修正course_user中active_time未更新问题 2024-01-11 20:42:54 +08:00
xiaochong0302
ebc609ac19 修正chapter_user表中plan_id=0问题 2024-01-11 20:31:09 +08:00
xiaochong0302
486ac7bd69 修正chapter_user表中plan_id=0问题 2024-01-11 20:30:28 +08:00
xiaochong0302
5e1ca229ec 修正课时评论管理链接 2024-01-11 18:51:52 +08:00
xiaochong0302
680f1cf1bc 修复sync_learning时,course_user未更新active_time问题 2024-01-11 13:00:24 +08:00
xiaochong0302
b67011c041 修复主页simple模式免费课程模块样式问题 2024-01-08 11:21:49 +08:00
xiaochong0302
fd2e8d2aee 1.优化错误处理
2.更新layui2.9.3
2024-01-07 09:31:50 +08:00
xiaochong0302
78d538c816 清理代码 2023-12-30 15:23:53 +08:00
xiaochong0302
5ce45971e6 优化AccountSearchTrait 2023-12-28 21:31:59 +08:00
xiaochong0302
33fc75b9f8 1.精简chapter/lessons.volt
2.使用ServiceTrait精简代码
2023-12-27 16:05:23 +08:00
xiaochong0302
59e27e1443 修正用户active_time搜索条件 2023-12-25 20:18:41 +08:00
xiaochong0302
ce9f0eade0 修正用户active_time搜索条件 2023-12-25 20:18:13 +08:00
xiaochong0302
411ffe8f1c 统一layui-skin=switch属性位置 2023-12-21 09:30:41 +08:00
xiaochong0302
decf80273a 统一layui-skin=switch属性位置 2023-12-21 09:26:48 +08:00
xiaochong0302
db82de6f35 修正plan_id格式问题 2023-12-20 21:54:01 +08:00
xiaochong0302
52aa85b2ae 修正plan_id格式问题 2023-12-20 21:53:47 +08:00
xiaochong0302
6c33dbc724 修正课时发布switch开关问题 2023-12-20 21:39:25 +08:00
xiaochong0302
2714a048f8 修正课时发布switch开关问题 2023-12-20 21:38:27 +08:00
xiaochong0302
dd0c26d6ad v1.6.8 start 2023-12-20 21:17:10 +08:00
xiaochong0302
8e40019939 Merge branch 'koogua/v1.6.7' 2023-12-13 20:54:01 +08:00
xiaochong0302
fb01e61332 去除分类必选限制 2023-12-13 20:20:51 +08:00
xiaochong0302
da0cc73c12 优化变量名和排版 2023-12-13 12:53:35 +08:00
xiaochong0302
b192760deb 优化相关文章和问题 2023-12-12 17:18:24 +08:00
xiaochong0302
e0da7b71b3 调整内容缓存时间 2023-12-12 16:19:04 +08:00
xiaochong0302
56f909b5d2 调整推荐课程缓存时间 2023-12-11 17:47:07 +08:00
xiaochong0302
c859deec44 vip.js -> vip.index.js 2023-12-11 12:56:43 +08:00
xiaochong0302
435bc12035 增加问题推荐 2023-12-11 12:23:42 +08:00
xiaochong0302
dca1ccf79a 优化排版 2023-12-10 20:55:26 +08:00
xiaochong0302
817b32b067 放弃部分地方缓存的使用 2023-12-09 19:02:05 +08:00
xiaochong0302
51428ac97a 补充遗漏的批量删除点击事件 2023-12-09 09:01:18 +08:00
xiaochong0302
8f22cab282 优化批量删除后的跳转 2023-12-08 20:17:39 +08:00
xiaochong0302
982b1d5ca7 删除多余文件 2023-12-07 20:57:25 +08:00
xiaochong0302
f3fcb6956a beta 2023-12-07 17:09:28 +08:00
xiaochong0302
3dd5490bdb 阶段性优化 2023-12-06 20:24:09 +08:00
xiaochong0302
5268e6370c Merge remote-tracking branch 'origin/koogua/v1.6.7' into koogua/v1.6.7 2023-12-04 19:47:11 +08:00
xiaochong0302
79a678fa54 阶段性优化 2023-12-04 19:46:54 +08:00
xiaochong0302
0072b4f5fe 精简代码 2023-10-29 22:30:14 +08:00
koogua
51de0ed94b 字数统计加上图片字数 2023-10-01 11:05:53 +08:00
xiaochong0302
26e3e94881 修正绑定邮箱password未定义错误 2023-09-22 20:42:13 +08:00
xiaochong0302
0a86fc3f05 修正绑定邮箱password未定义错误 2023-09-22 20:41:42 +08:00
xiaochong0302
e905e7cb96 修正课程课件资源列表权限 2023-09-18 06:53:05 +08:00
xiaochong0302
2c881547b4 修正课程课件资源列表权限 2023-09-18 06:52:57 +08:00
xiaochong0302
7d54f0e933 增加匿名评价 2023-09-16 21:44:23 +08:00
xiaochong0302
1bef24f217 1.kg_course表增加索引
2.优化错误页
3.优化富文本内容长度获取
4.优化layer关闭窗口后发布状态同步
2023-09-16 20:51:31 +08:00
xiaochong0302
0dec52806b 优化直播测试的streamName解析 2023-09-04 10:53:47 +08:00
xiaochong0302
241d802fe1 直播页分享地址:full_url->share_url 2023-09-04 10:38:10 +08:00
xiaochong0302
66bd0965d6 去除课时列表中的课件属性 2023-09-03 10:54:55 +08:00
xiaochong0302
40380132a2 Merge branch 'koogua/v1.6.6'
# Conflicts:
#	app/Http/Admin/Services/Resource.php
2023-08-31 17:41:09 +08:00
xiaochong0302
ebd310caa6 v1.6.6 2023-08-31 17:18:05 +08:00
xiaochong0302
138b9d45ce 日常优化 2023-08-28 15:55:40 +08:00
xiaochong0302
504bf6d8e6 去除删除远程COS课件的逻辑 2023-08-11 15:54:11 +08:00
xiaochong0302
65b5190a05 去除删除远程COS课件的逻辑 2023-08-11 15:53:41 +08:00
xiaochong0302
f284a8ef92 修正邮箱注册提交按钮不可用问题 2023-08-03 16:57:15 +08:00
xiaochong0302
c584f25455 修正邮箱注册提交按钮不可用问题 2023-08-03 16:56:18 +08:00
xiaochong0302
85ba7911ac 优化cleanDemoDataTask 2023-08-02 17:59:47 +08:00
xiaochong0302
190117146f 优化tag表migration 2023-08-02 17:18:25 +08:00
xiaochong0302
c0e44a76d0 v1.6.6开始 2023-07-23 18:56:49 +08:00
xiaochong0302
0c9256751d 优化AuthTrait 2023-07-11 09:55:21 +08:00
xiaochong0302
1c0af6fa1e 去除后台登录页的captcha检查 2023-07-10 17:40:18 +08:00
xiaochong0302
4f18d78356 去除后台登录页的无用captcha代码 2023-07-10 15:08:44 +08:00
xiaochong0302
621b921862 v1.6.5发布说明 2023-07-05 16:58:42 +08:00
xiaochong0302
e48d831ce3 1.清理无用代码
2.递归函数增加返回值
2023-07-03 18:51:20 +08:00
xiaochong0302
30ece511df 1.优化日志清理
2.增加cli下带色输出
2023-07-03 16:23:11 +08:00
xiaochong0302
b519fd4d6d 1.去除腾讯验证码
2.使用本地验证码
2023-06-25 18:48:55 +08:00
xiaochong0302
fca03feb35 清理layui扩展引入 2023-06-24 17:00:54 +08:00
xiaochong0302
71898bf5ec 清理无用的计划任务 2023-06-23 19:57:21 +08:00
xiaochong0302
cf80b3c878 更新layui-v2.8.8 2023-06-23 19:50:51 +08:00
xiaochong0302
44b5633f23 更新layui-v2.8.8 2023-06-20 21:16:59 +08:00
xiaochong0302
f0fdd6ebbb 修正图文分享链接参数问题 2023-06-19 14:05:41 +08:00
xiaochong0302
c9ddb0abab 修正钉钉机器人webhook配置 2023-06-17 18:51:06 +08:00
xiaochong0302
13ff32343d Merge branch 'koogua/v1.6.4' 2023-06-15 21:45:30 +08:00
xiaochong0302
41c4fc45b2 更新版本号v1.6.4 2023-06-15 19:45:15 +08:00
xiaochong0302
9159e28b51 v1.6.4 2023-06-15 19:40:44 +08:00
xiaochong0302
36ef6ca37b 优化课程章节handleMeInfo 2023-06-15 18:55:31 +08:00
xiaochong0302
a72f44225f 1.优化课程章节权限
2.优化钉钉机器人
2023-06-15 18:05:27 +08:00
xiaochong0302
f7a3c0d736 优化Providers 2023-06-15 11:39:26 +08:00
xiaochong0302
fb5feb0759 优化通知 2023-06-15 11:32:59 +08:00
xiaochong0302
ce2329a71c 优化用户课程查找 2023-06-15 10:55:17 +08:00
xiaochong0302
5985576065 1.优化语法层面
2.增加推荐课程|文章|考试widget
2023-05-23 17:27:14 +08:00
xiaochong0302
cced354b2a Merge branch 'koogua/v1.6.4' of https://gitee.com/koogua/course-tencent-cloud into koogua/v1.6.4 2023-05-22 21:14:00 +08:00
xiaochong0302
f094f10011 恢复误删的AnswerList 2023-05-22 21:13:50 +08:00
koogua
2a055d9ad4 更新composer包 2023-05-22 19:20:14 +08:00
xiaochong0302
e3e5d20a7c 纠正单词评选错误 2023-05-12 18:52:11 +08:00
xiaochong0302
7322d1fc0d 优化分享URL 2023-05-11 21:54:20 +08:00
koogua
84d21d80da 优化me相关信息 2023-05-10 21:08:15 +08:00
xiaochong0302
772380adcd 优化订单确认页样式 2023-05-09 11:29:47 +08:00
xiaochong0302
5405e1652e 优化订单确认页样式 2023-05-09 11:26:02 +08:00
xiaochong0302
259859fae6 修正验证登录空口令问题 2023-05-08 23:41:39 +08:00
xiaochong0302
251c1348fa 修正验证登录空口令问题 2023-05-08 23:38:10 +08:00
xiaochong0302
a581b0d493 Merge branch 'koogua/v1.6.3' 2023-05-07 21:00:31 +08:00
xiaochong0302
464527fe67 v1.6.3 2023-05-07 20:59:01 +08:00
xiaochong0302
1b1c048cca 优化htmlprufier处理 2023-05-07 18:12:00 +08:00
xiaochong0302
d59a63079a 过滤html实体编码xss 2023-05-07 16:25:16 +08:00
xiaochong0302
5ca47be92c 优化课程过滤分组条件样式 2023-05-06 14:48:13 +08:00
xiaochong0302
a343b3c5f5 更新layui-v2.8.2 2023-05-05 15:37:46 +08:00
xiaochong0302
c639f89c7b 替换xiaochong0302/ip2region 2023-05-03 17:23:08 +08:00
xiaochong0302
bba2842967 升级layui-v2.8.1 2023-05-03 15:52:44 +08:00
xiaochong0302
14b2e1df20 优化语法相关 2023-05-03 15:18:54 +08:00
xiaochong0302
56bbb7d6fe 优化排序条件,改善分页重复问题 2023-03-08 19:49:01 +08:00
xiaochong0302
5a061ad9fb 修正手续费率设置为0无效的问题 2023-03-05 17:03:48 +08:00
xiaochong0302
fcd15c1a5f 去除未支付“新鲜”订单检查 2023-03-03 19:40:59 +08:00
xiaochong0302
df9d77cad2 1.强化文章|提问|课程列表参数检查
2.优化课程学习时长同步
2023-02-26 19:07:54 +08:00
xiaochong0302
d65e4cab43 Merge branch 'master' of https://gitee.com/koogua/course-tencent-cloud 2023-02-16 14:05:53 +08:00
koogua
7355e8c625 Merge branch 'koogua/v1.6.2'
# Conflicts:
#	CHANGELOG.md
2023-02-15 20:38:46 +08:00
koogua
59b3edc1c0 Merge remote-tracking branch 'gitee/koogua/v1.6.2' into koogua/v1.6.2 2023-02-15 19:47:15 +08:00
koogua
f5753da68b v1.6.2发布 2023-02-15 19:47:00 +08:00
koogua
d560e62405 v1.6.2发布 2023-02-15 19:41:24 +08:00
xiaochong0302
2bc5cbf1a9 优化Repo查询 2023-02-15 00:10:11 +08:00
xiaochong0302
ecb20a14f4 优化条件判断 2023-02-14 22:30:02 +08:00
xiaochong0302
74c08316f1 修正记忆播放问题 2023-02-12 17:09:21 +08:00
xiaochong0302
a3d62c71bf 腾讯云短信模板规则更新,同步更新短信内容 2022-12-31 17:04:15 +08:00
xiaochong0302
254a78f246 ServerMonitor资源监控阀值可配置 2022-12-20 16:36:13 +08:00
xiaochong0302
2a20d1eb2e v1.6.2开始 2022-12-15 11:08:00 +08:00
xiaochong0302
db077346e1 补充发行说明 2022-12-15 10:52:01 +08:00
koogua
8b501d8757 v1.6.1发布 2022-12-12 16:22:09 +08:00
koogua
1f996ab384 修正通知标记为已读,计数不归零问题 2022-12-12 16:07:01 +08:00
koogua
2145316913 添加套餐页面去除summary,和商业版保持一致 2022-12-12 16:02:38 +08:00
koogua
77228b99f0 Merge branch 'koogua/v1.6.1' of gitee.com:koogua/course-tencent-cloud into koogua/v1.6.1 2022-12-12 15:58:33 +08:00
xiaochong0302
1b25ccc30d 优化语法结构 2022-11-28 19:28:07 +08:00
koogua
3d42389012 修正播放器中央播放按钮显示问题 2022-11-17 18:05:45 +08:00
xiaochong0302
46beccb67a 优化腾讯云播放地址鉴权参数 2022-11-13 17:08:52 +08:00
koogua
7f9a63886f 优化学员学习记录显示 2022-11-10 12:08:46 +08:00
koogua
bd4d340f53 Merge branch 'koogua/v1.6.1' of gitee.com:koogua/course-tencent-cloud into koogua/v1.6.1 2022-11-07 10:34:19 +08:00
xiaochong0302
05837d6c5f 简化单章节层级显示 2022-11-06 23:19:15 +08:00
xiaochong0302
46176071b8 优化热门作者,答主和问题 2022-11-06 12:55:12 +08:00
koogua
a941d1129a 富文本编辑器增加粘贴图片和远程图片本地化 2022-11-02 15:01:25 +08:00
koogua
301557abbc 优化表单数据提交体验 2022-10-31 20:18:34 +08:00
xiaochong0302
372b996365 精简代码 2022-10-31 09:53:24 +08:00
xiaochong0302
3c5310b5bd Merge branch 'master' of https://gitee.com/koogua/course-tencent-cloud 2022-10-30 23:38:24 +08:00
koogua
6edbcc4638 v1.6.1开工 2022-10-28 17:05:24 +08:00
koogua
3e7082b251 修正大播放图标不居中问题 2022-10-28 15:41:37 +08:00
koogua
1825f2346f Merge branch 'koogua/v1.6.0' 2022-10-27 19:05:22 +08:00
koogua
dd2c3009a4 v1.6.0 2022-10-27 19:04:21 +08:00
xiaochong0302
6b6ccea185 更新composer.json 2022-10-26 00:34:15 +08:00
xiaochong0302
fd1c209a1d 更新composer.json 2022-10-26 00:32:14 +08:00
koogua
04c0ac186f 优化热门答主 2022-10-21 21:00:07 +08:00
koogua
5032c0b432 优化热门问题和热门答主 2022-10-21 20:30:50 +08:00
koogua
d8c5a3d0a2 优化通知计数 2022-10-21 17:55:31 +08:00
koogua
a3cb6d757a 单页和帮助增加浏览属性 2022-10-21 15:09:41 +08:00
koogua
7153d4e5ef 1.导航教师->师资
2.播放器中间增加播放按钮
2022-10-10 17:58:25 +08:00
koogua
63a1f6eb1d 优化内容表格样式 2022-10-02 15:42:43 +08:00
koogua
810956cf36 logo添加首页链接 2022-09-29 18:29:45 +08:00
koogua
2ece258a67 调整退款收费费率范围 2022-09-29 18:13:37 +08:00
koogua
fc4ee4cf49 更新composer包 2022-09-22 11:10:58 +08:00
koogua
de38cc756d 调整layui-main样式更新导致的尺寸问题 2022-09-21 17:48:34 +08:00
koogua
d840f5fe71 更新包版本 2022-09-21 17:08:44 +08:00
koogua
1c42df299e Merge branch 'koogua/v1.5.9' 2022-09-20 17:58:22 +08:00
koogua
370ffa4250 优化错误日志 2022-09-20 17:55:49 +08:00
koogua
c17447784c 绑定页增加用户协议和隐私政策 2022-09-19 18:51:47 +08:00
koogua
79cc6b9c9e 增加用户协议和隐私政策 2022-09-19 17:58:52 +08:00
koogua
06607e7f2e 升级layui v2.7.6 2022-09-17 18:51:12 +08:00
koogua
9ebbf2cecc 优化router扫描规则 2022-09-16 18:44:33 +08:00
koogua
79a2253918 1.文章单页等增加关键字
2.专题增加封面上传
2022-09-15 20:39:49 +08:00
koogua
c801559b62 更新微博分享链接 2022-09-15 16:08:46 +08:00
koogua
3854a082d3 1.更新默认图片
2.更新直播名格式化
2022-09-15 16:08:04 +08:00
koogua
8d64969040 调整Notice目录结构 2022-09-08 20:01:11 +08:00
koogua
b79d6e5588 去除user全文索引相关 2022-09-06 17:30:06 +08:00
koogua
42f591173d 修正内容图片上传问题 2022-09-06 11:03:43 +08:00
koogua
93ec72faf6 修正内容图片上传问题 2022-09-06 11:03:19 +08:00
koogua
fbcc721828 去除group残留 2022-09-06 10:58:02 +08:00
koogua
bf3b84638a Merge branch 'koogua/v1.5.8' 2022-08-31 10:31:30 +08:00
koogua
1093f52350 Merge branch 'koogua/v1.5.8' into develop 2022-08-31 10:31:06 +08:00
koogua
a47e63340e 优化文章缩略图尺寸 2022-08-31 10:30:16 +08:00
koogua
73d04e3c63 Merge branch 'koogua/v1.5.8' 2022-08-31 10:28:38 +08:00
koogua
ea78fd3c5c 优化文章缩略图尺寸 2022-08-31 10:27:03 +08:00
koogua
6870380091 优化用户登录,用户注册,忘记密码 2022-08-28 10:32:25 +08:00
koogua
13873dcb0b sitemap条目增加过滤条件 2022-08-24 14:51:18 +08:00
koogua
b60f8fe485 优化登录/注册/忘记密码页 2022-08-22 15:06:52 +08:00
koogua
21f79dad80 整理migrations 2022-08-19 18:06:10 +08:00
koogua
923095700f 整理migrations 2022-08-19 17:10:30 +08:00
koogua
290fda610b 修复升级cos-sdk带来的参数检查错误 2022-08-19 15:31:45 +08:00
koogua
9b55b04e5f 修复升级cos-sdk带来的参数检查错误 2022-08-19 15:31:34 +08:00
koogua
4c9557c5c8 优化腾讯云短信错误日志 2022-08-17 17:17:25 +08:00
koogua
2628f6b7d7 1.整理查询构建语句
2.整理前台编辑器页面
2022-08-15 17:22:33 +08:00
koogua
20fb468f0d 整理优化css 2022-08-12 17:21:29 +08:00
koogua
cd9422afc1 1.清理群组残留
2.优化HtmlPurifier缓存目录自动创建
2022-08-09 16:43:55 +08:00
1018 changed files with 18338 additions and 19509 deletions

2
.gitignore vendored
View File

@ -5,11 +5,11 @@
/config/xs.course.ini
/config/xs.article.ini
/config/xs.question.ini
/config/xs.user.ini
/config/alipay/*.crt
/config/wxpay/*.pem
/db/migrations/schema.php
/public/robots.txt
/public/sitemap.xml
/public/h5
/storage/cache/purifier
*KgTest*

View File

@ -1,8 +1,286 @@
### [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)
- 升级layui-2.9.8
- 调整html编辑器属性
- 增加代码块内容复制
- 清理无用的Captcha配置
- 联系人QQ改为上传二维码图片
- 修正logo,favicon上传路径
- 登录后台同时登录前台
- 移动端修正评论发表
### [v1.6.9](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.9)(2024-04-15)
- 增加用户删除和还原功能
- 增加unauthorized响应
- 增加post方式传递csrf_token
- 删除chapter中resource_count,consult_count属性
- 精简csrf_token白名单
- 拆解优化migrations创建表脚本
- 修正chapter_user时长重复计数问题
- 修正后台刷新首页缓存问题
- 修正home模块中编辑器图片上传
- 优化文章和提问搜索条件
- 优化课程详情页排版
- 优化storage上传
- 优化CategoryTreeList
- 优化CourseUserTrait
- 更新layui-v2.9.7
### [v1.6.8](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.8)(2024-01-30)
- 修正course_user中active_time未更新问题
- 修正主页simple模式免费课程模块样式问题
- 修正chapter_user中plan_id=0问题
- 修正课时评论管理链接
- 修正用户active_time搜索条件
- 修正课时发布switch开关
- 精简chapter/lessons.volt
- 去除league/commonmark包
- 去除分类等必选判断
- 更新layui-v2.9.3
- 使用ServiceTrait精简代码
- 优化AccountTrait
- 优化错误处理
### [v1.6.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.7)(2023-12-15)
- 增加文章分类功能
- 增加问题分类功能
- 增加审核等批量功能
- 增加若干业务插件埋点
- 精简重构大量业务逻辑
- 移除秒杀营销功能
- 已发现的问题修复
### [v1.6.6](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.6)(2023-08-30)
- 还原意外删除的AnswerList.php文件
- 修正邮箱注册提交按钮不可用问题
- 去除删除远程课件逻辑
- 增加课程课件资料总览
- 优化cleanDemoDataTask脚本
- 优化tag表migration脚本
- 命名结构等常规优化
### [v1.6.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.5)(2023-07-15)
- 升级layui-v2.8.8
- 使用本地图像验证码
- 优化计划任务脚本
- 优化日志清理脚本
- 优化钉钉webhook
- 修正图文分享参数问题
### [v1.6.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.4)(2023-06-15)
- 增加推荐课程等Widget
- 更新Composer包
- 修正验证空口令问题
- 优化订单确认页样式
- 优化课程等Me相关信息
- 优化分享URL
- 优化用户课程查找
- 优化通知相关
- 优化Providers
- 优化课程章节权限
- 优化钉钉机器人
### [v1.6.3](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.3)(2023-05-08)
- 强化文章|提问|课程列表参数检查
- 优化HtmlPurifier内容过滤
- 优化排序条件和分页重复问题
- 优化课程搜索分组条件样式
- 优化课程学习时长同步
- 优化程序语法层面
- 更新Layui-v2.8.2
- 替换ip2region包
- 去除未支付“新鲜”订单检查
- 修正手续费率设置为0无效问题
### [v1.6.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.2)(2023-02-12)
- 增加ServerMonitor监控指标配置
- 同步更新腾讯云短信内容规则
- 文章和问答增加评论开关属性
- 修正视频记忆播放无效问题
- 升级composer包版本
- 优化Repo查询默认排序
- 优化管理后台细节
- 优化二维码输出
- 优化评分检查
### [v1.6.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.1)(2022-12-12)
- 富文本编辑器增加粘贴图片和远程图片本地化
- 修正用户通知标记为已读,计数不归零问题
- 修正播放器中央按钮显示问题
- 优化腾讯云播放地址鉴权参数
- 优化热门作者,答主和问题
- 优化学员学习记录显示
- 优化表单数据提交体验
- 优化单章节层级显示
- 优化ServerInfo类
### [v1.6.0](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.0)(2022-10-26)
- 播放器中间增加大号播放按钮
- 单页和帮助增加浏览计数属性
- logo上增加首页链接
- 修正分类默认图标问题
- 修正layui-main样式更新带来的问题
- 更新composer包
- 调整退款手续费范围
- 导航部分,教师->师资
- 优化分页组件参数
- 优化内容表格样式
- 优化热门问题和热门答主
- 优化通知计数方式
### [v1.5.9](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.9)(2022-09-20)
- 修正内容图片上传问题
- 去除user全文索引
- 调整notice目录结构
- 更新默认图片
- 更新直播名格式化
- 更新微博分享链接
- 文章单页等增加SEO关键字
- 专题增加封面上传
- 优化router扫描规则
- 升级layui至v2.7.6
- 增加用户协议和隐私政策
- 优化错误日志
### [v1.5.8](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.8)(2022-08-28)
- 整理migrations
- 更新自动安装脚本
- 优化登录/注册/忘记密码页
- 修复移动端首页课程缓存刷新
- sitemap条目增加过滤条件
### [v1.5.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.7)(2022-08-18)
- 清理群组残留
- 升级腾讯云存储SDK到v2.5.6
- GuzzleHttp升级到v6.5.7
- 优化HtmlPurifier缓存目录自动创建
- 优化问题回答排序问题
- 优化腾讯云短信错误日志
- 整理查询构建语句
- 整理优化CSS
### [v1.5.6](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.6)(2022-08-08)
- 增加应用内命令行migrations
- 移除群组和微聊模块
- kindeditor替换vditor - markdown转html
- kindeditor替换vditor
- markdown转html
### [v1.5.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.5)(2022-07-27)

View File

@ -1,23 +1,23 @@
## 酷瓜云课堂
![酷瓜云课堂](https://portal-1255691183.file.myqcloud.com/img/content/61dd395c053e5.png)
[![酷瓜云课堂-开源知识付费解决方案](https://portal-1255691183.file.myqcloud.com/img/content/63ec392618bd5.png)](https://www.koogua.com)
### 系统介绍
酷瓜云课堂依托腾讯云基础服务架构采用C扩展框架Phalcon开发GPL-2.0开源协议,致力开源网课系统,开源网校系统,开源知识付费系统,开源在线教育系统。
![star](https://koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=star)
![fork](https://koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=fork)
![license](https://koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=license)
![release](https://koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=release)
![star](https://www.koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=star)
![fork](https://www.koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=fork)
![license](https://www.koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=license)
![release](https://www.koogua.com/gitee/badge?user=koogua&project=course-tencent-cloud&type=release)
### 系统功能
实现了点播、直播、专栏、面授、问答、会员、群组、微聊、积分、秒杀等。
实现了点播、直播、专栏、问答、会员、积分等。
友情提示:
- 演示系统配置低(1Core1G1M 跑多个容器)切莫压测
- 演示系统配置低(2核2G1M 跑多个容器)切莫压测
- 课程数据来源于网络(无实质内容)切莫购买
- 管理后台已禁止数据提交,私密配置已过滤
@ -34,12 +34,6 @@ H5手机端演示
演示账号13507083515 / 123456
微信公众号演示:
![公众号二维码](https://portal-1255691183.file.myqcloud.com/img/content/616f998270eca.png)
演示账号13507083515 / 123456
支付流程演示:
- [MySQL提升课程全面讲解MySQL架构设计0.01元)](https://ctc.koogua.com/order/confirm?item_id=1390&item_type=1)
@ -48,33 +42,25 @@ H5手机端演示
Tips: 测试支付请用手机号注册一个新账户,以便接收订单通知,以及避免课程无法购买
即时通讯演示:
请使用以下两个账号在不同终端或者浏览器登录,打开微聊界面
- 帐号A100015@163.com / 123456
- 帐号B100065@163.com / 123456
微信推送演示:
Tips: 请用手机注册一个新账号,用户中心 -> 关注订阅,扫码关注公众号。之后的登录、购买、退款、直播、咨询等会有消息推送。
### 项目组件
- 后台框架:[phalcon 3.4.5](https://phalcon.io)
- 前端框架:[layui 2.6.8](https://layui.com) [layim 3.9.8](https://www.layui.com/layim)(已授权)
- 全文检索:[xunsearch 1.4.9](http://www.xunsearch.com)
- 即时通讯:[workerman 3.5.22](https://workerman.net)
- 后台框架:[phalcon 3.4](https://phalcon.io)
- 前端框架:[layui 2.9](https://layui.dev)
- 全文检索:[xunsearch 1.4](http://www.xunsearch.com)
- 基础依赖:[php7.3](https://php.net) [mysql5.7](https://mysql.com) [redis5.0](https://redis.io)
### 项目文档
- [运行环境搭建](https://koogua.com/page/wiki)
- [系统服务配置](https://koogua.com/page/wiki)
- [客户终端配置](https://koogua.com/page/wiki)
- [运行环境搭建](https://www.koogua.com/page/wiki)
- [系统服务配置](https://www.koogua.com/page/wiki)
- [客户终端配置](https://www.koogua.com/page/wiki)
### 意见反馈
- [码云平台](https://gitee.com/koogua/course-tencent-cloud/issues)
- [官方社区](https://koogua.com/community)
- [官方社区](https://www.koogua.com/community)
- QQ交流群: 787363898

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Question as QuestionRepo;
use App\Repos\User as UserRepo;
class AnswerList extends Builder
{
@ -18,7 +17,7 @@ class AnswerList extends Builder
$questions = $this->getQuestions($answers);
foreach ($answers as $key => $answer) {
$answers[$key]['question'] = $questions[$answer['question_id']] ?? new \stdClass();
$answers[$key]['question'] = $questions[$answer['question_id']] ?? null;
}
return $answers;
@ -29,7 +28,7 @@ class AnswerList extends Builder
$users = $this->getUsers($answers);
foreach ($answers as $key => $answer) {
$answers[$key]['owner'] = $users[$answer['owner_id']] ?? new \stdClass();
$answers[$key]['owner'] = $users[$answer['owner_id']] ?? null;
}
return $answers;
@ -56,20 +55,7 @@ class AnswerList extends Builder
{
$ids = kg_array_column($answers, 'owner_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Article as ArticleRepo;
use App\Repos\User as UserRepo;
use Phalcon\Text;
class ArticleFavoriteList extends Builder
@ -19,7 +18,7 @@ class ArticleFavoriteList extends Builder
$articles = $this->getArticles($relations);
foreach ($relations as $key => $value) {
$relations[$key]['article'] = $articles[$value['article_id']] ?? new \stdClass();
$relations[$key]['article'] = $articles[$value['article_id']] ?? null;
}
return $relations;
@ -30,7 +29,7 @@ class ArticleFavoriteList extends Builder
$users = $this->getUsers($relations);
foreach ($relations as $key => $value) {
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
}
return $relations;
@ -70,20 +69,7 @@ class ArticleFavoriteList extends Builder
{
$ids = kg_array_column($relations, 'user_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -7,9 +7,8 @@
namespace App\Builders;
use App\Caches\CategoryList as CategoryListCache;
use App\Caches\CategoryAllList as CategoryAllListCache;
use App\Models\Category as CategoryModel;
use App\Repos\User as UserRepo;
class ArticleList extends Builder
{
@ -28,7 +27,7 @@ class ArticleList extends Builder
$categories = $this->getCategories();
foreach ($articles as $key => $article) {
$articles[$key]['category'] = $categories[$article['category_id']] ?? new \stdClass();
$articles[$key]['category'] = $categories[$article['category_id']] ?? null;
}
return $articles;
@ -39,7 +38,7 @@ class ArticleList extends Builder
$users = $this->getUsers($articles);
foreach ($articles as $key => $article) {
$articles[$key]['owner'] = $users[$article['owner_id']] ?? new \stdClass();
$articles[$key]['owner'] = $users[$article['owner_id']] ?? null;
}
return $articles;
@ -47,7 +46,7 @@ class ArticleList extends Builder
public function getCategories()
{
$cache = new CategoryListCache();
$cache = new CategoryAllListCache();
$items = $cache->get(CategoryModel::TYPE_ARTICLE);
@ -69,20 +68,7 @@ class ArticleList extends Builder
{
$ids = kg_array_column($articles, 'owner_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -7,6 +7,7 @@
namespace App\Builders;
use App\Repos\User as UserRepo;
use Phalcon\Di\Injectable;
class Builder extends Injectable
@ -17,4 +18,22 @@ class Builder extends Injectable
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;
}
}

View File

@ -8,15 +8,16 @@
namespace App\Builders;
use App\Models\Category as CategoryModel;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
use App\Repos\Category as CategoryRepo;
class CategoryTreeList extends Builder
{
public function handle($type)
{
$topCategories = $this->findTopCategories($type);
$categoryRepo = new CategoryRepo();
$topCategories = $categoryRepo->findTopCategories($type);
if ($topCategories->count() == 0) {
return [];
@ -39,7 +40,9 @@ class CategoryTreeList extends Builder
protected function handleChildren(CategoryModel $category)
{
$subCategories = $this->findChildCategories($category->id);
$categoryRepo = new CategoryRepo();
$subCategories = $categoryRepo->findChildCategories($category->id);
if ($subCategories->count() == 0) {
return [];
@ -59,37 +62,4 @@ class CategoryTreeList extends Builder
return $list;
}
/**
* @param int $type
* @return ResultsetInterface|Resultset|CategoryModel[]
*/
protected function findTopCategories($type)
{
$query = CategoryModel::query();
$query->where('parent_id = 0');
$query->andWhere('published = 1');
$query->andWhere('deleted = 0');
$query->andWhere('type = :type:', ['type' => $type]);
$query->orderBy('priority ASC');
return $query->execute();
}
/**
* @param int $parentId
* @return ResultsetInterface|Resultset|CategoryModel[]
*/
protected function findChildCategories($parentId)
{
$query = CategoryModel::query();
$query->where('parent_id = :parent_id:', ['parent_id' => $parentId]);
$query->andWhere('published = 1');
$query->andWhere('deleted = 0');
$query->orderBy('priority ASC');
return $query->execute();
}
}

View File

@ -7,8 +7,6 @@
namespace App\Builders;
use App\Repos\User as UserRepo;
class CommentList extends Builder
{
@ -17,8 +15,8 @@ class CommentList extends Builder
$users = $this->getUsers($comments);
foreach ($comments as $key => $comment) {
$comments[$key]['owner'] = $users[$comment['owner_id']] ?? new \stdClass();
$comments[$key]['to_user'] = $users[$comment['to_user_id']] ?? new \stdClass();
$comments[$key]['owner'] = $users[$comment['owner_id']] ?? null;
$comments[$key]['to_user'] = $users[$comment['to_user_id']] ?? null;
}
return $comments;
@ -30,20 +28,7 @@ class CommentList extends Builder
$toUserIds = kg_array_column($comments, 'to_user_id');
$ids = array_merge($ownerIds, $toUserIds);
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -7,9 +7,7 @@
namespace App\Builders;
use App\Repos\Chapter as ChapterRepo;
use App\Repos\Course as CourseRepo;
use App\Repos\User as UserRepo;
class ConsultList extends Builder
{
@ -19,7 +17,7 @@ class ConsultList extends Builder
$courses = $this->getCourses($consults);
foreach ($consults as $key => $consult) {
$consults[$key]['course'] = $courses[$consult['course_id']] ?? new \stdClass();
$consults[$key]['course'] = $courses[$consult['course_id']] ?? null;
}
return $consults;
@ -30,8 +28,8 @@ class ConsultList extends Builder
$users = $this->getUsers($consults);
foreach ($consults as $key => $consult) {
$consults[$key]['owner'] = $users[$consult['owner_id']] ?? new \stdClass();
$consults[$key]['replier'] = $users[$consult['replier_id']] ?? new \stdClass();
$consults[$key]['owner'] = $users[$consult['owner_id']] ?? null;
$consults[$key]['replier'] = $users[$consult['replier_id']] ?? null;
}
return $consults;
@ -54,43 +52,13 @@ class ConsultList extends Builder
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)
{
$ownerIds = kg_array_column($consults, 'owner_id');
$replierIds = kg_array_column($consults, 'replier_id');
$ids = array_merge($ownerIds, $replierIds);
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Course as CourseRepo;
use App\Repos\User as UserRepo;
class CourseFavoriteList extends Builder
{
@ -18,7 +17,7 @@ class CourseFavoriteList extends Builder
$courses = $this->getCourses($relations);
foreach ($relations as $key => $value) {
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
}
return $relations;
@ -29,7 +28,7 @@ class CourseFavoriteList extends Builder
$users = $this->getUsers($relations);
foreach ($relations as $key => $value) {
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
}
return $relations;
@ -70,20 +69,7 @@ class CourseFavoriteList extends Builder
{
$ids = kg_array_column($relations, 'user_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -7,9 +7,8 @@
namespace App\Builders;
use App\Caches\CategoryList as CategoryListCache;
use App\Caches\CategoryAllList as CategoryAllListCache;
use App\Models\Category as CategoryModel;
use App\Repos\User as UserRepo;
class CourseList extends Builder
{
@ -19,7 +18,7 @@ class CourseList extends Builder
$categories = $this->getCategories();
foreach ($courses as $key => $course) {
$courses[$key]['category'] = $categories[$course['category_id']] ?? new \stdClass();
$courses[$key]['category'] = $categories[$course['category_id']] ?? null;
}
return $courses;
@ -30,7 +29,7 @@ class CourseList extends Builder
$teachers = $this->getTeachers($courses);
foreach ($courses as $key => $course) {
$courses[$key]['teacher'] = $teachers[$course['teacher_id']] ?? new \stdClass();
$courses[$key]['teacher'] = $teachers[$course['teacher_id']] ?? null;
}
return $courses;
@ -38,7 +37,7 @@ class CourseList extends Builder
public function getCategories()
{
$cache = new CategoryListCache();
$cache = new CategoryAllListCache();
$items = $cache->get(CategoryModel::TYPE_COURSE);
@ -60,20 +59,7 @@ class CourseList extends Builder
{
$ids = kg_array_column($courses, 'teacher_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -18,7 +18,7 @@ class CourseTopicList extends Builder
$courses = $this->getCourses($relations);
foreach ($relations as $key => $value) {
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
}
return $relations;
@ -29,7 +29,7 @@ class CourseTopicList extends Builder
$topics = $this->getTopics($relations);
foreach ($relations as $key => $value) {
$relations[$key]['topic'] = $topics[$value['topic_id']] ?? new \stdClass();
$relations[$key]['topic'] = $topics[$value['topic_id']] ?? null;
}
return $relations;

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Course as CourseRepo;
use App\Repos\User as UserRepo;
class CourseUserList extends Builder
{
@ -18,7 +17,7 @@ class CourseUserList extends Builder
$courses = $this->getCourses($relations);
foreach ($relations as $key => $value) {
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
}
return $relations;
@ -29,7 +28,7 @@ class CourseUserList extends Builder
$users = $this->getUsers($relations);
foreach ($relations as $key => $value) {
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
}
return $relations;
@ -74,20 +73,7 @@ class CourseUserList extends Builder
{
$ids = kg_array_column($relations, 'user_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -1,104 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Builders;
use App\Repos\Chapter as ChapterRepo;
use App\Repos\Course as CourseRepo;
use App\Repos\User as UserRepo;
class DanmuList extends Builder
{
public function handleCourses(array $danmus)
{
$courses = $this->getCourses($danmus);
foreach ($danmus as $key => $danmu) {
$danmus[$key]['course'] = $courses[$danmu['course_id']] ?? new \stdClass();
}
return $danmus;
}
public function handleChapters(array $danmus)
{
$chapters = $this->getChapters($danmus);
foreach ($danmus as $key => $danmu) {
$danmus[$key]['chapter'] = $chapters[$danmu['chapter_id']] ?? new \stdClass();
}
return $danmus;
}
public function handleUsers(array $danmus)
{
$users = $this->getUsers($danmus);
foreach ($danmus as $key => $danmu) {
$danmus[$key]['owner'] = $users[$danmu['owner_id']] ?? new \stdClass();
}
return $danmus;
}
public function getCourses(array $danmus)
{
$ids = kg_array_column($danmus, 'course_id');
$courseRepo = new CourseRepo();
$courses = $courseRepo->findByIds($ids, ['id', 'title']);
$result = [];
foreach ($courses->toArray() as $course) {
$result[$course['id']] = $course;
}
return $result;
}
public function getChapters(array $danmus)
{
$ids = kg_array_column($danmus, '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 $danmus)
{
$ids = kg_array_column($danmus, 'owner_id');
$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;
}
}

View File

@ -7,7 +7,7 @@
namespace App\Builders;
use App\Caches\CategoryList as CategoryListCache;
use App\Caches\CategoryAllList as CategoryAllListCache;
use App\Models\Category as CategoryModel;
class HelpList extends Builder
@ -18,7 +18,7 @@ class HelpList extends Builder
$categories = $this->getCategories();
foreach ($helps as $key => $help) {
$helps[$key]['category'] = $categories[$help['category_id']] ?? new \stdClass();
$helps[$key]['category'] = $categories[$help['category_id']] ?? null;
}
return $helps;
@ -26,7 +26,7 @@ class HelpList extends Builder
public function getCategories()
{
$cache = new CategoryListCache();
$cache = new CategoryAllListCache();
$items = $cache->get(CategoryModel::TYPE_HELP);

View File

@ -9,7 +9,6 @@ namespace App\Builders;
use App\Repos\Chapter as ChapterRepo;
use App\Repos\Course as CourseRepo;
use App\Repos\User as UserRepo;
class LearningList extends Builder
{
@ -19,7 +18,7 @@ class LearningList extends Builder
$courses = $this->getCourses($relations);
foreach ($relations as $key => $value) {
$relations[$key]['course'] = $courses[$value['course_id']] ?? new \stdClass();
$relations[$key]['course'] = $courses[$value['course_id']] ?? null;
}
return $relations;
@ -30,7 +29,7 @@ class LearningList extends Builder
$chapters = $this->getChapters($relations);
foreach ($relations as $key => $value) {
$relations[$key]['chapter'] = $chapters[$value['chapter_id']] ?? new \stdClass();
$relations[$key]['chapter'] = $chapters[$value['chapter_id']] ?? null;
}
return $relations;
@ -41,7 +40,7 @@ class LearningList extends Builder
$users = $this->getUsers($relations);
foreach ($relations as $key => $value) {
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
}
return $relations;
@ -85,17 +84,7 @@ class LearningList extends Builder
{
$ids = kg_array_column($relations, 'user_id');
$userRepo = new UserRepo();
$users = $userRepo->findByIds($ids, ['id', 'name']);
$result = [];
foreach ($users->toArray() as $user) {
$result[$user['id']] = $user;
}
return $result;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -19,7 +19,7 @@ class LiveList extends Builder
$courses = $this->getCourses($lives);
foreach ($lives as $key => $live) {
$lives[$key]['course'] = $courses[$live['course_id']] ?? new \stdClass();
$lives[$key]['course'] = $courses[$live['course_id']] ?? null;
}
return $lives;
@ -30,7 +30,7 @@ class LiveList extends Builder
$chapters = $this->getChapters($lives);
foreach ($lives as $key => $live) {
$lives[$key]['chapter'] = $chapters[$live['chapter_id']] ?? new \stdClass();
$lives[$key]['chapter'] = $chapters[$live['chapter_id']] ?? null;
}
return $lives;
@ -63,7 +63,7 @@ class LiveList extends Builder
foreach ($courses->toArray() as $course) {
$course['cover'] = $baseUrl . $course['cover'];
$course['teacher'] = $teachers[$course['teacher_id']] ?? new \stdClass();
$course['teacher'] = $teachers[$course['teacher_id']] ?? null;
$result[$course['id']] = [
'id' => $course['id'],
'title' => $course['title'],

View File

@ -7,8 +7,6 @@
namespace App\Builders;
use App\Repos\User as UserRepo;
class NotificationList extends Builder
{
@ -17,8 +15,8 @@ class NotificationList extends Builder
$users = $this->getUsers($notifications);
foreach ($notifications as $key => $notification) {
$notifications[$key]['sender'] = $users[$notification['sender_id']] ?? new \stdClass();
$notifications[$key]['receiver'] = $users[$notification['receiver_id']] ?? new \stdClass();
$notifications[$key]['sender'] = $users[$notification['sender_id']] ?? null;
$notifications[$key]['receiver'] = $users[$notification['receiver_id']] ?? null;
}
return $notifications;
@ -30,20 +28,7 @@ class NotificationList extends Builder
$receiverIds = kg_array_column($notifications, 'receiver_id');
$ids = array_merge($senderIds, $receiverIds);
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -9,7 +9,6 @@ namespace App\Builders;
use App\Models\Course as CourseModel;
use App\Models\Order as OrderModel;
use App\Repos\User as UserRepo;
class OrderList extends Builder
{
@ -30,7 +29,7 @@ class OrderList extends Builder
$users = $this->getUsers($orders);
foreach ($orders as $key => $order) {
$orders[$key]['owner'] = $users[$order['owner_id']] ?? new \stdClass();
$orders[$key]['owner'] = $users[$order['owner_id']] ?? null;
}
return $orders;
@ -113,8 +112,13 @@ class OrderList extends Builder
$me['allow_refund'] = $refundStatusOk && $refundTimeOk ? 1 : 0;
}
$me['allow_pay'] = $payStatusOk;
$me['allow_cancel'] = $cancelStatusOk;
if ($payStatusOk == 1) {
$me['allow_pay'] = 1;
}
if ($cancelStatusOk == 1) {
$me['allow_cancel'] = 1;
}
return $me;
}
@ -149,20 +153,6 @@ class OrderList extends Builder
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
* @return mixed
@ -184,17 +174,7 @@ class OrderList extends Builder
{
$ids = kg_array_column($orders, 'owner_id');
$userRepo = new UserRepo();
$users = $userRepo->findShallowUserByIds($ids);
$result = [];
foreach ($users->toArray() as $user) {
$result[$user['id']] = $user;
}
return $result;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Question as QuestionRepo;
use App\Repos\User as UserRepo;
use Phalcon\Text;
class QuestionFavoriteList extends Builder
@ -19,7 +18,7 @@ class QuestionFavoriteList extends Builder
$questions = $this->getQuestions($relations);
foreach ($relations as $key => $value) {
$relations[$key]['question'] = $questions[$value['question_id']] ?? new \stdClass();
$relations[$key]['question'] = $questions[$value['question_id']] ?? null;
}
return $relations;
@ -30,7 +29,7 @@ class QuestionFavoriteList extends Builder
$users = $this->getUsers($relations);
foreach ($relations as $key => $value) {
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
}
return $relations;
@ -70,20 +69,7 @@ class QuestionFavoriteList extends Builder
{
$ids = kg_array_column($relations, 'user_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -7,9 +7,8 @@
namespace App\Builders;
use App\Caches\CategoryList as CategoryListCache;
use App\Caches\CategoryAllList as CategoryAllListCache;
use App\Models\Category as CategoryModel;
use App\Repos\User as UserRepo;
class QuestionList extends Builder
{
@ -27,8 +26,8 @@ class QuestionList extends Builder
{
$categories = $this->getCategories();
foreach ($questions as $key => $article) {
$questions[$key]['category'] = $categories[$article['category_id']] ?? new \stdClass();
foreach ($questions as $key => $question) {
$questions[$key]['category'] = $categories[$question['category_id']] ?? null;
}
return $questions;
@ -39,8 +38,8 @@ class QuestionList extends Builder
$users = $this->getUsers($questions);
foreach ($questions as $key => $question) {
$questions[$key]['owner'] = $users[$question['owner_id']] ?? new \stdClass();
$questions[$key]['last_replier'] = $users[$question['last_replier_id']] ?? new \stdClass();
$questions[$key]['owner'] = $users[$question['owner_id']] ?? null;
$questions[$key]['last_replier'] = $users[$question['last_replier_id']] ?? null;
}
return $questions;
@ -48,7 +47,7 @@ class QuestionList extends Builder
public function getCategories()
{
$cache = new CategoryListCache();
$cache = new CategoryAllListCache();
$items = $cache->get(CategoryModel::TYPE_QUESTION);
@ -72,20 +71,7 @@ class QuestionList extends Builder
$lastReplierIds = kg_array_column($questions, 'last_replier_id');
$ids = array_merge($ownerIds, $lastReplierIds);
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -9,7 +9,6 @@ namespace App\Builders;
use App\Models\Refund as RefundModel;
use App\Repos\Order as OrderRepo;
use App\Repos\User as UserRepo;
class RefundList extends Builder
{
@ -19,7 +18,7 @@ class RefundList extends Builder
$orders = $this->getOrders($trades);
foreach ($trades as $key => $trade) {
$trades[$key]['order'] = $orders[$trade['order_id']] ?? new \stdClass();
$trades[$key]['order'] = $orders[$trade['order_id']] ?? null;
}
return $trades;
@ -30,7 +29,7 @@ class RefundList extends Builder
$users = $this->getUsers($refunds);
foreach ($refunds as $key => $refund) {
$refunds[$key]['owner'] = $users[$refund['owner_id']] ?? new \stdClass();
$refunds[$key]['owner'] = $users[$refund['owner_id']] ?? null;
}
return $refunds;
@ -75,20 +74,7 @@ class RefundList extends Builder
{
$ids = kg_array_column($refunds, 'owner_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -7,8 +7,6 @@
namespace App\Builders;
use App\Repos\User as UserRepo;
class ReportList extends Builder
{
@ -17,7 +15,7 @@ class ReportList extends Builder
$users = $this->getUsers($reports);
foreach ($reports as $key => $report) {
$reports[$key]['owner'] = $users[$report['owner_id']] ?? new \stdClass();
$reports[$key]['owner'] = $users[$report['owner_id']] ?? null;
}
return $reports;
@ -27,20 +25,7 @@ class ReportList extends Builder
{
$ids = kg_array_column($reports, 'owner_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -17,7 +17,7 @@ class ResourceList extends Builder
$uploads = $this->getUploads($relations);
foreach ($relations as $key => $value) {
$relations[$key]['upload'] = $uploads[$value['upload_id']] ?? new \stdClass();
$relations[$key]['upload'] = $uploads[$value['upload_id']] ?? null;
}
return $relations;

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Course as CourseRepo;
use App\Repos\User as UserRepo;
class ReviewList extends Builder
{
@ -18,7 +17,7 @@ class ReviewList extends Builder
$courses = $this->getCourses($reviews);
foreach ($reviews as $key => $review) {
$reviews[$key]['course'] = $courses[$review['course_id']] ?? new \stdClass();
$reviews[$key]['course'] = $courses[$review['course_id']] ?? null;
}
return $reviews;
@ -29,7 +28,7 @@ class ReviewList extends Builder
$users = $this->getUsers($reviews);
foreach ($reviews as $key => $review) {
$reviews[$key]['owner'] = $users[$review['owner_id']] ?? new \stdClass();
$reviews[$key]['owner'] = $users[$review['owner_id']] ?? null;
}
return $reviews;
@ -56,20 +55,7 @@ class ReviewList extends Builder
{
$ids = kg_array_column($reviews, 'owner_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Tag as TagRepo;
use App\Repos\User as UserRepo;
class TagFollowList extends Builder
{
@ -18,7 +17,7 @@ class TagFollowList extends Builder
$tags = $this->getTags($relations);
foreach ($relations as $key => $value) {
$relations[$key]['tag'] = $tags[$value['tag_id']] ?? new \stdClass();
$relations[$key]['tag'] = $tags[$value['tag_id']] ?? null;
}
return $relations;
@ -29,7 +28,7 @@ class TagFollowList extends Builder
$users = $this->getUsers($relations);
foreach ($relations as $key => $value) {
$relations[$key]['user'] = $users[$value['user_id']] ?? new \stdClass();
$relations[$key]['user'] = $users[$value['user_id']] ?? null;
}
return $relations;
@ -61,20 +60,7 @@ class TagFollowList extends Builder
{
$ids = kg_array_column($relations, 'user_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -8,7 +8,6 @@
namespace App\Builders;
use App\Repos\Order as OrderRepo;
use App\Repos\User as UserRepo;
class TradeList extends Builder
{
@ -18,7 +17,7 @@ class TradeList extends Builder
$orders = $this->getOrders($trades);
foreach ($trades as $key => $trade) {
$trades[$key]['order'] = $orders[$trade['order_id']] ?? new \stdClass();
$trades[$key]['order'] = $orders[$trade['order_id']] ?? null;
}
return $trades;
@ -29,7 +28,7 @@ class TradeList extends Builder
$users = $this->getUsers($trades);
foreach ($trades as $key => $trade) {
$trades[$key]['owner'] = $users[$trade['owner_id']] ?? new \stdClass();
$trades[$key]['owner'] = $users[$trade['owner_id']] ?? null;
}
return $trades;
@ -56,20 +55,7 @@ class TradeList extends Builder
{
$ids = kg_array_column($trades, 'owner_id');
$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;
return $this->getShallowUserByIds($ids);
}
}

View File

@ -8,6 +8,7 @@
namespace App\Builders;
use App\Models\User as UserModel;
use App\Repos\Account as AccountRepo;
use App\Repos\Role as RoleRepo;
class UserList extends Builder
@ -24,6 +25,17 @@ class UserList extends Builder
return $users;
}
public function handleAccounts(array $users)
{
$accounts = $this->getAccounts($users);
foreach ($users as $key => $user) {
$users[$key]['account'] = $accounts[$user['id']] ?? null;
}
return $users;
}
public function handleAdminRoles(array $users)
{
$roles = $this->getAdminRoles($users);
@ -46,6 +58,26 @@ class UserList extends Builder
return $users;
}
protected function getAccounts(array $users)
{
$ids = kg_array_column($users, 'id');
$accountRepo = new AccountRepo();
$accounts = $accountRepo->findByIds($ids);
$result = [];
foreach ($accounts as $account) {
$result[$account->id] = [
'phone' => $account->phone,
'email' => $account->email,
];
}
return $result;
}
protected function getAdminRoles(array $users)
{
$ids = kg_array_column($users, 'admin_role');

View File

@ -27,10 +27,10 @@ class AppInfo extends Cache
$appInfo = new \App\Library\AppInfo();
return [
'name' => $appInfo->name,
'alias' => $appInfo->alias,
'link' => $appInfo->link,
'version' => $appInfo->version,
'name' => $appInfo->get('name'),
'alias' => $appInfo->get('alias'),
'link' => $appInfo->get('link'),
'version' => $appInfo->get('version'),
];
}

View File

@ -1,36 +0,0 @@
<?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 = 1 * 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;
}
}

View File

@ -0,0 +1,46 @@
<?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 Phalcon\Mvc\Model\Resultset;
class CategoryAllList extends Cache
{
protected $lifetime = 365 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "category_all_list:{$id}";
}
public function getContent($id = null)
{
/**
* @var Resultset $categories
*/
$categories = CategoryModel::query()
->columns(['id', 'parent_id', 'name', 'priority', 'level', 'path'])
->where('type = :type:', ['type' => $id])
->orderBy('level ASC, priority ASC')
->execute();
if ($categories->count() == 0) {
return [];
}
return $categories->toArray();
}
}

View File

@ -25,10 +25,6 @@ class CategoryList extends Cache
return "category_list:{$id}";
}
/**
* @param null $id
* @return array
*/
public function getContent($id = null)
{
/**

View File

@ -12,7 +12,7 @@ use App\Repos\Chapter as ChapterRepo;
class Chapter extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -9,6 +9,7 @@ namespace App\Caches;
use App\Library\Cache\Backend\Redis as RedisCache;
use Phalcon\Di\Injectable;
use Redis;
abstract class Counter extends Injectable
{
@ -19,7 +20,7 @@ abstract class Counter extends Injectable
protected $cache;
/**
* @var \Redis
* @var Redis
*/
protected $redis;
@ -30,19 +31,13 @@ abstract class Counter extends Injectable
$this->redis = $this->cache->getRedis();
}
/**
* 获取缓存内容
*
* @param mixed $id
* @return array
*/
public function get($id = null)
{
$key = $this->getKey($id);
$content = $this->redis->hGetAll($key);
if (!$this->cache->exists($key)) {
if (!$this->redis->exists($key)) {
$content = $this->getContent($id);
$lifetime = $this->getLifetime();
@ -54,23 +49,13 @@ abstract class Counter extends Injectable
return $content;
}
/**
* 删除缓存内容
*
* @param mixed $id
*/
public function delete($id = null)
{
$key = $this->getKey($id);
$this->cache->delete($key);
$this->redis->del($key);
}
/**
* 重建缓存内容
*
* @param mixed $id
*/
public function rebuild($id = null)
{
$this->delete($id);

View File

@ -12,7 +12,7 @@ use App\Repos\Course as CourseRepo;
class Course extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -1,59 +0,0 @@
<?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\Repos\Course as CourseRepo;
class CourseCategoryList extends Cache
{
protected $lifetime = 1 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "course_category_list:{$id}";
}
public function getContent($id = null)
{
$courseRepo = new CourseRepo();
$categories = $courseRepo->findCategories($id);
if ($categories->count() == 0) {
return [];
}
return $this->handleContent($categories);
}
/**
* @param CategoryModel[] $categories
* @return array
*/
public function handleContent($categories)
{
$result = [];
foreach ($categories as $category) {
$result[] = [
'id' => $category->id,
'name' => $category->name,
];
}
return $result;
}
}

View File

@ -13,7 +13,7 @@ use App\Repos\Course as CourseRepo;
class CoursePackageList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -13,7 +13,7 @@ use App\Repos\Course as CourseRepo;
class CourseRelatedList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -1,63 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Models\User as UserModel;
use App\Repos\Course as CourseRepo;
class CourseTeacherList extends Cache
{
protected $lifetime = 1 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "course_teacher_list:{$id}";
}
public function getContent($id = null)
{
$courseRepo = new CourseRepo();
$users = $courseRepo->findTeachers($id);
if ($users->count() == 0) {
return [];
}
return $this->handleContent($users);
}
/**
* @param UserModel[] $users
* @return array
*/
public function handleContent($users)
{
$result = [];
foreach ($users as $user) {
$result[] = [
'id' => $user->id,
'name' => $user->name,
'avatar' => $user->avatar,
'vip' => $user->vip,
'title' => $user->title,
'about' => $user->about,
];
}
return $result;
}
}

View File

@ -14,7 +14,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class CourseTopicList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -0,0 +1,71 @@
<?php
/**
* @copyright Copyright (c) 2023 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Models\Article as ArticleModel;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
class FeaturedArticleList extends Cache
{
protected $lifetime = 3600;
protected $limit = 5;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return 'featured_article_list';
}
public function getContent($id = null)
{
$articles = $this->findArticles($this->limit);
if ($articles->count() == 0) {
return [];
}
$result = [];
foreach ($articles as $article) {
$result[] = [
'id' => $article->id,
'title' => $article->title,
'cover' => $article->cover,
'favorite_count' => $article->favorite_count,
'comment_count' => $article->comment_count,
'view_count' => $article->view_count,
'like_count' => $article->like_count,
];
}
return $result;
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset|ArticleModel[]
*/
protected function findArticles($limit = 5)
{
return ArticleModel::query()
->where('featured = 1')
->andWhere('published = :published:', ['published' => ArticleModel::PUBLISH_APPROVED])
->andWhere('deleted = 0')
->orderBy('RAND()')
->limit($limit)
->execute();
}
}

View File

@ -1,6 +1,6 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @copyright Copyright (c) 2023 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
@ -11,10 +11,12 @@ use App\Models\Course as CourseModel;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
class CourseRecommendedList extends Cache
class FeaturedCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
protected $limit = 5;
public function getLifetime()
{
@ -23,26 +25,17 @@ class CourseRecommendedList extends Cache
public function getKey($id = null)
{
return "course_recommended_list:{$id}";
return 'featured_course_list';
}
public function getContent($id = null)
{
$courses = $this->findCourses(5);
$courses = $this->findCourses($this->limit);
if ($courses->count() == 0) {
return [];
}
return $this->handleContent($courses);
}
/**
* @param CourseModel[] $courses
* @return array
*/
public function handleContent($courses)
{
$result = [];
foreach ($courses as $course) {
@ -76,10 +69,10 @@ class CourseRecommendedList extends Cache
* @param int $limit
* @return ResultsetInterface|Resultset|CourseModel[]
*/
public function findCourses($limit = 5)
protected function findCourses($limit = 5)
{
return CourseModel::query()
->where('market_price > 0')
->where('featured = 1')
->andWhere('published = 1')
->andWhere('deleted = 0')
->orderBy('RAND()')

View File

@ -0,0 +1,72 @@
<?php
/**
* @copyright Copyright (c) 2023 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Models\Question as QuestionModel;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
class FeaturedQuestionList extends Cache
{
protected $lifetime = 3600;
protected $limit = 5;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return 'featured_question_list';
}
public function getContent($id = null)
{
$questions = $this->findQuestions($this->limit);
if ($questions->count() == 0) {
return [];
}
$result = [];
foreach ($questions as $question) {
$result[] = [
'id' => $question->id,
'title' => $question->title,
'cover' => $question->cover,
'favorite_count' => $question->favorite_count,
'answer_count' => $question->answer_count,
'view_count' => $question->view_count,
'like_count' => $question->like_count,
];
}
return $result;
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset|QuestionModel[]
*/
protected function findQuestions($limit = 5)
{
return QuestionModel::query()
->where('featured = 1')
->andWhere('published = :published:', ['published' => QuestionModel::PUBLISH_APPROVED])
->andWhere('deleted = 0')
->orderBy('RAND()')
->limit($limit)
->execute();
}
}

View File

@ -1,36 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Repos\FlashSale as FlashSaleRepo;
class FlashSale extends Cache
{
protected $lifetime = 1 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "flash_sale:{$id}";
}
public function getContent($id = null)
{
$saleRepo = new FlashSaleRepo();
$sale = $saleRepo->findById($id);
return $sale ?: null;
}
}

View File

@ -1,36 +0,0 @@
<?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;
}
}

View File

@ -1,97 +0,0 @@
<?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 = 365 * 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();
}
}

View File

@ -14,13 +14,11 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class HotQuestionList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{
$tomorrow = strtotime('tomorrow');
return $tomorrow - time();
return $this->lifetime;
}
public function getKey($id = null)
@ -48,6 +46,12 @@ class HotQuestionList extends Cache
return $this->handleQuestions($questions);
}
$questions = $this->findFullyHotQuestions();
if ($questions->count() > 0) {
return $this->handleQuestions($questions);
}
return [];
}
@ -102,6 +106,17 @@ class HotQuestionList extends Cache
return $this->findHotQuestions($createTime, $limit);
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset|QuestionModel[]
*/
protected function findFullyHotQuestions($limit = 10)
{
$createTime = 0;
return $this->findHotQuestions($createTime, $limit);
}
/**
* @param int $createTime
* @param int $limit

View File

@ -14,7 +14,7 @@ use App\Services\Logic\Article\ArticleList as ArticleListService;
class IndexArticleList extends Cache
{
protected $lifetime = 15 * 60;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -19,7 +19,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexFeaturedCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -1,36 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Services\Logic\FlashSale\SaleList;
class IndexFlashSaleList extends Cache
{
protected $lifetime = 1 * 86400;
public function getLifetime()
{
return strtotime('tomorrow') - time();
}
public function getKey($id = null)
{
return 'index_flash_sale_list';
}
public function getContent($id = null)
{
$service = new SaleList();
$sales = $service->handle();
return $sales[0]['items'] ?? [];
}
}

View File

@ -19,7 +19,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexFreeCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -18,7 +18,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexLiveList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -19,7 +19,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexNewCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -14,7 +14,7 @@ use App\Services\Logic\Question\QuestionList as QuestionListService;
class IndexQuestionList extends Cache
{
protected $lifetime = 15 * 60;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -17,7 +17,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexSimpleFeaturedCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -17,7 +17,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexSimpleFreeCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -17,7 +17,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexSimpleNewCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -17,7 +17,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexSimpleVipCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -14,7 +14,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexSlideList extends Cache
{
protected $lifetime = 365 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -14,7 +14,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexTeacherList extends Cache
{
protected $lifetime = 1 * 3600;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -19,7 +19,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class IndexVipCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Models\FlashSale as FlashSaleModel;
class MaxFlashSaleId extends Cache
{
protected $lifetime = 365 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return 'max_flash_sale_id';
}
public function getContent($id = null)
{
$sale = FlashSaleModel::findFirst(['order' => 'id DESC']);
return $sale->id ?? 0;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,34 +0,0 @@
<?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;
}
}

View File

@ -1,44 +0,0 @@
<?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,
];
}
}

View File

@ -13,7 +13,7 @@ use App\Repos\Package as PackageRepo;
class PackageCourseList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -1,36 +0,0 @@
<?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;
}
}

View File

@ -1,36 +0,0 @@
<?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 = 1 * 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;
}
}

View File

@ -19,7 +19,7 @@ class PointHotGiftList extends Cache
*
* @var int
*/
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
/**
* 显示个数

View File

@ -1,36 +0,0 @@
<?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 = 1 * 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;
}
}

View File

@ -13,9 +13,9 @@ use App\Repos\Article as ArticleRepo;
class TaggedArticleList extends Cache
{
protected $limit = 5;
protected $limit = 15;
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -13,9 +13,9 @@ use App\Repos\Question as QuestionRepo;
class TaggedQuestionList extends Cache
{
protected $limit = 5;
protected $limit = 15;
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -7,8 +7,8 @@
namespace App\Caches;
use App\Models\Article as ArticleModel;
use App\Models\ArticleLike as ArticleLikeModel;
use App\Models\Answer as AnswerModel;
use App\Models\AnswerLike as AnswerLikeModel;
use App\Repos\User as UserRepo;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
@ -16,7 +16,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class TopAnswererList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{
@ -37,10 +37,24 @@ class TopAnswererList extends Cache
return $this->handleUsers($userIds);
}
$randOwners = $this->findRandArticleOwners();
$rankings = $this->findMonthlyAuthorRankings();
if ($randOwners->count() > 0) {
$userIds = kg_array_column($randOwners->toArray(), 'owner_id');
if ($rankings->count() > 0) {
$userIds = kg_array_column($rankings->toArray(), 'author_id');
return $this->handleUsers($userIds);
}
$rankings = $this->findYearlyAuthorRankings();
if ($rankings->count() > 0) {
$userIds = kg_array_column($rankings->toArray(), 'author_id');
return $this->handleUsers($userIds);
}
$rankings = $this->findFullyAuthorRankings();
if ($rankings->count() > 0) {
$userIds = kg_array_column($rankings->toArray(), 'author_id');
return $this->handleUsers($userIds);
}
@ -73,23 +87,53 @@ class TopAnswererList extends Cache
* @param int $limit
* @return ResultsetInterface|Resultset
*/
protected function findRandArticleOwners($limit = 10)
protected function findWeeklyAuthorRankings($limit = 10)
{
return ArticleModel::query()
->columns(['owner_id'])
->orderBy('RAND()')
->limit($limit)
->execute();
$createTime = strtotime('monday this week');
return $this->findAuthorRankings($createTime, $limit);
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset
*/
protected function findWeeklyAuthorRankings($limit = 10)
protected function findMonthlyAuthorRankings($limit = 10)
{
$createTime = strtotime('monday this week');
$createTime = strtotime(date('Y-m-01'));
return $this->findAuthorRankings($createTime, $limit);
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset
*/
protected function findYearlyAuthorRankings($limit = 10)
{
$createTime = strtotime(date('Y-01-01'));
return $this->findAuthorRankings($createTime, $limit);
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset
*/
protected function findFullyAuthorRankings($limit = 10)
{
$createTime = 0;
return $this->findAuthorRankings($createTime, $limit);
}
/**
* @param int $createTime
* @param int $limit
* @return ResultsetInterface|Resultset
*/
protected function findAuthorRankings($createTime, $limit = 10)
{
$columns = [
'author_id' => 'a.owner_id',
'like_count' => 'count(al.user_id)',
@ -97,8 +141,8 @@ class TopAnswererList extends Cache
return $this->modelsManager->createBuilder()
->columns($columns)
->addFrom(ArticleLikeModel::class, 'al')
->join(ArticleModel::class, 'al.article_id = a.id', 'a')
->addFrom(AnswerLikeModel::class, 'al')
->join(AnswerModel::class, 'al.answer_id = a.id', 'a')
->where('al.create_time > :create_time:', ['create_time' => $createTime])
->groupBy('author_id')
->orderBy('like_count DESC')

View File

@ -16,7 +16,7 @@ use Phalcon\Mvc\Model\ResultsetInterface;
class TopAuthorList extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 3600;
public function getLifetime()
{

View File

@ -12,7 +12,7 @@ use App\Repos\User as UserRepo;
class User extends Cache
{
protected $lifetime = 1 * 86400;
protected $lifetime = 86400;
public function getLifetime()
{

View File

@ -10,8 +10,6 @@ namespace App\Caches;
class UserDailyCounter extends Counter
{
protected $lifetime = 1 * 86400;
public function getLifetime()
{
$tomorrow = strtotime('tomorrow');

View File

@ -7,7 +7,36 @@
namespace App\Console\Migrations;
use App\Models\Setting as SettingModel;
use App\Repos\Setting as SettingRepo;
use App\Traits\Service as ServiceTrait;
abstract class Migration
{
use ServiceTrait;
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);
}
}
}

View File

@ -1,162 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2022 深圳市酷瓜软件有限公司
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* @link https://www.koogua.com
*/
namespace App\Console\Migrations;
use App\Models\Answer as AnswerModel;
use App\Models\Article as ArticleModel;
use App\Models\Course as CourseModel;
use App\Models\Help as HelpModel;
use App\Models\Page as PageModel;
use App\Models\PointGift as PointGiftModel;
use App\Models\Question as QuestionModel;
use League\CommonMark\GithubFlavoredMarkdownConverter;
use Phalcon\Mvc\Model\Resultset;
class V202207291145 extends Migration
{
/**
* @var GithubFlavoredMarkdownConverter
*/
protected $markdownConverter;
public function run()
{
$this->initMarkdownConverter();
$this->courseMarkdownToHtml();
$this->articleMarkdownToHtml();
$this->questionMarkdownToHtml();
$this->answerMarkdownToHtml();
$this->pageMarkdownToHtml();
$this->helpMarkdownToHtml();
$this->pointGiftMarkdownToHtml();
}
protected function initMarkdownConverter()
{
$this->markdownConverter = new GithubFlavoredMarkdownConverter([
'html_input' => 'escape',
'allow_unsafe_links' => false,
]);
}
protected function articleMarkdownToHtml()
{
/**
* @var $articles Resultset|ArticleModel[]
*/
$articles = ArticleModel::query()->execute();
if ($articles->count() == 0) return;
foreach ($articles as $article) {
$content = $this->markdownConverter->convertToHtml($article->content);
$article->content = $content;
$article->update();
}
}
protected function courseMarkdownToHtml()
{
/**
* @var $courses Resultset|CourseModel[]
*/
$courses = CourseModel::query()->execute();
if ($courses->count() == 0) return;
foreach ($courses as $course) {
$details = $this->markdownConverter->convertToHtml($course->details);
$course->details = $details;
$course->update();
}
}
protected function questionMarkdownToHtml()
{
/**
* @var $questions Resultset|QuestionModel[]
*/
$questions = QuestionModel::query()->execute();
if ($questions->count() == 0) return;
foreach ($questions as $question) {
$content = $this->markdownConverter->convertToHtml($question->content);
$question->content = $content;
$question->update();
}
}
protected function answerMarkdownToHtml()
{
/**
* @var $answers Resultset|AnswerModel[]
*/
$answers = AnswerModel::query()->execute();
if ($answers->count() == 0) return;
foreach ($answers as $answer) {
$content = $this->markdownConverter->convertToHtml($answer->content);
$answer->content = $content;
$answer->update();
}
}
protected function pageMarkdownToHtml()
{
/**
* @var $pages Resultset|PageModel[]
*/
$pages = PageModel::query()->execute();
if ($pages->count() == 0) return;
foreach ($pages as $page) {
$content = $this->markdownConverter->convertToHtml($page->content);
$page->content = $content;
$page->update();
}
}
protected function helpMarkdownToHtml()
{
/**
* @var $helps Resultset|HelpModel[]
*/
$helps = HelpModel::query()->execute();
if ($helps->count() == 0) return;
foreach ($helps as $help) {
$content = $this->markdownConverter->convertToHtml($help->content);
$help->content = $content;
$help->update();
}
}
protected function pointGiftMarkdownToHtml()
{
/**
* @var $gifts Resultset|PointGiftModel[]
*/
$gifts = PointGiftModel::query()
->where('type = :type:', ['type' => PointGiftModel::TYPE_GOODS])
->execute();
if ($gifts->count() == 0) return;
foreach ($gifts as $gift) {
$details = $this->markdownConverter->convertToHtml($gift->details);
$gift->details = $details;
$gift->update();
}
}
}

View File

@ -0,0 +1,48 @@
<?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();
}
}
}

View File

@ -0,0 +1,29 @@
<?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);
}
}

View File

@ -0,0 +1,41 @@
<?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();
}
}

View File

@ -20,8 +20,6 @@ class ArticleIndexTask extends Task
* 搜索测试
*
* @command: php console.php article_index search {query}
* @param array $params
* @throws \XSException
*/
public function searchAction($params)
{
@ -31,7 +29,9 @@ class ArticleIndexTask extends Task
exit('please special a query word' . PHP_EOL);
}
$result = $this->searchArticles($query);
$handler = new ArticleSearcher();
$result = $handler->search($query);
var_export($result);
}
@ -42,24 +42,6 @@ class ArticleIndexTask extends Task
* @command: php console.php article_index clean
*/
public function cleanAction()
{
$this->cleanArticleIndex();
}
/**
* 重建索引
*
* @command: php console.php article_index rebuild
*/
public function rebuildAction()
{
$this->rebuildArticleIndex();
}
/**
* 清空索引
*/
protected function cleanArticleIndex()
{
$handler = new ArticleSearcher();
@ -74,8 +56,10 @@ class ArticleIndexTask extends Task
/**
* 重建索引
*
* @command: php console.php article_index rebuild
*/
protected function rebuildArticleIndex()
public function rebuildAction()
{
$articles = $this->findArticles();
@ -83,7 +67,7 @@ class ArticleIndexTask extends Task
$handler = new ArticleSearcher();
$documenter = new ArticleDocument();
$doc = new ArticleDocument();
$index = $handler->getXS()->getIndex();
@ -92,7 +76,7 @@ class ArticleIndexTask extends Task
$index->beginRebuild();
foreach ($articles as $article) {
$document = $documenter->setDocument($article);
$document = $doc->setDocument($article);
$index->add($document);
}
@ -102,17 +86,39 @@ class ArticleIndexTask extends Task
}
/**
* 搜索文章
* 刷新索引缓存
*
* @param string $query
* @return array
* @throws \XSException
* @command: php console.php article_index flush_index
*/
protected function searchArticles($query)
public function flushIndexAction()
{
$handler = new ArticleSearcher();
return $handler->search($query);
$index = $handler->getXS()->getIndex();
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;
}
/**

View File

@ -7,13 +7,14 @@
namespace App\Console\Tasks;
use App\Caches\CategoryAllList as CategoryAllListCache;
use App\Caches\CategoryList as CategoryListCache;
use App\Caches\CategoryTreeList as CategoryTreeListCache;
use App\Caches\IndexSlideList as IndexSlideListCache;
use App\Models\Account as AccountModel;
use App\Models\Category as CategoryModel;
use App\Repos\User as UserRepo;
use App\Services\Utils\IndexCourseCache as IndexCourseCacheUtil;
use App\Services\Utils\IndexPageCache as IndexPageCacheUtil;
class CleanDemoDataTask extends Task
{
@ -38,8 +39,8 @@ class CleanDemoDataTask extends Task
echo '------ start truncate tables ------' . PHP_EOL;
$excludeTables = [
'kg_area', 'kg_migration', 'kg_nav', 'kg_page',
'kg_reward', 'kg_role', 'kg_setting', 'kg_vip',
'kg_area', 'kg_migration', 'kg_migration_task', 'kg_nav',
'kg_page', 'kg_role', 'kg_setting', 'kg_vip',
];
$tables = $this->db->listTables();
@ -81,17 +82,19 @@ class CleanDemoDataTask extends Task
protected function cleanCache()
{
$util = new IndexCourseCacheUtil();
$util = new IndexPageCacheUtil();
$util->rebuild();
$slideListCache = new IndexSlideListCache();
$slideListCache->rebuild();
$categoryListCache = new CategoryListCache();
$categoryAllListCache = new CategoryAllListCache();
$categoryTreeListCache = new CategoryTreeListCache();
foreach (CategoryModel::types() as $key => $value) {
$categoryListCache->rebuild($key);
$categoryAllListCache->rebuild($key);
$categoryTreeListCache->rebuild($key);
}
}
@ -104,14 +107,8 @@ class CleanDemoDataTask extends Task
$courseIndexTask = new CourseIndexTask();
$courseIndexTask->cleanAction();
$groupIndexTask = new GroupIndexTask();
$groupIndexTask->cleanAction();
$questionIndexTask = new QuestionIndexTask();
$questionIndexTask->cleanAction();
$userIndexTask = new UserIndexTask();
$userIndexTask->cleanAction();
}
protected function isDemoEnv()
@ -120,7 +117,7 @@ class CleanDemoDataTask extends Task
$user = $userRepo->findById(100015);
return $user ? true : false;
return (bool)$user;
}
}

View File

@ -19,7 +19,6 @@ class CleanLogTask extends Task
$this->cleanHttpLog();
$this->cleanSqlLog();
$this->cleanListenLog();
$this->cleanCaptchaLog();
$this->cleanWeChatLog();
$this->cleanMailLog();
$this->cleanSmsLog();
@ -96,18 +95,6 @@ class CleanLogTask extends Task
$this->whitelist[] = $type;
}
/**
* 清理验证码服务日志
*/
protected function cleanCaptchaLog()
{
$type = 'captcha';
$this->cleanLog($type, 7);
$this->whitelist[] = $type;
}
/**
* 清理点播服务日志
*/
@ -268,13 +255,12 @@ class CleanLogTask extends Task
* 清理其它日志
*
* @param int $keepDays
* @return mixed
*/
protected function cleanOtherLog($keepDays = 7)
{
$files = glob(log_path() . "/*.log");
if (!$files) return false;
if (!$files) return;
foreach ($files as $file) {
$name = str_replace(log_path() . '/', '', $file);
@ -287,9 +273,9 @@ class CleanLogTask extends Task
if (strtotime($today) - strtotime($date) >= $keepDays * 86400) {
$deleted = unlink($file);
if ($deleted) {
echo "delete {$file} success" . PHP_EOL;
$this->successPrint("remove {$file} success");
} else {
echo "delete {$file} failed" . PHP_EOL;
$this->errorPrint("remove {$file} failed");
}
}
}
@ -300,13 +286,12 @@ class CleanLogTask extends Task
*
* @param string $prefix
* @param int $keepDays 保留天数
* @return mixed
*/
protected function cleanLog($prefix, $keepDays)
{
$files = glob(log_path() . "/{$prefix}-*.log");
if (!$files) return false;
if (!$files) return;
foreach ($files as $file) {
$date = substr($file, -14, 10);
@ -314,9 +299,9 @@ class CleanLogTask extends Task
if (strtotime($today) - strtotime($date) >= $keepDays * 86400) {
$deleted = unlink($file);
if ($deleted) {
echo "------ delete {$file} success ------" . PHP_EOL;
$this->successPrint("remove {$file} success");
} else {
echo "------ delete {$file} failed -------" . PHP_EOL;
$this->errorPrint("remove {$file} failed");
}
}
}

View File

@ -1,86 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Console\Tasks;
use App\Models\Order as OrderModel;
use App\Repos\FlashSale as FlashSaleRepo;
use App\Services\Logic\FlashSale\Queue as FlashSaleQueue;
use App\Services\Logic\FlashSale\UserOrderCache;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
class CloseFlashSaleOrderTask extends Task
{
public function mainAction()
{
$orders = $this->findOrders();
echo sprintf('pending orders: %s', $orders->count()) . PHP_EOL;
if ($orders->count() == 0) return;
echo '------ start close order task ------' . PHP_EOL;
foreach ($orders as $order) {
$this->incrFlashSaleStock($order->promotion_id);
$this->pushFlashSaleQueue($order->promotion_id);
$this->deleteUserOrderCache($order->owner_id, $order->promotion_id);
$order->status = OrderModel::STATUS_CLOSED;
$order->update();
}
echo '------ end close order task ------' . PHP_EOL;
}
protected function incrFlashSaleStock($saleId)
{
$flashSaleRepo = new FlashSaleRepo();
$flashSale = $flashSaleRepo->findById($saleId);
$flashSale->stock += 1;
$flashSale->update();
}
protected function pushFlashSaleQueue($saleId)
{
$queue = new FlashSaleQueue();
$queue->push($saleId);
}
protected function deleteUserOrderCache($userId, $saleId)
{
$cache = new UserOrderCache();
$cache->delete($userId, $saleId);
}
/**
* 查找待关闭订单
*
* @param int $limit
* @return ResultsetInterface|Resultset|OrderModel[]
*/
protected function findOrders($limit = 1000)
{
$status = OrderModel::STATUS_PENDING;
$type = OrderModel::PROMOTION_FLASH_SALE;
$time = time() - 15 * 60;
return OrderModel::query()
->where('status = :status:', ['status' => $status])
->andWhere('promotion_type = :type:', ['type' => $type])
->andWhere('create_time < :time:', ['time' => $time])
->limit($limit)
->execute();
}
}

View File

@ -0,0 +1,72 @@
<?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();
}
}

View File

@ -42,11 +42,9 @@ class CloseOrderTask extends Task
{
$status = OrderModel::STATUS_PENDING;
$time = time() - 12 * 3600;
$type = 0;
return OrderModel::query()
->where('status = :status:', ['status' => $status])
->andWhere('promotion_type = :type:', ['type' => $type])
->andWhere('create_time < :time:', ['time' => $time])
->limit($limit)
->execute();

View File

@ -20,8 +20,6 @@ class CourseIndexTask extends Task
* 搜索测试
*
* @command: php console.php course_index search {query}
* @param array $params
* @throws \XSException
*/
public function searchAction($params)
{
@ -31,7 +29,9 @@ class CourseIndexTask extends Task
exit('please special a query word' . PHP_EOL);
}
$result = $this->searchCourses($query);
$handler = new CourseSearcher();
$result = $handler->search($query);
var_export($result);
}
@ -42,24 +42,6 @@ class CourseIndexTask extends Task
* @command: php console.php course_index clean
*/
public function cleanAction()
{
$this->cleanCourseIndex();
}
/**
* 重建索引
*
* @command: php console.php course_index rebuild
*/
public function rebuildAction()
{
$this->rebuildCourseIndex();
}
/**
* 清空索引
*/
protected function cleanCourseIndex()
{
$handler = new CourseSearcher();
@ -74,8 +56,10 @@ class CourseIndexTask extends Task
/**
* 重建索引
*
* @command: php console.php course_index rebuild
*/
protected function rebuildCourseIndex()
public function rebuildAction()
{
$courses = $this->findCourses();
@ -83,7 +67,7 @@ class CourseIndexTask extends Task
$handler = new CourseSearcher();
$documenter = new CourseDocument();
$doc = new CourseDocument();
$index = $handler->getXS()->getIndex();
@ -92,7 +76,7 @@ class CourseIndexTask extends Task
$index->beginRebuild();
foreach ($courses as $course) {
$document = $documenter->setDocument($course);
$document = $doc->setDocument($course);
$index->add($document);
}
@ -102,17 +86,39 @@ class CourseIndexTask extends Task
}
/**
* 搜索课程
* 刷新索引缓存
*
* @param string $query
* @return array
* @throws \XSException
* @command: php console.php course_index flush_index
*/
protected function searchCourses($query)
public function flushIndexAction()
{
$handler = new CourseSearcher();
return $handler->search($query);
$index = $handler->getXS()->getIndex();
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;
}
/**
@ -124,7 +130,7 @@ class CourseIndexTask extends Task
{
return CourseModel::query()
->where('published = 1')
->where('deleted = 0')
->andWhere('deleted = 0')
->execute();
}

View File

@ -19,7 +19,7 @@ use App\Repos\Vip as VipRepo;
use App\Services\Logic\Deliver\CourseDeliver as CourseDeliverService;
use App\Services\Logic\Deliver\PackageDeliver as PackageDeliverService;
use App\Services\Logic\Deliver\VipDeliver as VipDeliverService;
use App\Services\Logic\Notice\OrderFinish as OrderFinishNotice;
use App\Services\Logic\Notice\External\OrderFinish as OrderFinishNotice;
use App\Services\Logic\Point\History\OrderConsume as OrderConsumePointHistory;
use Phalcon\Mvc\Model;
use Phalcon\Mvc\Model\Resultset;
@ -58,9 +58,6 @@ class DeliverTask extends Task
case OrderModel::ITEM_VIP:
$this->handleVipOrder($order);
break;
default:
$this->noMatchedHandler($order);
break;
}
$order->status = OrderModel::STATUS_FINISHED;
@ -156,11 +153,6 @@ class DeliverTask extends Task
$this->closePendingOrders($user->id);
}
protected function noMatchedHandler(OrderModel $order)
{
throw new \RuntimeException("No Matched Handler For Order: {$order->id}");
}
protected function closePendingOrders($userId)
{
$orders = $this->findUserPendingOrders($userId);
@ -173,9 +165,7 @@ class DeliverTask extends Task
];
foreach ($orders as $order) {
$case1 = in_array($order->item_type, $itemTypes);
$case2 = $order->promotion_type == 0;
if ($case1 && $case2) {
if (in_array($order->item_type, $itemTypes)) {
$order->status = OrderModel::STATUS_CLOSED;
$order->update();
}

View File

@ -10,7 +10,7 @@ namespace App\Console\Tasks;
use App\Http\Admin\Services\Setting as SettingService;
use App\Library\Utils\Password as PasswordUtil;
use App\Models\ChapterVod as ChapterVodModel;
use App\Services\Utils\IndexCourseCache as IndexCourseCacheUtil;
use App\Services\Utils\IndexPageCache as IndexPageCacheUtil;
use App\Validators\Account as AccountValidator;
class MaintainTask extends Task
@ -26,7 +26,7 @@ class MaintainTask extends Task
{
$section = $params[0] ?? null;
$util = new IndexCourseCacheUtil();
$util = new IndexPageCacheUtil();
$util->rebuild($section);
@ -64,34 +64,6 @@ class MaintainTask extends Task
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;
}
/**
* 关闭站点
*

View File

@ -8,16 +8,15 @@
namespace App\Console\Tasks;
use App\Models\Task as TaskModel;
use App\Services\Logic\Notice\AccountLogin as AccountLoginNotice;
use App\Services\Logic\Notice\ConsultReply as ConsultReplyNotice;
use App\Services\Logic\Notice\DingTalk\ConsultCreate as ConsultCreateNotice;
use App\Services\Logic\Notice\DingTalk\CustomService as CustomServiceNotice;
use App\Services\Logic\Notice\DingTalk\ServerMonitor as ServerMonitorNotice;
use App\Services\Logic\Notice\DingTalk\TeacherLive as TeacherLiveNotice;
use App\Services\Logic\Notice\LiveBegin as LiveBeginNotice;
use App\Services\Logic\Notice\OrderFinish as OrderFinishNotice;
use App\Services\Logic\Notice\PointGoodsDeliver as PointGoodsDeliverNotice;
use App\Services\Logic\Notice\RefundFinish as RefundFinishNotice;
use App\Services\Logic\Notice\External\AccountLogin as AccountLoginNotice;
use App\Services\Logic\Notice\External\ConsultReply as ConsultReplyNotice;
use App\Services\Logic\Notice\External\DingTalk\ConsultCreate as ConsultCreateNotice;
use App\Services\Logic\Notice\External\DingTalk\ServerMonitor as ServerMonitorNotice;
use App\Services\Logic\Notice\External\DingTalk\TeacherLive as TeacherLiveNotice;
use App\Services\Logic\Notice\External\LiveBegin as LiveBeginNotice;
use App\Services\Logic\Notice\External\OrderFinish as OrderFinishNotice;
use App\Services\Logic\Notice\External\PointGoodsDeliver as PointGoodsDeliverNotice;
use App\Services\Logic\Notice\External\RefundFinish as RefundFinishNotice;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
@ -62,9 +61,6 @@ class NoticeTask extends Task
case TaskModel::TYPE_STAFF_NOTICE_SERVER_MONITOR:
$this->handleServerMonitorNotice($task);
break;
case TaskModel::TYPE_STAFF_NOTICE_CUSTOM_SERVICE:
$this->handleCustomServiceNotice($task);
break;
}
$task->status = TaskModel::STATUS_FINISHED;
@ -157,13 +153,6 @@ class NoticeTask extends Task
$notice->handleTask($task);
}
protected function handleCustomServiceNotice(TaskModel $task)
{
$notice = new CustomServiceNotice();
$notice->handleTask($task);
}
/**
* @param int $limit
* @return ResultsetInterface|Resultset|TaskModel[]
@ -181,7 +170,6 @@ class NoticeTask extends Task
TaskModel::TYPE_STAFF_NOTICE_CONSULT_CREATE,
TaskModel::TYPE_STAFF_NOTICE_TEACHER_LIVE,
TaskModel::TYPE_STAFF_NOTICE_SERVER_MONITOR,
TaskModel::TYPE_STAFF_NOTICE_CUSTOM_SERVICE,
];
$status = TaskModel::STATUS_PENDING;

View File

@ -17,7 +17,7 @@ use App\Repos\User as UserRepo;
use App\Repos\Vip as VipRepo;
use App\Services\Logic\Deliver\CourseDeliver as CourseDeliverService;
use App\Services\Logic\Deliver\VipDeliver as VipDeliverService;
use App\Services\Logic\Notice\DingTalk\PointGiftRedeem as PointGiftRedeemNotice;
use App\Services\Logic\Notice\External\DingTalk\PointGiftRedeem as PointGiftRedeemNotice;
use App\Services\Logic\Point\History\PointGiftRefund as PointGiftRefundPointHistory;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;

View File

@ -20,8 +20,6 @@ class QuestionIndexTask extends Task
* 搜索测试
*
* @command: php console.php question_index search {query}
* @param array $params
* @throws \XSException
*/
public function searchAction($params)
{
@ -31,7 +29,9 @@ class QuestionIndexTask extends Task
exit('please special a query word' . PHP_EOL);
}
$result = $this->searchQuestions($query);
$handler = new QuestionSearcher();
$result = $handler->search($query);
var_export($result);
}
@ -42,24 +42,6 @@ class QuestionIndexTask extends Task
* @command: php console.php question_index clean
*/
public function cleanAction()
{
$this->cleanQuestionIndex();
}
/**
* 重建索引
*
* @command: php console.php question_index rebuild
*/
public function rebuildAction()
{
$this->rebuildQuestionIndex();
}
/**
* 清空索引
*/
protected function cleanQuestionIndex()
{
$handler = new QuestionSearcher();
@ -74,8 +56,10 @@ class QuestionIndexTask extends Task
/**
* 重建索引
*
* @command: php console.php question_index rebuild
*/
protected function rebuildQuestionIndex()
public function rebuildAction()
{
$questions = $this->findQuestions();
@ -83,7 +67,7 @@ class QuestionIndexTask extends Task
$handler = new QuestionSearcher();
$documenter = new QuestionDocument();
$doc = new QuestionDocument();
$index = $handler->getXS()->getIndex();
@ -92,7 +76,7 @@ class QuestionIndexTask extends Task
$index->beginRebuild();
foreach ($questions as $question) {
$document = $documenter->setDocument($question);
$document = $doc->setDocument($question);
$index->add($document);
}
@ -102,17 +86,39 @@ class QuestionIndexTask extends Task
}
/**
* 搜索文章
* 刷新索引缓存
*
* @param string $query
* @return array
* @throws \XSException
* @command: php console.php question_index flush_index
*/
protected function searchQuestions($query)
public function flushIndexAction()
{
$handler = new QuestionSearcher();
return $handler->search($query);
$index = $handler->getXS()->getIndex();
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;
}
/**

Some files were not shown because too many files have changed in this diff Show More