mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-10 10:40:03 +08:00
beta
This commit is contained in:
parent
3dd5490bdb
commit
f3fcb6956a
@ -1,5 +1,12 @@
|
||||
### [v1.6.7](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.7)(2023-10-30)
|
||||
### [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)
|
||||
|
||||
|
87
app/Console/Migrations/V20231201101515.php
Normal file
87
app/Console/Migrations/V20231201101515.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2023 深圳市酷瓜软件有限公司
|
||||
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* @link https://www.koogua.com
|
||||
*/
|
||||
|
||||
namespace App\Console\Migrations;
|
||||
|
||||
use App\Models\ChapterUser as ChapterUserModel;
|
||||
use App\Models\CourseUser as CourseUserModel;
|
||||
use Phalcon\Mvc\Model\ResultsetInterface;
|
||||
|
||||
class V20231201101515 extends Migration
|
||||
{
|
||||
|
||||
public function run()
|
||||
{
|
||||
$this->handleCourseUsers();
|
||||
$this->handleChapterUsers();
|
||||
}
|
||||
|
||||
protected function handleCourseUsers()
|
||||
{
|
||||
$courseUsers = $this->findCourseUsers();
|
||||
|
||||
if ($courseUsers->count() == 0) return;
|
||||
|
||||
$mappings = [];
|
||||
|
||||
/**
|
||||
* 只保留第一条记录
|
||||
*/
|
||||
foreach ($courseUsers as $courseUser) {
|
||||
$key = $courseUser->course_id . '-' . $courseUser->user_id;
|
||||
if (!isset($mappings[$key])) {
|
||||
$mappings[$key] = 1;
|
||||
} else {
|
||||
$courseUser->deleted = 1;
|
||||
$courseUser->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function handleChapterUsers()
|
||||
{
|
||||
$chapterUsers = $this->findChapterUsers();
|
||||
|
||||
if ($chapterUsers->count() == 0) return;
|
||||
|
||||
/**
|
||||
* 只保留第一条记录
|
||||
*/
|
||||
foreach ($chapterUsers as $chapterUser) {
|
||||
$key = $chapterUser->chapter_id . '-' . $chapterUser->user_id;
|
||||
if (!isset($mappings[$key])) {
|
||||
$mappings[$key] = 1;
|
||||
} else {
|
||||
$chapterUser->deleted = 1;
|
||||
$chapterUser->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResultsetInterface|CourseUserModel[]
|
||||
*/
|
||||
protected function findCourseUsers()
|
||||
{
|
||||
return CourseUserModel::query()
|
||||
->where('deleted = 0')
|
||||
->orderBy('id DESC')
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ResultsetInterface|ChapterUserModel[]
|
||||
*/
|
||||
protected function findChapterUsers()
|
||||
{
|
||||
return ChapterUserModel::query()
|
||||
->where('deleted = 0')
|
||||
->orderBy('id DESC')
|
||||
->execute();
|
||||
}
|
||||
|
||||
}
|
@ -31,7 +31,7 @@ class TeacherController extends Controller
|
||||
return $this->response->redirect($location);
|
||||
}
|
||||
|
||||
$this->seo->prependTitle('教师');
|
||||
$this->seo->prependTitle('师资');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="layui-breadcrumb breadcrumb">
|
||||
<a href="/">首页</a>
|
||||
<a><cite>教师</cite></a>
|
||||
<a><cite>师资</cite></a>
|
||||
</div>
|
||||
|
||||
<div id="teacher-list" data-url="{{ pager_url }}"></div>
|
||||
|
@ -155,7 +155,7 @@ final class V20210403184518 extends AbstractMigration
|
||||
'id' => 5,
|
||||
'parent_id' => 0,
|
||||
'level' => 1,
|
||||
'name' => '教师',
|
||||
'name' => '师资',
|
||||
'path' => ',5,',
|
||||
'target' => '_self',
|
||||
'url' => '/teacher/list',
|
||||
|
Loading…
x
Reference in New Issue
Block a user